aboutsummaryrefslogtreecommitdiff
path: root/gcc/recog.c
diff options
context:
space:
mode:
authorJ"orn Rennecke <joern.rennecke@st.com>2005-03-02 22:02:32 +0000
committerJoern Rennecke <amylaar@gcc.gnu.org>2005-03-02 22:02:32 +0000
commit0a6348324781b62b78fb46d6210f7a023c91b3dd (patch)
tree2e930d7443fe4dbacbd3f498df67cff02962fe05 /gcc/recog.c
parent7df74013f138db3ed797e9be6759c644ba7364c3 (diff)
downloadgcc-0a6348324781b62b78fb46d6210f7a023c91b3dd.zip
gcc-0a6348324781b62b78fb46d6210f7a023c91b3dd.tar.gz
gcc-0a6348324781b62b78fb46d6210f7a023c91b3dd.tar.bz2
recog.c (verify_changes, [...]): New functions, broken out of apply_change_group.
* recog.c (verify_changes, confirm_change_group): New functions, broken out of apply_change_group. (apply_change_group): Use them. * recog.h (verify_change, confirm_change_group): Declare. * rtl.h (redirect_jump_2): Declare. * jump.c (redirect_exp, invert_exp): Delete. (invert_exp_1): Take second parameter. Return value. Changed caller. (redirect_jump_2): New function, broken out of redirect_jump. (redirect_jump): Use redirect_jump_1 and redirect_jump_2. (invert_jump): Use invert_jump_1 and redirect_jump_2. * ifcvt.c (dead_or_predicable): Use redirect_jump_2. From-SVN: r95813
Diffstat (limited to 'gcc/recog.c')
-rw-r--r--gcc/recog.c46
1 files changed, 34 insertions, 12 deletions
diff --git a/gcc/recog.c b/gcc/recog.c
index 1c0e27e..224df47 100644
--- a/gcc/recog.c
+++ b/gcc/recog.c
@@ -294,11 +294,11 @@ num_changes_pending (void)
return num_changes;
}
-/* Apply a group of changes previously issued with `validate_change'.
+/* Tentatively apply the changes numbered NUM and up.
Return 1 if all changes are valid, zero otherwise. */
int
-apply_change_group (void)
+verify_changes (int num)
{
int i;
rtx last_validated = NULL_RTX;
@@ -312,7 +312,7 @@ apply_change_group (void)
we also require that the operands meet the constraints for
the insn. */
- for (i = 0; i < num_changes; i++)
+ for (i = num; i < num_changes; i++)
{
rtx object = changes[i].object;
@@ -376,17 +376,38 @@ apply_change_group (void)
last_validated = object;
}
- if (i == num_changes)
- {
- basic_block bb;
+ return (i == num_changes);
+}
- for (i = 0; i < num_changes; i++)
- if (changes[i].object
- && INSN_P (changes[i].object)
- && (bb = BLOCK_FOR_INSN (changes[i].object)))
- bb->flags |= BB_DIRTY;
+/* A group of changes has previously been issued with validate_change and
+ verified with verify_changes. Update the BB_DIRTY flags of the affected
+ blocks, and clear num_changes. */
- num_changes = 0;
+void
+confirm_change_group (void)
+{
+ int i;
+ basic_block bb;
+
+ for (i = 0; i < num_changes; i++)
+ if (changes[i].object
+ && INSN_P (changes[i].object)
+ && (bb = BLOCK_FOR_INSN (changes[i].object)))
+ bb->flags |= BB_DIRTY;
+
+ num_changes = 0;
+}
+
+/* Apply a group of changes previously issued with `validate_change'.
+ If all changes are valid, call confirm_change_group and return 1,
+ otherwise, call cancel_changes and return 0. */
+
+int
+apply_change_group (void)
+{
+ if (verify_changes (0))
+ {
+ confirm_change_group ();
return 1;
}
else
@@ -396,6 +417,7 @@ apply_change_group (void)
}
}
+
/* Return the number of changes so far in the current group. */
int