15 #ifndef LLVM_IR_MDBUILDER_H
16 #define LLVM_IR_MDBUILDER_H
48 assert(Accuracy > 0.0 &&
"Invalid fpmath accuracy!");
59 uint32_t Weights[] = { TrueWeight, FalseWeight };
65 assert(Weights.
size() >= 2 &&
"Need at least two branch weights!");
71 for (
unsigned i = 0, e = Weights.
size(); i != e; ++i)
127 bool isConstant =
false) {
143 Offset(Offset), Size(Size), TBAA(TBAA) {}
151 for (
unsigned i = 0, e = Fields.
size(); i != e; ++i) {
154 Vals[i * 3 + 2] = Fields[i].TBAA;
162 ArrayRef<std::pair<MDNode*, uint64_t> > Fields) {
166 for (
unsigned i = 0, e = Fields.size(); i != e; ++i) {
167 Ops[i * 2 + 1] = Fields[i].first;
176 uint64_t Offset = 0) {
MDNode * createTBAANode(StringRef Name, MDNode *Parent, bool isConstant=false)
Return metadata for a non-root TBAA node with the given name, parent in the TBAA tree, and value for 'pointsToConstantMemory'.
void replaceOperandWith(unsigned i, Value *NewVal)
replaceOperandWith - Replace a specific operand.
static void deleteTemporary(MDNode *N)
static MDNode * getTemporary(LLVMContext &Context, ArrayRef< Value * > Vals)
MDNode * createBranchWeights(ArrayRef< uint32_t > Weights)
Return metadata containing a number of branch weights.
MDNode * createAnonymousTBAARoot()
Return metadata appropriate for a TBAA root node. Each returned node is distinct from all other metad...
static MDString * get(LLVMContext &Context, StringRef Str)
MDBuilder(LLVMContext &context)
TBAAStructField(uint64_t Offset, uint64_t Size, MDNode *TBAA)
MDString * createString(StringRef Str)
Return the given string as metadata.
MDNode * createTBAAStructNode(ArrayRef< TBAAStructField > Fields)
Return metadata for a tbaa.struct node with the given struct field descriptions.
MDNode - a tuple of other values.
static IntegerType * getInt64Ty(LLVMContext &C)
MDNode * createBranchWeights(uint32_t TrueWeight, uint32_t FalseWeight)
Return metadata containing two branch weights.
static MDNode * get(LLVMContext &Context, ArrayRef< Value * > Vals)
static Type * getFloatTy(LLVMContext &C)
MDNode * createTBAAScalarTypeNode(StringRef Name, MDNode *Parent, uint64_t Offset=0)
Return metadata for a TBAA scalar type node with the given name, an offset and a parent in the TBAA t...
MDNode * createTBAAStructTypeNode(StringRef Name, ArrayRef< std::pair< MDNode *, uint64_t > > Fields)
Return metadata for a TBAA struct node in the type DAG with the given name, a list of pairs (offset...
MDNode * createFPMath(float Accuracy)
Return metadata with the given settings. The special value 0.0 for the Accuracy parameter indicates t...
size_t size() const
size - Get the array size.
LLVM Constant Representation.
MDNode * createRange(const APInt &Lo, const APInt &Hi)
Return metadata describing the range [Lo, Hi).
unsigned getBitWidth() const
Return the number of bits in the APInt.
static IntegerType * get(LLVMContext &C, unsigned NumBits)
Get or create an IntegerType instance.
static Constant * get(Type *Ty, uint64_t V, bool isSigned=false)
static Constant * get(Type *Ty, double V)
Class for arbitrary precision integers.
MDNode * createTBAARoot(StringRef Name)
Return metadata appropriate for a TBAA root node with the given name. This may be identified (uniqued...
static IntegerType * getInt32Ty(LLVMContext &C)
MDNode * createTBAAStructTagNode(MDNode *BaseType, MDNode *AccessType, uint64_t Offset)
Return metadata for a TBAA tag node with the given base type, access type and offset relative to the ...
LLVM Value Representation.