[patch] expose register class api

DJ Delorie dj@redhat.com
Tue Mar 20 18:33:00 GMT 2007


The other patch I discussed last week.  The MeP port permits the user
to define the coprocessor registers (availability and grouping) in a
system-wide header file with pragmas.  Thus, we need to re-initialize
the register class info.  Yes, the MeP backend ensures that the source
doesn't redefine the registers once compilation starts; we're
basically doing the same thing as OVERRIDE_OPTIONS, but from within
the source.  Since the register classes can be defined (we allow up to
four user-specified classes for use in inline asms), we need access to
the subclasses array in order to generate union classes and such.

No regressions on i686.  Ok?

	* hard-reg-set.h (reg_class_subclasses): Declare.
	* rtl.h (init_reg_sets_1): Declare.
	* regclass.c (init_reg_sets_1): Make global.
	(reg_class_subclasses): Make global.

Index: hard-reg-set.h
===================================================================
--- hard-reg-set.h	(revision 123090)
+++ hard-reg-set.h	(working copy)
@@ -461,12 +461,16 @@ extern int inv_reg_alloc_order[FIRST_PSE
 extern HARD_REG_SET reg_class_contents[N_REG_CLASSES];
 
 /* For each reg class, number of regs it contains.  */
 
 extern unsigned int reg_class_size[N_REG_CLASSES];
 
+/* For each reg class, table listing all the classes contained in it.  */
+
+extern enum reg_class reg_class_subclasses[N_REG_CLASSES][N_REG_CLASSES];
+
 /* For each pair of reg classes,
    a largest reg class contained in their union.  */
 
 extern enum reg_class reg_class_subunion[N_REG_CLASSES][N_REG_CLASSES];
 
 /* For each pair of reg classes,
Index: regclass.c
===================================================================
--- regclass.c	(revision 123090)
+++ regclass.c	(working copy)
@@ -46,13 +46,12 @@ Software Foundation, 51 Franklin Street,
 #include "output.h"
 #include "ggc.h"
 #include "timevar.h"
 #include "hashtab.h"
 #include "target.h"
 
-static void init_reg_sets_1 (void);
 static void init_reg_autoinc (void);
 
 /* If we have auto-increment or auto-decrement and we can have secondary
    reloads, we are not allowed to use classes requiring secondary
    reloads for pseudos auto-incremented since reload can't handle it.  */
 /* We leave it to target hooks to decide if we have secondary reloads, so
@@ -170,13 +169,13 @@ unsigned int reg_class_size[N_REG_CLASSE
 /* For each reg class, table listing all the containing classes.  */
 
 static enum reg_class reg_class_superclasses[N_REG_CLASSES][N_REG_CLASSES];
 
 /* For each reg class, table listing all the classes contained in it.  */
 
-static enum reg_class reg_class_subclasses[N_REG_CLASSES][N_REG_CLASSES];
+enum reg_class reg_class_subclasses[N_REG_CLASSES][N_REG_CLASSES];
 
 /* For each pair of reg classes,
    a largest reg class contained in their union.  */
 
 enum reg_class reg_class_subunion[N_REG_CLASSES][N_REG_CLASSES];
 
@@ -300,13 +299,13 @@ init_reg_sets (void)
 #endif
 }
 
 /* After switches have been processed, which perhaps alter
    `fixed_regs' and `call_used_regs', convert them to HARD_REG_SETs.  */
 
-static void
+void
 init_reg_sets_1 (void)
 {
   unsigned int i, j;
   unsigned int /* enum machine_mode */ m;
 
   /* This macro allows the fixed or call-used registers
Index: rtl.h
===================================================================
--- rtl.h	(revision 123090)
+++ rtl.h	(working copy)
@@ -2172,12 +2172,13 @@ extern void regclass_init (void);
 extern void regclass (rtx, int);
 extern void reg_scan (rtx, unsigned int);
 extern void reg_scan_update (rtx, rtx, unsigned int);
 extern void fix_register (const char *, int, int);
 extern void init_subregs_of_mode (void);
 extern void record_subregs_of_mode (rtx);
+extern void init_reg_sets_1 (void);
 #ifdef HARD_CONST
 extern void cannot_change_mode_set_regs (HARD_REG_SET *,
 					 enum machine_mode, unsigned int);
 #endif
 extern bool invalid_mode_change_p (unsigned int, enum reg_class,
 				   enum machine_mode);



More information about the Gcc-patches mailing list