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  InsertPoint
 InsertPoint - A saved insertion point. More...

Public Member Functions

 IRBuilderBase (LLVMContext &context)
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 (const DebugLoc &L)
 Set location information used by debugging information.
void DisableDebugLocations ()
 Temporarily suppress DebugLocations from being attached to emitted instructions, until the next call to SetCurrentDebugLocation() or EnableDebugLocations(). Use this if you want an instruction to be counted towards the prologue or if there is no useful source location.
void EnableDebugLocations ()
 Restore the previously saved DebugLocation.
DebugLoc getCurrentDebugLocation () 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.
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.
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.
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 (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=0)
 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=0)
CallInstCreateMemCpy (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.
CallInstCreateMemCpy (Value *Dst, Value *Src, Value *Size, unsigned Align, bool isVolatile=false, MDNode *TBAATag=0, MDNode *TBAAStructTag=0)
CallInstCreateMemMove (Value *Dst, Value *Src, uint64_t Size, unsigned Align, bool isVolatile=false, MDNode *TBAATag=0)
 Create and insert a memmove between the specified pointers.
CallInstCreateMemMove (Value *Dst, Value *Src, Value *Size, unsigned Align, bool isVolatile=false, MDNode *TBAATag=0)
CallInstCreateLifetimeStart (Value *Ptr, ConstantInt *Size=0)
 Create a lifetime.start intrinsic.
CallInstCreateLifetimeEnd (Value *Ptr, ConstantInt *Size=0)
 Create a lifetime.end intrinsic.

Protected Attributes

llvm::DebugLoc SavedDbgLocation
BasicBlockBB
BasicBlock::iterator InsertPt
LLVMContextContext

Detailed Description

Common base class shared among various IRBuilders.

Definition at line 49 of file IRBuilder.h.


Constructor & Destructor Documentation

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

Definition at line 61 of file IRBuilder.h.

References ClearInsertionPoint().


Member Function Documentation

void llvm::IRBuilderBase::ClearInsertionPoint ( ) [inline]

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

Definition at line 72 of file IRBuilder.h.

References BB.

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

Value * IRBuilderBase::CreateGlobalString ( StringRef  Str,
const Twine Name = "" 
)

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(), and llvm::ConstantInt::getType().

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(), and llvm::ConstantInt::getType().

CallInst* llvm::IRBuilderBase::CreateMemCpy ( Value Dst,
Value Src,
uint64_t  Size,
unsigned  Align,
bool  isVolatile = false,
MDNode TBAATag = 0,
MDNode TBAAStructTag = 0 
) [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 318 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 
)
CallInst* llvm::IRBuilderBase::CreateMemMove ( Value Dst,
Value Src,
uint64_t  Size,
unsigned  Align,
bool  isVolatile = false,
MDNode TBAATag = 0 
) [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 334 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 
)
CallInst* llvm::IRBuilderBase::CreateMemSet ( Value Ptr,
Value Val,
uint64_t  Size,
unsigned  Align,
bool  isVolatile = false,
MDNode TBAATag = 0 
) [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 306 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 
)
void llvm::IRBuilderBase::DisableDebugLocations ( ) [inline]

Temporarily suppress DebugLocations from being attached to emitted instructions, until the next call to SetCurrentDebugLocation() or EnableDebugLocations(). Use this if you want an instruction to be counted towards the prologue or if there is no useful source location.

Definition at line 125 of file IRBuilder.h.

References getCurrentDebugLocation(), SavedDbgLocation, and SetCurrentDebugLocation().

void llvm::IRBuilderBase::EnableDebugLocations ( ) [inline]

Restore the previously saved DebugLocation.

Definition at line 132 of file IRBuilder.h.

References llvm::DebugLoc::isUnknown(), SavedDbgLocation, and SetCurrentDebugLocation().

LLVMContext& llvm::IRBuilderBase::getContext ( ) const [inline]

Definition at line 78 of file IRBuilder.h.

References Context.

Referenced by foldSelectICmpAnd(), and generateUnsignedDivisionCode().

DebugLoc llvm::IRBuilderBase::getCurrentDebugLocation ( ) const [inline]

Get location information used by debugging information.

Definition at line 138 of file IRBuilder.h.

Referenced by DisableDebugLocations().

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

Type* llvm::IRBuilderBase::getDoubleTy ( ) [inline]

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

Definition at line 278 of file IRBuilder.h.

References Context.

ConstantInt* llvm::IRBuilderBase::getFalse ( ) [inline]

Get the constant value for i1 false.

Definition at line 214 of file IRBuilder.h.

References Context.

Referenced by llvm::UpgradeIntrinsicCall().

Type* llvm::IRBuilderBase::getFloatTy ( ) [inline]

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

Definition at line 273 of file IRBuilder.h.

References Context.

BasicBlock* llvm::IRBuilderBase::GetInsertBlock ( ) const [inline]
BasicBlock::iterator llvm::IRBuilderBase::GetInsertPoint ( ) const [inline]
ConstantInt* llvm::IRBuilderBase::getInt ( const APInt AI) [inline]

Get a constant integer value.

Definition at line 239 of file IRBuilder.h.

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

ConstantInt* llvm::IRBuilderBase::getInt1 ( bool  V) [inline]

Get a constant value representing either true or false.

Definition at line 204 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 224 of file IRBuilder.h.

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

IntegerType* llvm::IRBuilderBase::getInt16Ty ( ) [inline]

Fetch the type representing a 16-bit integer.

Definition at line 258 of file IRBuilder.h.

References Context.

Referenced by getInt16().

IntegerType* llvm::IRBuilderBase::getInt1Ty ( ) [inline]

Fetch the type representing a single bit.

Definition at line 248 of file IRBuilder.h.

References Context.

Referenced by getInt1().

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

Get a constant 64-bit value.

Definition at line 234 of file IRBuilder.h.

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

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

IntegerType* llvm::IRBuilderBase::getInt64Ty ( ) [inline]

Fetch the type representing a 64-bit integer.

Definition at line 268 of file IRBuilder.h.

References Context.

Referenced by CreateLifetimeEnd(), CreateLifetimeStart(), and getInt64().

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

Get a constant 8-bit value.

Definition at line 219 of file IRBuilder.h.

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

Referenced by llvm::UpgradeIntrinsicCall().

PointerType* llvm::IRBuilderBase::getInt8PtrTy ( unsigned  AddrSpace = 0) [inline]
IntegerType* llvm::IRBuilderBase::getInt8Ty ( ) [inline]

Fetch the type representing an 8-bit integer.

Definition at line 253 of file IRBuilder.h.

References Context.

Referenced by llvm::SimplifyFortifiedLibCalls::fold(), and getInt8().

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

Fetch the type representing a pointer to an integer value.

Definition at line 293 of file IRBuilder.h.

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

ConstantInt* llvm::IRBuilderBase::getTrue ( ) [inline]

Get the constant value for i1 true.

Definition at line 209 of file IRBuilder.h.

References Context.

Referenced by generateUnsignedDivisionCode().

Type* llvm::IRBuilderBase::getVoidTy ( ) [inline]

Fetch the type representing void.

Definition at line 283 of file IRBuilder.h.

References Context.

void llvm::IRBuilderBase::restoreIP ( InsertPoint  IP) [inline]
InsertPoint llvm::IRBuilderBase::saveAndClearIP ( ) [inline]

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

Definition at line 177 of file IRBuilder.h.

References ClearInsertionPoint(), GetInsertBlock(), and GetInsertPoint().

InsertPoint llvm::IRBuilderBase::saveIP ( ) const [inline]

Returns the current insert point.

Definition at line 172 of file IRBuilder.h.

References GetInsertBlock(), and GetInsertPoint().

void llvm::IRBuilderBase::SetCurrentDebugLocation ( const DebugLoc L) [inline]
void llvm::IRBuilderBase::SetInsertPoint ( BasicBlock TheBB) [inline]
void llvm::IRBuilderBase::SetInsertPoint ( Instruction I) [inline]

This specifies that created instructions should be inserted before the specified instruction.

Definition at line 89 of file IRBuilder.h.

References BB, llvm::Instruction::getDebugLoc(), llvm::Instruction::getParent(), I, InsertPt, and SetCurrentDebugLocation().

void llvm::IRBuilderBase::SetInsertPoint ( BasicBlock TheBB,
BasicBlock::iterator  IP 
) [inline]

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

Definition at line 97 of file IRBuilder.h.

References BB, and InsertPt.

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 104 of file IRBuilder.h.

References llvm::BasicBlock::getTerminator(), llvm::Use::getUser(), and SetInsertPoint().

void llvm::IRBuilderBase::SetInstDebugLocation ( Instruction I) const [inline]

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

Definition at line 142 of file IRBuilder.h.

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

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


Member Data Documentation

Save the current debug location here while we are suppressing line table entries.

Definition at line 54 of file IRBuilder.h.

Referenced by DisableDebugLocations(), and EnableDebugLocations().


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