LLVM  9.0.0svn
Public Member Functions | Static Public Member Functions | List of all members
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, int64_t Offset, bool IsIndexSignExt)
SDValue getBase ()
SDValue getBase () const
SDValue getIndex ()
SDValue getIndex () const
bool equalBaseIndex (const BaseIndexOffset &Other, const SelectionDAG &DAG, int64_t &Off) const
bool equalBaseIndex (const BaseIndexOffset &Other, const SelectionDAG &DAG) const
bool contains (int64_t Size, const BaseIndexOffset &Other, int64_t OtherSize, const SelectionDAG &DAG) const
void print (raw_ostream &OS) const
void dump () const

Static Public Member Functions

static bool computeAliasing (const BaseIndexOffset &BasePtr0, const int64_t NumBytes0, const BaseIndexOffset &BasePtr1, const int64_t NumBytes1, const SelectionDAG &DAG, bool &IsAlias)
static BaseIndexOffset match (const LSBaseSDNode *N, const SelectionDAG &DAG)
 Parses tree in Ptr for base, index, offset addresses. More...

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 32 of file SelectionDAGAddressAnalysis.h.

Constructor & Destructor Documentation

◆ BaseIndexOffset() [1/2]

llvm::BaseIndexOffset::BaseIndexOffset ( )

Referenced by match().

◆ BaseIndexOffset() [2/2]

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

Definition at line 41 of file SelectionDAGAddressAnalysis.h.

Member Function Documentation

◆ computeAliasing()

bool BaseIndexOffset::computeAliasing ( const BaseIndexOffset BasePtr0,
const int64_t  NumBytes0,
const BaseIndexOffset BasePtr1,
const int64_t  NumBytes1,
const SelectionDAG DAG,
bool IsAlias 

◆ contains()

bool BaseIndexOffset::contains ( int64_t  Size,
const BaseIndexOffset Other,
int64_t  OtherSize,
const SelectionDAG DAG 
) const

Definition at line 138 of file SelectionDAGAddressAnalysis.cpp.

References equalBaseIndex(), and Size.

Referenced by equalBaseIndex(), and ShrinkLoadReplaceStoreWithStore().

◆ dump()

LLVM_DUMP_METHOD void BaseIndexOffset::dump ( ) const

Definition at line 264 of file SelectionDAGAddressAnalysis.cpp.

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

Referenced by equalBaseIndex().

◆ equalBaseIndex() [1/2]

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

◆ equalBaseIndex() [2/2]

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

◆ getBase() [1/2]

SDValue llvm::BaseIndexOffset::getBase ( )

◆ getBase() [2/2]

SDValue llvm::BaseIndexOffset::getBase ( ) const

Definition at line 47 of file SelectionDAGAddressAnalysis.h.

◆ getIndex() [1/2]

SDValue llvm::BaseIndexOffset::getIndex ( )

Definition at line 48 of file SelectionDAGAddressAnalysis.h.

Referenced by computeAliasing().

◆ getIndex() [2/2]

SDValue llvm::BaseIndexOffset::getIndex ( ) const

Definition at line 49 of file SelectionDAGAddressAnalysis.h.

References equalBaseIndex(), and Other.

◆ match()

BaseIndexOffset BaseIndexOffset::match ( const LSBaseSDNode N,
const SelectionDAG DAG 

◆ print()

void BaseIndexOffset::print ( raw_ostream OS) const

Definition at line 268 of file SelectionDAGAddressAnalysis.cpp.

References llvm::SDNode::print().

Referenced by dump(), and equalBaseIndex().

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