LLVM API Documentation
Common base class shared among various IRBuilders. More...
#include <IRBuilder.h>
Classes | |
class | FastMathFlagGuard |
class | InsertPoint |
InsertPoint - A saved insertion point. More... | |
class | InsertPointGuard |
Public Member Functions | |
IRBuilderBase (LLVMContext &context, MDNode *FPMathTag=0) | |
void | ClearInsertionPoint () |
Clear the insertion point: created instructions will not be inserted into a block. More... | |
BasicBlock * | GetInsertBlock () const |
BasicBlock::iterator | GetInsertPoint () const |
LLVMContext & | getContext () const |
void | SetInsertPoint (BasicBlock *TheBB) |
This specifies that created instructions should be appended to the end of the specified block. More... | |
void | SetInsertPoint (Instruction *I) |
This specifies that created instructions should be inserted before the specified instruction. More... | |
void | SetInsertPoint (BasicBlock *TheBB, BasicBlock::iterator IP) |
This specifies that created instructions should be inserted at the specified point. More... | |
void | SetInsertPoint (Use &U) |
Find the nearest point that dominates this use, and specify that created instructions should be inserted at this point. More... | |
void | SetCurrentDebugLocation (const DebugLoc &L) |
Set location information used by debugging information. More... | |
DebugLoc | getCurrentDebugLocation () const |
Get location information used by debugging information. More... | |
void | SetInstDebugLocation (Instruction *I) const |
If this builder has a current debug location, set it on the specified instruction. More... | |
Type * | getCurrentFunctionReturnType () const |
Get the return type of the current function that we're emitting into. More... | |
InsertPoint | saveIP () const |
Returns the current insert point. More... | |
InsertPoint | saveAndClearIP () |
Returns the current insert point, clearing it in the process. More... | |
void | restoreIP (InsertPoint IP) |
Sets the current insert point to a previously-saved location. More... | |
MDNode * | getDefaultFPMathTag () const |
Get the floating point math metadata being used. More... | |
FastMathFlags | getFastMathFlags () const |
Get the flags to be applied to created floating point ops. More... | |
void | clearFastMathFlags () |
Clear the fast-math flags. More... | |
void | SetDefaultFPMathTag (MDNode *FPMathTag) |
Set the floating point math metadata to be used. More... | |
void | SetFastMathFlags (FastMathFlags NewFMF) |
Set the fast-math flags to be used with generated fp-math operators. More... | |
Value * | CreateGlobalString (StringRef Str, const Twine &Name="") |
Make a new global variable with initializer type i8*. More... | |
ConstantInt * | getInt1 (bool V) |
Get a constant value representing either true or false. More... | |
ConstantInt * | getTrue () |
Get the constant value for i1 true. More... | |
ConstantInt * | getFalse () |
Get the constant value for i1 false. More... | |
ConstantInt * | getInt8 (uint8_t C) |
Get a constant 8-bit value. More... | |
ConstantInt * | getInt16 (uint16_t C) |
Get a constant 16-bit value. More... | |
ConstantInt * | getInt32 (uint32_t C) |
Get a constant 32-bit value. More... | |
ConstantInt * | getInt64 (uint64_t C) |
Get a constant 64-bit value. More... | |
ConstantInt * | getInt (const APInt &AI) |
Get a constant integer value. More... | |
IntegerType * | getInt1Ty () |
Fetch the type representing a single bit. More... | |
IntegerType * | getInt8Ty () |
Fetch the type representing an 8-bit integer. More... | |
IntegerType * | getInt16Ty () |
Fetch the type representing a 16-bit integer. More... | |
IntegerType * | getInt32Ty () |
Fetch the type representing a 32-bit integer. More... | |
IntegerType * | getInt64Ty () |
Fetch the type representing a 64-bit integer. More... | |
Type * | getFloatTy () |
Fetch the type representing a 32-bit floating point value. More... | |
Type * | getDoubleTy () |
Fetch the type representing a 64-bit floating point value. More... | |
Type * | getVoidTy () |
Fetch the type representing void. More... | |
PointerType * | getInt8PtrTy (unsigned AddrSpace=0) |
Fetch the type representing a pointer to an 8-bit integer value. More... | |
IntegerType * | getIntPtrTy (const DataLayout *DL, unsigned AddrSpace=0) |
Fetch the type representing a pointer to an integer value. More... | |
CallInst * | CreateMemSet (Value *Ptr, Value *Val, uint64_t Size, unsigned Align, bool isVolatile=false, MDNode *TBAATag=0) |
Create and insert a memset to the specified pointer and the specified value. More... | |
CallInst * | CreateMemSet (Value *Ptr, Value *Val, Value *Size, unsigned Align, bool isVolatile=false, MDNode *TBAATag=0) |
CallInst * | CreateMemCpy (Value *Dst, Value *Src, uint64_t Size, unsigned Align, bool isVolatile=false, MDNode *TBAATag=0, MDNode *TBAAStructTag=0) |
Create and insert a memcpy between the specified pointers. More... | |
CallInst * | CreateMemCpy (Value *Dst, Value *Src, Value *Size, unsigned Align, bool isVolatile=false, MDNode *TBAATag=0, MDNode *TBAAStructTag=0) |
CallInst * | CreateMemMove (Value *Dst, Value *Src, uint64_t Size, unsigned Align, bool isVolatile=false, MDNode *TBAATag=0) |
Create and insert a memmove between the specified pointers. More... | |
CallInst * | CreateMemMove (Value *Dst, Value *Src, Value *Size, unsigned Align, bool isVolatile=false, MDNode *TBAATag=0) |
CallInst * | CreateLifetimeStart (Value *Ptr, ConstantInt *Size=0) |
Create a lifetime.start intrinsic. More... | |
CallInst * | CreateLifetimeEnd (Value *Ptr, ConstantInt *Size=0) |
Create a lifetime.end intrinsic. More... | |
Protected Attributes | |
BasicBlock * | BB |
BasicBlock::iterator | InsertPt |
LLVMContext & | Context |
MDNode * | DefaultFPMathTag |
FastMathFlags | FMF |
Common base class shared among various IRBuilders.
Definition at line 50 of file IRBuilder.h.
|
inline |
Definition at line 61 of file IRBuilder.h.
References ClearInsertionPoint().
|
inline |
Clear the fast-math flags.
Definition at line 183 of file IRBuilder.h.
References llvm::FastMathFlags::clear(), and FMF.
|
inline |
Clear the insertion point: created instructions will not be inserted into a block.
Definition at line 72 of file IRBuilder.h.
Referenced by llvm::SCEVExpander::clearInsertPoint(), IRBuilderBase(), restoreIP(), and saveAndClearIP().
Make a new global variable with initializer type i8*.
Make a new global variable with an initializer that has array of i8 type filled in with the null terminated string value specified. The new global variable will be marked mergable with any others of the same contents. If Name is specified, it is the name of the global variable created.
CreateGlobalString - Make a new global variable with an initializer that has array of i8 type filled in with the nul terminated string value specified. If Name is specified, it is the name of the global variable created.
Definition at line 26 of file IRBuilder.cpp.
References BB, Context, llvm::BasicBlock::getParent(), llvm::GlobalValue::getParent(), llvm::ConstantDataArray::getString(), llvm::Value::getType(), llvm::GlobalValue::PrivateLinkage, llvm::Value::setName(), and llvm::GlobalValue::setUnnamedAddr().
Referenced by llvm::IRBuilder< true, TargetFolder >::CreateGlobalStringPtr().
CallInst * IRBuilderBase::CreateLifetimeEnd | ( | Value * | Ptr, |
ConstantInt * | Size = 0 |
||
) |
Create a lifetime.end intrinsic.
If the pointer isn't i8* it will be converted.
Definition at line 140 of file IRBuilder.cpp.
References BB, createCallHelper(), llvm::Intrinsic::getDeclaration(), getInt64(), getInt64Ty(), llvm::BasicBlock::getParent(), llvm::GlobalValue::getParent(), llvm::Value::getType(), llvm::ConstantInt::getType(), and llvm::Intrinsic::lifetime_end.
Referenced by llvm::InlineFunction().
CallInst * IRBuilderBase::CreateLifetimeStart | ( | Value * | Ptr, |
ConstantInt * | Size = 0 |
||
) |
Create a lifetime.start intrinsic.
If the pointer isn't i8* it will be converted.
Definition at line 125 of file IRBuilder.cpp.
References BB, createCallHelper(), llvm::Intrinsic::getDeclaration(), getInt64(), getInt64Ty(), llvm::BasicBlock::getParent(), llvm::GlobalValue::getParent(), llvm::Value::getType(), llvm::ConstantInt::getType(), and llvm::Intrinsic::lifetime_start.
|
inline |
Create and insert a memcpy between the specified pointers.
If the pointers aren't i8*, they will be converted. If a TBAA tag is specified, it will be added to the instruction.
Definition at line 365 of file IRBuilder.h.
References getInt64().
Referenced by llvm::SimplifyFortifiedLibCalls::fold().
CallInst * IRBuilderBase::CreateMemCpy | ( | Value * | Dst, |
Value * | Src, | ||
Value * | Size, | ||
unsigned | Align, | ||
bool | isVolatile = false , |
||
MDNode * | TBAATag = 0 , |
||
MDNode * | TBAAStructTag = 0 |
||
) |
Definition at line 82 of file IRBuilder.cpp.
References BB, createCallHelper(), llvm::Intrinsic::getDeclaration(), getInt1(), getInt32(), llvm::BasicBlock::getParent(), llvm::GlobalValue::getParent(), llvm::Value::getType(), llvm::LLVMContext::MD_tbaa, llvm::LLVMContext::MD_tbaa_struct, llvm::Intrinsic::memcpy, and llvm::Instruction::setMetadata().
|
inline |
Create and insert a memmove between the specified pointers.
If the pointers aren't i8*, they will be converted. If a TBAA tag is specified, it will be added to the instruction.
Definition at line 381 of file IRBuilder.h.
References getInt64().
Referenced by llvm::SimplifyFortifiedLibCalls::fold().
CallInst * IRBuilderBase::CreateMemMove | ( | Value * | Dst, |
Value * | Src, | ||
Value * | Size, | ||
unsigned | Align, | ||
bool | isVolatile = false , |
||
MDNode * | TBAATag = 0 |
||
) |
Definition at line 106 of file IRBuilder.cpp.
References BB, createCallHelper(), llvm::Intrinsic::getDeclaration(), getInt1(), getInt32(), llvm::BasicBlock::getParent(), llvm::GlobalValue::getParent(), llvm::Value::getType(), llvm::LLVMContext::MD_tbaa, llvm::Intrinsic::memmove, and llvm::Instruction::setMetadata().
|
inline |
Create and insert a memset to the specified pointer and the specified value.
If the pointer isn't an i8*, it will be converted. If a TBAA tag is specified, it will be added to the instruction.
Definition at line 353 of file IRBuilder.h.
References getInt64().
Referenced by llvm::SimplifyFortifiedLibCalls::fold().
CallInst * IRBuilderBase::CreateMemSet | ( | Value * | Ptr, |
Value * | Val, | ||
Value * | Size, | ||
unsigned | Align, | ||
bool | isVolatile = false , |
||
MDNode * | TBAATag = 0 |
||
) |
Definition at line 64 of file IRBuilder.cpp.
References BB, createCallHelper(), llvm::Intrinsic::getDeclaration(), getInt1(), getInt32(), llvm::BasicBlock::getParent(), llvm::GlobalValue::getParent(), llvm::Value::getType(), llvm::LLVMContext::MD_tbaa, llvm::Intrinsic::memset, and llvm::Instruction::setMetadata().
|
inline |
Definition at line 79 of file IRBuilder.h.
References Context.
Referenced by foldSelectICmpAnd(), and generateUnsignedDivisionCode().
|
inline |
Get location information used by debugging information.
Definition at line 123 of file IRBuilder.h.
Type * IRBuilderBase::getCurrentFunctionReturnType | ( | ) | const |
Get the return type of the current function that we're emitting into.
Definition at line 37 of file IRBuilder.cpp.
References BB, llvm::BasicBlock::getParent(), and llvm::Function::getReturnType().
Referenced by llvm::IRBuilder< true, TargetFolder >::CreateAggregateRet().
|
inline |
Get the floating point math metadata being used.
Definition at line 177 of file IRBuilder.h.
References DefaultFPMathTag.
|
inline |
Fetch the type representing a 64-bit floating point value.
Definition at line 325 of file IRBuilder.h.
References Context, and llvm::Type::getDoubleTy().
|
inline |
Get the constant value for i1 false.
Definition at line 261 of file IRBuilder.h.
References Context, and llvm::ConstantInt::getFalse().
Referenced by llvm::UpgradeIntrinsicCall().
|
inline |
Get the flags to be applied to created floating point ops.
Definition at line 180 of file IRBuilder.h.
References FMF.
|
inline |
Fetch the type representing a 32-bit floating point value.
Definition at line 320 of file IRBuilder.h.
References Context, and llvm::Type::getFloatTy().
|
inline |
Definition at line 77 of file IRBuilder.h.
References BB.
Referenced by createCallHelper(), llvm::EmitFPutC(), llvm::EmitFPutS(), llvm::EmitFWrite(), llvm::EmitMemChr(), llvm::EmitMemCmp(), llvm::EmitMemCpyChk(), llvm::EmitPutChar(), llvm::EmitPutS(), llvm::EmitStrChr(), llvm::EmitStrCpy(), llvm::EmitStrLen(), llvm::EmitStrNCmp(), llvm::EmitStrNCpy(), llvm::EmitStrNLen(), llvm::EmitUnaryFloatFnCall(), generateUnsignedDivisionCode(), saveAndClearIP(), and saveIP().
|
inline |
Definition at line 78 of file IRBuilder.h.
References InsertPt.
Referenced by createCallHelper(), llvm::expandDivision(), llvm::expandRemainder(), generateUnsignedDivisionCode(), saveAndClearIP(), and saveIP().
|
inline |
Get a constant integer value.
Definition at line 286 of file IRBuilder.h.
References Context, and llvm::ConstantInt::get().
|
inline |
Get a constant value representing either true or false.
Definition at line 251 of file IRBuilder.h.
References llvm::ConstantInt::get(), and getInt1Ty().
Referenced by CreateMemCpy(), CreateMemMove(), and CreateMemSet().
|
inline |
Get a constant 16-bit value.
Definition at line 271 of file IRBuilder.h.
References llvm::ConstantInt::get(), and getInt16Ty().
|
inline |
Fetch the type representing a 16-bit integer.
Definition at line 305 of file IRBuilder.h.
References Context, and llvm::Type::getInt16Ty().
Referenced by getInt16().
|
inline |
Fetch the type representing a single bit.
Definition at line 295 of file IRBuilder.h.
References Context, and llvm::Type::getInt1Ty().
Referenced by getInt1().
|
inline |
Get a constant 32-bit value.
Definition at line 276 of file IRBuilder.h.
References llvm::ConstantInt::get(), and getInt32Ty().
Referenced by createFailOrdering(), CreateMemCpy(), CreateMemMove(), CreateMemSet(), createOrdering(), generateSignedDivisionCode(), generateSignedRemainderCode(), generateUnsignedDivisionCode(), OptimizeIntegerToVectorInsertions(), OptimizeIntToFloatBitCast(), and llvm::UpgradeIntrinsicCall().
|
inline |
Fetch the type representing a 32-bit integer.
Definition at line 310 of file IRBuilder.h.
References Context, and llvm::Type::getInt32Ty().
Referenced by llvm::IRBuilder< true, TargetFolder >::CreateVectorSplat(), llvm::EmitFPutC(), llvm::EmitFPutS(), llvm::EmitMemChr(), llvm::EmitMemCmp(), llvm::EmitPutChar(), llvm::EmitPutS(), llvm::EmitStrChr(), llvm::EmitStrNCmp(), llvm::expandDivisionUpTo32Bits(), llvm::expandRemainderUpTo32Bits(), generateUnsignedDivisionCode(), and getInt32().
|
inline |
Get a constant 64-bit value.
Definition at line 281 of file IRBuilder.h.
References llvm::ConstantInt::get(), and getInt64Ty().
Referenced by CreateLifetimeEnd(), CreateLifetimeStart(), CreateMemCpy(), CreateMemMove(), and CreateMemSet().
|
inline |
Fetch the type representing a 64-bit integer.
Definition at line 315 of file IRBuilder.h.
References Context, and llvm::Type::getInt64Ty().
Referenced by CreateLifetimeEnd(), CreateLifetimeStart(), and getInt64().
|
inline |
Get a constant 8-bit value.
Definition at line 266 of file IRBuilder.h.
References llvm::ConstantInt::get(), and getInt8Ty().
Referenced by llvm::UpgradeIntrinsicCall().
|
inline |
Fetch the type representing a pointer to an 8-bit integer value.
Definition at line 335 of file IRBuilder.h.
References Context, and llvm::Type::getInt8PtrTy().
Referenced by llvm::CastToCStr(), llvm::EmitFPutS(), llvm::EmitFWrite(), llvm::EmitMemChr(), llvm::EmitMemCmp(), llvm::EmitMemCpyChk(), llvm::EmitPutS(), llvm::EmitStrChr(), llvm::EmitStrCpy(), llvm::EmitStrLen(), llvm::EmitStrNCmp(), llvm::EmitStrNCpy(), and llvm::EmitStrNLen().
|
inline |
Fetch the type representing an 8-bit integer.
Definition at line 300 of file IRBuilder.h.
References Context, and llvm::Type::getInt8Ty().
Referenced by llvm::SimplifyFortifiedLibCalls::fold(), and getInt8().
|
inline |
Fetch the type representing a pointer to an integer value.
Definition at line 340 of file IRBuilder.h.
References Context, and llvm::DataLayout::getIntPtrType().
|
inline |
Get the constant value for i1 true.
Definition at line 256 of file IRBuilder.h.
References Context, and llvm::ConstantInt::getTrue().
Referenced by generateUnsignedDivisionCode().
|
inline |
Fetch the type representing void.
Definition at line 330 of file IRBuilder.h.
References Context, and llvm::Type::getVoidTy().
|
inline |
Sets the current insert point to a previously-saved location.
Definition at line 169 of file IRBuilder.h.
References ClearInsertionPoint(), llvm::IRBuilderBase::InsertPoint::getBlock(), llvm::IRBuilderBase::InsertPoint::getPoint(), llvm::IRBuilderBase::InsertPoint::isSet(), and SetInsertPoint().
Referenced by llvm::IRBuilderBase::InsertPointGuard::~InsertPointGuard().
|
inline |
Returns the current insert point, clearing it in the process.
Definition at line 162 of file IRBuilder.h.
References ClearInsertionPoint(), GetInsertBlock(), and GetInsertPoint().
|
inline |
Returns the current insert point.
Definition at line 157 of file IRBuilder.h.
References GetInsertBlock(), and GetInsertPoint().
|
inline |
Set location information used by debugging information.
Definition at line 118 of file IRBuilder.h.
Referenced by llvm::IRBuilder< true, TargetFolder >::IRBuilder(), llvm::SCEVExpander::replaceCongruentIVs(), SetInsertPoint(), SimplifyTerminatorOnSelect(), TryToSimplifyUncondBranchWithICmpInIt(), and llvm::IRBuilderBase::InsertPointGuard::~InsertPointGuard().
|
inline |
Set the floating point math metadata to be used.
Definition at line 186 of file IRBuilder.h.
References DefaultFPMathTag.
|
inline |
Set the fast-math flags to be used with generated fp-math operators.
Definition at line 189 of file IRBuilder.h.
References FMF.
|
inline |
This specifies that created instructions should be appended to the end of the specified block.
Definition at line 83 of file IRBuilder.h.
References BB, llvm::BasicBlock::end(), and InsertPt.
Referenced by llvm::SCEVExpander::expandCodeFor(), FoldTwoEntryPHINode(), generatedUnsignedRemainderCode(), generateSignedDivisionCode(), generateSignedRemainderCode(), generateUnsignedDivisionCode(), llvm::IRBuilder< true, TargetFolder >::IRBuilder(), ProcessUAddIdiom(), ProcessUGT_ADDCST_ADD(), restoreIP(), SetInsertPoint(), SimplifyBranchOnICmpChain(), SimplifyCondBranchToTwoReturns(), llvm::InstCombiner::SliceUpIllegalIntegerPHI(), SwitchToLookupTable(), TryToSimplifyUncondBranchWithICmpInIt(), llvm::UpgradeIntrinsicCall(), and llvm::ObjectSizeOffsetEvaluator::visitPHINode().
|
inline |
This specifies that created instructions should be inserted before the specified instruction.
Definition at line 90 of file IRBuilder.h.
References BB, llvm::BasicBlock::end(), llvm::Instruction::getDebugLoc(), llvm::Instruction::getParent(), I, InsertPt, and SetCurrentDebugLocation().
|
inline |
This specifies that created instructions should be inserted at the specified point.
Definition at line 99 of file IRBuilder.h.
|
inline |
Find the nearest point that dominates this use, and specify that created instructions should be inserted at this point.
Definition at line 106 of file IRBuilder.h.
References llvm::BasicBlock::getTerminator(), llvm::Use::getUser(), and SetInsertPoint().
|
inline |
If this builder has a current debug location, set it on the specified instruction.
Definition at line 127 of file IRBuilder.h.
References llvm::DebugLoc::isUnknown(), and llvm::Instruction::setDebugLoc().
Referenced by createCallHelper(), and llvm::IRBuilder< true, TargetFolder >::Insert().
|
protected |
Definition at line 53 of file IRBuilder.h.
Referenced by ClearInsertionPoint(), CreateGlobalString(), CreateLifetimeEnd(), CreateLifetimeStart(), CreateMemCpy(), CreateMemMove(), CreateMemSet(), getCurrentFunctionReturnType(), GetInsertBlock(), llvm::IRBuilder< true, TargetFolder >::Insert(), and SetInsertPoint().
|
protected |
Definition at line 55 of file IRBuilder.h.
Referenced by llvm::IRBuilder< true, TargetFolder >::CreateAggregateRet(), llvm::IRBuilder< true, TargetFolder >::CreateConstGEP1_32(), llvm::IRBuilder< true, TargetFolder >::CreateConstGEP1_64(), llvm::IRBuilder< true, TargetFolder >::CreateConstGEP2_32(), llvm::IRBuilder< true, TargetFolder >::CreateConstGEP2_64(), llvm::IRBuilder< true, TargetFolder >::CreateConstInBoundsGEP1_32(), llvm::IRBuilder< true, TargetFolder >::CreateConstInBoundsGEP1_64(), llvm::IRBuilder< true, TargetFolder >::CreateConstInBoundsGEP2_32(), llvm::IRBuilder< true, TargetFolder >::CreateConstInBoundsGEP2_64(), llvm::IRBuilder< true, TargetFolder >::CreateFence(), CreateGlobalString(), llvm::IRBuilder< true, TargetFolder >::CreateGlobalStringPtr(), llvm::IRBuilder< true, TargetFolder >::CreatePtrDiff(), llvm::IRBuilder< true, TargetFolder >::CreateRet(), llvm::IRBuilder< true, TargetFolder >::CreateRetVoid(), llvm::IRBuilder< true, TargetFolder >::CreateUnreachable(), getContext(), getDoubleTy(), getFalse(), getFloatTy(), getInt(), getInt16Ty(), getInt1Ty(), getInt32Ty(), getInt64Ty(), getInt8PtrTy(), getInt8Ty(), getIntPtrTy(), getTrue(), and getVoidTy().
|
protected |
Definition at line 57 of file IRBuilder.h.
Referenced by getDefaultFPMathTag(), SetDefaultFPMathTag(), and llvm::IRBuilderBase::FastMathFlagGuard::~FastMathFlagGuard().
|
protected |
Definition at line 58 of file IRBuilder.h.
Referenced by clearFastMathFlags(), getFastMathFlags(), SetFastMathFlags(), and llvm::IRBuilderBase::FastMathFlagGuard::~FastMathFlagGuard().
|
protected |
Definition at line 54 of file IRBuilder.h.
Referenced by ClearInsertionPoint(), GetInsertPoint(), llvm::IRBuilder< true, TargetFolder >::Insert(), and SetInsertPoint().