LLVM  mainline
Classes | Public Member Functions | Protected Member Functions
llvm::MDBuilder Class Reference

#include <MDBuilder.h>

List of all members.

Classes

struct  TBAAStructField

Public Member Functions

 MDBuilder (LLVMContext &context)
MDStringcreateString (StringRef Str)
 Return the given string as metadata.
ConstantAsMetadatacreateConstant (Constant *C)
 Return the given constant as metadata.
MDNodecreateFPMath (float Accuracy)
 Return metadata with the given settings.
MDNodecreateBranchWeights (uint32_t TrueWeight, uint32_t FalseWeight)
 Return metadata containing two branch weights.
MDNodecreateBranchWeights (ArrayRef< uint32_t > Weights)
 Return metadata containing a number of branch weights.
MDNodecreateFunctionEntryCount (uint64_t Count)
 Return metadata containing the entry count for a function.
MDNodecreateRange (const APInt &Lo, const APInt &Hi)
 Return metadata describing the range [Lo, Hi).
MDNodecreateRange (Constant *Lo, Constant *Hi)
 Return metadata describing the range [Lo, Hi).
MDNodecreateAnonymousTBAARoot ()
 Return metadata appropriate for a TBAA root node.
MDNodecreateAnonymousAliasScopeDomain (StringRef Name=StringRef())
 Return metadata appropriate for an alias scope domain node.
MDNodecreateAnonymousAliasScope (MDNode *Domain, StringRef Name=StringRef())
 Return metadata appropriate for an alias scope root node.
MDNodecreateTBAARoot (StringRef Name)
 Return metadata appropriate for a TBAA root node with the given name.
MDNodecreateAliasScopeDomain (StringRef Name)
 Return metadata appropriate for an alias scope domain node with the given name.
MDNodecreateAliasScope (StringRef Name, MDNode *Domain)
 Return metadata appropriate for an alias scope node with the given name.
