LLVM API Documentation

Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions
llvm::CallInst Class Reference

#include <Instructions.h>

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

List of all members.

Public Types

enum  TailCallKind { TCK_None = 0, TCK_Tail = 1, TCK_MustTail = 2 }

Public Member Functions

 ~CallInst ()
TailCallKind getTailCallKind () const
bool isTailCall () const
bool isMustTailCall () const
void setTailCall (bool isTC=true)
void setTailCallKind (TailCallKind TCK)
 DECLARE_TRANSPARENT_OPERAND_ACCESSORS (Value)
 Provide fast operand accessors.
unsigned getNumArgOperands () const
ValuegetArgOperand (unsigned i) const
void setArgOperand (unsigned i, Value *v)
iterator_range< op_iteratorarg_operands ()
 arg_operands - iteration adapter for range-for loops.
iterator_range< const_op_iteratorarg_operands () const
 arg_operands - iteration adapter for range-for loops.
const UsegetArgOperandUse (unsigned i) const
 Wrappers for getting the Use of a call argument.
UsegetArgOperandUse (unsigned i)
CallingConv::ID getCallingConv () const
void setCallingConv (CallingConv::ID CC)
const AttributeSetgetAttributes () const
void setAttributes (const AttributeSet &Attrs)
void addAttribute (unsigned i, Attribute::AttrKind attr)
 addAttribute - adds the attribute to the list of attributes.
void removeAttribute (unsigned i, Attribute attr)
 removeAttribute - removes the attribute from the list of attributes.
bool hasFnAttr (Attribute::AttrKind A) const
 Determine whether this call has the given attribute.
bool paramHasAttr (unsigned i, Attribute::AttrKind A) const
 Determine whether the call or the callee has the given attributes.
unsigned getParamAlignment (unsigned i) const
 Extract the alignment for a call or parameter (0=unknown).
uint64_t getDereferenceableBytes (unsigned i) const
 Extract the number of dereferenceable bytes for a call or parameter (0=unknown).
bool isNoBuiltin () const
 Return true if the call should not be treated as a call to a builtin.
bool isNoInline () const
 Return true if the call should not be inlined.
void setIsNoInline ()
bool canReturnTwice () const
 Return true if the call can return twice.
void setCanReturnTwice ()
bool doesNotAccessMemory () const
 Determine if the call does not access memory.
void setDoesNotAccessMemory ()
bool onlyReadsMemory () const
 Determine if the call does not access or only reads memory.
void setOnlyReadsMemory ()
bool doesNotReturn () const
 Determine if the call cannot return.
void setDoesNotReturn ()
bool doesNotThrow () const
 Determine if the call cannot unwind.
void setDoesNotThrow ()
bool cannotDuplicate () const
 Determine if the call cannot be duplicated.
void setCannotDuplicate ()
bool hasStructRetAttr () const
 Determine if the call returns a structure through first pointer argument.
bool hasByValArgument () const
 Determine if any call argument is an aggregate passed by value.
FunctiongetCalledFunction () const
const ValuegetCalledValue () const
ValuegetCalledValue ()
void setCalledFunction (Value *Fn)
 setCalledFunction - Set the function called.
bool isInlineAsm () const
 isInlineAsm - Check if this call is an inline asm statement.

Static Public Member Functions

