aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Coplan <alex.coplan@arm.com>2023-08-17 14:08:31 +0100
committerAlex Coplan <alex.coplan@arm.com>2023-08-17 14:08:31 +0100
commit84a5be47f8e13839efdf0e06f02ef1a0cacf5e34 (patch)
tree0376986d65918f20b70fdc2b359ff02c55672fb3
parent903d937569992a885faf8a1bf7d120e9e66f456b (diff)
downloadgcc-84a5be47f8e13839efdf0e06f02ef1a0cacf5e34.zip
gcc-84a5be47f8e13839efdf0e06f02ef1a0cacf5e34.tar.gz
gcc-84a5be47f8e13839efdf0e06f02ef1a0cacf5e34.tar.bz2
doc: Fixes to RTL-SSA sample code
This patch fixes up the code examples in the RTL-SSA documentation (the sections on making insn changes) to reflect the current API. The main issues are as follows: - rtl_ssa::recog takes an obstack_watermark & as the first parameter. Presumably this is intended to be the change attempt, so I've updated the examples to pass this through. - The variants of recog and restrict_movement that take an ignore predicate have been renamed with an _ignoring suffix, so I've updated callers to use those names. - A couple of minor "obvious" fixes to add a missing address-of operator and correct a variable name. gcc/ChangeLog: * doc/rtl.texi: Fix up sample code for RTL-SSA insn changes.
-rw-r--r--gcc/doc/rtl.texi24
1 files changed, 12 insertions, 12 deletions
diff --git a/gcc/doc/rtl.texi b/gcc/doc/rtl.texi
index 76aeafb..0ed88f5 100644
--- a/gcc/doc/rtl.texi
+++ b/gcc/doc/rtl.texi
@@ -4964,7 +4964,7 @@ the pass should check whether the new pattern matches a target
instruction or satisfies the requirements of an inline asm:
@smallexample
-if (!rtl_ssa::recog (change))
+if (!rtl_ssa::recog (attempt, change))
return false;
@end smallexample
@@ -5015,7 +5015,7 @@ if (!rtl_ssa::restrict_movement (change))
insn_change_watermark watermark;
// Use validate_change etc. to change INSN's pattern.
@dots{}
-if (!rtl_ssa::recog (change)
+if (!rtl_ssa::recog (attempt, change)
|| !rtl_ssa::change_is_worthwhile (change))
return false;
@@ -5048,7 +5048,7 @@ For example, if a pass is changing exactly two instructions,
it might do:
@smallexample
-rtl_ssa::insn_change *changes[] = @{ &change1, change2 @};
+rtl_ssa::insn_change *changes[] = @{ &change1, &change2 @};
@end smallexample
where @code{change1}'s instruction must come before @code{change2}'s.
@@ -5066,7 +5066,7 @@ in the correct order with respect to each other.
The way to do this is:
@smallexample
-if (!rtl_ssa::restrict_movement (change, insn_is_changing (changes)))
+if (!rtl_ssa::restrict_movement_ignoring (change, insn_is_changing (changes)))
return false;
@end smallexample
@@ -5078,7 +5078,7 @@ changing instructions (which might, for example, no longer need
to clobber the flags register). The way to do this is:
@smallexample
-if (!rtl_ssa::recog (change, insn_is_changing (changes)))
+if (!rtl_ssa::recog_ignoring (attempt, change, insn_is_changing (changes)))
return false;
@end smallexample
@@ -5118,28 +5118,28 @@ Putting all this together, the process for a two-instruction change is:
@smallexample
auto attempt = crtl->ssa->new_change_attempt ();
-rtl_ssa::insn_change change (insn1);
+rtl_ssa::insn_change change1 (insn1);
change1.new_defs = @dots{};
change1.new_uses = @dots{};
change1.move_range = @dots{};
-rtl_ssa::insn_change change (insn2);
+rtl_ssa::insn_change change2 (insn2);
change2.new_defs = @dots{};
change2.new_uses = @dots{};
change2.move_range = @dots{};
-rtl_ssa::insn_change *changes[] = @{ &change1, change2 @};
+rtl_ssa::insn_change *changes[] = @{ &change1, &change2 @};
auto is_changing = insn_is_changing (changes);
-if (!rtl_ssa::restrict_movement (change1, is_changing)
- || !rtl_ssa::restrict_movement (change2, is_changing))
+if (!rtl_ssa::restrict_movement_ignoring (change1, is_changing)
+ || !rtl_ssa::restrict_movement_ignoring (change2, is_changing))
return false;
insn_change_watermark watermark;
// Use validate_change etc. to change INSN1's and INSN2's patterns.
@dots{}
-if (!rtl_ssa::recog (change1, is_changing)
- || !rtl_ssa::recog (change2, is_changing)
+if (!rtl_ssa::recog_ignoring (attempt, change1, is_changing)
+ || !rtl_ssa::recog_ignoring (attempt, change2, is_changing)
|| !rtl_ssa::changes_are_worthwhile (changes)
|| !crtl->ssa->verify_insn_changes (changes))
return false;