summaryrefslogtreecommitdiff
path: root/gcc/global.c
diff options
context:
space:
mode:
authoramodra <amodra@138bc75d-0d04-0410-961f-82ee72b054a4>2003-12-06 12:22:31 +0000
committeramodra <amodra@138bc75d-0d04-0410-961f-82ee72b054a4>2003-12-06 12:22:31 +0000
commit706382f7a1477154e2d1e4a0a61ffff2c20dcd58 (patch)
tree806d63a055d1e8b44cd4e930d2d4c903a4cfaee2 /gcc/global.c
parenta0ecb4a2815864fc3773d6d62b6379b88e59f7f8 (diff)
downloadgcc-706382f7a1477154e2d1e4a0a61ffff2c20dcd58.tar.gz
PR 13169
* basic-block.h (PROP_ASM_SCAN): Define. * final.c (regs_asm_clobbered): New array. * regs.h (regs_asm_clobbered): Declare. * flow.c (life_analysis): Init it. (mark_set_regs): Set PROP_ASM_SCAN for asms. (mark_set_1): Set regs_asm_clobbered. * global.c (global_alloc): Don't set eliminable_regset when regs_asm_clobbered. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@74363 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/global.c')
-rw-r--r--gcc/global.c40
1 files changed, 30 insertions, 10 deletions
diff --git a/gcc/global.c b/gcc/global.c
index c808e207406..c337cd41cfc 100644
--- a/gcc/global.c
+++ b/gcc/global.c
@@ -343,22 +343,42 @@ global_alloc (FILE *file)
#ifdef ELIMINABLE_REGS
for (i = 0; i < ARRAY_SIZE (eliminables); i++)
{
- SET_HARD_REG_BIT (eliminable_regset, eliminables[i].from);
+ bool cannot_elim
+ = (! CAN_ELIMINATE (eliminables[i].from, eliminables[i].to)
+ || (eliminables[i].to == STACK_POINTER_REGNUM && need_fp));
- if (! CAN_ELIMINATE (eliminables[i].from, eliminables[i].to)
- || (eliminables[i].to == STACK_POINTER_REGNUM && need_fp))
- SET_HARD_REG_BIT (no_global_alloc_regs, eliminables[i].from);
+ if (!regs_asm_clobbered[eliminables[i].from])
+ {
+ SET_HARD_REG_BIT (eliminable_regset, eliminables[i].from);
+
+ if (cannot_elim)
+ SET_HARD_REG_BIT (no_global_alloc_regs, eliminables[i].from);
+ }
+ else if (cannot_elim)
+ error ("%s cannot be used in asm here",
+ reg_names[eliminables[i].from]);
}
#if FRAME_POINTER_REGNUM != HARD_FRAME_POINTER_REGNUM
- SET_HARD_REG_BIT (eliminable_regset, HARD_FRAME_POINTER_REGNUM);
- if (need_fp)
- SET_HARD_REG_BIT (no_global_alloc_regs, HARD_FRAME_POINTER_REGNUM);
+ if (!regs_asm_clobbered[HARD_FRAME_POINTER_REGNUM])
+ {
+ SET_HARD_REG_BIT (eliminable_regset, HARD_FRAME_POINTER_REGNUM);
+ if (need_fp)
+ SET_HARD_REG_BIT (no_global_alloc_regs, HARD_FRAME_POINTER_REGNUM);
+ }
+ else if (need_fp)
+ error ("%s cannot be used in asm here",
+ reg_names[HARD_FRAME_POINTER_REGNUM]);
#endif
#else
- SET_HARD_REG_BIT (eliminable_regset, FRAME_POINTER_REGNUM);
- if (need_fp)
- SET_HARD_REG_BIT (no_global_alloc_regs, FRAME_POINTER_REGNUM);
+ if (!regs_asm_clobbered[FRAME_POINTER_REGNUM])
+ {
+ SET_HARD_REG_BIT (eliminable_regset, FRAME_POINTER_REGNUM);
+ if (need_fp)
+ SET_HARD_REG_BIT (no_global_alloc_regs, FRAME_POINTER_REGNUM);
+ }
+ else if (need_fp)
+ error ("%s cannot be used in asm here", reg_names[FRAME_POINTER_REGNUM]);
#endif
/* Track which registers have already been used. Start with registers