44 ConstantPlaceHolder &operator=(
const ConstantPlaceHolder &) =
delete;
47 void *
operator new(
size_t s) {
return User::operator
new(s, 1); }
50 static bool classof(
const Value *V) {
51 return isa<ConstantExpr>(V) &&
52 cast<ConstantExpr>(V)->getOpcode() == Instruction::UserOp1;
86 if (
Constant *PHC = dyn_cast<Constant>(&*OldV)) {
87 ResolveConstants.push_back(std::make_pair(PHC, Idx));
91 Value *PrevVal = OldV;
92 OldV->replaceAllUsesWith(V);
101 if (
Value *V = ValuePtrs[Idx]) {
102 if (Ty != V->getType())
104 return cast<Constant>(V);
121 if (
Value *V = ValuePtrs[Idx]) {
123 if (Ty && Ty != V->getType())
151 while (!ResolveConstants.empty()) {
152 Value *RealVal = operator[](ResolveConstants.back().second);
153 Constant *Placeholder = ResolveConstants.back().first;
154 ResolveConstants.pop_back();
159 while (!Placeholder->use_empty()) {
165 if (!isa<Constant>(U) || isa<GlobalValue>(U)) {
166 UI.getUse().set(RealVal);
172 Constant *UserC = cast<Constant>(U);
176 if (!isa<ConstantPlaceHolder>(*
I)) {
179 }
else if (*
I == Placeholder) {
185 ResolveConstants.begin(), ResolveConstants.end(),
186 std::pair<Constant *, unsigned>(cast<Constant>(*I), 0));
187 assert(It != ResolveConstants.end() && It->first == *
I);
188 NewOp = operator[](It->second);
196 if (
ConstantArray *UserCA = dyn_cast<ConstantArray>(UserC)) {
198 }
else if (
ConstantStruct *UserCS = dyn_cast<ConstantStruct>(UserC)) {
200 }
else if (isa<ConstantVector>(UserC)) {
203 assert(isa<ConstantExpr>(UserC) &&
"Must be a ConstantExpr.");
204 NewC = cast<ConstantExpr>(UserC)->getWithOperands(NewOps);
213 Placeholder->replaceAllUsesWith(RealVal);
214 Placeholder->deleteValue();
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
This class represents an incoming formal argument to a Function.
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
This class represents lattice values for constants.
void push_back(const T &Elt)
void deleteValue()
Delete a pointer to a generic Value.
static Constant * get(ArrayType *T, ArrayRef< Constant *> V)
Value * getValueFwdRef(unsigned Idx, Type *Ty)
A Use represents the edge between a Value definition and its users.
#define DEFINE_TRANSPARENT_OPERAND_ACCESSORS(CLASS, VALUECLASS)
Macro for generating out-of-class operand accessor definitions.
A constant value that is initialized with an expression using other constant values.
Value handle that is nullable, but tries to track the Value.
void assignValue(Value *V, unsigned Idx)
auto lower_bound(R &&Range, ForwardIt I) -> decltype(adl_begin(Range))
Provide wrappers to std::lower_bound which take ranges instead of having to pass begin/end explicitly...
void replaceAllUsesWith(Value *V)
Change all uses of this to point to a new Value.
The instances of the Type class are immutable: once they are created, they are never changed...
This is an important class for using LLVM in a threaded context.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This is an important base class in LLVM.
This file contains the declarations for the subclasses of Constant, which represent the different fla...
void resolveConstantForwardRefs()
Once all constants are read, this method bulk resolves any forward references.
static Constant * get(StructType *T, ArrayRef< Constant *> V)
#define DECLARE_TRANSPARENT_OPERAND_ACCESSORS(VALUECLASS)
Macro for generating in-class operand accessor declarations.
static UndefValue * get(Type *T)
Static factory methods - Return an 'undef' object of the specified type.
Constant * getConstantFwdRef(unsigned Idx, Type *Ty)
void sort(IteratorTy Start, IteratorTy End)
auto size(R &&Range, typename std::enable_if< std::is_same< typename std::iterator_traits< decltype(Range.begin())>::iterator_category, std::random_access_iterator_tag >::value, void >::type *=nullptr) -> decltype(std::distance(Range.begin(), Range.end()))
Get the size of a range.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
ConstantArray - Constant Array Declarations.
static IntegerType * getInt32Ty(LLVMContext &C)
Compile-time customization of User operands.
void destroyConstant()
Called if some element of this constant is no longer valid.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
user_iterator user_begin()
LLVM Value Representation.
FixedNumOperandTraits - determine the allocation regime of the Use array when it is a prefix to the U...
static Constant * get(ArrayRef< Constant *> V)