This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [committed] Shorten non PIC PA 1.1 calls on hppa-hpux
- From: "John David Anglin" <dave at hiauly1 dot hia dot nrc dot ca>
- To: dave at hiauly1 dot hia dot nrc dot ca (John David Anglin)
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 24 Nov 2009 19:49:15 -0500 (EST)
- Subject: Re: [committed] Shorten non PIC PA 1.1 calls on hppa-hpux
> The enclosed change shortens long PA 1.x calls when not generating PIC
> code. In this case, we can just use space register sr4 for the be and
> bel branch instructions, avoiding two instructions to load the space
> register of the call destination. This is always a stub in the current
> space.
Sigh, I was wrong about there always being a stub in the current space.
With the above change, we get an ICE building the current trunk. The
attached patch revises the change to only use the sr4 short form when
the call target binds local. The problem affects 32-bit hppa*-*-hpux*.
Current change was tested on hppa2.0w-hp-hpux11.11 and hppa64-hp-hpux11.11,
trunk and 4.4 branches with no regressions. Committed to trunk and 4.4.
Dave
--
J. David Anglin dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada (613) 990-0752 (FAX: 952-6602)
2009-11-24 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
* pa.c (output_call): Only use sr4 for long interspace calls if
call binds local and generating non PIC code.
(attr_length_call): Adjust length calculation for above.
Index: config/pa/pa.c
===================================================================
--- config/pa/pa.c (revision 152888)
+++ config/pa/pa.c (working copy)
@@ -7437,7 +7437,7 @@
{
length += 20;
- if (!TARGET_PA_20 && !TARGET_NO_SPACE_REGS && flag_pic)
+ if (!TARGET_PA_20 && !TARGET_NO_SPACE_REGS && (!local_call || flag_pic))
length += 8;
}
@@ -7457,7 +7457,7 @@
if (!sibcall)
length += 8;
- if (!TARGET_NO_SPACE_REGS && flag_pic)
+ if (!TARGET_NO_SPACE_REGS && (!local_call || flag_pic))
length += 8;
}
}
@@ -7654,7 +7654,7 @@
if (!sibcall && !TARGET_PA_20)
{
output_asm_insn ("{bl|b,l} .+8,%%r2", xoperands);
- if (TARGET_NO_SPACE_REGS)
+ if (TARGET_NO_SPACE_REGS || (local_call && !flag_pic))
output_asm_insn ("addi 8,%%r2,%%r2", xoperands);
else
output_asm_insn ("addi 16,%%r2,%%r2", xoperands);
@@ -7679,20 +7679,20 @@
}
else
{
- if (!TARGET_NO_SPACE_REGS && flag_pic)
+ if (!TARGET_NO_SPACE_REGS && (!local_call || flag_pic))
output_asm_insn ("ldsid (%%r1),%%r31\n\tmtsp %%r31,%%sr0",
xoperands);
if (sibcall)
{
- if (TARGET_NO_SPACE_REGS || !flag_pic)
+ if (TARGET_NO_SPACE_REGS || (local_call && !flag_pic))
output_asm_insn ("be 0(%%sr4,%%r1)", xoperands);
else
output_asm_insn ("be 0(%%sr0,%%r1)", xoperands);
}
else
{
- if (TARGET_NO_SPACE_REGS || !flag_pic)
+ if (TARGET_NO_SPACE_REGS || (local_call && !flag_pic))
output_asm_insn ("ble 0(%%sr4,%%r1)", xoperands);
else
output_asm_insn ("ble 0(%%sr0,%%r1)", xoperands);