46 : Context(C), Materializer(NULL), ModuleID(MID) {
49 Context.addModule(
this);
53 Context.removeModule(
this);
68 while (!temp.
empty()) {
69 std::pair<StringRef, StringRef>
P =
getToken(temp,
"-");
74 if (token[0] ==
'e') {
76 }
else if (token[0] ==
'E') {
89 while (!temp.
empty()) {
90 std::pair<StringRef, StringRef> TmpP =
getToken(temp,
"-");
93 StringRef token = TmpP.second, signalToken = TmpP.first;
95 if (signalToken[0] ==
'p') {
97 getToken(token,
":").first.getAsInteger(10, size);
185 va_start(Args, RetTy);
188 std::vector<Type*> ArgTys;
189 while (
Type *ArgTy = va_arg(Args,
Type*))
190 ArgTys.push_back(ArgTy);
203 va_start(Args, RetTy);
206 std::vector<Type*> ArgTys;
207 while (
Type *ArgTy = va_arg(Args,
Type*))
208 ArgTys.push_back(ArgTy);
239 if (AllowLocal || !Result->hasLocalLinkage())
300 NMD->setParent(
this);
310 NamedMDList.
erase(NMD);
317 if (!ModFlags)
return;
319 for (
unsigned i = 0, e = ModFlags->
getNumOperands(); i != e; ++i) {
334 for (
unsigned I = 0, E = ModuleFlags.
size();
I < E; ++
I) {
374 "Invalid number of operands for module flag!");
375 assert(isa<ConstantInt>(Node->
getOperand(0)) &&
377 "Invalid operand types for module flag!");
385 assert(!Materializer &&
386 "Module already has a GVMaterializer. Call MaterializeAllPermanently"
387 " to clear it out before setting another one.");
388 Materializer.reset(GVM);
393 return Materializer->isMaterializable(GV);
399 return Materializer->isDematerializable(GV);
407 error_code EC = Materializer->Materialize(GV);
417 return Materializer->Dematerialize(GV);
423 error_code EC = Materializer->MaterializeModule(
this);
434 Materializer.reset();
452 I->dropAllReferences();
455 I->dropAllReferences();
458 I->dropAllReferences();
StringRef getName() const
getName - Return a constant reference to this named metadata's name.
void push_back(const T &Elt)
PointerSize getPointerSize() const
Target Pointer Size information.
StringRef getString() const
const ValueSymbolTable & getValueSymbolTable() const
Get the symbol table of global variable and function identifiers.
static MDString * get(LLVMContext &Context, StringRef Str)
unsigned getNumOperands() const
getNumOperands - Return number of MDNode operands.
void setMaterializer(GVMaterializer *GVM)
void addOperand(MDNode *M)
addOperand - Add metadata operand.
static PointerType * get(Type *ElementType, unsigned AddressSpace)
Endianness
An enumeration for describing the endianess of the target machine.
NamedMDNode * getOrInsertNamedMetadata(StringRef Name)
Externally visible function.
MDNode - a tuple of other values.
unsigned getPointerAddressSpace() const
Get the address space of this pointer or pointer vector type.
const GlobalVariable * getGlobalVariable(StringRef Name, bool AllowInternal=false) const
static MDNode * get(LLVMContext &Context, ArrayRef< Value * > Vals)
Value * getOperand(unsigned i) const LLVM_READONLY
getOperand - Return specified operand.
void getMDKindNames(SmallVectorImpl< StringRef > &Result) const
void push_back(NodeTy *val)
void eraseNamedMetadata(NamedMDNode *NMD)
std::pair< StringRef, StringRef > getToken(StringRef Source, StringRef Delimiters=" \t\n\v\f\r")
void setName(const Twine &Name)
bool Materialize(GlobalValue *GV, std::string *ErrInfo=0)
uint64_t getZExtValue() const
Return the zero extended value.
global_iterator global_begin()
static FunctionType * get(Type *Result, ArrayRef< Type * > Params, bool isVarArg)
bool MaterializeAllPermanently(std::string *ErrInfo=0)
Function * getFunction(StringRef Name) const
void getMDKindNames(SmallVectorImpl< StringRef > &Result) const
Module(StringRef ModuleID, LLVMContext &C)
bool MaterializeAll(std::string *ErrInfo=0)
alias_iterator alias_end()
bool isDematerializable(const GlobalValue *GV) const
Constant * getOrInsertFunction(StringRef Name, FunctionType *T, AttributeSet AttributeList)
Constant * getOrInsertGlobal(StringRef Name, Type *Ty)
NamedMDNode * getModuleFlagsMetadata() const
LLVM Constant Representation.
ModFlagBehavior
This enumeration defines the supported behaviors of module flags.
PointerSize
An enumeration for describing the size of a pointer on the target machine.
MDNode * getOperand(unsigned i) const
getOperand - Return specified operand.
unsigned getMDKindID(StringRef Name) const
getMDKindID - Return a unique non-zero ID for the specified metadata kind.
void Dematerialize(GlobalValue *GV)
iterator erase(iterator where)
global_iterator global_end()
static Constant * getBitCast(Constant *C, Type *Ty)
static PointerType * getUnqual(Type *ElementType)
Class for constant integers.
StringRef toStringRef(SmallVectorImpl< char > &Out) const
NamedMDNode * getOrInsertModuleFlagsMetadata()
alias_iterator alias_begin()
static Constant * get(Type *Ty, uint64_t V, bool isSigned=false)
std::string message() const
GlobalAlias * getNamedAlias(StringRef Name) const
Value * getModuleFlag(StringRef Key) const
static const uint16_t * lookup(unsigned opcode, unsigned domain)
PointerType * getType() const
getType - Global values are always pointers.
NamedMDNode * getNamedMetadata(const Twine &Name) const
Endianness getEndianness() const
Target endian information.
static IntegerType * getInt32Ty(LLVMContext &C)
bool isMaterializable(const GlobalValue *GV) const
~Module()
The module destructor. This will dropAllReferences.
void setAttributes(AttributeSet attrs)
Set the attribute list for this Function.
bool hasLocalLinkage() const
LLVM Value Representation.
unsigned getNumOperands() const
getNumOperands - Return the number of NamedMDNode operands.
unsigned getMDKindID(StringRef Name) const
GlobalValue * getNamedValue(StringRef Name) const
Value * lookup(StringRef Name) const
Lookup a named Value.
void addModuleFlag(ModFlagBehavior Behavior, StringRef Key, Value *Val)
void push_back(const NodeTy &val)
static Function * Create(FunctionType *Ty, LinkageTypes Linkage, const Twine &N="", Module *M=0)
bool empty() const
empty - Check if the string is empty.