class GetElementPtrInst

Declaration

class GetElementPtrInst : public Instruction { /* full declaration omitted */ };

Declared at: llvm/include/llvm/IR/Instructions.h:892

Inherits from: Instruction

Member Variables

Inherited from Value:

protected SubclassOptionalData
protected NumUserOperands
protected IsUsedByMD
protected HasName
protected HasHungOffUses
protected HasDescriptor
public static MaxAlignmentExponent = 29
public static MaximumAlignment = 1U << MaxAlignmentExponent

Method Overview

  • public static llvm::GetElementPtrInst * Create(llvm::Type * PointeeType, llvm::Value * Ptr, ArrayRef<llvm::Value *> IdxList, const llvm::Twine & NameStr = "", llvm::Instruction * InsertBefore = nullptr)
  • public static llvm::GetElementPtrInst * Create(llvm::Type * PointeeType, llvm::Value * Ptr, ArrayRef<llvm::Value *> IdxList, const llvm::Twine & NameStr, llvm::BasicBlock * InsertAtEnd)
  • public static llvm::GetElementPtrInst * CreateInBounds(llvm::Value * Ptr, ArrayRef<llvm::Value *> IdxList, const llvm::Twine & NameStr = "", llvm::Instruction * InsertBefore = nullptr)
  • public static llvm::GetElementPtrInst * CreateInBounds(llvm::Type * PointeeType, llvm::Value * Ptr, ArrayRef<llvm::Value *> IdxList, const llvm::Twine & NameStr = "", llvm::Instruction * InsertBefore = nullptr)
  • public static llvm::GetElementPtrInst * CreateInBounds(llvm::Value * Ptr, ArrayRef<llvm::Value *> IdxList, const llvm::Twine & NameStr, llvm::BasicBlock * InsertAtEnd)
  • public static llvm::GetElementPtrInst * CreateInBounds(llvm::Type * PointeeType, llvm::Value * Ptr, ArrayRef<llvm::Value *> IdxList, const llvm::Twine & NameStr, llvm::BasicBlock * InsertAtEnd)
  • public bool accumulateConstantOffset(const llvm::DataLayout & DL, llvm::APInt & Offset) const
  • public static bool classof(const llvm::Value * V)
  • public static bool classof(const llvm::Instruction * I)
  • protected llvm::GetElementPtrInst * cloneImpl() const
  • public unsigned int getAddressSpace() const
  • public static llvm::Type * getGEPReturnType(llvm::Type * ElTy, llvm::Value * Ptr, ArrayRef<llvm::Value *> IdxList)
  • public static llvm::Type * getIndexedType(llvm::Type * Ty, ArrayRef<llvm::Value *> IdxList)
  • public static llvm::Type * getIndexedType(llvm::Type * Ty, ArrayRef<llvm::Constant *> IdxList)
  • public static llvm::Type * getIndexedType(llvm::Type * Ty, ArrayRef<uint64_t> IdxList)
  • public unsigned int getNumIndices() const
  • public unsigned int getPointerAddressSpace() const
  • public const llvm::Value * getPointerOperand() const
  • public llvm::Value * getPointerOperand()
  • public static unsigned int getPointerOperandIndex()
  • public llvm::Type * getPointerOperandType() const
  • public llvm::Type * getResultElementType() const
  • public llvm::Type * getSourceElementType() const
  • public bool hasAllConstantIndices() const
  • public bool hasAllZeroIndices() const
  • public bool hasIndices() const
  • public inline llvm::User::op_iterator idx_begin()
  • public inline llvm::User::const_op_iterator idx_begin() const
  • public inline llvm::User::op_iterator idx_end()
  • public inline llvm::User::const_op_iterator idx_end() const
  • public inline iterator_range<llvm::User::op_iterator> indices()
  • public inline iterator_range<llvm::User::const_op_iterator> indices() const
  • public bool isInBounds() const
  • public void setIsInBounds(bool b = true)
  • public void setResultElementType(llvm::Type * Ty)
  • public void setSourceElementType(llvm::Type * Ty)

Inherited from Instruction:

Inherited from User:

Inherited from Value:

Methods

static llvm::GetElementPtrInst* Create(
    llvm::Type* PointeeType,
    llvm::Value* Ptr,
    ArrayRef<llvm::Value*> IdxList,
    const llvm::Twine& NameStr = "",
    llvm::Instruction* InsertBefore = nullptr)

