mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-09 11:25:55 +00:00
* 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
This commit is contained in:
@@ -1723,8 +1723,8 @@ SDOperand X86TargetLowering::LowerOperation(SDOperand Op, SelectionDAG &DAG) {
|
|||||||
DAG.getValueType(AVT), InFlag);
|
DAG.getValueType(AVT), InFlag);
|
||||||
}
|
}
|
||||||
case ISD::GlobalAddress: {
|
case ISD::GlobalAddress: {
|
||||||
|
SDOperand Result;
|
||||||
GlobalValue *GV = cast<GlobalAddressSDNode>(Op)->getGlobal();
|
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
|
// 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 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,
|
// 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().
|
if (getTargetMachine().
|
||||||
getSubtarget<X86Subtarget>().getIndirectExternAndWeakGlobals() &&
|
getSubtarget<X86Subtarget>().getIndirectExternAndWeakGlobals() &&
|
||||||
(GV->hasWeakLinkage() || GV->isExternal()))
|
(GV->hasWeakLinkage() || GV->isExternal()))
|
||||||
return DAG.getLoad(MVT::i32, DAG.getEntryNode(),
|
Result = DAG.getLoad(MVT::i32, DAG.getEntryNode(),
|
||||||
GVOp, DAG.getSrcValue(NULL));
|
DAG.getTargetGlobalAddress(GV, getPointerTy()),
|
||||||
else
|
DAG.getSrcValue(NULL));
|
||||||
return GVOp;
|
return Result;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -153,8 +153,7 @@ def brtarget : Operand<OtherVT>;
|
|||||||
// Define X86 specific addressing mode.
|
// Define X86 specific addressing mode.
|
||||||
def addr : ComplexPattern<i32, 4, "SelectAddr", []>;
|
def addr : ComplexPattern<i32, 4, "SelectAddr", []>;
|
||||||
def leaaddr : ComplexPattern<i32, 4, "SelectLEAAddr",
|
def leaaddr : ComplexPattern<i32, 4, "SelectLEAAddr",
|
||||||
[add, frameindex, constpool,
|
[add, frameindex, constpool]>;
|
||||||
globaladdr, tglobaladdr, externalsym]>;
|
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// X86 Instruction Format Definitions.
|
// X86 Instruction Format Definitions.
|
||||||
@@ -2958,6 +2957,10 @@ def RDTSC : I<0x31, RawFrm, (ops), "rdtsc", [(X86rdtsc)]>,
|
|||||||
// Non-Instruction Patterns
|
// Non-Instruction Patterns
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
// GlobalAddress and ExternalSymbol
|
||||||
|
def : Pat<(i32 globaladdr:$dst), (MOV32ri globaladdr:$dst)>;
|
||||||
|
def : Pat<(i32 externalsym:$dst), (MOV32ri externalsym:$dst)>;
|
||||||
|
|
||||||
// Calls
|
// Calls
|
||||||
def : Pat<(X86call tglobaladdr:$dst),
|
def : Pat<(X86call tglobaladdr:$dst),
|
||||||
(CALLpcrel32 tglobaladdr:$dst)>;
|
(CALLpcrel32 tglobaladdr:$dst)>;
|
||||||
|
Reference in New Issue
Block a user