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,
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;
}
}
}
// 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.
// 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)>;