LLVM API Documentation

llvm::GetElementPtrInst Class Reference

#include <Instructions.h>

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

List of all members.

Public Member Functions

virtual GetElementPtrInst * clone (LLVMContext &Context) const
 DECLARE_TRANSPARENT_OPERAND_ACCESSORS (Value)
 Transparently provide more efficient getOperand methods.
const PointerType * getType () const
op_iterator idx_begin ()
const_op_iterator idx_begin () const
op_iterator idx_end ()
const_op_iterator idx_end () const
Value * getPointerOperand ()
const Value * getPointerOperand () const
const PointerType * getPointerOperandType () const
unsigned getNumIndices () const
bool hasIndices () const
bool hasAllZeroIndices () const
bool hasAllConstantIndices () const

Static Public Member Functions

template<typename InputIterator>
static GetElementPtrInst * Create (Value *Ptr, InputIterator IdxBegin, InputIterator IdxEnd, const Twine &NameStr="", Instruction *InsertBefore=0)
template<typename InputIterator>
static GetElementPtrInst * Create (Value *Ptr, InputIterator IdxBegin, InputIterator IdxEnd, const Twine &NameStr, BasicBlock *InsertAtEnd)
static GetElementPtrInst * Create (Value *Ptr, Value *Idx, const Twine &NameStr="", Instruction *InsertBefore=0)
static GetElementPtrInst * Create (Value *Ptr, Value *Idx, const Twine &NameStr, BasicBlock *InsertAtEnd)
template<typename InputIterator>
static GetElementPtrInst * CreateInBounds (Value *Ptr, InputIterator IdxBegin, InputIterator IdxEnd, const Twine &NameStr="", Instruction *InsertBefore=0)
template<typename InputIterator>
static GetElementPtrInst * CreateInBounds (Value *Ptr, InputIterator IdxBegin, InputIterator IdxEnd, const Twine &NameStr, BasicBlock *InsertAtEnd)
static GetElementPtrInst * CreateInBounds (Value *Ptr, Value *Idx, const Twine &NameStr="", Instruction *InsertBefore=0)
static GetElementPtrInst * CreateInBounds (Value *Ptr, Value *Idx, const Twine &NameStr, BasicBlock *InsertAtEnd)
template<typename InputIterator>
static const Type * getIndexedType (const Type *Ptr, InputIterator IdxBegin, InputIterator IdxEnd)
static const Type * getIndexedType (const Type *Ptr, Value *const *Idx, unsigned NumIdx)
static const Type * getIndexedType (const Type *Ptr, uint64_t const *Idx, unsigned NumIdx)
static const Type * getIndexedType (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 375 of file Instructions.h.


Member Function Documentation

template<typename InputIterator>
static GetElementPtrInst* llvm::GetElementPtrInst::Create ( Value *  Ptr,
InputIterator  IdxBegin,
InputIterator  IdxEnd,
const Twine &  NameStr = "",
Instruction *  InsertBefore = 0 
) [inline, static]

template<typename InputIterator>
static GetElementPtrInst* llvm::GetElementPtrInst::Create ( Value *  Ptr,
InputIterator  IdxBegin,
InputIterator  IdxEnd,
const Twine &  NameStr,
BasicBlock *  InsertAtEnd 
) [inline, static]

Definition at line 456 of file Instructions.h.

static GetElementPtrInst* llvm::GetElementPtrInst::Create ( Value *  Ptr,
Value *  Idx,
const Twine &  NameStr = "",
Instruction *  InsertBefore = 0 
) [inline, static]

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

Definition at line 468 of file Instructions.h.

static GetElementPtrInst* llvm::GetElementPtrInst::Create ( Value *  Ptr,
Value *  Idx,
const Twine &  NameStr,
BasicBlock *  InsertAtEnd 
) [inline, static]

Definition at line 473 of file Instructions.h.

template<typename InputIterator>
static GetElementPtrInst* llvm::GetElementPtrInst::CreateInBounds ( Value *  Ptr,
InputIterator  IdxBegin,
InputIterator  IdxEnd,
const Twine &  NameStr = "",
Instruction *  InsertBefore = 0 
) [inline, static]

template<typename InputIterator>
static GetElementPtrInst* llvm::GetElementPtrInst::CreateInBounds ( Value *  Ptr,
InputIterator  IdxBegin,
InputIterator  IdxEnd,
const Twine &  NameStr,
BasicBlock *  InsertAtEnd 
) [inline, static]

Definition at line 492 of file Instructions.h.

References Create().

static GetElementPtrInst* llvm::GetElementPtrInst::CreateInBounds ( Value *  Ptr,
Value *  Idx,
const Twine &  NameStr = "",
Instruction *  InsertBefore = 0 
) [inline, static]

Definition at line 502 of file Instructions.h.

References Create().

static GetElementPtrInst* llvm::GetElementPtrInst::CreateInBounds ( Value *  Ptr,
Value *  Idx,
const Twine &  NameStr,
BasicBlock *  InsertAtEnd 
) [inline, static]

Definition at line 509 of file Instructions.h.

References Create().

GetElementPtrInst * GetElementPtrInst::clone ( LLVMContext &  Context  )  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 2865 of file Instructions.cpp.

References llvm::User::getNumOperands(), and llvm::Value::SubclassOptionalData.

llvm::GetElementPtrInst::DECLARE_TRANSPARENT_OPERAND_ACCESSORS ( Value   ) 

Transparently provide more efficient getOperand methods.

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

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

Reimplemented from llvm::Value.

Definition at line 523 of file Instructions.h.

References llvm::Intrinsic::getType().

template<typename InputIterator>
static const Type* llvm::GetElementPtrInst::getIndexedType ( const Type *  Ptr,
InputIterator  IdxBegin,
InputIterator  IdxEnd 
) [inline, static]

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

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

Definition at line 534 of file Instructions.h.

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

Definition at line 1113 of file Instructions.cpp.

References getIndexedTypeInternal().

const Type * GetElementPtrInst::getIndexedType ( const Type *  Ptr,
uint64_t const *  Idx,
unsigned  NumIdx 
) [static]

Definition at line 1119 of file Instructions.cpp.

References getIndexedTypeInternal().

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

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

Definition at line 550 of file Instructions.h.

References llvm::User::op_begin().

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

Definition at line 551 of file Instructions.h.

References llvm::User::op_begin().

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

Definition at line 552 of file Instructions.h.

References llvm::User::op_end().

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

Definition at line 553 of file Instructions.h.

References llvm::User::op_end().

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

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

Definition at line 558 of file Instructions.h.

References llvm::User::getOperand().

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

Definition at line 561 of file Instructions.h.

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

getPointerOperandType - Method to return the pointer operand as a PointerType.

Definition at line 567 of file Instructions.h.

References getPointerOperand(), and llvm::Value::getType().

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

Definition at line 572 of file Instructions.h.

References llvm::User::getNumOperands().

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

Definition at line 576 of file Instructions.h.

References llvm::User::getNumOperands().

bool GetElementPtrInst::hasAllZeroIndices (  )  const

hasAllZeroIndices - Return true if all of the indices of this GEP are zeros. If so, the result pointer and the first operand have the same value, just potentially different types.

hasAllZeroIndices - Return true if all of the indices of this GEP are zeros. If so, the result pointer and the first operand have the same value, just potentially different types.

Definition at line 1139 of file Instructions.cpp.

References llvm::User::getNumOperands(), and llvm::User::getOperand().

Referenced by equals(), and isOnlyCopiedFromConstantGlobal().

bool GetElementPtrInst::hasAllConstantIndices (  )  const

hasAllConstantIndices - Return true if all of the indices of this GEP are constant integers. If so, the result pointer and the first operand have a constant offset between them.

hasAllConstantIndices - Return true if all of the indices of this GEP are constant integers. If so, the result pointer and the first operand have a constant offset between them.

Definition at line 1153 of file Instructions.cpp.

References llvm::User::getNumOperands(), and llvm::User::getOperand().

Referenced by isSafeAndProfitableToSinkLoad().

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

Definition at line 591 of file Instructions.h.

Referenced by classof().

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

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

Reimplemented from llvm::Instruction.

Definition at line 592 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 595 of file Instructions.h.

References classof().


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