summaryrefslogtreecommitdiff
path: root/gcc/recog.c
diff options
context:
space:
mode:
authoramylaar <amylaar@138bc75d-0d04-0410-961f-82ee72b054a4>2005-03-02 22:02:32 +0000
committeramylaar <amylaar@138bc75d-0d04-0410-961f-82ee72b054a4>2005-03-02 22:02:32 +0000
commit82880dfd5cfbedf5fd319d079e242d61b95fc57f (patch)
tree2e930d7443fe4dbacbd3f498df67cff02962fe05 /gcc/recog.c
parentf664da299a9f3b7eed0b9c9659419126aa836b97 (diff)
downloadgcc-82880dfd5cfbedf5fd319d079e242d61b95fc57f.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@95813 138bc75d-0d04-0410-961f-82ee72b054a4
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 1c0e27e27b3..224df47cf8c 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