LLVM API Documentation

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 Member Functions

 ~CallInst ()
bool isTailCall () const
void setTailCall (bool isTC=true)
 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).
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 1217 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 1301 of file Instructions.h.

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

arg_operands - iteration adapter for range-for loops.

Definition at line 1308 of file Instructions.h.

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

Determine if the call cannot be duplicated.

Definition at line 1405 of file Instructions.h.

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

Referenced by HasNoDuplicateCall().

Return true if the call can return twice.

Definition at line 1369 of file Instructions.h.

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

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

Definition at line 1445 of file Instructions.h.

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

Referenced by classof().

static bool llvm::CallInst::classof ( const Value V) [inline, static]

Methods for support type inquiry through isa, cast, and dyn_cast:

Reimplemented from llvm::Instruction.

Reimplemented in llvm::VACopyInst, llvm::VAEndInst, llvm::VAStartInst, llvm::MemMoveInst, llvm::MemCpyInst, llvm::MemTransferInst, llvm::MemSetInst, llvm::MemIntrinsic, llvm::DbgValueInst, llvm::DbgDeclareInst, llvm::DbgInfoIntrinsic, and llvm::IntrinsicInst.

Definition at line 1448 of file Instructions.h.

References classof().

CallInst * CallInst::clone_impl ( ) const [override, protected, virtual]

Implements llvm::Instruction.

Definition at line 3679 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 1246 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 1252 of file Instructions.h.

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

Definition at line 1256 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 514 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 521 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 456 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 473 of file Instructions.cpp.

References createMalloc().

Provide fast operand accessors.

Determine if the call does not access memory.

Definition at line 1377 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 1393 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 1399 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 1297 of file Instructions.h.

References llvm::User::getOperand().

Referenced by llvm::AddCatchInfo(), addStackMapLiveVars(), checkBinaryFloatSignature(), checkUnaryFloatSignature(), computeArraySize(), 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::MemIntrinsic::getLength(), getLocForWrite(), llvm::DbgValueInst::getOffset(), llvm::MemIntrinsic::getRawDest(), llvm::MemTransferInst::getRawSource(), llvm::VACopyInst::getSrc(), llvm::NVPTXTargetLowering::getTgtMemIntrinsic(), llvm::ARM64TargetLowering::getTgtMemIntrinsic(), llvm::AArch64TargetLowering::getTgtMemIntrinsic(), llvm::ARMTargetLowering::getTgtMemIntrinsic(), llvm::DbgValueInst::getValue(), llvm::MemSetInst::getValue(), llvm::DbgDeclareInst::getVariable(), llvm::DbgValueInst::getVariable(), llvm::MemIntrinsic::getVolatileCst(), isDynamicConstant(), llvm::IntrinsicLowering::LowerIntrinsicCall(), llvm::IntrinsicLowering::LowerToByteSwap(), PerformHeapAllocSRoA(), ReplaceFPIntrinsicWithCall(), tryToMoveFreeBeforeNullTest(), TryToOptimizeStoreOfMallocToGlobal(), llvm::UpgradeIntrinsicCall(), llvm::InstCombiner::visitCallInst(), llvm::InstCombiner::visitFCmpInst(), llvm::InstCombiner::visitFPTrunc(), llvm::InstCombiner::visitFree(), and WriteInstruction().

Definition at line 1314 of file Instructions.h.

References llvm::User::getOperandUse().

getAttributes - Return the parameter attributes for this call.

Definition at line 1328 of file Instructions.h.

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

getCalledValue - Get a pointer to the function that is invoked by this instruction.

Definition at line 1431 of file Instructions.h.

References llvm::User::Op().

Referenced by llvm::ComputeUsesVAFloatArgument(), llvm::ARMTargetLowering::ExpandInlineAsm(), HandleCallsInBlockInlinedThroughInvoke(), shouldConvertUse(), and WriteInstruction().

Definition at line 1432 of file Instructions.h.

References llvm::User::Op().

getCallingConv/setCallingConv - Get or set the calling convention of this function call.

Definition at line 1318 of file Instructions.h.

References llvm::Instruction::getSubclassDataFromInstruction().

Referenced by HandleCallsInBlockInlinedThroughInvoke(), llvm::SelectionDAGBuilder::LowerCallOperands(), and WriteInstruction().

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

Definition at line 1351 of file Instructions.h.

References llvm::AttributeSet::getParamAlignment().

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

Definition at line 1418 of file Instructions.h.

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

Determine whether this call has the given attribute.

Definition at line 1341 of file Instructions.h.

References llvm::Attribute::NoBuiltin.

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

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

Definition at line 1412 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 1440 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 1357 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 1363 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 1385 of file Instructions.h.

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

Referenced by checkBinaryFloatSignature(), and 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 1332 of file Instructions.h.

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

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

setCalledFunction - Set the function called.

Definition at line 1435 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: