LLVM API Documentation

Classes | Public Member Functions | Protected Attributes
llvm::IRBuilderBase Class Reference

Common base class shared among various IRBuilders. More...

#include <IRBuilder.h>

Inheritance diagram for llvm::IRBuilderBase:
Inheritance graph
[legend]
Collaboration diagram for llvm::IRBuilderBase:
Collaboration graph
[legend]

List of all members.

Classes

class  FastMathFlagGuard
class  InsertPoint
 InsertPoint - A saved insertion point. More...
class  InsertPointGuard

Public Member Functions

 IRBuilderBase (LLVMContext &context, MDNode *FPMathTag=nullptr)
void ClearInsertionPoint ()
 Clear the insertion point: created instructions will not be inserted into a block.
BasicBlockGetInsertBlock () const
BasicBlock::iterator GetInsertPoint () const
LLVMContextgetContext () const
void SetInsertPoint (BasicBlock *TheBB)
 This specifies that created instructions should be appended to the end of the specified block.
void SetInsertPoint (Instruction *I)
 This specifies that created instructions should be inserted before the specified instruction.
void SetInsertPoint (BasicBlock *TheBB, BasicBlock::iterator IP)
 This specifies that created instructions should be inserted at the specified point.
void SetInsertPoint (Use &U)
 Find the nearest point that dominates this use, and specify that created instructions should be inserted at this point.
void SetCurrentDebugLocation (DebugLoc L)
 Set location information used by debugging information.
const DebugLocgetCurrentDebugLocation () const
 Get location information used by debugging information.
void SetInstDebugLocation (Instruction *I) const
 If this builder has a current debug location, set it on the specified instruction.
TypegetCurrentFunctionReturnType () const
 Get the return type of the current function that we're emitting into.
InsertPoint saveIP () const
 Returns the current insert point.
InsertPoint saveAndClearIP ()
 Returns the current insert point, clearing it in the process.
void restoreIP (InsertPoint IP)
 Sets the current insert point to a previously-saved location.
MDNodegetDefaultFPMathTag () const
 Get the floating point math metadata being used.
FastMathFlags getFastMathFlags () const
 Get the flags to be applied to created floating point ops.
void clearFastMathFlags ()
 Clear the fast-math flags.
void SetDefaultFPMathTag (MDNode *FPMathTag)
 Set the floating point math metadata to be used.
void SetFastMathFlags (FastMathFlags NewFMF)
 Set the fast-math flags to be used with generated fp-math operators.
ValueCreateGlobalString (StringRef Str, const Twine &Name="")
 Make a new global variable with initializer type i8*.
ConstantIntgetInt1 (bool V)
 Get a constant value representing either true or false.
ConstantIntgetTrue ()
 Get the constant value for i1 true.
ConstantIntgetFalse ()
 Get the constant value for i1 false.
ConstantIntgetInt8 (uint8_t C)
 Get a constant 8-bit value.
ConstantIntgetInt16 (uint16_t C)
 Get a constant 16-bit value.
ConstantIntgetInt32 (uint32_t C)
 Get a constant 32-bit value.
ConstantIntgetInt64 (uint64_t C)
 Get a constant 64-bit value.
ConstantIntgetIntN (unsigned N, uint64_t C)
 Get a constant N-bit value, zero extended or truncated from a 64-bit value.
ConstantIntgetInt (const APInt &AI)
 Get a constant integer value.
IntegerTypegetInt1Ty ()
 Fetch the type representing a single bit.
IntegerTypegetInt8Ty ()
 Fetch the type representing an 8-bit integer.
IntegerTypegetInt16Ty ()
 Fetch the type representing a 16-bit integer.
IntegerTypegetInt32Ty ()
 Fetch the type representing a 32-bit integer.
IntegerTypegetInt64Ty ()
 Fetch the type representing a 64-bit integer.
IntegerTypegetIntNTy (unsigned N)
 Fetch the type representing an N-bit integer.
TypegetHalfTy ()
 Fetch the type representing a 16-bit floating point value.
TypegetFloatTy ()
 Fetch the type representing a 32-bit floating point value.
TypegetDoubleTy ()
 Fetch the type representing a 64-bit floating point value.
