* [ira] patch fixing a performance degradation for sh4
@ 2008-04-06 23:21 Vladimir Makarov
0 siblings, 0 replies; only message in thread
From: Vladimir Makarov @ 2008-04-06 23:21 UTC (permalink / raw)
To: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 547 bytes --]
The following patch fixes a problem reported by Kaz Kojima in
http://gcc.gnu.org/ml/gcc-patches/2008-04/msg00467.html
2008-04-06 Vladimir Makarov <vmakarov@redhat.com>
* ira-int.h (reg_class_intersect, reg_class_union): Add comments.
* hard-reg-set.h (reg_class_subclasses): New external definition.
* ira.c (setup_reg_class_intersect_union): Define for classes
containing no hard registers available for allocation.
* regclass.c (reg_class_subclasses): Make it external.
* config/sh/sh.h (IRA_COVER_CLASSES): Add TARGET_REGS.
[-- Attachment #2: sh4.patch --]
[-- Type: text/x-patch, Size: 6326 bytes --]
Index: ira-int.h
===================================================================
--- ira-int.h (revision 133926)
+++ ira-int.h (working copy)
@@ -701,9 +701,9 @@ extern enum reg_class reg_class_cover[N_
/* The value is number of elements in the subsequent array. */
extern int important_classes_num;
-/* The array containing classes (including cover classes) which are
- subclasses of cover classes. Such classes is important for
- calculation of the hard register usage costs. */
+/* The array containing non-empty classes (including non-empty cover
+ classes) which are subclasses of cover classes. Such classes is
+ important for calculation of the hard register usage costs. */
extern enum reg_class important_classes[N_REG_CLASSES];
/* The array containing indexes of important classes in the previous
@@ -718,12 +718,18 @@ extern enum reg_class class_translate[N_
/* The biggest important class inside of intersection of the two
classes (that is calculated taking only hard registers available
- for allocation into account). */
+ for allocation into account). If the both classes contain no hard
+ registers available for allocation, the value is calculated with
+ taking all hard-registers including fixed ones into account. */
extern enum reg_class reg_class_intersect[N_REG_CLASSES][N_REG_CLASSES];
/* The biggest important class inside of union of the two classes
(that is calculated taking only hard registers available for
- allocation into account). */
+ allocation into account). If the both classes contain no hard
+ registers available for allocation, the value is calculated with
+ taking all hard-registers including fixed ones into account. In
+ other words, the value is the corresponding reg_class_subunion
+ value. */
extern enum reg_class reg_class_union[N_REG_CLASSES][N_REG_CLASSES];
extern void set_non_alloc_regs (int);
Index: hard-reg-set.h
===================================================================
--- hard-reg-set.h (revision 133840)
+++ hard-reg-set.h (working copy)
@@ -561,6 +561,10 @@ extern HARD_REG_SET reg_class_contents[N
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. */
Index: ira.c
===================================================================
--- ira.c (revision 133926)
+++ ira.c (working copy)
@@ -507,9 +507,9 @@ enum reg_class reg_class_cover[N_REG_CLA
/* The value is number of elements in the subsequent array. */
int important_classes_num;
-/* The array containing classes (including cover classes) which are
- subclasses of cover classes. Such classes is important for
- calculation of the hard register usage costs. */
+/* The array containing non-empty classes (including non-empty cover
+ classes) which are subclasses of cover classes. Such classes is
+ important for calculation of the hard register usage costs. */
enum reg_class important_classes[N_REG_CLASSES];
/* The array containing indexes of important classes in the previous
@@ -645,12 +645,18 @@ setup_class_translate (void)
/* The biggest important class inside of intersection of the two
classes (that is calculated taking only hard registers available
- for allocation into account). */
+ for allocation into account). If the both classes contain no hard
+ registers available for allocation, the value is calculated with
+ taking all hard-registers including fixed ones into account. */
enum reg_class reg_class_intersect[N_REG_CLASSES][N_REG_CLASSES];
/* The biggest important class inside of union of the two classes
(that is calculated taking only hard registers available for
- allocation into account). */
+ allocation into account). If the both classes contain no hard
+ registers available for allocation, the value is calculated with
+ taking all hard-registers including fixed ones into account. In
+ other words, the value is the corresponding reg_class_subunion
+ value. */
enum reg_class reg_class_union[N_REG_CLASSES][N_REG_CLASSES];
#ifdef IRA_COVER_CLASSES
@@ -667,6 +673,24 @@ setup_reg_class_intersect_union (void)
for (cl2 = 0; cl2 < N_REG_CLASSES; cl2++)
{
reg_class_intersect[cl1][cl2] = NO_REGS;
+ COPY_HARD_REG_SET (temp_hard_regset, reg_class_contents[cl1]);
+ AND_COMPL_HARD_REG_SET (temp_hard_regset, no_unit_alloc_regs);
+ COPY_HARD_REG_SET (temp_set2, reg_class_contents[cl2]);
+ AND_COMPL_HARD_REG_SET (temp_set2, no_unit_alloc_regs);
+ if (hard_reg_set_equal_p (temp_hard_regset, zero_hard_reg_set)
+ && hard_reg_set_equal_p (temp_set2, zero_hard_reg_set))
+ {
+ for (i = 0;; i++)
+ {
+ cl3 = reg_class_subclasses[cl1][i];
+ if (cl3 == LIM_REG_CLASSES)
+ break;
+ if (reg_class_subset_p (reg_class_intersect[cl1][cl2], cl3))
+ reg_class_intersect[cl1][cl2] = cl3;
+ }
+ reg_class_union[cl1][cl2] = reg_class_subunion[cl1][cl2];
+ continue;
+ }
reg_class_union[cl1][cl2] = NO_REGS;
COPY_HARD_REG_SET (intersection_set, reg_class_contents[cl1]);
AND_HARD_REG_SET (intersection_set, reg_class_contents[cl2]);
Index: regclass.c
===================================================================
--- regclass.c (revision 133840)
+++ regclass.c (working copy)
@@ -178,7 +178,7 @@ static enum reg_class reg_class_supercla
/* 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. */
Index: config/sh/sh.h
===================================================================
--- config/sh/sh.h (revision 133927)
+++ config/sh/sh.h (working copy)
@@ -1504,7 +1504,7 @@ extern enum reg_class regno_reg_class[FI
#define IRA_COVER_CLASSES \
{ \
- GENERAL_REGS, FP_REGS, PR_REGS, T_REGS, MAC_REGS, \
+ GENERAL_REGS, FP_REGS, PR_REGS, T_REGS, MAC_REGS, TARGET_REGS, \
LIM_REG_CLASSES \
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-04-06 22:49 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-06 23:21 [ira] patch fixing a performance degradation for sh4 Vladimir Makarov
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).