diff options
author | Dan Gohman <gohman@apple.com> | 2008-10-18 02:06:02 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2008-10-18 02:06:02 +0000 |
commit | 6520e20e4fb31f2e65e25c38b372b19d33a83df4 (patch) | |
tree | bdd9f9d2f77e38a304c7abc38e87b8f734f06da8 /include/llvm/CodeGen/SelectionDAGNodes.h | |
parent | 95915730de69342d3733f5c391779ae007eb3efa (diff) |
Teach DAGCombine to fold constant offsets into GlobalAddress nodes,
and add a TargetLowering hook for it to use to determine when this
is legal (i.e. not in PIC mode, etc.)
This allows instruction selection to emit folded constant offsets
in more cases, such as the included testcase, eliminating the need
for explicit arithmetic instructions.
This eliminates the need for the C++ code in X86ISelDAGToDAG.cpp
that attempted to achieve the same effect, but wasn't as effective.
Also, fix handling of offsets in GlobalAddressSDNodes in several
places, including changing GlobalAddressSDNode's offset from
int to int64_t.
The Mips, Alpha, Sparc, and CellSPU targets appear to be
unaware of GlobalAddress offsets currently, so set the hook to
false on those targets.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57748 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen/SelectionDAGNodes.h')
-rw-r--r-- | include/llvm/CodeGen/SelectionDAGNodes.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/include/llvm/CodeGen/SelectionDAGNodes.h b/include/llvm/CodeGen/SelectionDAGNodes.h index 94c8dadd96..494783229a 100644 --- a/include/llvm/CodeGen/SelectionDAGNodes.h +++ b/include/llvm/CodeGen/SelectionDAGNodes.h @@ -1819,15 +1819,16 @@ public: class GlobalAddressSDNode : public SDNode { GlobalValue *TheGlobal; - int Offset; + int64_t Offset; virtual void ANCHOR(); // Out-of-line virtual method to give class a home. protected: friend class SelectionDAG; - GlobalAddressSDNode(bool isTarget, const GlobalValue *GA, MVT VT, int o = 0); + GlobalAddressSDNode(bool isTarget, const GlobalValue *GA, MVT VT, + int64_t o = 0); public: GlobalValue *getGlobal() const { return TheGlobal; } - int getOffset() const { return Offset; } + int64_t getOffset() const { return Offset; } static bool classof(const GlobalAddressSDNode *) { return true; } static bool classof(const SDNode *N) { |