MDNodecreateTBAANode (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'.
MDNodecreateTBAAStructNode (ArrayRef< TBAAStructField > Fields)
 Return metadata for a tbaa.struct node with the given struct field descriptions.
MDNodecreateTBAAStructTypeNode (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, field type in the type DAG).
MDNodecreateTBAAScalarTypeNode (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 type DAG.
MDNodecreateTBAAStructTagNode (MDNode *BaseType, MDNode *AccessType, uint64_t Offset, bool IsConstant=false)
 Return metadata for a TBAA tag node with the given base type, access type and offset relative to the base type.

Protected Member Functions

MDNodecreateAnonymousAARoot (StringRef Name=StringRef(), MDNode *Extra=nullptr)
 Return metadata appropriate for a AA root node (scope or TBAA).

Detailed Description

Definition at line 32 of file MDBuilder.h.


Constructor & Destructor Documentation

llvm::MDBuilder::MDBuilder ( LLVMContext context) [inline]

Definition at line 36 of file MDBuilder.h.


Member Function Documentation

MDNode * MDBuilder::createAliasScope ( StringRef  Name,
MDNode Domain 
)

Return metadata appropriate for an alias scope node with the given name.

This may be identified (uniqued) with other scopes with the same name and domain.

Definition at line 127 of file MDBuilder.cpp.

References createString(), and llvm::MDNode::get().

Return metadata appropriate for an alias scope domain node with the given name.

This may be identified (uniqued) with other roots with the same name.

Definition at line 123 of file MDBuilder.cpp.

References createString(), and llvm::MDNode::get().

MDNode * MDBuilder::createAnonymousAARoot ( StringRef  Name = StringRef(),
MDNode Extra = nullptr 
) [protected]

Return metadata appropriate for a AA root node (scope or TBAA).

Each returned node is distinct from all other metadata and will never be identified (uniqued) with anything else.

Definition at line 83 of file MDBuilder.cpp.

References createString(), llvm::NVPTXISD::Dummy, llvm::StringRef::empty(), llvm::MDNode::get(), llvm::MDNode::getTemporary(), llvm::None, llvm::SmallVectorTemplateBase< T, isPodLike >::push_back(), and llvm::MDNode::replaceOperandWith().

Referenced by createAnonymousAliasScope(), createAnonymousAliasScopeDomain(), and createAnonymousTBAARoot().

Return metadata appropriate for an alias scope root node.

Each returned node is distinct from all other metadata and will never be identified (uniqued) with anything else.

Definition at line 105 of file MDBuilder.h.

References createAnonymousAARoot().

Return metadata appropriate for an alias scope domain node.

Each returned node is distinct from all other metadata and will never be identified (uniqued) with anything else.

Definition at line 98 of file MDBuilder.h.

References createAnonymousAARoot().

Return metadata appropriate for a TBAA root node.

Each returned node is distinct from all other metadata and will never be identified (uniqued) with anything else.

Definition at line 91 of file MDBuilder.h.

References createAnonymousAARoot().

MDNode * MDBuilder::createBranchWeights ( uint32_t  TrueWeight,
uint32_t  FalseWeight 
)

Return metadata containing two branch weights.

Definition at line 37 of file MDBuilder.cpp.

MDNode * MDBuilder::createBranchWeights ( ArrayRef< uint32_t >  Weights)

Return metadata containing a number of branch weights.

Definition at line 43 of file MDBuilder.cpp.

References createConstant(), createString(), llvm::ConstantInt::get(), llvm::MDNode::get(), llvm::Type::getInt32Ty(), and llvm::ArrayRef< T >::size().

MDNode * MDBuilder::createFPMath ( float  Accuracy)

Return metadata with the given settings.

The special value 0.0 for the Accuracy parameter indicates the default (maximal precision) setting.

Definition at line 28 of file MDBuilder.cpp.

References createConstant(), llvm::ConstantFP::get(), llvm::MDNode::get(), and llvm::Type::getFloatTy().

Return metadata containing the entry count for a function.

Definition at line 56 of file MDBuilder.cpp.

References createConstant(), createString(), llvm::ConstantInt::get(), llvm::MDNode::get(), and llvm::Type::getInt64Ty().

Referenced by llvm::Function::setEntryCount().

Return metadata describing the range [Lo, Hi).

Definition at line 66 of file MDBuilder.cpp.

References llvm::IntegerType::get(), llvm::ConstantInt::get(), and llvm::APInt::getBitWidth().

Return metadata describing the range [Lo, Hi).

Definition at line 73 of file MDBuilder.cpp.

References createConstant(), and llvm::MDNode::get().

MDNode * MDBuilder::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'.

Definition at line 111 of file MDBuilder.cpp.

References createConstant(), createString(), llvm::ConstantInt::get(), llvm::MDNode::get(), and llvm::Type::getInt64Ty().

Return metadata appropriate for a TBAA root node with the given name.

This may be identified (uniqued) with other roots with the same name.

Definition at line 105 of file MDBuilder.cpp.

References createString(), and llvm::MDNode::get().

MDNode * MDBuilder::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 type DAG.

Definition at line 161 of file MDBuilder.cpp.

References createConstant(), createString(), llvm::ConstantInt::get(), llvm::MDNode::get(), and llvm::Type::getInt64Ty().

Return metadata for a tbaa.struct node with the given struct field descriptions.

Definition at line 134 of file MDBuilder.cpp.

References createConstant(), llvm::ConstantInt::get(), llvm::MDNode::get(), llvm::Type::getInt64Ty(), llvm::Int64, and llvm::ArrayRef< T >::size().

MDNode * MDBuilder::createTBAAStructTagNode ( MDNode BaseType,
MDNode AccessType,
uint64_t  Offset,
bool  IsConstant = false 
)

Return metadata for a TBAA tag node with the given base type, access type and offset relative to the base type.

Definition at line 170 of file MDBuilder.cpp.

References createConstant(), llvm::ConstantInt::get(), llvm::MDNode::get(), llvm::Type::getInt64Ty(), and llvm::Int64.

MDNode * MDBuilder::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, field type in the type DAG).

Definition at line 147 of file MDBuilder.cpp.

References createConstant(), createString(), llvm::ConstantInt::get(), llvm::MDNode::get(), llvm::Type::getInt64Ty(), and llvm::Int64.


The documentation for this class was generated from the following files: