diff mbox

RFA: MN10300: Fix building libstdc++-v3

Message ID 87r47k15qd.fsf@redhat.com
State New
Headers show

Commit Message

Nick Clifton Feb. 3, 2014, 5:11 p.m. UTC
Hi Jeff, Hi Alex,

  Currently the mainline MN10300 toolchain does not build the
  libstdc++-v3 library because:

    /libstdc++-v3/include/bits/locale_facets_nonio.tcc:1213:5:
    error: unable to find a register to spill in class 'EXTENDED_REGS'

    mn10300-elf/mn10300-elf/libstdc++-v3/include/bits/locale_facets_nonio.tcc:1213:5:
    internal compiler error: in spill_failure, at reload1.c:2106

  Of course the MN10300 does not have any extended registers, so it is
  not surprising that reload cannot find any to spill.  The reason why
  reload thinks that it can use the EXTENDED_REGS class however is the
  mn10300_register_move_cost() function which tells it that it only costs
  2 to move via those registers.  Hence the patch below.

  With the patch applied the libstdc++-v3 library now builds.  OK to
  apply ?

gcc/ChangeLog
2014-02-03  Nick Clifton  <nickc@redhat.com>

	* config/mn10300/mn10300.c (mn10300_register_move_cost): Prevent
	moves via extended registers in MN10300 mode.
diff mbox

Patch

Index: gcc/config/mn10300/mn10300.c
===================================================================
--- gcc/config/mn10300/mn10300.c	(revision 207416)
+++ gcc/config/mn10300/mn10300.c	(working copy)
@@ -2216,6 +2214,11 @@ 
   enum reg_class to = (enum reg_class) ito;
   enum reg_class scratch, test;
 
+  /* Make sure that moves via the extended register class
+     are too expensive to ever be chosen for the MN10300.  */
+  if (! TARGET_AM33 && (ifrom == EXTENDED_REGS || ito == EXTENDED_REGS))
+    return 100;
+
   /* Simplify the following code by unifying the fp register classes.  */
   if (to == FP_ACC_REGS)
     to = FP_REGS;