RFD: apply_change_group variant that doesn't apply changes

Joern RENNECKE joern.rennecke@st.com
Tue Jan 11 04:07:00 GMT 2005


In working on the ifconversion / cross-jump merging, I find that there 
are several places
where I want to accumulate a number of changes, then check if I can 
apply then, but
not permanently install them yet.  Keeping track of all the changes a 
second time in order to
be able to undo them seems rather wasteful, since we could use 
cancel_changes, if only
num_changes had not been cleared  I.e. I would like a function that does 
most of the
work of apply_change_group, but at the end

  if (i == num_changes)
    {
      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;
      return 1;
    }
  else
    {
      cancel_changes (0);
      return 0;
    }

I would like it to just do

  return i == num_changes;

and then have another function that sets the BB_DIRTY flags and clears 
num_changes when I decide
to go ahead with  the changes.  Then we could implement the  actual 
apply_change_group trivially
with these two functions and cancel_changes.



More information about the Gcc mailing list