* Added lowering hook for external weak global address. It inserts a load
for Darwin.
* Added lowering hook for ISD::RET. It inserts CopyToRegs for the return
value (or store / fld / copy to ST(0) for floating point value). This
eliminate the need to write C++ code to handle RET with variable number
of operands.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24888 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/X86/X86ISelDAGToDAG.cpp b/lib/Target/X86/X86ISelDAGToDAG.cpp
index 4484ae5..3dcf444 100644
--- a/lib/Target/X86/X86ISelDAGToDAG.cpp
+++ b/lib/Target/X86/X86ISelDAGToDAG.cpp
@@ -173,22 +173,7 @@
case ISD::GlobalAddress:
if (AM.GV == 0) {
- GlobalValue *GV = cast<GlobalAddressSDNode>(N)->getGlobal();
- // 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,
- // not the GV offset field.
- if (Subtarget->getIndirectExternAndWeakGlobals() &&
- (GV->hasWeakLinkage() || GV->isExternal())) {
- AM.Base.Reg =
- CurDAG->getTargetNode(X86::MOV32rm, MVT::i32, MVT::Other,
- CurDAG->getRegister(0, MVT::i32),
- getI8Imm(1), CurDAG->getRegister(0, MVT::i32),
- CurDAG->getTargetGlobalAddress(GV, MVT::i32),
- CurDAG->getEntryNode());
- } else {
- AM.GV = GV;
- }
+ AM.GV = cast<GlobalAddressSDNode>(N)->getGlobal();
return false;
}
break;