static CallInstCreate (Value *Func, ArrayRef< Value * > Args, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
static CallInstCreate (Value *Func, ArrayRef< Value * > Args, const Twine &NameStr, BasicBlock *InsertAtEnd)
static CallInstCreate (Value *F, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
static CallInstCreate (Value *F, const Twine &NameStr, BasicBlock *InsertAtEnd)
static InstructionCreateMalloc (Instruction *InsertBefore, Type *IntPtrTy, Type *AllocTy, Value *AllocSize, Value *ArraySize=nullptr, Function *MallocF=nullptr, const Twine &Name="")
static InstructionCreateMalloc (BasicBlock *InsertAtEnd, Type *IntPtrTy, Type *AllocTy, Value *AllocSize, Value *ArraySize=nullptr, Function *MallocF=nullptr, const Twine &Name="")
static InstructionCreateFree (Value *Source, Instruction *InsertBefore)
 CreateFree - Generate the IR for a call to the builtin free function.
static InstructionCreateFree (Value *Source, BasicBlock *InsertAtEnd)
static bool classof (const Instruction *I)
static bool classof (const Value *V)
 Methods for support type inquiry through isa, cast, and dyn_cast:

Protected Member Functions

CallInstclone_impl () const override

Detailed Description

CallInst - This class represents a function call, abstracting a target machine's calling convention. This class uses low bit of the SubClassData field to indicate whether or not this is a tail call. The rest of the bits hold the calling convention of the call.

Definition at line 1241 of file Instructions.h.


Member Enumeration Documentation

Enumerator:
TCK_None 
TCK_Tail 
TCK_MustTail 

Definition at line 1307 of file Instructions.h.


Constructor & Destructor Documentation

Definition at line 263 of file Instructions.cpp.


Member Function Documentation

arg_operands - iteration adapter for range-for loops.

Definition at line 1339 of file Instructions.h.

References llvm::User::op_begin(), and llvm::User::op_end().

Referenced by llvm::UpgradeIntrinsicCall().

arg_operands - iteration adapter for range-for loops.

Definition at line 1346 of file Instructions.h.

References llvm::User::op_begin(), and llvm::User::op_end().

Determine if the call cannot be duplicated.

Definition at line 1449 of file Instructions.h.

References hasFnAttr(), and llvm::Attribute::NoDuplicate.

Referenced by HasNoDuplicateCall().

Return true if the call can return twice.

Definition at line 1413 of file Instructions.h.

References hasFnAttr(), and llvm::Attribute::ReturnsTwice.

static bool llvm::CallInst::classof ( const Instruction I) [inline, static]

Definition at line 1489 of file Instructions.h.

References llvm::Call, and llvm::Instruction::getOpcode().

Referenced by classof().

static bool llvm::CallInst::classof ( const Value V) [inline, static]
CallInst * CallInst::clone_impl ( ) const [override, protected, virtual]

Implements llvm::Instruction.

Definition at line 3749 of file Instructions.cpp.

References llvm::User::getNumOperands().

static CallInst* llvm::CallInst::Create ( Value Func,
ArrayRef< Value * >  Args,
const Twine NameStr = "",
Instruction InsertBefore = nullptr 
) [inline, static]
static CallInst* llvm::CallInst::Create ( Value Func,
ArrayRef< Value * >  Args,
const Twine NameStr,
BasicBlock InsertAtEnd 
) [inline, static]

Definition at line 1270 of file Instructions.h.

References llvm::ArrayRef< T >::size().

static CallInst* llvm::CallInst::Create ( Value F,
const Twine NameStr = "",
Instruction InsertBefore = nullptr 
) [inline, static]

Definition at line 1276 of file Instructions.h.

static CallInst* llvm::CallInst::Create ( Value F,
const Twine NameStr,
BasicBlock InsertAtEnd 
) [inline, static]

Definition at line 1280 of file Instructions.h.

Instruction * CallInst::CreateFree ( Value Source,
Instruction InsertBefore 
) [static]

CreateFree - Generate the IR for a call to the builtin free function.

Definition at line 515 of file Instructions.cpp.

References createFree().

Referenced by LLVMBuildFree(), and PerformHeapAllocSRoA().

Instruction * CallInst::CreateFree ( Value Source,
BasicBlock InsertAtEnd 
) [static]

CreateFree - Generate the IR for a call to the builtin free function. Note: This function does not add the call to the basic block, that is the responsibility of the caller.

Definition at line 522 of file Instructions.cpp.

References createFree().

Instruction * CallInst::CreateMalloc ( Instruction InsertBefore,
Type IntPtrTy,
Type AllocTy,
Value AllocSize,
Value ArraySize = nullptr,
Function MallocF = nullptr,
const Twine Name = "" 
) [static]

CreateMalloc - Generate the IR for a call to malloc: 1. Compute the malloc call's argument as the specified type's size, possibly multiplied by the array size if the array size is not constant 1. 2. Call malloc with that argument. 3. Bitcast the result of the malloc call to the specified type.

Definition at line 457 of file Instructions.cpp.

References createMalloc().

Referenced by LLVMBuildArrayMalloc(), LLVMBuildMalloc(), PerformHeapAllocSRoA(), and TryToOptimizeStoreOfMallocToGlobal().

Instruction * CallInst::CreateMalloc ( BasicBlock InsertAtEnd,
Type IntPtrTy,
Type AllocTy,
Value AllocSize,
Value ArraySize = nullptr,
Function MallocF = nullptr,
const Twine Name = "" 
) [static]

CreateMalloc - Generate the IR for a call to malloc: 1. Compute the malloc call's argument as the specified type's size, possibly multiplied by the array size if the array size is not constant 1. 2. Call malloc with that argument. 3. Bitcast the result of the malloc call to the specified type. Note: This function does not add the bitcast to the basic block, that is the responsibility of the caller.

Definition at line 474 of file Instructions.cpp.

References createMalloc().

Provide fast operand accessors.

Determine if the call does not access memory.

Definition at line 1421 of file Instructions.h.

References hasFnAttr(), and llvm::Attribute::ReadNone.

Referenced by onlyReadsMemory().

bool llvm::CallInst::doesNotReturn ( ) const [inline]

Determine if the call cannot return.

Definition at line 1437 of file Instructions.h.

References hasFnAttr(), and llvm::Attribute::NoReturn.

bool llvm::CallInst::doesNotThrow ( ) const [inline]

Determine if the call cannot unwind.

Definition at line 1443 of file Instructions.h.

References hasFnAttr(), and llvm::Attribute::NoUnwind.

Referenced by HandleCallsInBlockInlinedThroughInvoke(), and llvm::InstCombiner::visitCallInst().

getArgOperand/setArgOperand - Return/set the i-th call argument.

Definition at line 1335 of file Instructions.h.

References llvm::User::getOperand().

Referenced by llvm::AddCatchInfo(), llvm::checkBinaryFloatSignature(), llvm::checkUnaryFloatSignature(), computeArraySize(), computeKnownBitsFromAssume(), llvm::ComputeUsesVAFloatArgument(), detectLog2OfHalf(), llvm::SimplifyFortifiedLibCalls::fold(), llvm::DbgDeclareInst::getAddress(), llvm::MemIntrinsic::getAlignmentCst(), llvm::MemIntrinsic::getAlignmentType(), llvm::VAStartInst::getArgList(), llvm::VAEndInst::getArgList(), llvm::VACopyInst::getDest(), llvm::DbgDeclareInst::getExpression(), llvm::DbgValueInst::getExpression(), llvm::InstrProfIncrementInst::getHash(), llvm::InstrProfIncrementInst::getIndex(), llvm::MemIntrinsic::getLength(), getLocForWrite(), llvm::InstrProfIncrementInst::getName(), llvm::InstrProfIncrementInst::getNumCounters(), llvm::DbgValueInst::getOffset(), llvm::MemIntrinsic::getRawDest(), llvm::MemTransferInst::getRawSource(), llvm::VACopyInst::getSrc(), llvm::AArch64TargetLowering::getTgtMemIntrinsic(), llvm::ARMTargetLowering::getTgtMemIntrinsic(), llvm::NVPTXTargetLowering::getTgtMemIntrinsic(), llvm::PPCTargetLowering::getTgtMemIntrinsic(), llvm::DbgValueInst::getValue(), llvm::MemSetInst::getValue(), llvm::DbgDeclareInst::getVariable(), llvm::DbgValueInst::getVariable(), llvm::MemIntrinsic::getVolatileCst(), isDynamicConstant(), isFortifiedCallFoldable(), isReportingError(), llvm::IntrinsicLowering::LowerIntrinsicCall(), llvm::IntrinsicLowering::LowerToByteSwap(), PerformHeapAllocSRoA(), ReplaceFPIntrinsicWithCall(), llvm::FastISel::selectIntrinsicCall(), llvm::FastISel::selectPatchpoint(), tryToMoveFreeBeforeNullTest(), TryToOptimizeStoreOfMallocToGlobal(), llvm::UpgradeIntrinsicCall(), llvm::InstCombiner::visitCallInst(), llvm::InstCombiner::visitFCmpInst(), llvm::InstCombiner::visitFPTrunc(), llvm::InstCombiner::visitFree(), and WriteInstruction().

Definition at line 1352 of file Instructions.h.

References llvm::User::getOperandUse().

getAttributes - Return the parameter attributes for this call.

Definition at line 1366 of file Instructions.h.

Referenced by addAttribute(), HandleCallsInBlockInlinedThroughInvoke(), lowerCallFromStatepoint(), removeAttribute(), and WriteInstruction().

Definition at line 1476 of file Instructions.h.

References llvm::User::Op().

uint64_t llvm::CallInst::getDereferenceableBytes ( unsigned  i) const [inline]

Extract the number of dereferenceable bytes for a call or parameter (0=unknown).

Definition at line 1395 of file Instructions.h.

References llvm::AttributeSet::getDereferenceableBytes().

Extract the alignment for a call or parameter (0=unknown).

Definition at line 1389 of file Instructions.h.

References llvm::AttributeSet::getParamAlignment().

Determine if any call argument is an aggregate passed by value.

Definition at line 1462 of file Instructions.h.

References llvm::Attribute::ByVal, and llvm::AttributeSet::hasAttrSomewhere().

Determine whether this call has the given attribute.

Definition at line 1379 of file Instructions.h.

References llvm::Attribute::NoBuiltin.

Referenced by cannotDuplicate(), canReturnTwice(), doesNotAccessMemory(), doesNotReturn(), doesNotThrow(), isNoInline(), isTrigLibCall(), and onlyReadsMemory().

Determine if the call returns a structure through first pointer argument.

Definition at line 1456 of file Instructions.h.

References paramHasAttr(), and llvm::Attribute::StructRet.

bool llvm::CallInst::isInlineAsm ( ) const [inline]

isInlineAsm - Check if this call is an inline asm statement.

Definition at line 1484 of file Instructions.h.

References llvm::User::Op().

bool llvm::CallInst::isNoBuiltin ( ) const [inline]

Return true if the call should not be treated as a call to a builtin.

Definition at line 1401 of file Instructions.h.

References llvm::Attribute::Builtin, and llvm::Attribute::NoBuiltin.

Referenced by llvm::LibCallSimplifier::optimizeCall().

bool llvm::CallInst::isNoInline ( ) const [inline]

Return true if the call should not be inlined.

Definition at line 1407 of file Instructions.h.

References hasFnAttr(), and llvm::Attribute::NoInline.

bool llvm::CallInst::isTailCall ( ) const [inline]

Determine if the call does not access or only reads memory.

Definition at line 1429 of file Instructions.h.

References doesNotAccessMemory(), hasFnAttr(), and llvm::Attribute::ReadOnly.

Referenced by llvm::checkBinaryFloatSignature(), and llvm::checkUnaryFloatSignature().

Determine whether the call or the callee has the given attributes.

Definition at line 357 of file Instructions.cpp.

References F(), getCalledFunction(), and llvm::AttributeSet::hasAttribute().

Referenced by hasStructRetAttr().

removeAttribute - removes the attribute from the list of attributes.

Definition at line 340 of file Instructions.cpp.

References getAttributes(), llvm::Value::getContext(), llvm::AttributeSet::removeAttributes(), and setAttributes().

void llvm::CallInst::setArgOperand ( unsigned  i,
Value v 
) [inline]
void llvm::CallInst::setAttributes ( const AttributeSet Attrs) [inline]

setAttributes - Set the parameter attributes for this call.

Definition at line 1370 of file Instructions.h.

Referenced by addAttribute(), llvm::EmitBinaryFloatFnCall(), llvm::EmitUnaryFloatFnCall(), lowerCallFromStatepoint(), and removeAttribute().

void llvm::CallInst::setCalledFunction ( Value Fn) [inline]

setCalledFunction - Set the function called.

Definition at line 1479 of file Instructions.h.

References llvm::User::Op().

Referenced by llvm::InstCombiner::visitCallInst().

void llvm::CallInst::setIsNoInline ( ) [inline]
void llvm::CallInst::setTailCall ( bool  isTC = true) [inline]

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