Just to follow up on this email since I looked into some of the
issues a little more last night.
Andrew Pinski/R&D/SCEA wrote on 04/17/2006 08:21:01 AM:
> I decided to look into the Yara branch to see if it could even be
> bootstrap on PPC (with Yara turned on by default).
>
> I ran into an ICE while compiling libgcc2.c for __muldi3.
> The ICE was in emit_secondary_memory_move.
> The preprocessed source is:
> typedef int SItype __attribute__ ((mode (SI)));
> typedef int DItype __attribute__ ((mode (DI)));
> struct DWstruct {SItype high, low;};
> typedef union
> {
> struct DWstruct s;
> DItype ll;
> } DWunion;
> DItype __muldi3 (DItype u)
> {
> DWunion w;
> w.ll = 0;
> w.s.high = u;
> return w.ll;
> }
The problem here is the translation table is broken.
Here is what we get on powerpc-darwin:
Class cover:
FLOAT_REGS NON_FLOAT_REGS
Class translation:
NO_REGS -> NO_REGS
BASE_REGS -> NO_REGS
GENERAL_REGS -> NO_REGS
FLOAT_REGS -> FLOAT_REGS
ALTIVEC_REGS -> NO_REGS
VRSAVE_REGS -> NO_REGS
VSCR_REGS -> NO_REGS
SPE_ACC_REGS -> NO_REGS
SPEFSCR_REGS -> NO_REGS
NON_SPECIAL_REGS -> NO_REGS
MQ_REGS -> NON_FLOAT_REGS
LINK_REGS -> NON_FLOAT_REGS
CTR_REGS -> NON_FLOAT_REGS
LINK_OR_CTR_REGS -> NON_FLOAT_REGS
SPECIAL_REGS -> NO_REGS
SPEC_OR_GEN_REGS -> NO_REGS
CR0_REGS -> NON_FLOAT_REGS
CR_REGS -> NON_FLOAT_REGS
NON_FLOAT_REGS -> NON_FLOAT_REGS
XER_REGS -> NO_REGS
ALL_REGS -> NO_REGS
GENERAL_REGS points to NO_REGS which means we always spill :(.
This is the same issue as the thrid problem in fact.
>
---------------------------------------------------------------------------
>
> And then I decided just to look into code generation:
> int f(void)
> {
> return 0;
> }
>
>
---------------------------------------------------------------------------
> With the above code, I noticed that GCC saved and restored
> the link register which is not needed because this is a leaf function.
The saving and restoring of the link register can be solved by the
attached
patch which should also help x86 code gen at the same time (I have not
bootstrapped
it yet there).
-- Pinski
Index: yara.c
===================================================================
--- yara.c (revision 112997)
+++ yara.c (working copy)
@@ -449,6 +449,12 @@ gate_yara (void)
static unsigned int
rest_of_handle_yara (void)
{
+
+ /* Determine if the current function is a leaf before running reload
+ since this can impact optimizations done by the prologue and
+ epilogue thus changing register elimination offsets. */
+ current_function_is_leaf = leaf_function_p ();
+
compact_blocks ();
/* Allocate the reg_renumber array. */