summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2010-06-30 06:12:22 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2010-06-30 06:12:22 +0000
commit4573d576a70a67d1f7a1c75282340ecaf8ecc587 (patch)
tree94a5923625f40d69409e2f1f008709fbeff934c4 /gcc
parente3a4b3ceab170db22a112187b36cbe5255e312d0 (diff)
downloadgcc-4573d576a70a67d1f7a1c75282340ecaf8ecc587.tar.gz
PR debug/44694
* cselib.h (cselib_preserve_cfa_base_value): Add regno argument. * cselib.c (cfa_base_preserved_regno): New static variable. (cselib_reset_table): Don't reset cfa_base_preserved_regno instead of REGNO (cfa_base_preserved_val->locs->loc). (cselib_preserve_cfa_base_value): Add regno argument, set cfa_base_preserved_regno to it. (cselib_invalidate_regno): Allow removal of registers other than cfa_base_preserved_regno from cfa_base_preserved_val. (cselib_finish): Set cfa_base_preserved_regno to INVALID_REGNUM. * var-tracking.c (adjust_mems): Replace sp or hfp even outside of MEM addresses, if not on LHS. (reverse_op): Don't add reverse ops for cfa_base_rtx. (vt_init_cfa_base): Adjust cselib_preserve_cfa_base_value caller. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@161587 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog17
-rw-r--r--gcc/cselib.c15
-rw-r--r--gcc/cselib.h2
-rw-r--r--gcc/var-tracking.c11
4 files changed, 36 insertions, 9 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 42e0295a95a..40f79171d6c 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,20 @@
+2010-06-30 Jakub Jelinek <jakub@redhat.com>
+
+ PR debug/44694
+ * cselib.h (cselib_preserve_cfa_base_value): Add regno argument.
+ * cselib.c (cfa_base_preserved_regno): New static variable.
+ (cselib_reset_table): Don't reset cfa_base_preserved_regno instead
+ of REGNO (cfa_base_preserved_val->locs->loc).
+ (cselib_preserve_cfa_base_value): Add regno argument, set
+ cfa_base_preserved_regno to it.
+ (cselib_invalidate_regno): Allow removal of registers other than
+ cfa_base_preserved_regno from cfa_base_preserved_val.
+ (cselib_finish): Set cfa_base_preserved_regno to INVALID_REGNUM.
+ * var-tracking.c (adjust_mems): Replace sp or hfp even outside
+ of MEM addresses, if not on LHS.
+ (reverse_op): Don't add reverse ops for cfa_base_rtx.
+ (vt_init_cfa_base): Adjust cselib_preserve_cfa_base_value caller.
+
2010-06-30 Bernd Schmidt <bernds@codesourcery.com>
* recog.c (peep2_do_rebuild_jump_labels, peep2_do_cleanup_cfg): New
diff --git a/gcc/cselib.c b/gcc/cselib.c
index 5e819cd9797..28ed6d7b348 100644
--- a/gcc/cselib.c
+++ b/gcc/cselib.c
@@ -178,6 +178,7 @@ static cselib_val dummy_val;
that is constant through the whole function and should never be
eliminated. */
static cselib_val *cfa_base_preserved_val;
+static unsigned int cfa_base_preserved_regno;
/* Used to list all values that contain memory reference.
May or may not contain the useless values - the list is compacted
@@ -338,7 +339,7 @@ cselib_reset_table (unsigned int num)
if (cfa_base_preserved_val)
{
- unsigned int regno = REGNO (cfa_base_preserved_val->locs->loc);
+ unsigned int regno = cfa_base_preserved_regno;
unsigned int new_used_regs = 0;
for (i = 0; i < n_used_regs; i++)
if (used_regs[i] == regno)
@@ -571,12 +572,15 @@ cselib_preserved_value_p (cselib_val *v)
never invalidated and preserved across cselib_reset_table calls. */
void
-cselib_preserve_cfa_base_value (cselib_val *v)
+cselib_preserve_cfa_base_value (cselib_val *v, unsigned int regno)
{
if (cselib_preserve_constants
&& v->locs
&& REG_P (v->locs->loc))
- cfa_base_preserved_val = v;
+ {
+ cfa_base_preserved_val = v;
+ cfa_base_preserved_regno = regno;
+ }
}
/* Clean all non-constant expressions in the hash table, but retain
@@ -1783,7 +1787,9 @@ cselib_invalidate_regno (unsigned int regno, enum machine_mode mode)
if (i < FIRST_PSEUDO_REGISTER && v != NULL)
this_last = end_hard_regno (GET_MODE (v->val_rtx), i) - 1;
- if (this_last < regno || v == NULL || v == cfa_base_preserved_val)
+ if (this_last < regno || v == NULL
+ || (v == cfa_base_preserved_val
+ && i == cfa_base_preserved_regno))
{
l = &(*l)->next;
continue;
@@ -2266,6 +2272,7 @@ cselib_finish (void)
cselib_discard_hook = NULL;
cselib_preserve_constants = false;
cfa_base_preserved_val = NULL;
+ cfa_base_preserved_regno = INVALID_REGNUM;
free_alloc_pool (elt_list_pool);
free_alloc_pool (elt_loc_list_pool);
free_alloc_pool (cselib_val_pool);
diff --git a/gcc/cselib.h b/gcc/cselib.h
index 90d963888c6..4259e396fdf 100644
--- a/gcc/cselib.h
+++ b/gcc/cselib.h
@@ -99,6 +99,6 @@ extern unsigned int cselib_get_next_uid (void);
extern void cselib_preserve_value (cselib_val *);
extern bool cselib_preserved_value_p (cselib_val *);
extern void cselib_preserve_only_values (void);
-extern void cselib_preserve_cfa_base_value (cselib_val *);
+extern void cselib_preserve_cfa_base_value (cselib_val *, unsigned int);
extern void dump_cselib_table (FILE *);
diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c
index 8786a7d784c..a90ca3884d9 100644
--- a/gcc/var-tracking.c
+++ b/gcc/var-tracking.c
@@ -798,8 +798,9 @@ adjust_mems (rtx loc, const_rtx old_rtx, void *data)
switch (GET_CODE (loc))
{
case REG:
- /* Don't do any sp or fp replacements outside of MEM addresses. */
- if (amd->mem_mode == VOIDmode)
+ /* Don't do any sp or fp replacements outside of MEM addresses
+ on the LHS. */
+ if (amd->mem_mode == VOIDmode && amd->store)
return loc;
if (loc == stack_pointer_rtx
&& !frame_pointer_needed)
@@ -5193,7 +5194,9 @@ reverse_op (rtx val, const_rtx expr)
return NULL_RTX;
}
- if (!REG_P (XEXP (src, 0)) || !SCALAR_INT_MODE_P (GET_MODE (src)))
+ if (!REG_P (XEXP (src, 0))
+ || !SCALAR_INT_MODE_P (GET_MODE (src))
+ || XEXP (src, 0) == cfa_base_rtx)
return NULL_RTX;
v = cselib_lookup (XEXP (src, 0), GET_MODE (XEXP (src, 0)), 0);
@@ -8163,7 +8166,7 @@ vt_init_cfa_base (void)
val = cselib_lookup_from_insn (cfa_base_rtx, GET_MODE (cfa_base_rtx), 1,
get_insns ());
preserve_value (val);
- cselib_preserve_cfa_base_value (val);
+ cselib_preserve_cfa_base_value (val, REGNO (cfa_base_rtx));
var_reg_decl_set (&VTI (ENTRY_BLOCK_PTR)->out, cfa_base_rtx,
VAR_INIT_STATUS_INITIALIZED, dv_from_value (val->val_rtx),
0, NULL_RTX, INSERT);