diff options
author | Jan Hubicka <jh@suse.cz> | 2007-06-27 03:21:13 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2007-06-27 01:21:13 +0000 |
commit | 95e88efd101c43bb55c8584fa2bf2ccbff718401 (patch) | |
tree | d59653c3a0aa3705788cc27ac0fac2f506d86c38 /gcc/recog.c | |
parent | a652517c6f573d8069375cc4793e85eb250ba3b2 (diff) | |
download | gcc-95e88efd101c43bb55c8584fa2bf2ccbff718401.zip gcc-95e88efd101c43bb55c8584fa2bf2ccbff718401.tar.gz gcc-95e88efd101c43bb55c8584fa2bf2ccbff718401.tar.bz2 |
fwprop.c (try_fwprop_subst): Use validate_unshare_change.
* fwprop.c (try_fwprop_subst): Use validate_unshare_change.
* postreload.c (reload_cse_simplify_set): Instead of copying the rtx
early use validate_unshare_change.
(reload_combine): Likewise.
* recog.c (change_t): New field unshare.
(validate_change_1): Rename from validate_change; add argument unshare.
(validate_change): Turn into wrapper of validate_change_1; update
prototype for bools.
(validate_unshare_change): New.
(confirm_change_group): Unshare changes if asked for; avoid unnecesary
calls of df_insn_rescan.
* recog.h (validate_change): Replace ints by bools.
(validate_unshare_change): Declare.
From-SVN: r126050
Diffstat (limited to 'gcc/recog.c')
-rw-r--r-- | gcc/recog.c | 42 |
1 files changed, 38 insertions, 4 deletions
diff --git a/gcc/recog.c b/gcc/recog.c index b12541e..497188d 100644 --- a/gcc/recog.c +++ b/gcc/recog.c @@ -166,6 +166,7 @@ typedef struct change_t int old_code; rtx *loc; rtx old; + bool unshare; } change_t; static change_t *changes; @@ -191,8 +192,8 @@ static int num_changes = 0; is not valid for the machine, suppress the change and return zero. Otherwise, perform the change and return 1. */ -int -validate_change (rtx object, rtx *loc, rtx new, int in_group) +static bool +validate_change_1 (rtx object, rtx *loc, rtx new, bool in_group, bool unshare) { rtx old = *loc; @@ -219,6 +220,7 @@ validate_change (rtx object, rtx *loc, rtx new, int in_group) changes[num_changes].object = object; changes[num_changes].loc = loc; changes[num_changes].old = old; + changes[num_changes].unshare = unshare; if (object && !MEM_P (object)) { @@ -239,6 +241,25 @@ validate_change (rtx object, rtx *loc, rtx new, int in_group) return apply_change_group (); } +/* Wrapper for validate_change_1 without the UNSHARE argument defaulting + UNSHARE to false. */ + +bool +validate_change (rtx object, rtx *loc, rtx new, bool in_group) +{ + return validate_change_1 (object, loc, new, in_group, false); +} + +/* Wrapper for validate_change_1 without the UNSHARE argument defaulting + UNSHARE to true. */ + +bool +validate_unshare_change (rtx object, rtx *loc, rtx new, bool in_group) +{ + return validate_change_1 (object, loc, new, in_group, true); +} + + /* Keep X canonicalized if some changes have made it non-canonical; only modifies the operands of X, not (for example) its code. Simplifications are not the job of this routine. @@ -414,14 +435,27 @@ void confirm_change_group (void) { int i; + rtx last_object = NULL; for (i = 0; i < num_changes; i++) { rtx object = changes[i].object; - if (object && INSN_P (object)) - df_insn_rescan (object); + + if (changes[i].unshare) + *changes[i].loc = copy_rtx (*changes[i].loc); + + /* Avoid unnecesary rescaning when multiple changes to same instruction + are made. */ + if (object) + { + if (object != last_object && last_object && INSN_P (last_object)) + df_insn_rescan (last_object); + last_object = object; + } } + if (last_object && INSN_P (last_object)) + df_insn_rescan (last_object); num_changes = 0; } |