LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Member Functions | Protected Attributes | List of all members
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]

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...
 
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. 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...
 
TypegetCurrentFunctionReturnType () 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...
 
MDNodegetDefaultFPMathTag () 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...
 
ValueCreateGlobalString (StringRef Str, const Twine &Name="")
 Make a new global variable with initializer type i8*. More...
 
ConstantIntgetInt1 (bool V)
 Get a constant value representing either true or false. More...
 
ConstantIntgetTrue ()
 Get the constant value for i1 true. More...
 
ConstantIntgetFalse ()
 Get the constant value for i1 false. More...
 
ConstantIntgetInt8 (uint8_t C)
 Get a constant 8-bit value. More...
 
ConstantIntgetInt16 (uint16_t C)
 Get a constant 16-bit value. More...
 
ConstantIntgetInt32 (uint32_t C)
 Get a constant 32-bit value. More...
 
ConstantIntgetInt64 (uint64_t C)
 Get a constant 64-bit value. More...
 
ConstantIntgetInt (const APInt &AI)
 Get a constant integer value. More...
 
IntegerTypegetInt1Ty ()
 Fetch the type representing a single bit. More...
 
IntegerTypegetInt8Ty ()
 Fetch the type representing an 8-bit integer. More...
 
IntegerTypegetInt16Ty ()
 Fetch the type representing a 16-bit integer. More...
 
IntegerTypegetInt32Ty ()
 Fetch the type representing a 32-bit integer. More...
 
IntegerTypegetInt64Ty ()
 Fetch the type representing a 64-bit integer. More...
 
TypegetFloatTy ()
 Fetch the type representing a 32-bit floating point value. More...
 
TypegetDoubleTy ()
 Fetch the type representing a 64-bit floating point value. More...
 
TypegetVoidTy ()
 Fetch the type representing void. More...
 
PointerTypegetInt8PtrTy (unsigned AddrSpace=0)
 Fetch the type representing a pointer to an 8-bit integer value. More...
 
IntegerTypegetIntPtrTy (const DataLayout *DL, unsigned AddrSpace=0)
 Fetch the type representing a pointer to an integer value. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
CallInstCreateLifetimeEnd (Value *Ptr, ConstantInt *Size=0)
 Create a lifetime.end intrinsic. More...
 

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 = 0 
)
inline

Definition at line 61 of file IRBuilder.h.

References ClearInsertionPoint().

Member Function Documentation

void llvm::IRBuilderBase::clearFastMathFlags ( )
inline

Clear the fast-math flags.

Definition at line 183 of file IRBuilder.h.

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

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, and InsertPt.

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 
)
CallInst * IRBuilderBase::CreateLifetimeStart ( Value Ptr,
ConstantInt Size = 0 
)
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 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 
)
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 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 
)
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 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 
)
LLVMContext& llvm::IRBuilderBase::getContext ( ) const
inline

Definition at line 79 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 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().

MDNode* llvm::IRBuilderBase::getDefaultFPMathTag ( ) const
inline

Get the floating point math metadata being used.

Definition at line 177 of file IRBuilder.h.

References DefaultFPMathTag.

Type* llvm::IRBuilderBase::getDoubleTy ( )
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().

ConstantInt* llvm::IRBuilderBase::getFalse ( )
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().

FastMathFlags llvm::IRBuilderBase::getFastMathFlags ( ) const
inline

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

Definition at line 180 of file IRBuilder.h.

References FMF.

Type* llvm::IRBuilderBase::getFloatTy ( )
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().

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 286 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 251 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 271 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 305 of file IRBuilder.h.

References Context, and llvm::Type::getInt16Ty().

Referenced by getInt16().

IntegerType* llvm::IRBuilderBase::getInt1Ty ( )
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().

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

References Context, and llvm::Type::getInt64Ty().

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

ConstantInt* llvm::IRBuilderBase::getInt8 ( uint8_t  C)
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().

PointerType* llvm::IRBuilderBase::getInt8PtrTy ( unsigned  AddrSpace = 0)
inline
IntegerType* llvm::IRBuilderBase::getInt8Ty ( )
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().

IntegerType* llvm::IRBuilderBase::getIntPtrTy ( const DataLayout DL,
unsigned  AddrSpace = 0 
)
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().

ConstantInt* llvm::IRBuilderBase::getTrue ( )
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().

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

Fetch the type representing void.

Definition at line 330 of file IRBuilder.h.

References Context, and llvm::Type::getVoidTy().

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

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

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

Returns the current insert point.

Definition at line 157 of file IRBuilder.h.

References GetInsertBlock(), and GetInsertPoint().

void llvm::IRBuilderBase::SetCurrentDebugLocation ( const DebugLoc L)
inline
void llvm::IRBuilderBase::SetDefaultFPMathTag ( MDNode FPMathTag)
inline

Set the floating point math metadata to be used.

Definition at line 186 of file IRBuilder.h.

References DefaultFPMathTag.

void llvm::IRBuilderBase::SetFastMathFlags ( FastMathFlags  NewFMF)
inline

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

Definition at line 189 of file IRBuilder.h.

References FMF.

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

References BB, llvm::BasicBlock::end(), 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 99 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 106 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 127 of file IRBuilder.h.

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

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

Member Data Documentation

BasicBlock* llvm::IRBuilderBase::BB
protected
LLVMContext& llvm::IRBuilderBase::Context
protected
MDNode* llvm::IRBuilderBase::DefaultFPMathTag
protected
FastMathFlags llvm::IRBuilderBase::FMF
protected
BasicBlock::iterator llvm::IRBuilderBase::InsertPt
protected

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