summaryrefslogtreecommitdiff
path: root/gcc/ra.c
diff options
context:
space:
mode:
authordje <dje@138bc75d-0d04-0410-961f-82ee72b054a4>2004-07-29 14:49:22 +0000
committerdje <dje@138bc75d-0d04-0410-961f-82ee72b054a4>2004-07-29 14:49:22 +0000
commit4711b23a824ecef074c0959dfd96290decec2957 (patch)
treee47884bc158f810bb28401260833e164be0f927e /gcc/ra.c
parent67f7113c7606c53c4a76d85760e513b4a148483c (diff)
downloadgcc-4711b23a824ecef074c0959dfd96290decec2957.tar.gz
2004-07-29 Pat Haugen <pthaugen@us.ibm.com>
* ra.h (single_reg_in_regclass): Declare. * ra.c (single_reg_in_regclass): Define. (first_hard_reg): New. (init_ra): Initialize single_reg_in_regclass. * ra-colorize.c (ok_class): New. (coalesce, aggressive_coalesce, extended_coalesce_2): Use it. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@85300 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ra.c')
-rw-r--r--gcc/ra.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/ra.c b/gcc/ra.c
index acc1be57e33..c1098e4c5fc 100644
--- a/gcc/ra.c
+++ b/gcc/ra.c
@@ -84,6 +84,7 @@
* use the constraints from asms
*/
+static int first_hard_reg (HARD_REG_SET);
static struct obstack ra_obstack;
static void create_insn_info (struct df *);
static void free_insn_info (void);
@@ -147,6 +148,7 @@ int orig_max_uid;
HARD_REG_SET never_use_colors;
HARD_REG_SET usable_regs[N_REG_CLASSES];
unsigned int num_free_regs[N_REG_CLASSES];
+int single_reg_in_regclass[N_REG_CLASSES];
HARD_REG_SET hardregs_for_mode[NUM_MACHINE_MODES];
HARD_REG_SET invalid_mode_change_regs;
unsigned char byte2bitcount[256];
@@ -212,6 +214,19 @@ hard_regs_count (HARD_REG_SET rs)
return count;
}
+/* Returns the first hardreg in HARD_REG_SET RS. Assumes there is at
+ least one reg in the set. */
+
+static int
+first_hard_reg (HARD_REG_SET rs)
+{
+ int c;
+ for (c = 0; c < FIRST_PSEUDO_REGISTER && !TEST_HARD_REG_BIT (rs, c); c++)
+ if (c == FIRST_PSEUDO_REGISTER)
+ abort();
+ return c;
+}
+
/* Basically like emit_move_insn (i.e. validifies constants and such),
but also handle MODE_CC moves (but then the operands must already
be basically valid. */
@@ -515,6 +530,10 @@ init_ra (void)
size = hard_regs_count (rs);
num_free_regs[i] = size;
COPY_HARD_REG_SET (usable_regs[i], rs);
+ if (size == 1)
+ single_reg_in_regclass[i] = first_hard_reg (rs);
+ else
+ single_reg_in_regclass[i] = -1;
}
/* Setup hardregs_for_mode[].