GCC Middle and Back End API Reference
insn_change_watermark Class Reference

#include <recog.h>

Public Member Functions

 insn_change_watermark ()
 
 ~insn_change_watermark ()
 
void keep ()
 

Private Attributes

int m_old_num_changes
 

Detailed Description

This RAII class can help to undo tentative insn changes on failure.
When an object of the class goes out of scope, it undoes all group
changes that have been made via the validate_change machinery and
not yet confirmed via confirm_change_group.

For example:

   insn_change_watermark watermark;
   validate_change (..., true); // A
   ...
   if (test)
     // Undoes change A.
     return false;
   ...
   validate_change (..., true); // B
   ...
   if (test)
     // Undoes changes A and B.
     return false;
   ...
   confirm_change_group ();

Code that wants to avoid this behavior can use keep ():

   insn_change_watermark watermark;
   validate_change (..., true); // A
   ...
   if (test)
     // Undoes change A.
     return false;
   ...
   watermark.keep ();
   validate_change (..., true); // B
   ...
   if (test)
     // Undoes change B, but not A.
     return false;
   ...
   confirm_change_group ();   

Constructor & Destructor Documentation

◆ insn_change_watermark()

insn_change_watermark::insn_change_watermark ( )
inline

◆ ~insn_change_watermark()

insn_change_watermark::~insn_change_watermark ( )
inline

Member Function Documentation

◆ keep()

void insn_change_watermark::keep ( )
inline

Field Documentation

◆ m_old_num_changes

int insn_change_watermark::m_old_num_changes
private

Referenced by keep(), and ~insn_change_watermark().


The documentation for this class was generated from the following file: