diff options
author | Evan Cheng <evan.cheng@apple.com> | 2006-01-12 07:56:47 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2006-01-12 07:56:47 +0000 |
commit | 002fe9baf2bdc50532c6238b92ac46191fd01c38 (patch) | |
tree | 8268e10a4b51b2048a6e0f2c8dbac787aae32c8c | |
parent | bb48e33bcdc98fbed7c37aaa7f76ddb7b04b254f (diff) | |
download | external_llvm-002fe9baf2bdc50532c6238b92ac46191fd01c38.zip external_llvm-002fe9baf2bdc50532c6238b92ac46191fd01c38.tar.gz external_llvm-002fe9baf2bdc50532c6238b92ac46191fd01c38.tar.bz2 |
* Materialize GlobalAddress and ExternalSym with MOV32ri rather than
LEA32r.
* Do not lower GlobalAddress to TargetGlobalAddress. Let isel does it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25246 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Target/X86/X86ISelLowering.cpp | 11 | ||||
-rw-r--r-- | lib/Target/X86/X86InstrInfo.td | 7 |
2 files changed, 10 insertions, 8 deletions
diff --git a/lib/Target/X86/X86ISelLowering.cpp b/lib/Target/X86/X86ISelLowering.cpp index 25ac370..8b15727 100644 --- a/lib/Target/X86/X86ISelLowering.cpp +++ b/lib/Target/X86/X86ISelLowering.cpp @@ -1723,8 +1723,8 @@ SDOperand X86TargetLowering::LowerOperation(SDOperand Op, SelectionDAG &DAG) { 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 @@ SDOperand X86TargetLowering::LowerOperation(SDOperand Op, SelectionDAG &DAG) { 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; } } } diff --git a/lib/Target/X86/X86InstrInfo.td b/lib/Target/X86/X86InstrInfo.td index 9de8185..d6dc20a 100644 --- a/lib/Target/X86/X86InstrInfo.td +++ b/lib/Target/X86/X86InstrInfo.td @@ -153,8 +153,7 @@ def brtarget : Operand<OtherVT>; // 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 @@ def RDTSC : I<0x31, RawFrm, (ops), "rdtsc", [(X86rdtsc)]>, // 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)>; |