diff options
| author | Nate Begeman <natebegeman@mac.com> | 2004-11-25 07:09:01 +0000 |
|---|---|---|
| committer | Nate Begeman <natebegeman@mac.com> | 2004-11-25 07:09:01 +0000 |
| commit | 3f76eb69f6cd886da91714e2db41d4196ac865df (patch) | |
| tree | 03ebf8f268f30405e8c82421f8a70353e1b86af9 /llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp | |
| parent | d0af8e24b5ad73c80be5fc6c6a62799bb2a0ff18 (diff) | |
| download | bcm5719-llvm-3f76eb69f6cd886da91714e2db41d4196ac865df.tar.gz bcm5719-llvm-3f76eb69f6cd886da91714e2db41d4196ac865df.zip | |
Enable optimization suggested by Chris Lattner to not emit reloc stubs for
static global variables whose addresses are taken. This allows us to
convert the following code for taking the address of a static function foo
addis r2, r30, ha16(Ll1__2E_foo_2$non_lazy_ptr-"L00001$pb")
lwz r3, lo16(Ll1__2E_foo_2$non_lazy_ptr-"L00001$pb")(r2)
which also includes linker stub code emitted at the end of the .s file not
shown here, and replace it with this:
addis r2, r30, ha16(l1__2E_foo_2-"L00001$pb")
la r3, lo16(l1__2E_foo_2-"L00001$pb")(r2)
which in addition to not needing linker help, also has no load instruction.
For those not up on PowerPC mnemonics, la is shorthand for add immediate.
llvm-svn: 18239
Diffstat (limited to 'llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp')
| -rw-r--r-- | llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp b/llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp index 465f560266a..f2fc5639574 100644 --- a/llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp +++ b/llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp @@ -703,7 +703,7 @@ void PPC32ISel::copyConstantToRegister(MachineBasicBlock *MBB, BuildMI(*MBB, IP, PPC::LOADHiAddr, 2, TmpReg) .addReg(getGlobalBaseReg(MBB, IP)).addGlobalAddress(GV); - if (GV->hasWeakLinkage() || GV->isExternal() || isa<Function>(GV)) { + if (GV->hasWeakLinkage() || GV->isExternal()) { BuildMI(*MBB, IP, PPC::LWZ, 2, R).addGlobalAddress(GV).addReg(TmpReg); } else { BuildMI(*MBB, IP, PPC::LA, 2, R).addReg(TmpReg).addGlobalAddress(GV); |

