LLVM  mainline
Public Member Functions | Static Public Member Functions | Protected Member Functions
llvm::AllocaInst Class Reference

AllocaInst - an instruction to allocate memory on the stack. More...

#include <Instructions.h>

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

List of all members.

Public Member Functions

 AllocaInst (Type *Ty, Value *ArraySize=nullptr, const Twine &Name="", Instruction *InsertBefore=nullptr)
 AllocaInst (Type *Ty, Value *ArraySize, const Twine &Name, BasicBlock *InsertAtEnd)
 AllocaInst (Type *Ty, const Twine &Name, Instruction *InsertBefore=nullptr)
 AllocaInst (Type *Ty, const Twine &Name, BasicBlock *InsertAtEnd)
 AllocaInst (Type *Ty, Value *ArraySize, unsigned Align, const Twine &Name="", Instruction *InsertBefore=nullptr)
 AllocaInst (Type *Ty, Value *ArraySize, unsigned Align, const Twine &Name, BasicBlock *InsertAtEnd)
 ~AllocaInst () override
bool isArrayAllocation () const
 isArrayAllocation - Return true if there is an allocation size parameter to the allocation instruction that is not 1.
const ValuegetArraySize () const
 getArraySize - Get the number of elements allocated.
ValuegetArraySize ()
PointerTypegetType () const
 getType - Overload to return most specific pointer type
TypegetAllocatedType () const
 getAllocatedType - Return the type that is being allocated by the instruction.
void setAllocatedType (Type *Ty)
 for use only in special circumstances that need to generically transform a whole instruction (eg: IR linking and vectorization).
unsigned getAlignment () const
 getAlignment - Return the alignment of the memory that is being allocated by the instruction.
void setAlignment (unsigned Align)
bool isStaticAlloca () const
 isStaticAlloca - Return true if this alloca is in the entry block of the function and is a constant size.
bool isUsedWithInAlloca () const
 Return true if this alloca is used as an inalloca argument to a call.
void setUsedWithInAlloca (bool V)
 Specify whether this alloca is used to represent the arguments to a call.

Static Public Member Functions

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

AllocaInstclone_impl () const override

Detailed Description

AllocaInst - an instruction to allocate memory on the stack.

Definition at line 75 of file Instructions.h.


Constructor & Destructor Documentation

AllocaInst::AllocaInst ( Type Ty,
Value ArraySize = nullptr,
const Twine Name = "",
Instruction InsertBefore = nullptr 
) [explicit]

Definition at line 817 of file Instructions.cpp.

Referenced by clone_impl().

AllocaInst::AllocaInst ( Type Ty,
Value ArraySize,
const Twine Name,
BasicBlock InsertAtEnd 
)

Definition at line 821 of file Instructions.cpp.

AllocaInst::AllocaInst ( Type Ty,
const Twine Name,
Instruction InsertBefore = nullptr 
)

Definition at line 811 of file Instructions.cpp.

AllocaInst::AllocaInst ( Type Ty,
const Twine Name,
BasicBlock InsertAtEnd 
)

Definition at line 814 of file Instructions.cpp.

AllocaInst::AllocaInst ( Type Ty,
Value ArraySize,
unsigned  Align,
const Twine Name = "",
Instruction InsertBefore = nullptr 
)

Definition at line 825 of file Instructions.cpp.

References llvm::Type::isVoidTy(), setAlignment(), and llvm::Value::setName().

AllocaInst::AllocaInst ( Type Ty,
Value ArraySize,
unsigned  Align,
const Twine Name,
BasicBlock InsertAtEnd 
)

Definition at line 835 of file Instructions.cpp.

References llvm::Type::isVoidTy(), setAlignment(), and llvm::Value::setName().

AllocaInst::~AllocaInst ( ) [override]

Definition at line 846 of file Instructions.cpp.


Member Function Documentation

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

Reimplemented from llvm::UnaryInstruction.

Definition at line 151 of file Instructions.h.

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

Referenced by classof().

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

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

Reimplemented from llvm::UnaryInstruction.

Definition at line 154 of file Instructions.h.

References classof().

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

getArraySize - Get the number of elements allocated.

For a simple allocation of a single element, this will return a constant 1 value.

Definition at line 106 of file Instructions.h.

References llvm::User::getOperand().

Referenced by llvm::InlineFunction(), isStaticAlloca(), simplifyAllocaArraySize(), llvm::ObjectSizeOffsetVisitor::visitAllocaInst(), llvm::ObjectSizeOffsetEvaluator::visitAllocaInst(), and llvm::InstCombiner::visitAllocaInst().

Definition at line 107 of file Instructions.h.

References llvm::User::getOperand().

isArrayAllocation - Return true if there is an allocation size parameter to the allocation instruction that is not 1.

Definition at line 858 of file Instructions.cpp.

References llvm::User::getOperand().

Referenced by InlineCallIfPossible(), isArray(), simplifyAllocaArraySize(), llvm::ObjectSizeOffsetVisitor::visitAllocaInst(), llvm::ObjectSizeOffsetEvaluator::visitAllocaInst(), and llvm::InstCombiner::visitAllocaInst().

isStaticAlloca - Return true if this alloca is in the entry block of the function and is a constant size.

If so, the code generator will fold it into the prolog/epilog code, so it is basically free.

Definition at line 867 of file Instructions.cpp.

References llvm::Function::front(), getArraySize(), llvm::Instruction::getParent(), llvm::BasicBlock::getParent(), and isUsedWithInAlloca().

Return true if this alloca is used as an inalloca argument to a call.

Such allocas are never considered static even if they are in the entry block.

Definition at line 139 of file Instructions.h.

References llvm::Instruction::getSubclassDataFromInstruction().

Referenced by clone_impl(), isStaticAlloca(), and WriteInstruction().

void llvm::AllocaInst::setAllocatedType ( Type Ty) [inline]

for use only in special circumstances that need to generically transform a whole instruction (eg: IR linking and vectorization).

Definition at line 121 of file Instructions.h.

Specify whether this alloca is used to represent the arguments to a call.

Definition at line 145 of file Instructions.h.

References llvm::Instruction::getSubclassDataFromInstruction().

Referenced by clone_impl().


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