TypegetVoidTy ()
 Fetch the type representing void.
PointerTypegetInt8PtrTy (unsigned AddrSpace=0)
 Fetch the type representing a pointer to an 8-bit integer value.
IntegerTypegetIntPtrTy (const DataLayout *DL, unsigned AddrSpace=0)
 Fetch the type representing a pointer to an integer value.
CallInstCreateMemSet (Value *Ptr, Value *Val, uint64_t Size, unsigned Align, bool isVolatile=false, MDNode *TBAATag=nullptr, MDNode *ScopeTag=nullptr, MDNode *NoAliasTag=nullptr)
 Create and insert a memset to the specified pointer and the specified value.
CallInstCreateMemSet (Value *Ptr, Value *Val, Value *Size, unsigned Align, bool isVolatile=false, MDNode *TBAATag=nullptr, MDNode *ScopeTag=nullptr, MDNode *NoAliasTag=nullptr)
CallInstCreateMemCpy (Value *Dst, Value *Src, uint64_t Size, unsigned Align, bool isVolatile=false, MDNode *TBAATag=nullptr, MDNode *TBAAStructTag=nullptr, MDNode *ScopeTag=nullptr, MDNode *NoAliasTag=nullptr)
 Create and insert a memcpy between the specified pointers.
CallInstCreateMemCpy (Value *Dst, Value *Src, Value *Size, unsigned Align, bool isVolatile=false, MDNode *TBAATag=nullptr, MDNode *TBAAStructTag=nullptr, MDNode *ScopeTag=nullptr, MDNode *NoAliasTag=nullptr)
CallInstCreateMemMove (Value *Dst, Value *Src, uint64_t Size, unsigned Align, bool isVolatile=false, MDNode *TBAATag=nullptr, MDNode *ScopeTag=nullptr, MDNode *NoAliasTag=nullptr)
 Create and insert a memmove between the specified pointers.
CallInstCreateMemMove (Value *Dst, Value *Src, Value *Size, unsigned Align, bool isVolatile=false, MDNode *TBAATag=nullptr, MDNode *ScopeTag=nullptr, MDNode *NoAliasTag=nullptr)
CallInstCreateLifetimeStart (Value *Ptr, ConstantInt *Size=nullptr)
 Create a lifetime.start intrinsic.
CallInstCreateLifetimeEnd (Value *Ptr, ConstantInt *Size=nullptr)
 Create a lifetime.end intrinsic.
CallInstCreateMaskedLoad (Value *Ptr, unsigned Align, Value *Mask, Value *PassThru=0, const Twine &Name="")
 Create a call to Masked Load intrinsic.
CallInstCreateMaskedStore (Value *Val, Value *Ptr, unsigned Align, Value *Mask)
 Create a call to Masked Store intrinsic.
CallInstCreateAssumption (Value *Cond)
 Create an assume intrinsic call that allows the optimizer to assume that the provided condition will be true.
CallInstCreateGCStatepoint (Value *ActualCallee, ArrayRef< Value * > CallArgs, ArrayRef< Value * > DeoptArgs, ArrayRef< Value * > GCArgs, const Twine &Name="")
 Create a call to the experimental.gc.statepoint intrinsic to start a new statepoint sequence.
CallInstCreateGCStatepoint (Value *ActualCallee, ArrayRef< Use > CallArgs, ArrayRef< Value * > DeoptArgs, ArrayRef< Value * > GCArgs, const Twine &Name="")
CallInstCreateGCResult (Instruction *Statepoint, Type *ResultType, const Twine &Name="")
 Create a call to the experimental.gc.result intrinsic to extract the result from a call wrapped in a statepoint.
CallInstCreateGCRelocate (Instruction *Statepoint, int BaseOffset, int DerivedOffset, Type *ResultType, const Twine &Name="")
 Create a call to the experimental.gc.relocate intrinsics to project the relocated value of one pointer from the statepoint.

Protected Attributes

BasicBlockBB
BasicBlock::iterator InsertPt
LLVMContextContext
MDNodeDefaultFPMathTag
FastMathFlags FMF

Detailed Description

Common base class shared among various IRBuilders.

Definition at line 50 of file IRBuilder.h.


Constructor & Destructor Documentation

llvm::IRBuilderBase::IRBuilderBase ( LLVMContext context,
MDNode FPMathTag = nullptr 
) [inline]

Definition at line 61 of file IRBuilder.h.

References ClearInsertionPoint().


Member Function Documentation

Clear the fast-math flags.

Definition at line 181 of file IRBuilder.h.

References llvm::FastMathFlags::clear(), and FMF.

Clear the insertion point: created instructions will not be inserted into a block.

Definition at line 72 of file IRBuilder.h.

References BB, and InsertPt.

Referenced by llvm::SCEVExpander::clearInsertPoint(), IRBuilderBase(), restoreIP(), and saveAndClearIP().

Create an assume intrinsic call that allows the optimizer to assume that the provided condition will be true.

Definition at line 177 of file IRBuilder.cpp.

References BB, createCallHelper(), llvm::Intrinsic::getDeclaration(), getInt1Ty(), llvm::BasicBlock::getParent(), llvm::GlobalValue::getParent(), and llvm::Value::getType().

Referenced by llvm::IRBuilder< true, TargetFolder >::CreateAlignmentAssumption().

CallInst * IRBuilderBase::CreateGCRelocate ( Instruction Statepoint,
int  BaseOffset,
int  DerivedOffset,
Type ResultType,
const Twine Name = "" 
)

Create a call to the experimental.gc.relocate intrinsics to project the relocated value of one pointer from the statepoint.

Definition at line 286 of file IRBuilder.cpp.

References BB, createCallHelper(), llvm::Intrinsic::getDeclaration(), getInt32(), llvm::BasicBlock::getParent(), and llvm::GlobalValue::getParent().

CallInst * IRBuilderBase::CreateGCResult ( Instruction Statepoint,
Type ResultType,
const Twine Name = "" 
)

Create a call to the experimental.gc.result intrinsic to extract the result from a call wrapped in a statepoint.

Definition at line 274 of file IRBuilder.cpp.

References BB, createCallHelper(), llvm::Intrinsic::getDeclaration(), llvm::BasicBlock::getParent(), llvm::GlobalValue::getParent(), and ID.

Referenced by ReplaceWithStatepoint().

CallInst * IRBuilderBase::CreateGCStatepoint ( Value ActualCallee,
ArrayRef< Value * >  CallArgs,
ArrayRef< Value * >  DeoptArgs,
ArrayRef< Value * >  GCArgs,
const Twine Name = "" 
)
CallInst * IRBuilderBase::CreateGCStatepoint ( Value ActualCallee,
ArrayRef< Use CallArgs,
ArrayRef< Value * >  DeoptArgs,
ArrayRef< Value * >  GCArgs,
const Twine Name = "" 
)

Definition at line 263 of file IRBuilder.cpp.

References CreateGCStatepoint().

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(), 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 = nullptr 
)

Create a lifetime.end intrinsic.

If the pointer isn't i8* it will be converted.

Definition at line 162 of file IRBuilder.cpp.

References BB, createCallHelper(), llvm::Intrinsic::getDeclaration(), getInt64(), getInt64Ty(), llvm::BasicBlock::getParent(), llvm::GlobalValue::getParent(), llvm::ConstantInt::getType(), and llvm::Value::getType().

CallInst * IRBuilderBase::CreateLifetimeStart ( Value Ptr,
ConstantInt Size = nullptr 
)

Create a lifetime.start intrinsic.

If the pointer isn't i8* it will be converted.

Definition at line 147 of file IRBuilder.cpp.

References BB, createCallHelper(), llvm::Intrinsic::getDeclaration(), getInt64(), getInt64Ty(), llvm::BasicBlock::getParent(), llvm::GlobalValue::getParent(), llvm::ConstantInt::getType(), and llvm::Value::getType().

CallInst * IRBuilderBase::CreateMaskedLoad ( Value Ptr,
unsigned  Align,
Value Mask,
Value PassThru = 0,
const Twine Name = "" 
)

Create a call to Masked Load intrinsic.

Create a call to a Masked Load intrinsic. Ptr - the base pointer for the load Align - alignment of the source location Mask - an vector of booleans which indicates what vector lanes should be accessed in memory PassThru - a pass-through value that is used to fill the masked-off lanes of the result Name - name of the result variable

