LLVM
4.0.0
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
llvm.src
lib
Bitcode
Reader
ValueList.h
Go to the documentation of this file.
1
//===-- Bitcode/Reader/ValueEnumerator.h - Number values --------*- C++ -*-===//
2
//
3
// The LLVM Compiler Infrastructure
4
//
5
// This file is distributed under the University of Illinois Open Source
6
// License. See LICENSE.TXT for details.
7
//
8
//===----------------------------------------------------------------------===//
9
//
10
// This class gives values and types Unique ID's.
11
//
12
//===----------------------------------------------------------------------===//
13
14
#include "
llvm/IR/LLVMContext.h
"
15
#include "
llvm/IR/ValueHandle.h
"
16
17
#include <vector>
18
19
namespace
llvm {
20
class
Constant
;
21
22
class
BitcodeReaderValueList
{
23
std::vector<WeakVH> ValuePtrs;
24
25
/// As we resolve forward-referenced constants, we add information about them
26
/// to this vector. This allows us to resolve them in bulk instead of
27
/// resolving each reference at a time. See the code in
28
/// ResolveConstantForwardRefs for more information about this.
29
///
30
/// The key of this vector is the placeholder constant, the value is the slot
31
/// number that holds the resolved value.
32
typedef
std::vector<std::pair<Constant *, unsigned>> ResolveConstantsTy;
33
ResolveConstantsTy ResolveConstants;
34
LLVMContext
&Context;
35
36
public
:
37
BitcodeReaderValueList
(
LLVMContext
&
C
) : Context(C) {}
38
~BitcodeReaderValueList
() {
39
assert
(ResolveConstants.empty() &&
"Constants not resolved?"
);
40
}
41
42
// vector compatibility methods
43
unsigned
size
()
const
{
return
ValuePtrs.size(); }
44
void
resize
(
unsigned
N
) { ValuePtrs.resize(N); }
45
void
push_back
(
Value
*V) { ValuePtrs.emplace_back(V); }
46
47
void
clear
() {
48
assert
(ResolveConstants.empty() &&
"Constants not resolved?"
);
49
ValuePtrs.clear();
50
}
51
52
Value
*
operator[]
(
unsigned
i
)
const
{
53
assert
(i < ValuePtrs.size());
54
return
ValuePtrs[
i
];
55
}
56
57
Value
*
back
()
const
{
return
ValuePtrs.back(); }
58
void
pop_back
() { ValuePtrs.pop_back(); }
59
bool
empty
()
const
{
return
ValuePtrs.empty(); }
60
61
void
shrinkTo
(
unsigned
N
) {
62
assert
(N <=
size
() &&
"Invalid shrinkTo request!"
);
63
ValuePtrs.resize(N);
64
}
65
66
Constant
*
getConstantFwdRef
(
unsigned
Idx,
Type
*Ty);
67
Value
*
getValueFwdRef
(
unsigned
Idx,
Type
*Ty);
68
69
void
assignValue
(
Value
*V,
unsigned
Idx);
70
71
/// Once all constants are read, this method bulk resolves any forward
72
/// references.
73
void
resolveConstantForwardRefs
();
74
};
75
76
}
// namespace llvm
llvm::BitcodeReaderValueList::empty
bool empty() const
Definition:
ValueList.h:59
i
size_t i
Definition:
FuzzerTracePC.cpp:312
llvm::BitcodeReaderValueList::BitcodeReaderValueList
BitcodeReaderValueList(LLVMContext &C)
Definition:
ValueList.h:37
llvm::BitcodeReaderValueList::shrinkTo
void shrinkTo(unsigned N)
Definition:
ValueList.h:61
llvm::BitcodeReaderValueList::getValueFwdRef
Value * getValueFwdRef(unsigned Idx, Type *Ty)
Definition:
ValueList.cpp:96
llvm::BitcodeReaderValueList::pop_back
void pop_back()
Definition:
ValueList.h:58
llvm::BitcodeReaderValueList::push_back
void push_back(Value *V)
Definition:
ValueList.h:45
llvm::BitcodeReaderValueList::back
Value * back() const
Definition:
ValueList.h:57
llvm::BitcodeReaderValueList::assignValue
void assignValue(Value *V, unsigned Idx)
Definition:
ValueList.cpp:52
llvm::BitcodeReaderValueList::size
unsigned size() const
Definition:
ValueList.h:43
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed...
Definition:
Type.h:45
llvm::LLVMContext
This is an important class for using LLVM in a threaded context.
Definition:
LLVMContext.h:48
llvm::Constant
This is an important base class in LLVM.
Definition:
Constant.h:42
llvm::BitcodeReaderValueList::operator[]
Value * operator[](unsigned i) const
Definition:
ValueList.h:52
llvm::BitcodeReaderValueList::resolveConstantForwardRefs
void resolveConstantForwardRefs()
Once all constants are read, this method bulk resolves any forward references.
Definition:
ValueList.cpp:127
llvm::BitcodeReaderValueList::getConstantFwdRef
Constant * getConstantFwdRef(unsigned Idx, Type *Ty)
Definition:
ValueList.cpp:80
llvm::BitcodeReaderValueList::~BitcodeReaderValueList
~BitcodeReaderValueList()
Definition:
ValueList.h:38
llvm::BitcodeReaderValueList
Definition:
ValueList.h:22
C
static GCRegistry::Add< ShadowStackGC > C("shadow-stack","Very portable GC for uncooperative code generators")
llvm::BitcodeReaderValueList::clear
void clear()
Definition:
ValueList.h:47
ValueHandle.h
llvm::BitcodeReaderValueList::resize
void resize(unsigned N)
Definition:
ValueList.h:44
N
#define N
LLVMContext.h
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::Value
LLVM Value Representation.
Definition:
Value.h:71
llvm::ISD::Constant
Definition:
ISDOpcodes.h:61
Generated on Wed Mar 8 2017 17:30:25 for LLVM by
1.8.6