RFA: LM32: Fix building libgcc

nick clifton nickc@redhat.com
Wed Aug 22 07:23:00 GMT 2012


Hi Sébastien,

> After applying your patch, I get an assertion failure in
> emit_return_into_block, at function.c:5600 when trying to compile
> anything (line is "gcc_assert (ANY_RETURN_P (pat));").
>
> Any ideas?

Doh - I should have checked further.  The problem is the return_internal 
pattern.  emit_return_into_block() expects that in a return insn that 
contains more than one piece of RTL, the first piece of RTL will be 
(return).  This is not (currently) true for the lm23.

Fixing that let the build proceed as far as truncdfsf2.c in libgcc, 
This then fails with a return insn that does not match the return 
pattern.  This turns out to be because the "return" pattern should 
really be an expander that will work when conditions are not being 
tested.  The simplest way to fix this was to create an expander and 
rename "return" to "basic_return".

Next there is seg-fault building ffssi2 in newlib.  I do not have a fix 
for this one yet, but at least libgcc builds now.

OK to apply ?

Cheers
   Nick

gcc/ChangeLog
2012-08-21  Nick Clifton  <nickc@redhat.com>

	* config/lm32/lm32.md (return_internal): Place the (return) as the
	first element in the vector.
	(return): Changed into an expander.
	(basic_return): Renamed version of previous return pattern.

  Index: gcc/config/lm32/lm32.md
===================================================================
--- gcc/config/lm32/lm32.md	(revision 190564)
+++ gcc/config/lm32/lm32.md	(working copy)
@@ -629,16 +629,22 @@
  )

  (define_insn "return_internal"
-  [(use (match_operand:SI 0 "register_operand" "r"))
-   (return)]
+  [(return)
+   (use (match_operand:SI 0 "register_operand" "r"))]
    ""
    "b        %0"
    [(set_attr "type" "uibranch")]
  )

-(define_insn "return"
+(define_expand "return"
    [(return)]
    "lm32_can_use_return ()"
+  "lm32_expand_epilogue (); DONE;"
+)
+
+(define_insn "basic_return"
+  [(return)]
+  "lm32_can_use_return ()"
    "ret"
    [(set_attr "type" "uibranch")]
  )



More information about the Gcc-patches mailing list