LLVM 24.0.0git
llvm::BaseIndexOffset Class Reference

Helper struct to parse and store a memory address as base + index + offset. More...

#include "llvm/CodeGen/SelectionDAGAddressAnalysis.h"

Public Member Functions

 BaseIndexOffset ()=default
 BaseIndexOffset (SDValue Base, SDValue Index, bool IsIndexSignExt)
 BaseIndexOffset (SDValue Base, SDValue Index, int64_t Offset, bool IsIndexSignExt)
 BaseIndexOffset (SDValue Base, SDValue Index, StackOffset Offset, bool IsIndexSignExt)
SDValue getBase ()
SDValue getBase () const
SDValue getIndex ()
SDValue getIndex () const
void addToOffset (int64_t VectorOff)
bool hasValidOffset () const
bool hasValidStackOffset () const
int64_t getOffset () const
LLVM_ABI bool equalBaseIndex (const BaseIndexOffset &Other, const SelectionDAG &DAG, StackOffset &Off) const
LLVM_ABI bool equalBaseIndex (const BaseIndexOffset &Other, const SelectionDAG &DAG, int64_t &Off) const
bool equalBaseIndex (const BaseIndexOffset &Other, const SelectionDAG &DAG) const
LLVM_ABI bool contains (const SelectionDAG &DAG, int64_t BitSize, const BaseIndexOffset &Other, int64_t OtherBitSize, int64_t &BitOffset) const
bool contains (const SelectionDAG &DAG, int64_t BitSize, const BaseIndexOffset &Other, int64_t OtherBitSize) const
LLVM_ABI void print (raw_ostream &OS) const
LLVM_ABI void dump () const

Static Public Member Functions

static LLVM_ABI bool computeAliasing (const SDNode *Op0, const LocationSize NumBytes0, const SDNode *Op1, const LocationSize NumBytes1, const SelectionDAG &DAG, bool &IsAlias)
static LLVM_ABI BaseIndexOffset match (const SDNode *N, const SelectionDAG &DAG)
 Parses tree in N for base, index, and fixed/scalable offsets.

Detailed Description

Helper struct to parse and store a memory address as base + index + offset.

We ignore sign extensions when it is safe to do so. The following two expressions are not equivalent. To differentiate we need to store whether there was a sign extension involved in the index computation. (load (i64 add (i64 copyfromreg c) (i64 signextend (add (i8 load index) (i8 1)))) vs

(load (i64 add (i64 copyfromreg c) (i64 signextend (i32 add (i32 signextend (i8 load index)) (i32 1)))))

Definition at line 35 of file SelectionDAGAddressAnalysis.h.

Constructor & Destructor Documentation

◆ BaseIndexOffset() [1/4]

llvm::BaseIndexOffset::BaseIndexOffset ( )
default

◆ BaseIndexOffset() [2/4]

llvm::BaseIndexOffset::BaseIndexOffset ( SDValue Base,
SDValue Index,
bool IsIndexSignExt )
inline

Definition at line 44 of file SelectionDAGAddressAnalysis.h.

◆ BaseIndexOffset() [3/4]

llvm::BaseIndexOffset::BaseIndexOffset ( SDValue Base,
SDValue Index,
int64_t Offset,
bool IsIndexSignExt )
inline

Definition at line 46 of file SelectionDAGAddressAnalysis.h.

References BaseIndexOffset().

◆ BaseIndexOffset() [4/4]

llvm::BaseIndexOffset::BaseIndexOffset ( SDValue Base,
SDValue Index,
StackOffset Offset,
bool IsIndexSignExt )
inline

Definition at line 50 of file SelectionDAGAddressAnalysis.h.

Member Function Documentation

◆ addToOffset()

void llvm::BaseIndexOffset::addToOffset ( int64_t VectorOff)
inline

◆ computeAliasing()

◆ contains() [1/2]

bool llvm::BaseIndexOffset::contains ( const SelectionDAG & DAG,
int64_t BitSize,
const BaseIndexOffset & Other,
int64_t OtherBitSize ) const
inline

Definition at line 94 of file SelectionDAGAddressAnalysis.h.

References BaseIndexOffset(), contains(), and llvm::Other.

◆ contains() [2/2]

bool BaseIndexOffset::contains ( const SelectionDAG & DAG,
int64_t BitSize,
const BaseIndexOffset & Other,
int64_t OtherBitSize,
int64_t & BitOffset ) const

Definition at line 187 of file SelectionDAGAddressAnalysis.cpp.

References BaseIndexOffset(), equalBaseIndex(), and llvm::Other.

Referenced by contains().

◆ dump()

LLVM_DUMP_METHOD void BaseIndexOffset::dump ( ) const

Definition at line 327 of file SelectionDAGAddressAnalysis.cpp.

References llvm::dbgs(), LLVM_DUMP_METHOD, and print().

◆ equalBaseIndex() [1/3]

bool llvm::BaseIndexOffset::equalBaseIndex ( const BaseIndexOffset & Other,
const SelectionDAG & DAG ) const
inline

◆ equalBaseIndex() [2/3]

bool BaseIndexOffset::equalBaseIndex ( const BaseIndexOffset & Other,
const SelectionDAG & DAG,
int64_t & Off ) const

◆ equalBaseIndex() [3/3]

◆ getBase() [1/2]

SDValue llvm::BaseIndexOffset::getBase ( )
inline

Definition at line 55 of file SelectionDAGAddressAnalysis.h.

Referenced by computeAliasing().

◆ getBase() [2/2]

SDValue llvm::BaseIndexOffset::getBase ( ) const
inline

Definition at line 56 of file SelectionDAGAddressAnalysis.h.

◆ getIndex() [1/2]

SDValue llvm::BaseIndexOffset::getIndex ( )
inline

Definition at line 57 of file SelectionDAGAddressAnalysis.h.

◆ getIndex() [2/2]

SDValue llvm::BaseIndexOffset::getIndex ( ) const
inline

Definition at line 58 of file SelectionDAGAddressAnalysis.h.

◆ getOffset()

int64_t llvm::BaseIndexOffset::getOffset ( ) const
inline

Definition at line 67 of file SelectionDAGAddressAnalysis.h.

References assert(), and hasValidOffset().

◆ hasValidOffset()

bool llvm::BaseIndexOffset::hasValidOffset ( ) const
inline

Definition at line 64 of file SelectionDAGAddressAnalysis.h.

Referenced by getOffset().

◆ hasValidStackOffset()

bool llvm::BaseIndexOffset::hasValidStackOffset ( ) const
inline

Definition at line 66 of file SelectionDAGAddressAnalysis.h.

Referenced by equalBaseIndex().

◆ match()

BaseIndexOffset BaseIndexOffset::match ( const SDNode * N,
const SelectionDAG & DAG )
static

Parses tree in N for base, index, and fixed/scalable offsets.

Definition at line 315 of file SelectionDAGAddressAnalysis.cpp.

References BaseIndexOffset(), llvm::dyn_cast(), matchLSNode(), and N.

Referenced by areNonVolatileConsecutiveLoadsOrStores(), computeAliasing(), performCONCAT_VECTORSCombine(), and TryDistrubutionADDVecReduce().

◆ print()

void BaseIndexOffset::print ( raw_ostream & OS) const

Definition at line 331 of file SelectionDAGAddressAnalysis.cpp.

Referenced by dump().


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