On 11/13/20 1:19 AM, Richard Sandiford via Gcc-patches wrote:
> In some cases, it can be convenient to roll back the changes that
> have been made by validate_change to see how things looked before,
> then reroll the changes. For example, this makes it possible
> to defer calculating the cost of an instruction until we know that
> the result is actually needed. It can also make dumps easier to read.
>
> This patch adds a couple of helper functions for doing that.
>
> gcc/
> * recog.h (temporarily_undo_changes, redo_changes): Declare.
> * recog.c (swap_change, temporarily_undo_changes): New functions.
> (redo_changes): Likewise.
OK... But...
+
> +/* Temporarily undo all the changes numbered NUM and up, with a view
> + to reapplying them later. The next call to the changes machinery
> + must be:
> +
> + redo_changes (NUM)
> +
> + otherwise things will end up in an invalid state. */
It'd be nice if we had state validation in the other routines. Somebody
is likely to mess this up at some point...
jeff