summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2008-09-25 23:34:02 +0000
committerDan Gohman <gohman@apple.com>2008-09-25 23:34:02 +0000
commit0c1b884df1f958964a2ecde0f915912b2378832c (patch)
tree5713504ad4b70ce1c68f52d633cc0201b7b5bdd3 /llvm/lib/Target
parent0c374216232bfb36e79c90ff0f1a88fa038db5f9 (diff)
downloadbcm5719-llvm-0c1b884df1f958964a2ecde0f915912b2378832c.tar.gz
bcm5719-llvm-0c1b884df1f958964a2ecde0f915912b2378832c.zip
Fix a bug in which address displacements were being added to the
load from the stub, instead of the result of the load from the stub. llvm-svn: 56626
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r--llvm/lib/Target/X86/X86FastISel.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/llvm/lib/Target/X86/X86FastISel.cpp b/llvm/lib/Target/X86/X86FastISel.cpp
index 0554121e62a..b7ff7494c05 100644
--- a/llvm/lib/Target/X86/X86FastISel.cpp
+++ b/llvm/lib/Target/X86/X86FastISel.cpp
@@ -427,10 +427,18 @@ bool X86FastISel::X86SelectAddress(Value *V, X86AddressMode &AM, bool isCall) {
Opc = X86::MOV64rm;
RC = X86::GR64RegisterClass;
}
+
+ X86AddressMode StubAM;
+ StubAM.Base.Reg = AM.Base.Reg;
+ StubAM.GV = AM.GV;
unsigned ResultReg = createResultReg(RC);
- addFullAddress(BuildMI(MBB, TII.get(Opc), ResultReg), AM);
+ addFullAddress(BuildMI(MBB, TII.get(Opc), ResultReg), StubAM);
+
+ // Now construct the final address. Note that the Disp, Scale,
+ // and Index values may already be set here.
AM.Base.Reg = ResultReg;
AM.GV = 0;
+
// Prevent loading GV stub multiple times in same MBB.
LocalValueMap[V] = AM.Base.Reg;
}
OpenPOWER on IntegriCloud