LLVM API Documentation

llvm::GetElementPtrInst Class Reference

#include <Instructions.h>

Inheritance diagram for llvm::GetElementPtrInst:

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

Collaboration graph
[legend]
List of all members.

Public Member Functions

 GetElementPtrInst (Value *Ptr, const std::vector< Value * > &Idx, const std::string &Name="", Instruction *InsertBefore=0)
 GetElementPtrInst (Value *Ptr, const std::vector< Value * > &Idx, const std::string &Name, BasicBlock *InsertAtEnd)
 GetElementPtrInst (Value *Ptr, Value *Idx, const std::string &Name="", Instruction *InsertBefore=0)
 GetElementPtrInst (Value *Ptr, Value *Idx, const std::string &Name, BasicBlock *InsertAtEnd)
 GetElementPtrInst (Value *Ptr, Value *Idx0, Value *Idx1, const std::string &Name="", Instruction *InsertBefore=0)
 GetElementPtrInst (Value *Ptr, Value *Idx0, Value *Idx1, const std::string &Name, BasicBlock *InsertAtEnd)
 ~GetElementPtrInst ()
virtual GetElementPtrInstclone () const
const PointerTypegetType () const
op_iterator idx_begin ()
const_op_iterator idx_begin () const
op_iterator idx_end ()
const_op_iterator idx_end () const
ValuegetPointerOperand ()
const ValuegetPointerOperand () const
unsigned getNumIndices () const
bool hasIndices () const

Static Public Member Functions

static const TypegetIndexedType (const Type *Ptr, const std::vector< Value * > &Indices, bool AllowStructLeaf=false)
static const TypegetIndexedType (const Type *Ptr, Value *Idx0, Value *Idx1, bool AllowStructLeaf=false)
static const TypegetIndexedType (const Type *Ptr, Value *Idx)
static unsigned getPointerOperandIndex ()
static bool classof (const GetElementPtrInst *)
static bool classof (const Instruction *I)
 Methods for support type inquiry through isa, cast, and dyn_cast:.
static bool classof (const Value *V)

Detailed Description

GetElementPtrInst - an instruction for type-safe pointer arithmetic to access elements of arrays and structs

Definition at line 331 of file Instructions.h.


Constructor & Destructor Documentation

GetElementPtrInst::GetElementPtrInst ( Value Ptr,
const std::vector< Value * > &  Idx,
const std::string &  Name = "",
Instruction InsertBefore = 0 
)

Constructors - Create a getelementptr instruction with a base pointer an list of indices. The first ctor can optionally insert before an existing instruction, the second appends the new instruction to the specified BasicBlock.

Definition at line 711 of file Instructions.cpp.

GetElementPtrInst::GetElementPtrInst ( Value Ptr,
const std::vector< Value * > &  Idx,
const std::string &  Name,
BasicBlock InsertAtEnd 
)

Definition at line 719 of file Instructions.cpp.

GetElementPtrInst::GetElementPtrInst ( Value Ptr,
Value Idx,
const std::string &  Name = "",
Instruction InsertBefore = 0 
)

Constructors - These two constructors are convenience methods because one and two index getelementptr instructions are so common.

Definition at line 727 of file Instructions.cpp.

References Idx.

GetElementPtrInst::GetElementPtrInst ( Value Ptr,
Value Idx,
const std::string &  Name,
BasicBlock InsertAtEnd 
)

Definition at line 734 of file Instructions.cpp.

References Idx.

GetElementPtrInst::GetElementPtrInst ( Value Ptr,
Value Idx0,
Value Idx1,
const std::string &  Name = "",
Instruction InsertBefore = 0 
)

Definition at line 741 of file Instructions.cpp.

GetElementPtrInst::GetElementPtrInst ( Value Ptr,
Value Idx0,
Value Idx1,
const std::string &  Name,
BasicBlock InsertAtEnd 
)

Definition at line 749 of file Instructions.cpp.

GetElementPtrInst::~GetElementPtrInst (  ) 

Definition at line 757 of file Instructions.cpp.

References llvm::User::OperandList.


Member Function Documentation

GetElementPtrInst * GetElementPtrInst::clone (  )  const [virtual]

