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 | 2fe6bee5b6035c1ebb2b0d35ad29b0942ea0b387 (patch) | |
tree | d61344becb0d144918cd28ffbcb4382d005e4d4b /llvm/lib/Target/Mips/MipsISelLowering.cpp | |
parent | 6de2556205f29d3ee46b6b7cbfd46b263ddca69a (diff) | |
download | bcm5719-llvm-2fe6bee5b6035c1ebb2b0d35ad29b0942ea0b387.tar.gz bcm5719-llvm-2fe6bee5b6035c1ebb2b0d35ad29b0942ea0b387.zip |
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.
llvm-svn: 57748
Diffstat (limited to 'llvm/lib/Target/Mips/MipsISelLowering.cpp')
-rw-r--r-- | llvm/lib/Target/Mips/MipsISelLowering.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Target/Mips/MipsISelLowering.cpp b/llvm/lib/Target/Mips/MipsISelLowering.cpp index 3224d73d5f6..8fdc4b799b8 100644 --- a/llvm/lib/Target/Mips/MipsISelLowering.cpp +++ b/llvm/lib/Target/Mips/MipsISelLowering.cpp @@ -1094,3 +1094,9 @@ getRegClassForInlineAsmConstraint(const std::string &Constraint, } return std::vector<unsigned>(); } + +bool +MipsTargetLowering::isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const { + // The Mips target isn't yet aware of offsets. + return false; +} |