Declared at: llvm/include/llvm/IR/Instructions.h:918

Parameters

llvm::Type* PointeeType
llvm::Value* Ptr
ArrayRef<llvm::Value*> IdxList
const llvm::Twine& NameStr = ""
llvm::Instruction* InsertBefore = nullptr

static llvm::GetElementPtrInst* Create(
    llvm::Type* PointeeType,
    llvm::Value* Ptr,
    ArrayRef<llvm::Value*> IdxList,
    const llvm::Twine& NameStr,
    llvm::BasicBlock* InsertAtEnd)

Declared at: llvm/include/llvm/IR/Instructions.h:934

Parameters

llvm::Type* PointeeType
llvm::Value* Ptr
ArrayRef<llvm::Value*> IdxList
const llvm::Twine& NameStr
llvm::BasicBlock* InsertAtEnd

static llvm::GetElementPtrInst* CreateInBounds(
    llvm::Value* Ptr,
    ArrayRef<llvm::Value*> IdxList,
    const llvm::Twine& NameStr = "",
    llvm::Instruction* InsertBefore = nullptr)

Description

Create an "inbounds" getelementptr. See the documentation for the "inbounds" flag in LangRef.html for details.

Declared at: llvm/include/llvm/IR/Instructions.h:952

Parameters

llvm::Value* Ptr
ArrayRef<llvm::Value*> IdxList
const llvm::Twine& NameStr = ""
llvm::Instruction* InsertBefore = nullptr

static llvm::GetElementPtrInst* CreateInBounds(
    llvm::Type* PointeeType,
    llvm::Value* Ptr,
    ArrayRef<llvm::Value*> IdxList,
    const llvm::Twine& NameStr = "",
    llvm::Instruction* InsertBefore = nullptr)

Declared at: llvm/include/llvm/IR/Instructions.h:960

Parameters

llvm::Type* PointeeType
llvm::Value* Ptr
ArrayRef<llvm::Value*> IdxList
const llvm::Twine& NameStr = ""
llvm::Instruction* InsertBefore = nullptr

static llvm::GetElementPtrInst* CreateInBounds(
    llvm::Value* Ptr,
    ArrayRef<llvm::Value*> IdxList,
    const llvm::Twine& NameStr,
    llvm::BasicBlock* InsertAtEnd)

Declared at: llvm/include/llvm/IR/Instructions.h:969

Parameters

llvm::Value* Ptr
ArrayRef<llvm::Value*> IdxList
const llvm::Twine& NameStr
llvm::BasicBlock* InsertAtEnd

static llvm::GetElementPtrInst* CreateInBounds(
    llvm::Type* PointeeType,
    llvm::Value* Ptr,
    ArrayRef<llvm::Value*> IdxList,
    const llvm::Twine& NameStr,
    llvm::BasicBlock* InsertAtEnd)

Declared at: llvm/include/llvm/IR/Instructions.h:976

Parameters

llvm::Type* PointeeType
llvm::Value* Ptr
ArrayRef<llvm::Value*> IdxList
const llvm::Twine& NameStr
llvm::BasicBlock* InsertAtEnd

bool accumulateConstantOffset(
    const llvm::DataLayout& DL,
    llvm::APInt& Offset) const

Description

Accumulate the constant address offset of this GEP if possible. This routine accepts an APInt into which it will accumulate the constant offset of this GEP if the GEP is in fact constant. If the GEP is not all-constant, it returns false and the value of the offset APInt is undefined (it is *not* preserved!). The APInt passed into this routine must be at least as wide as the IntPtr type for the address space of the base GEP pointer.

Declared at: llvm/include/llvm/IR/Instructions.h:1104

Parameters

const llvm::DataLayout& DL
llvm::APInt& Offset

static bool classof(const llvm::Value* V)

Declared at: llvm/include/llvm/IR/Instructions.h:1110

Parameters

const llvm::Value* V

static bool classof(const llvm::Instruction* I)

Declared at: llvm/include/llvm/IR/Instructions.h:1107

Parameters

const llvm::Instruction* I

llvm::GetElementPtrInst* cloneImpl() const

Declared at: llvm/include/llvm/IR/Instructions.h:915

unsigned int getAddressSpace() const

Description

