This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [mips] generate PIC jump tables for n32 and n64
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: Eric Christopher <echristo at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: 06 Nov 2002 18:57:58 -0200
- Subject: Re: [mips] generate PIC jump tables for n32 and n64
- Organization: GCC Team, Red Hat
- References: <or65w6yq45.fsf@free.redhat.lsd.ic.unicamp.br><1034554661.2029.5.camel@ghostwheel><or3cqv2wlc.fsf@free.redhat.lsd.ic.unicamp.br><1036614397.8249.5.camel@ghostwheel>
On Nov 6, 2002, Eric Christopher <echristo@redhat.com> wrote:
>> bootstrapped it on another mips64 port I'm working on. Are the
>> mips-specific parts ok for b-i-b?
> OK for b-i-b with the TARGET_GAS changes we talked about offline.
Thanks, here's the patch I've just checked in. Tested on IRIX 6 and
on the other, gas-based mips64 port.
Index: gcc/ChangeLog
from Alexandre Oliva <aoliva@redhat.com>
* config/mips/mips.h (ASM_OUTPUT_ADDR_DIFF_ELT): Output
.gpword/.gpdword for ABI_N32 and ABI_64 too, if using the GNU
assembler.
* config/mips/mips.md (tablejump_internal3): Output .cpadd
before jump on ABI_N32 too.
(tablejump_internal4): Ditto on ABI_64. Increase maximum
length to match.
Index: gcc/config/mips/mips.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/mips.h,v
retrieving revision 1.215.2.9
diff -u -p -r1.215.2.9 mips.h
--- gcc/config/mips/mips.h 5 Nov 2002 19:12:07 -0000 1.215.2.9
+++ gcc/config/mips/mips.h 6 Nov 2002 20:55:24 -0000
@@ -4402,7 +4402,9 @@ do { \
fprintf (STREAM, "\t%s\t%sL%d-%sLS%d\n", \
Pmode == DImode ? ".dword" : ".word", \
LOCAL_LABEL_PREFIX, VALUE, LOCAL_LABEL_PREFIX, REL); \
- else if (mips_abi == ABI_32 || mips_abi == ABI_O64) \
+ else if (mips_abi == ABI_32 || mips_abi == ABI_O64 \
+ || mips_abi == ABI_N32 \
+ || (TARGET_GAS && mips_abi == ABI_64)) \
fprintf (STREAM, "\t%s\t%sL%d\n", \
Pmode == DImode ? ".gpdword" : ".gpword", \
LOCAL_LABEL_PREFIX, VALUE); \
Index: gcc/config/mips/mips.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/mips.md,v
retrieving revision 1.141.2.4
diff -u -p -r1.141.2.4 mips.md
--- gcc/config/mips/mips.md 5 Nov 2002 19:12:07 -0000 1.141.2.4
+++ gcc/config/mips/mips.md 6 Nov 2002 20:55:27 -0000
@@ -9783,7 +9783,7 @@ move\\t%0,%z4\\n\\
"*
{
/* .cpadd expands to add REG,REG,$gp when pic, and nothing when not pic. */
- if (mips_abi == ABI_32 || mips_abi == ABI_O64)
+ if (mips_abi == ABI_32 || mips_abi == ABI_O64 || mips_abi == ABI_N32)
output_asm_insn (\".cpadd\\t%0\", operands);
return \"%*j\\t%0\";
}"
@@ -9811,9 +9811,16 @@ move\\t%0,%z4\\n\\
"Pmode == DImode && next_active_insn (insn) != 0
&& GET_CODE (PATTERN (next_active_insn (insn))) == ADDR_DIFF_VEC
&& PREV_INSN (next_active_insn (insn)) == operands[1]"
- "%*j\\t%0"
+ "*
+{
+ /* .cpadd expands to add REG,REG,$gp when pic, and nothing when not pic. */
+ if (TARGET_GAS && mips_abi == ABI_64)
+ output_asm_insn (\".cpadd\\t%0\", operands);
+ return \"%*j\\t%0\";
+}"
[(set_attr "type" "jump")
- (set_attr "mode" "none")])
+ (set_attr "mode" "none")
+ (set_attr "length" "8")])
;; Implement a switch statement when generating embedded PIC code.
;; Switches are implemented by `tablejump' when not using -membedded-pic.
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva@{redhat.com, gcc.gnu.org}
CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist Professional serial bug killer