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 () 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 std::string &NameStr="", Instruction *InsertBefore=0)
template<typename InputIterator>
static GetElementPtrInst * Create (Value *Ptr, InputIterator IdxBegin, InputIterator IdxEnd, const std::string &NameStr, BasicBlock *InsertAtEnd)
static GetElementPtrInst * Create (Value *Ptr, Value *Idx, const std::string &NameStr="", Instruction *InsertBefore=0)
static GetElementPtrInst * Create (Value *Ptr, Value *Idx, const std::string &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 383 of file Instructions.h.


Member Function Documentation

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

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

Definition at line 464 of file Instructions.h.

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

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

Definition at line 476 of file Instructions.h.

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

Definition at line 481 of file Instructions.h.

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 2855 of file Instructions.cpp.

References llvm::User::getNumOperands().

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 493 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 504 of file Instructions.h.

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

Definition at line 1079 of file Instructions.cpp.

References getIndexedTypeInternal().

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

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

References llvm::User::op_begin().

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

Definition at line 521 of file Instructions.h.

References llvm::User::op_begin().

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

Definition at line 522 of file Instructions.h.

References llvm::User::op_end().

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

Definition at line 523 of file Instructions.h.

References llvm::User::op_end().

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

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

Definition at line 528 of file Instructions.h.

References llvm::User::getOperand().

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

Definition at line 531 of file Instructions.h.

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

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

Definition at line 537 of file Instructions.h.

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

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

Definition at line 542 of file Instructions.h.

References llvm::User::getNumOperands().

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

Definition at line 546 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 1105 of file Instructions.cpp.

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

Referenced by 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 1119 of file Instructions.cpp.

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

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

Definition at line 562 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 563 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 566 of file Instructions.h.

References classof().


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