llvm::emitGEPOffset

Emit code to compute a GEP's offset from its base pointer.

Synopsis

Declared in <llvm/Analysis/Utils/Local.h>

Value*
emitGEPOffset(
    IRBuilderBase* Builder,
    DataLayout const& DL,
    User* GEP,
    bool NoAssumptions = false);

Description

Given a getelementptr instruction or constant expression, emits the code necessary to compute the offset from the base pointer (without adding in the base pointer). Returns the result as a signed integer of intptr size. When NoAssumptions is true, no assumptions about index computation not overflowing are made.

Return Value

The offset as a signed integer of intptr size.

Parameters

NameDescription
BuilderIR builder used to emit the offset computation.
DLData layout used for pointer and type sizes.
GEPGetElementPtr instruction or constant expression to measure.
NoAssumptionsIf true, do not assume index computations do not overflow.