class GEPOperator

Declaration

class GEPOperator : public ConcreteOperator { /* full declaration omitted */ };

Description

A helper template for defining operators for individual opcodes.

Declared at: llvm/include/llvm/IR/Operator.h:375

Inherits from: ConcreteOperator

Method Overview

Methods

static bool accumulateConstantOffset(
    llvm::Type* SourceType,
    ArrayRef<const llvm::Value*> Index,
    const llvm::DataLayout& DL,
    llvm::APInt& Offset,
    function_ref<bool(llvm::Value&, llvm::APInt&)>
        ExternalAnalysis = nullptr)

Declared at: llvm/include/llvm/IR/Operator.h:501

Parameters

llvm::Type* SourceType
ArrayRef<const llvm::Value*> Index
const llvm::DataLayout& DL
llvm::APInt& Offset
function_ref<bool(llvm::Value&, llvm::APInt&)> ExternalAnalysis = nullptr

bool accumulateConstantOffset(
    const llvm::DataLayout& DL,
    llvm::APInt& Offset,
    function_ref<bool(llvm::Value&, llvm::APInt&)>
        ExternalAnalysis = nullptr) const

Description

Accumulate the constant address offset of this GEP if possible. This routine accepts an APInt into which it will try to accumulate the constant offset of this GEP. If \p ExternalAnalysis is provided it will be used to calculate a offset when a operand of GEP is not constant. For example, for a value \p ExternalAnalysis might try to calculate a lower bound. If \p ExternalAnalysis is successful, it should return true. If the \p ExternalAnalysis returns false or the value returned by \p ExternalAnalysis results in a overflow/underflow, this routine returns false and the value of the offset APInt is undefined (it is *not* preserved!). The APInt passed into this routine must be at exactly as wide as the IntPtr type for the address space of the base GEP pointer.

Declared at: llvm/include/llvm/IR/Operator.h:497

Parameters

const llvm::DataLayout& DL
llvm::APInt& Offset
function_ref<bool(llvm::Value&, llvm::APInt&)> ExternalAnalysis = nullptr

bool collectOffset(
    const llvm::DataLayout& DL,
    unsigned int BitWidth,
    MapVector<llvm::Value*, llvm::APInt>&
        VariableOffsets,
    llvm::APInt& ConstantOffset) const

Description

Collect the offset of this GEP as a map of Values to their associated APInt multipliers, as well as a total Constant Offset.

Declared at: llvm/include/llvm/IR/Operator.h:508

Parameters

const llvm::DataLayout& DL
unsigned int BitWidth
MapVector<llvm::Value*, llvm::APInt>& VariableOffsets
llvm::APInt& ConstantOffset

unsigned int countNonConstantIndices() const

Declared at: llvm/include/llvm/IR/Operator.h:471

Optional<unsigned int> getInRangeIndex() const

Description

Returns the offset of the index with an inrange attachment, or None if none.

Declared at: llvm/include/llvm/IR/Operator.h:398

llvm::Align getMaxPreservedAlignment(
    const llvm::DataLayout& DL) const

Description

Compute the maximum alignment that this GEP is garranteed to preserve.

Declared at: llvm/include/llvm/IR/Operator.h:478

Parameters

const llvm::DataLayout& DL

unsigned int getNumIndices() const

Declared at: llvm/include/llvm/IR/Operator.h:439

unsigned int getPointerAddressSpace() const

Description

Method to return the address space of the pointer operand.

Declared at: llvm/include/llvm/IR/Operator.h:435

llvm::Value* getPointerOperand()

Declared at: llvm/include/llvm/IR/Operator.h:416

const llvm::Value* getPointerOperand() const

Declared at: llvm/include/llvm/IR/Operator.h:419

static unsigned int getPointerOperandIndex()

Declared at: llvm/include/llvm/IR/Operator.h:422

llvm::Type* getPointerOperandType() const

Description

Method to return the pointer operand as a PointerType.

Declared at: llvm/include/llvm/IR/Operator.h:427

llvm::Type* getResultElementType() const

Declared at: llvm/include/llvm/IR/Operator.h:432

llvm::Type* getSourceElementType() const

Declared at: llvm/include/llvm/IR/Operator.h:431

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/Operator.h:463

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/Operator.h:450

bool hasIndices() const

Declared at: llvm/include/llvm/IR/Operator.h:443

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

Declared at: llvm/include/llvm/IR/Operator.h:404

inline llvm::User::op_iterator idx_begin()

Declared at: llvm/include/llvm/IR/Operator.h:403

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

Declared at: llvm/include/llvm/IR/Operator.h:406

inline llvm::User::op_iterator idx_end()

Declared at: llvm/include/llvm/IR/Operator.h:405

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

Declared at: llvm/include/llvm/IR/Operator.h:412

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

Declared at: llvm/include/llvm/IR/Operator.h:408

bool isInBounds() const

Description

Test whether this is an inbounds GEP, as defined by LangRef.html.

Declared at: llvm/include/llvm/IR/Operator.h:392

void setIsInBounds(bool B)

Declared at: llvm/include/llvm/IR/Operator.h:385

Parameters

bool B