Returns the address space of this instruction's pointer type.

Declared at: llvm/include/llvm/IR/Instructions.h:1001

static llvm::Type* getGEPReturnType(
    llvm::Type* ElTy,
    llvm::Value* Ptr,
    ArrayRef<llvm::Value*> IdxList)

Description

Returns the pointer type returned by the GEP instruction, which may be a vector of pointers.

Declared at: llvm/include/llvm/IR/Instructions.h:1053

Parameters

llvm::Type* ElTy
llvm::Value* Ptr
ArrayRef<llvm::Value*> IdxList

static llvm::Type* getIndexedType(
    llvm::Type* Ty,
    ArrayRef<llvm::Value*> IdxList)

Description

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.

Declared at: llvm/include/llvm/IR/Instructions.h:1013

Parameters

llvm::Type* Ty
ArrayRef<llvm::Value*> IdxList

static llvm::Type* getIndexedType(
    llvm::Type* Ty,
    ArrayRef<llvm::Constant*> IdxList)

Declared at: llvm/include/llvm/IR/Instructions.h:1014

Parameters

llvm::Type* Ty
ArrayRef<llvm::Constant*> IdxList

static llvm::Type* getIndexedType(
    llvm::Type* Ty,
    ArrayRef<uint64_t> IdxList)

Declared at: llvm/include/llvm/IR/Instructions.h:1015

Parameters

llvm::Type* Ty
ArrayRef<uint64_t> IdxList

unsigned int getNumIndices() const

Declared at: llvm/include/llvm/IR/Instructions.h:1071

unsigned int getPointerAddressSpace() const

Description

Returns the address space of the pointer operand.

Declared at: llvm/include/llvm/IR/Instructions.h:1047

const llvm::Value* getPointerOperand() const

Declared at: llvm/include/llvm/IR/Instructions.h:1033

llvm::Value* getPointerOperand()

Declared at: llvm/include/llvm/IR/Instructions.h:1030

static unsigned int getPointerOperandIndex()

Declared at: llvm/include/llvm/IR/Instructions.h:1036

llvm::Type* getPointerOperandType() const

Description

Method to return the pointer operand as a PointerType.

Declared at: llvm/include/llvm/IR/Instructions.h:1042

llvm::Type* getResultElementType() const

Declared at: llvm/include/llvm/IR/Instructions.h:994

llvm::Type* getSourceElementType() const

Declared at: llvm/include/llvm/IR/Instructions.h:989

bool hasAllConstantIndices() const

Description

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.

Declared at: llvm/include/llvm/IR/Instructions.h:1087

bool hasAllZeroIndices() const

Description

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.

Declared at: llvm/include/llvm/IR/Instructions.h:1082

bool hasIndices() const

Declared at: llvm/include/llvm/IR/Instructions.h:1075

inline llvm::User::op_iterator idx_begin()

Declared at: llvm/include/llvm/IR/Instructions.h:1017

inline llvm::User::const_op_iterator idx_begin()
    const

Declared at: llvm/include/llvm/IR/Instructions.h:1018

inline llvm::User::op_iterator idx_end()

Declared at: llvm/include/llvm/IR/Instructions.h:1019

inline llvm::User::const_op_iterator idx_end()
    const

Declared at: llvm/include/llvm/IR/Instructions.h:1020

inline iterator_range<llvm::User::op_iterator>
indices()

Declared at: llvm/include/llvm/IR/Instructions.h:1022

inline iterator_range<
    llvm::User::const_op_iterator>
indices() const

Declared at: llvm/include/llvm/IR/Instructions.h:1026

bool isInBounds() const

Description

Determine whether the GEP has the inbounds flag.

Declared at: llvm/include/llvm/IR/Instructions.h:1094

void setIsInBounds(bool b = true)

Description

Set or clear the inbounds flag on this GEP instruction. See LangRef.html for the meaning of inbounds on a getelementptr.

Declared at: llvm/include/llvm/IR/Instructions.h:1091

Parameters

bool b = true

void setResultElementType(llvm::Type* Ty)

Declared at: llvm/include/llvm/IR/Instructions.h:992

Parameters

llvm::Type* Ty

void setSourceElementType(llvm::Type* Ty)

Declared at: llvm/include/llvm/IR/Instructions.h:991

Parameters

llvm::Type* Ty