LLVM: lib/Bitcode/Reader/ValueList.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
18
19using namespace llvm;
20
22 unsigned TypeID) {
23 if (Idx == size()) {
26 }
27
28 if (Idx >= size())
30
31 auto &Old = ValuePtrs[Idx];
32 if (!Old.first) {
33 Old.first = V;
34 Old.second = TypeID;
36 }
37
39
40 Value *PrevVal = Old.first;
41 if (PrevVal->getType() != V->getType())
43 std::errc::illegal_byte_sequence,
44 "Assigned value does not match type of forward declaration");
45 Old.first->replaceAllUsesWith(V);
48}
49
51 unsigned TyID,
53
54 if (Idx >= RefsUpperBound)
55 return nullptr;
56
57 if (Idx >= size())
59
60 if (Value *V = ValuePtrs[Idx].first) {
61
62 if (Ty && Ty != V->getType())
63 return nullptr;
64
65 Expected<Value *> MaybeV = MaterializeValueFn(Idx, ConstExprInsertBB);
66 if (!MaybeV) {
67
69 return nullptr;
70 }
71 return MaybeV.get();
72 }
73
74
75 if (!Ty)
76 return nullptr;
77
78
80 ValuePtrs[Idx] = {V, TyID};
81 return V;
82}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This class represents an incoming formal argument to a Function.
LLVM Basic Block Representation.
Value * getValueFwdRef(unsigned Idx, Type *Ty, unsigned TyID, BasicBlock *ConstExprInsertBB)
Definition ValueList.cpp:50
void push_back(Value *V, unsigned TypeID)
Error assignValue(unsigned Idx, Value *V, unsigned TypeID)
Definition ValueList.cpp:21
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
Tagged union holding either a T or a Error.
Error takeError()
Take ownership of the stored error.
reference get()
Returns a reference to the stored T value.
The instances of the Type class are immutable: once they are created, they are never changed.
LLVM Value Representation.
Type * getType() const
All values are typed, get the type of this value.
LLVM_ABI void deleteValue()
Delete a pointer to a generic Value.
This is an optimization pass for GlobalISel generic memory operations.
Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)
Create formatted StringError object.
bool isa(const From &Val)
isa - Return true if the parameter to the template is an instance of one of the template type argu...
void consumeError(Error Err)
Consume a Error without doing anything.