From 0896cc668adddc0be62f009679e1e7236ecec0e6 Mon Sep 17 00:00:00 2001 From: Jeff Law Date: Fri, 28 May 2010 16:19:22 -0600 Subject: ira.c (ira_bad_reload_regno, [...]): New functions. * ira.c (ira_bad_reload_regno, ira_build_reload_regno_1): New functions. * ira.h (ira_bad_reload_regno): Declare * reload1.c (allocate_reload_reg): Use ira_bad_reload_regno. From-SVN: r160001 --- gcc/ira.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'gcc/ira.c') diff --git a/gcc/ira.c b/gcc/ira.c index 10be6da..84d7bc1 100644 --- a/gcc/ira.c +++ b/gcc/ira.c @@ -1374,6 +1374,46 @@ setup_prohibited_mode_move_regs (void) +/* Return nonzero if REGNO is a particularly bad choice for reloading X. */ +static bool +ira_bad_reload_regno_1 (int regno, rtx x) +{ + int x_regno; + ira_allocno_t a; + enum reg_class pref; + + /* We only deal with pseudo regs. */ + if (! x || GET_CODE (x) != REG) + return false; + + x_regno = REGNO (x); + if (x_regno < FIRST_PSEUDO_REGISTER) + return false; + + /* If the pseudo prefers REGNO explicitly, then do not consider + REGNO a bad spill choice. */ + pref = reg_preferred_class (x_regno); + if (reg_class_size[pref] == 1) + return !TEST_HARD_REG_BIT (reg_class_contents[pref], regno); + + /* If the pseudo conflicts with REGNO, then we consider REGNO a + poor choice for a reload regno. */ + a = ira_regno_allocno_map[x_regno]; + if (TEST_HARD_REG_BIT (ALLOCNO_TOTAL_CONFLICT_HARD_REGS (a), regno)) + return true; + + return false; +} + +/* Return nonzero if REGNO is a particularly bad choice for reloading + IN or OUT. */ +bool +ira_bad_reload_regno (int regno, rtx in, rtx out) +{ + return (ira_bad_reload_regno_1 (regno, in) + || ira_bad_reload_regno_1 (regno, out)); +} + /* Function specific hard registers that can not be used for the register allocation. */ HARD_REG_SET ira_no_alloc_regs; -- cgit v1.1