From eedd2ccd02c19c651070525627ca73432d2a06f0 Mon Sep 17 00:00:00 2001 From: Nirav Dave Date: Tue, 30 Oct 2018 18:26:43 +0000 Subject: [PATCH] [DAG] Add const variants for BaseIndexOffset functions. llvm-svn: 345623 --- llvm/include/llvm/CodeGen/SelectionDAGAddressAnalysis.h | 11 +++++++---- llvm/lib/CodeGen/SelectionDAG/SelectionDAGAddressAnalysis.cpp | 7 ++++--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/llvm/include/llvm/CodeGen/SelectionDAGAddressAnalysis.h b/llvm/include/llvm/CodeGen/SelectionDAGAddressAnalysis.h index 5806064..2b2c48d 100644 --- a/llvm/include/llvm/CodeGen/SelectionDAGAddressAnalysis.h +++ b/llvm/include/llvm/CodeGen/SelectionDAGAddressAnalysis.h @@ -45,18 +45,21 @@ public: IsIndexSignExt(IsIndexSignExt) {} SDValue getBase() { return Base; } + SDValue getBase() const { return Base; } SDValue getIndex() { return Index; } + SDValue getIndex() const { return Index; } - bool equalBaseIndex(BaseIndexOffset &Other, const SelectionDAG &DAG) { + bool equalBaseIndex(const BaseIndexOffset &Other, + const SelectionDAG &DAG) const { int64_t Off; return equalBaseIndex(Other, DAG, Off); } - bool equalBaseIndex(BaseIndexOffset &Other, const SelectionDAG &DAG, - int64_t &Off); + bool equalBaseIndex(const BaseIndexOffset &Other, const SelectionDAG &DAG, + int64_t &Off) const; /// Parses tree in Ptr for base, index, offset addresses. - static BaseIndexOffset match(LSBaseSDNode *N, const SelectionDAG &DAG); + static BaseIndexOffset match(const LSBaseSDNode *N, const SelectionDAG &DAG); }; } // end namespace llvm diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGAddressAnalysis.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGAddressAnalysis.cpp index c859f16..8c57f18 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGAddressAnalysis.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGAddressAnalysis.cpp @@ -19,8 +19,9 @@ using namespace llvm; -bool BaseIndexOffset::equalBaseIndex(BaseIndexOffset &Other, - const SelectionDAG &DAG, int64_t &Off) { +bool BaseIndexOffset::equalBaseIndex(const BaseIndexOffset &Other, + const SelectionDAG &DAG, + int64_t &Off) const { // Conservatively fail if we a match failed.. if (!Base.getNode() || !Other.Base.getNode()) return false; @@ -75,7 +76,7 @@ bool BaseIndexOffset::equalBaseIndex(BaseIndexOffset &Other, } /// Parses tree in Ptr for base, index, offset addresses. -BaseIndexOffset BaseIndexOffset::match(LSBaseSDNode *N, +BaseIndexOffset BaseIndexOffset::match(const LSBaseSDNode *N, const SelectionDAG &DAG) { SDValue Ptr = N->getBasePtr(); -- 2.7.4