clone() - Create a copy of 'this' instruction that is identical in all ways except the following: The instruction has no parent The instruction has no name

Implements llvm::Instruction.

Definition at line 1309 of file Instructions.cpp.

const PointerType* llvm::GetElementPtrInst::getType (  )  const [inline]

All values are typed, get the type of this value.

Reimplemented from llvm::Value.

Definition at line 368 of file Instructions.h.

References llvm::Value::getType().

Referenced by llvm::ExpressionConvertibleToType(), OptimizeGEPExpression(), and ReplaceUsesOfGEPInst().

const Type * GetElementPtrInst::getIndexedType ( const Type Ptr,
const std::vector< Value * > &  Indices,
bool  AllowStructLeaf = false 
) [static]

getIndexedType - Returns the type of the element that would be loaded with a load instruction with the specified parameters.

A null type is returned if the indices are invalid for the specified pointer type.

Definition at line 767 of file Instructions.cpp.

References llvm::Type::getForwardedType(), and Ty.

Referenced by llvm::ConstantFoldGetElementPtr(), llvm::ConvertExpressionToType(), llvm::ExpressionConvertibleToType(), llvm::ConstantExpr::getGetElementPtr(), llvm::ConstantExpr::getGetElementPtrTy(), and llvm::BytecodeReader::ParseInstruction().

const Type * GetElementPtrInst::getIndexedType ( const Type Ptr,
Value Idx0,
Value Idx1,
bool  AllowStructLeaf = false 
) [static]

Definition at line 804 of file Instructions.cpp.

References llvm::SequentialType::getElementType(), llvm::CompositeType::getTypeAtIndex(), llvm::CompositeType::indexValid(), llvm::SequentialType::indexValid(), and llvm::Type::isFirstClassType().

const Type * GetElementPtrInst::getIndexedType ( const Type Ptr,
Value Idx 
) [static]

Definition at line 822 of file Instructions.cpp.

References llvm::SequentialType::getElementType(), Idx, and llvm::SequentialType::indexValid().

op_iterator llvm::GetElementPtrInst::idx_begin (  )  [inline]

Definition at line 385 of file Instructions.h.

References llvm::User::op_begin().

Referenced by llvm::ConvertExpressionToType(), and llvm::ExpressionConvertibleToType().

const_op_iterator llvm::GetElementPtrInst::idx_begin (  )  const [inline]

Definition at line 386 of file Instructions.h.

References llvm::User::op_begin().

op_iterator llvm::GetElementPtrInst::idx_end (  )  [inline]

Definition at line 387 of file Instructions.h.

References llvm::User::op_end().

Referenced by llvm::ConvertExpressionToType(), and llvm::ExpressionConvertibleToType().

const_op_iterator llvm::GetElementPtrInst::idx_end (  )  const [inline]

Definition at line 388 of file Instructions.h.

References llvm::User::op_end().

Value* llvm::GetElementPtrInst::getPointerOperand (  )  [inline]

Definition at line 390 of file Instructions.h.

References llvm::User::getOperand().

Referenced by llvm::ConvertExpressionToType(), llvm::ExpressionConvertibleToType(), and llvm::Interpreter::visitGetElementPtrInst().

const Value* llvm::GetElementPtrInst::getPointerOperand (  )  const [inline]

Definition at line 393 of file Instructions.h.

References llvm::User::getOperand().

static unsigned llvm::GetElementPtrInst::getPointerOperandIndex (  )  [inline, static]

Definition at line 396 of file Instructions.h.

References U.

unsigned llvm::GetElementPtrInst::getNumIndices (  )  const [inline]

Definition at line 400 of file Instructions.h.

References llvm::User::getNumOperands().

bool llvm::GetElementPtrInst::hasIndices (  )  const [inline]

Definition at line 404 of file Instructions.h.

References llvm::User::getNumOperands().

static bool llvm::GetElementPtrInst::classof ( const GetElementPtrInst  )  [inline, static]

Definition at line 409 of file Instructions.h.

Referenced by classof().

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

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

Reimplemented from llvm::Instruction.

Definition at line 410 of file Instructions.h.

References llvm::Instruction::getOpcode().

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

Reimplemented from llvm::Instruction.

Definition at line 413 of file Instructions.h.

References classof(), and V.


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