Definition at line 195 of file IRBuilder.cpp.

References llvm::UndefValue::get(), getInt32(), llvm::Value::getType(), and llvm::Type::isPointerTy().

CallInst * IRBuilderBase::CreateMaskedStore ( Value Val,
Value Ptr,
unsigned  Align,
Value Mask 
)

Create a call to Masked Store intrinsic.

Create a call to a Masked Store intrinsic. Val - the data to be stored, Ptr - the base pointer for the store Align - alignment of the destination location Mask - an vector of booleans which indicates what vector lanes should be accessed in memory

Definition at line 214 of file IRBuilder.cpp.

References getInt32(), and llvm::Value::getType().

CallInst* llvm::IRBuilderBase::CreateMemCpy ( Value Dst,
Value Src,
uint64_t  Size,
unsigned  Align,
bool  isVolatile = false,
MDNode TBAATag = nullptr,
MDNode TBAAStructTag = nullptr,
MDNode ScopeTag = nullptr,
MDNode NoAliasTag = nullptr 
) [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. Likewise with alias.scope and noalias tags.

Definition at line 386 of file IRBuilder.h.

References getInt64(), and isVolatile().

CallInst * IRBuilderBase::CreateMemCpy ( Value Dst,
Value Src,
Value Size,
unsigned  Align,
bool  isVolatile = false,
MDNode TBAATag = nullptr,
MDNode TBAAStructTag = nullptr,
MDNode ScopeTag = nullptr,
MDNode NoAliasTag = nullptr 
)
CallInst* llvm::IRBuilderBase::CreateMemMove ( Value Dst,
Value Src,
uint64_t  Size,
unsigned  Align,
bool  isVolatile = false,
MDNode TBAATag = nullptr,
MDNode ScopeTag = nullptr,
MDNode NoAliasTag = nullptr 
) [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. Likewise with alias.scope and noalias tags.

Definition at line 407 of file IRBuilder.h.

References getInt64(), and isVolatile().

CallInst * IRBuilderBase::CreateMemMove ( Value Dst,
Value Src,
Value Size,
unsigned  Align,
bool  isVolatile = false,
MDNode TBAATag = nullptr,
MDNode ScopeTag = nullptr,
MDNode NoAliasTag = nullptr 
)
CallInst* llvm::IRBuilderBase::CreateMemSet ( Value Ptr,
Value Val,
uint64_t  Size,
unsigned  Align,
bool  isVolatile = false,
MDNode TBAATag = nullptr,
MDNode ScopeTag = nullptr,
MDNode NoAliasTag = nullptr 
) [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. Likewise with alias.scope and noalias tags.

Definition at line 368 of file IRBuilder.h.

References getInt64(), and isVolatile().

CallInst * IRBuilderBase::CreateMemSet ( Value Ptr,
Value Val,
Value Size,
unsigned  Align,
bool  isVolatile = false,
MDNode TBAATag = nullptr,
MDNode ScopeTag = nullptr,
MDNode NoAliasTag = nullptr 
)

Definition at line 79 of file IRBuilder.h.

References Context.

Referenced by generateUnsignedDivisionCode().

Get location information used by debugging information.

Definition at line 121 of file IRBuilder.h.

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().

Get the floating point math metadata being used.

Definition at line 175 of file IRBuilder.h.

References DefaultFPMathTag.

Fetch the type representing a 64-bit floating point value.

Definition at line 339 of file IRBuilder.h.

References Context.

Get the constant value for i1 false.

Definition at line 259 of file IRBuilder.h.

References Context.

Referenced by llvm::UpgradeIntrinsicCall().

Get the flags to be applied to created floating point ops.

Definition at line 178 of file IRBuilder.h.

References FMF.

Fetch the type representing a 32-bit floating point value.

Definition at line 334 of file IRBuilder.h.

References Context.

Fetch the type representing a 16-bit floating point value.

Definition at line 329 of file IRBuilder.h.

References Context.

Get a constant integer value.

Definition at line 290 of file IRBuilder.h.

References Context, and llvm::ConstantInt::get().

Get a constant value representing either true or false.

Definition at line 249 of file IRBuilder.h.

References llvm::ConstantInt::get(), and getInt1Ty().

Referenced by CreateMemCpy(), CreateMemMove(), and CreateMemSet().

ConstantInt* llvm::IRBuilderBase::getInt16 ( uint16_t  C) [inline]

Get a constant 16-bit value.

Definition at line 269 of file IRBuilder.h.

References llvm::ConstantInt::get(), and getInt16Ty().

Fetch the type representing a 16-bit integer.

Definition at line 309 of file IRBuilder.h.

References Context.

Referenced by getInt16().

Fetch the type representing a single bit.

Definition at line 299 of file IRBuilder.h.

References Context.

Referenced by CreateAssumption(), and getInt1().

ConstantInt* llvm::IRBuilderBase::getInt32 ( uint32_t  C) [inline]
ConstantInt* llvm::IRBuilderBase::getInt64 ( uint64_t  C) [inline]

Fetch the type representing a 64-bit integer.

Definition at line 319 of file IRBuilder.h.

References Context.

Referenced by CreateLifetimeEnd(), CreateLifetimeStart(), llvm::expandDivisionUpTo64Bits(), llvm::expandRemainderUpTo64Bits(), and getInt64().

ConstantInt* llvm::IRBuilderBase::getInt8 ( uint8_t  C) [inline]

Get a constant 8-bit value.

Definition at line 264 of file IRBuilder.h.

References llvm::ConstantInt::get(), and getInt8Ty().

Referenced by llvm::UpgradeIntrinsicCall(), UpgradeX86PSLLDQIntrinsics(), and UpgradeX86PSRLDQIntrinsics().

Fetch the type representing an 8-bit integer.

Definition at line 304 of file IRBuilder.h.

References Context.

Referenced by getInt8().

ConstantInt* llvm::IRBuilderBase::getIntN ( unsigned  N,
uint64_t  C 
) [inline]

Get a constant N-bit value, zero extended or truncated from a 64-bit value.

Definition at line 285 of file IRBuilder.h.

References llvm::ConstantInt::get(), and getIntNTy().

Fetch the type representing an N-bit integer.

Definition at line 324 of file IRBuilder.h.

References Context.

Referenced by getIntN().

IntegerType* llvm::IRBuilderBase::getIntPtrTy ( const DataLayout DL,
unsigned  AddrSpace = 0 
) [inline]

Fetch the type representing a pointer to an integer value.

Definition at line 354 of file IRBuilder.h.

References Context, and llvm::DataLayout::getIntPtrType().

Referenced by llvm::IRBuilder< true, TargetFolder >::CreateAlignmentAssumption().

Get the constant value for i1 true.

Definition at line 254 of file IRBuilder.h.

References Context.

Referenced by generateUnsignedDivisionCode().

Fetch the type representing void.

Definition at line 344 of file IRBuilder.h.

References Context.

Returns the current insert point, clearing it in the process.

Definition at line 160 of file IRBuilder.h.

References ClearInsertionPoint(), GetInsertBlock(), GetInsertPoint(), and llvm::IP.

Returns the current insert point.

Definition at line 155 of file IRBuilder.h.

References GetInsertBlock(), and GetInsertPoint().

void llvm::IRBuilderBase::SetDefaultFPMathTag ( MDNode FPMathTag) [inline]

Set the floating point math metadata to be used.

Definition at line 184 of file IRBuilder.h.

References DefaultFPMathTag.

Set the fast-math flags to be used with generated fp-math operators.

Definition at line 187 of file IRBuilder.h.

References FMF.

void llvm::IRBuilderBase::SetInsertPoint ( BasicBlock TheBB) [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().

This specifies that created instructions should be inserted at the specified point.

Definition at line 99 of file IRBuilder.h.

References BB, InsertPt, and llvm::IP.

void llvm::IRBuilderBase::SetInsertPoint ( Use U) [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().

If this builder has a current debug location, set it on the specified instruction.

Definition at line 125 of file IRBuilder.h.

References llvm::DebugLoc::isUnknown(), and llvm::Instruction::setDebugLoc().

Referenced by createCallHelper(), and llvm::IRBuilder< true, TargetFolder >::Insert().


Member Data Documentation


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