From feb01ed5e0714ac8826a84829a04dcfd3575ee30 Mon Sep 17 00:00:00 2001 From: danglin Date: Tue, 11 Mar 2008 23:37:11 +0000 Subject: [PATCH] * pa.h (TARGET_LONG_PIC_SDIFF_CALL): Conditionalize define on TARGET_HPUX. Revise comment. (TARGET_LONG_PIC_PCREL_CALL): Revise comment. * pa.c (output_call): Update for revised TARGET_LONG_PIC_SDIFF_CALL. Use sr4 variant of `be' instruction when not generating PIC code. (attr_length_call): Adjust for above change. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@133123 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 9 +++++++++ gcc/config/pa/pa.c | 24 +++++++++++------------- gcc/config/pa/pa.h | 23 ++++++++++++----------- 3 files changed, 32 insertions(+), 24 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 510ccb0..f004924 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2008-03-11 John David Anglin + + * pa.h (TARGET_LONG_PIC_SDIFF_CALL): Conditionalize define on + TARGET_HPUX. Revise comment. + (TARGET_LONG_PIC_PCREL_CALL): Revise comment. + * pa.c (output_call): Update for revised TARGET_LONG_PIC_SDIFF_CALL. + Use sr4 variant of `be' instruction when not generating PIC code. + (attr_length_call): Adjust for above change. + 2008-03-11 Andrew Pinski * ipa-reference.c (static_execute): Remove module_statics_const and diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c index c270e4b..8076c40 100644 --- a/gcc/config/pa/pa.c +++ b/gcc/config/pa/pa.c @@ -7417,14 +7417,13 @@ attr_length_call (rtx insn, int sibcall) length += 12; /* long pc-relative branch sequence. */ - else if ((TARGET_SOM && TARGET_LONG_PIC_SDIFF_CALL) - || (TARGET_64BIT && !TARGET_GAS) + else if (TARGET_LONG_PIC_SDIFF_CALL || (TARGET_GAS && !TARGET_SOM && (TARGET_LONG_PIC_PCREL_CALL || local_call))) { length += 20; - if (!TARGET_PA_20 && !TARGET_NO_SPACE_REGS) + if (!TARGET_PA_20 && !TARGET_NO_SPACE_REGS && flag_pic) length += 8; } @@ -7444,7 +7443,7 @@ attr_length_call (rtx insn, int sibcall) if (!sibcall) length += 8; - if (!TARGET_NO_SPACE_REGS) + if (!TARGET_NO_SPACE_REGS && flag_pic) length += 8; } } @@ -7528,7 +7527,7 @@ output_call (rtx insn, rtx call_dest, int sibcall) of increasing length and complexity. In most cases, they don't allow an instruction in the delay slot. */ if (!((TARGET_LONG_ABS_CALL || local_call) && !flag_pic) - && !(TARGET_SOM && TARGET_LONG_PIC_SDIFF_CALL) + && !TARGET_LONG_PIC_SDIFF_CALL && !(TARGET_GAS && !TARGET_SOM && (TARGET_LONG_PIC_PCREL_CALL || local_call)) && !TARGET_64BIT) @@ -7574,13 +7573,12 @@ output_call (rtx insn, rtx call_dest, int sibcall) } else { - if ((TARGET_SOM && TARGET_LONG_PIC_SDIFF_CALL) - || (TARGET_64BIT && !TARGET_GAS)) + if (TARGET_LONG_PIC_SDIFF_CALL) { /* The HP assembler and linker can handle relocations - for the difference of two symbols. GAS and the HP - linker can't do this when one of the symbols is - external. */ + for the difference of two symbols. The HP assembler + recognizes the sequence as a pc-relative call and + the linker provides stubs when needed. */ xoperands[1] = gen_label_rtx (); output_asm_insn ("{bl|b,l} .+8,%%r1", xoperands); output_asm_insn ("addil L'%0-%l1,%%r1", xoperands); @@ -7665,20 +7663,20 @@ output_call (rtx insn, rtx call_dest, int sibcall) } else { - if (!TARGET_NO_SPACE_REGS) + if (!TARGET_NO_SPACE_REGS && flag_pic) output_asm_insn ("ldsid (%%r1),%%r31\n\tmtsp %%r31,%%sr0", xoperands); if (sibcall) { - if (TARGET_NO_SPACE_REGS) + if (TARGET_NO_SPACE_REGS || !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) + if (TARGET_NO_SPACE_REGS || !flag_pic) output_asm_insn ("ble 0(%%sr4,%%r1)", xoperands); else output_asm_insn ("ble 0(%%sr0,%%r1)", xoperands); diff --git a/gcc/config/pa/pa.h b/gcc/config/pa/pa.h index f8cf9d2..07f675e 100644 --- a/gcc/config/pa/pa.h +++ b/gcc/config/pa/pa.h @@ -101,17 +101,18 @@ extern int flag_pa_unix; calls. They are used only in non-pic code. */ #define TARGET_LONG_ABS_CALL (TARGET_SOM && !TARGET_GAS) -/* Define to a C expression evaluating to true to use long pic symbol - difference calls. This is a call variant similar to the long pic - pc-relative call. Long pic symbol difference calls are only used with - the HP SOM linker. Currently, only the HP assembler supports these - calls. GAS doesn't allow an arbitrary difference of two symbols. */ -#define TARGET_LONG_PIC_SDIFF_CALL (!TARGET_GAS) - -/* Define to a C expression evaluating to true to use long pic - pc-relative calls. Long pic pc-relative calls are only used with - GAS. Currently, they are usable for calls within a module but - not for external calls. */ +/* Define to a C expression evaluating to true to use long PIC symbol + difference calls. Long PIC symbol difference calls are only used with + the HP assembler and linker. The HP assembler detects this instruction + sequence and treats it as long pc-relative call. Currently, GAS only + allows a difference of two symbols in the same subspace, and it doesn't + detect the sequence as a pc-relative call. */ +#define TARGET_LONG_PIC_SDIFF_CALL (!TARGET_GAS && TARGET_HPUX) + +/* Define to a C expression evaluating to true to use long PIC + pc-relative calls. Long PIC pc-relative calls are only used with + GAS. Currently, they are usable for calls which bind local to a + module but not for external calls. */ #define TARGET_LONG_PIC_PCREL_CALL 0 /* Define to a C expression evaluating to true to use SOM secondary -- 2.7.4