[llvm-commits] CVS: llvm/lib/Target/X86/X86ISelLowering.cpp X86InstrInfo.td
Evan Cheng
evan.cheng at apple.com
Wed Jan 11 23:56:59 PST 2006
Changes in directory llvm/lib/Target/X86:
X86ISelLowering.cpp updated: 1.31 -> 1.32
X86InstrInfo.td updated: 1.198 -> 1.199
---
Log message:
* Materialize GlobalAddress and ExternalSym with MOV32ri rather than
LEA32r.
* Do not lower GlobalAddress to TargetGlobalAddress. Let isel does it.
---
Diffs of the changes: (+10 -8)
X86ISelLowering.cpp | 11 +++++------
X86InstrInfo.td | 7 +++++--
2 files changed, 10 insertions(+), 8 deletions(-)
Index: llvm/lib/Target/X86/X86ISelLowering.cpp
diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.31 llvm/lib/Target/X86/X86ISelLowering.cpp:1.32
--- llvm/lib/Target/X86/X86ISelLowering.cpp:1.31 Wed Jan 11 17:20:05 2006
+++ llvm/lib/Target/X86/X86ISelLowering.cpp Thu Jan 12 01:56:47 2006
@@ -1723,8 +1723,8 @@
DAG.getValueType(AVT), InFlag);
}
case ISD::GlobalAddress: {
+ SDOperand Result;
GlobalValue *GV = cast<GlobalAddressSDNode>(Op)->getGlobal();
- SDOperand GVOp = DAG.getTargetGlobalAddress(GV, getPointerTy());
// For Darwin, external and weak symbols are indirect, so we want to load
// the value at address GV, not the value of GV itself. This means that
// the GlobalAddress must be in the base or index register of the address,
@@ -1732,11 +1732,10 @@
if (getTargetMachine().
getSubtarget<X86Subtarget>().getIndirectExternAndWeakGlobals() &&
(GV->hasWeakLinkage() || GV->isExternal()))
- return DAG.getLoad(MVT::i32, DAG.getEntryNode(),
- GVOp, DAG.getSrcValue(NULL));
- else
- return GVOp;
- break;
+ Result = DAG.getLoad(MVT::i32, DAG.getEntryNode(),
+ DAG.getTargetGlobalAddress(GV, getPointerTy()),
+ DAG.getSrcValue(NULL));
+ return Result;
}
}
}
Index: llvm/lib/Target/X86/X86InstrInfo.td
diff -u llvm/lib/Target/X86/X86InstrInfo.td:1.198 llvm/lib/Target/X86/X86InstrInfo.td:1.199
--- llvm/lib/Target/X86/X86InstrInfo.td:1.198 Wed Jan 11 17:20:05 2006
+++ llvm/lib/Target/X86/X86InstrInfo.td Thu Jan 12 01:56:47 2006
@@ -153,8 +153,7 @@
// Define X86 specific addressing mode.
def addr : ComplexPattern<i32, 4, "SelectAddr", []>;
def leaaddr : ComplexPattern<i32, 4, "SelectLEAAddr",
- [add, frameindex, constpool,
- globaladdr, tglobaladdr, externalsym]>;
+ [add, frameindex, constpool]>;
//===----------------------------------------------------------------------===//
// X86 Instruction Format Definitions.
@@ -2958,6 +2957,10 @@
// Non-Instruction Patterns
//===----------------------------------------------------------------------===//
+// GlobalAddress and ExternalSymbol
+def : Pat<(i32 globaladdr:$dst), (MOV32ri globaladdr:$dst)>;
+def : Pat<(i32 externalsym:$dst), (MOV32ri externalsym:$dst)>;
+
// Calls
def : Pat<(X86call tglobaladdr:$dst),
(CALLpcrel32 tglobaladdr:$dst)>;
More information about the llvm-commits
mailing list