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 GetElementPtrInst * clone () const
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
unsigned getNumIndices () const
bool hasIndices () const

Static Public Member Functions

static const Type * getIndexedType (const Type *Ptr, const std::vector< Value * > &Indices, bool AllowStructLeaf=false)
static const Type * getIndexedType (const Type *Ptr, Value *Idx0, Value *Idx1, bool AllowStructLeaf=false)
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 316 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 677 of file Instructions.cpp.

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

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

References Idx.

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

Definition at line 700 of file Instructions.cpp.

References Idx.

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

Definition at line 707 of file Instructions.cpp.

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

Definition at line 715 of file Instructions.cpp.

GetElementPtrInst::~GetElementPtrInst (  ) 

Definition at line 723 of file Instructions.cpp.

References llvm::User::OperandList.


Member Function Documentation

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

Reimplemented from llvm::Instruction.

Definition at line 398 of file Instructions.h.

References classof(), and V.

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

References llvm::Instruction::getOpcode().

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

Definition at line 394 of file Instructions.h.

Referenced by classof().

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

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

Definition at line 788 of file Instructions.cpp.

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

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

Definition at line 770 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,
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 733 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().

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

Definition at line 385 of file Instructions.h.

References llvm::User::getNumOperands().

Referenced by llvm::DecomposeArrayRef().

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

Definition at line 378 of file Instructions.h.

References llvm::User::getOperand().

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

Definition at line 375 of file Instructions.h.

References llvm::User::getOperand().

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

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

Definition at line 381 of file Instructions.h.

References U.

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

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

Reimplemented from llvm::Value.

Definition at line 353 of file Instructions.h.

References llvm::Value::getType().

Referenced by llvm::ExpressionConvertibleToType().

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

Definition at line 389 of file Instructions.h.

References llvm::User::getNumOperands().

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

Definition at line 371 of file Instructions.h.

References llvm::User::op_begin().

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

Definition at line 370 of file Instructions.h.

References llvm::User::op_begin().

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

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

Definition at line 373 of file Instructions.h.

References llvm::User::op_end().

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

Definition at line 372 of file Instructions.h.

References llvm::User::op_end().

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


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