diff options
| author | Chris Lattner <sabre@nondot.org> | 2004-11-24 18:00:02 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2004-11-24 18:00:02 +0000 |
| commit | 659d72e3192564bc3a424e5ff7579194fc8930cf (patch) | |
| tree | 4b45624af611e3183de0c600ef50e61425d4ede3 | |
| parent | cb9af557e7b466fe3dae9e2936261bb75f1937b6 (diff) | |
| download | bcm5719-llvm-659d72e3192564bc3a424e5ff7579194fc8930cf.tar.gz bcm5719-llvm-659d72e3192564bc3a424e5ff7579194fc8930cf.zip | |
When rewriting the original call instruction, make sure to rewrite it to
call the right address.
llvm-svn: 18213
| -rw-r--r-- | llvm/lib/Target/PowerPC/PPC32JITInfo.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/lib/Target/PowerPC/PPC32JITInfo.cpp b/llvm/lib/Target/PowerPC/PPC32JITInfo.cpp index 299dce771f9..f7abc53a897 100644 --- a/llvm/lib/Target/PowerPC/PPC32JITInfo.cpp +++ b/llvm/lib/Target/PowerPC/PPC32JITInfo.cpp @@ -81,12 +81,13 @@ static void CompilationCallback() { // does not need to go through the stub anymore. unsigned CameFromOrigInst = CameFromOrig[-1]; if ((CameFromOrigInst >> 26) == 18) { // Direct call. - intptr_t Offset = ((intptr_t)Target-(intptr_t)CameFromOrig) >> 2; + intptr_t Offset = ((intptr_t)Target-(intptr_t)CameFromOrig+4) >> 2; if (Offset >= -(1 << 23) && Offset < (1 << 23)) { // In range? - // FIXME: hasn't been tested at all. - // Clear the original target out: + // Clear the original target out. CameFromOrigInst &= (63 << 26) | 3; - CameFromOrigInst |= Offset << 2; + // Fill in the new target. + CameFromOrigInst |= (Offset & ((1 << 24)-1)) << 2; + // Replace the call. CameFromOrig[-1] = CameFromOrigInst; } } |

