public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* RFA: PIC compilation for MN10300 machine description
@ 2007-11-13 13:19 Nick Clifton
  2007-11-25 11:22 ` Alexandre Oliva
  0 siblings, 1 reply; 2+ messages in thread
From: Nick Clifton @ 2007-11-13 13:19 UTC (permalink / raw)
  To: Jeff Law, aoliva; +Cc: gcc-patches

Hi Jeff, Hi Alex,

   May I apply the patch below please ?  It makes two small changes to
   the mn10300.md file to fix problems I encountered whilst compiling
   libgcc in PIC mode.  The first is that UNSPECed call insns can be
   generated and these do not have a mode on the address.  The call
   patterns however were not matching the address without a mode and so
   gcc was terminating with an ICE for an unrecognised insn.

   The second problem was that the GOTaddr2picreg pattern was putting
   the same rtx into two insns which resulted in a sharing violation
   which was picked up later on in the compilation process.

Cheers
   Nick

gcc/ChangeLog
2007-11-13  Nick Clifton  <nickc@redhat.com>

	* config/mn10300/mn10300.md (call_internal): Remove mode on
	operand 0 in order to match UNPSEC'ed calls generated in PIC
	mode.
         (call_value_internal): Remove mode on operand 1 in order to
	match UNPSEC'ed calls generated in PIC mode.
         (GOTaddr2picreg): Use copy_rtx to prevent sharing an rtx
	between two insns.

Index: gcc/config/mn10300/mn10300.md
===================================================================
--- gcc/config/mn10300/mn10300.md	(revision 130131)
+++ gcc/config/mn10300/mn10300.md	(working copy)
@@ -1819,8 +1819,10 @@
    DONE;
  }")

+;; NB: Mode on match_operand 0 deliberately omitted in
+;;     order to be able to match UNSPECs in PIC mode.
  (define_insn "call_internal"
-  [(call (mem:QI (match_operand:SI 0 "call_address_operand" "aS"))
+  [(call (mem:QI (match_operand 0 "call_address_operand" "aS"))
  	 (match_operand:SI 1 "general_operand" "g"))]
    ""
    "*
@@ -1864,9 +1866,11 @@
    DONE;
  }")

+;; NB: Mode on match_operand 1 deliberately omitted in
+;;     order to be able to match UNSPECs in PIC mode.
  (define_insn "call_value_internal"
    [(set (match_operand 0 "" "=dax")
-	(call (mem:QI (match_operand:SI 1 "call_address_operand" "aS"))
+	(call (mem:QI (match_operand 1 "call_address_operand" "aS"))
  	      (match_operand:SI 2 "general_operand" "g")))]
    ""
    "*
@@ -2560,7 +2564,7 @@
      emit_insn (gen_am33_loadPC (operands[0]));
    else
      emit_insn (gen_mn10300_loadPC (operands[0]));
-  emit_insn (gen_add_GOT_to_pic_reg (operands[0]));
+  emit_insn (gen_add_GOT_to_pic_reg (copy_rtx (operands[0])));
    DONE;
  }
  ")

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: RFA: PIC compilation for MN10300 machine description
  2007-11-13 13:19 RFA: PIC compilation for MN10300 machine description Nick Clifton
@ 2007-11-25 11:22 ` Alexandre Oliva
  0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Oliva @ 2007-11-25 11:22 UTC (permalink / raw)
  To: Nick Clifton; +Cc: Jeff Law, gcc-patches

On Nov 13, 2007, Nick Clifton <nickc@redhat.com> wrote:

> 	* config/mn10300/mn10300.md (call_internal): Remove mode on
> 	operand 0 in order to match UNPSEC'ed calls generated in PIC
> 	mode.
>         (call_value_internal): Remove mode on operand 1 in order to
> 	match UNPSEC'ed calls generated in PIC mode.
>         (GOTaddr2picreg): Use copy_rtx to prevent sharing an rtx
> 	between two insns.

Ok, thanks

-- 
Alexandre Oliva         http://www.lsd.ic.unicamp.br/~oliva/
FSF Latin America Board Member         http://www.fsfla.org/
Red Hat Compiler Engineer   aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist  oliva@{lsd.ic.unicamp.br, gnu.org}

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-11-24 21:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-13 13:19 RFA: PIC compilation for MN10300 machine description Nick Clifton
2007-11-25 11:22 ` Alexandre Oliva

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).