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 | d4c8bea47fd3403ff1f3786b99ff11e6e1b5fc09 (patch) | |
tree | 0bd0479bbffbc234a8a950f3d81bca407c4212a9 /lib/Target/PowerPC/PPCCodeEmitter.cpp | |
parent | 4f7ac4c76c55325f657a6f051ff22c19f2d86171 (diff) | |
download | external_llvm-d4c8bea47fd3403ff1f3786b99ff11e6e1b5fc09.zip external_llvm-d4c8bea47fd3403ff1f3786b99ff11e6e1b5fc09.tar.gz external_llvm-d4c8bea47fd3403ff1f3786b99ff11e6e1b5fc09.tar.bz2 |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18239 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/PowerPC/PPCCodeEmitter.cpp')
-rw-r--r-- | lib/Target/PowerPC/PPCCodeEmitter.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/Target/PowerPC/PPCCodeEmitter.cpp b/lib/Target/PowerPC/PPCCodeEmitter.cpp index e46d0ea..2f9c8c2 100644 --- a/lib/Target/PowerPC/PPCCodeEmitter.cpp +++ b/lib/Target/PowerPC/PPCCodeEmitter.cpp @@ -199,20 +199,20 @@ int PPC32CodeEmitter::getMachineOpValue(MachineInstr &MI, MachineOperand &MO) { Offset = -((intptr_t)MovePCtoLROffset+4); if (MI.getOpcode() == PPC::LOADHiAddr) { - if (GV->hasWeakLinkage() || GV->isExternal() || isa<Function>(GV)) + if (GV->hasWeakLinkage() || GV->isExternal()) Reloc = PPC::reloc_absolute_ptr_high; // Pointer to stub else Reloc = PPC::reloc_absolute_high; // Pointer to symbol } else if (MI.getOpcode() == PPC::LA) { - assert(!(GV->hasWeakLinkage() || GV->isExternal() || isa<Function>(GV)) + assert(!(GV->hasWeakLinkage() || GV->isExternal()) && "Something in the ISEL changed\n"); Reloc = PPC::reloc_absolute_low; } else if (MI.getOpcode() == PPC::LWZ) { Reloc = PPC::reloc_absolute_ptr_low; - assert((GV->hasWeakLinkage() || GV->isExternal() || isa<Function>(GV))&& + assert((GV->hasWeakLinkage() || GV->isExternal()) && "Something in the ISEL changed\n"); } else { // These don't show up for global value references AFAIK, only for |