LLVM 19.0.0git
|
The tracker collects all the change objects and implements the main API for saving / reverting / accepting. More...
#include "llvm/SandboxIR/Tracker.h"
Public Types | |
enum class | TrackerState { Disabled , Record } |
Public Member Functions | |
Tracker (Context &Ctx) | |
~Tracker () | |
Context & | getContext () const |
void | track (std::unique_ptr< IRChangeBase > &&Change) |
Record Change and take ownership. | |
bool | isTracking () const |
\Returns true if the tracker is recording changes. | |
TrackerState | getState () const |
\Returns the current state of the tracker. | |
void | save () |
Turns on IR tracking. | |
void | accept () |
Stops tracking and accept changes. | |
void | revert () |
Stops tracking and reverts to saved state. | |
void | dump (raw_ostream &OS) const |
LLVM_DUMP_METHOD void | dump () const |
Public Attributes | |
bool | InMiddleOfCreatingChange = false |
Helps catch bugs where we are creating new change objects while in the middle of creating other change objects. | |
Friends | |
unsigned | IRChangeBase::getIdx () const |
raw_ostream & | operator<< (raw_ostream &OS, const Tracker &Tracker) |
The tracker collects all the change objects and implements the main API for saving / reverting / accepting.
|
strong |
|
inlineexplicit |
Tracker::~Tracker | ( | ) |
Definition at line 40 of file Tracker.cpp.
References assert().
void Tracker::accept | ( | ) |
Stops tracking and accept changes.
Definition at line 170 of file Tracker.cpp.
References assert(), Disabled, and Record.
Referenced by llvm::sandboxir::Context::accept().
void Tracker::dump | ( | ) | const |
Definition at line 185 of file Tracker.cpp.
References llvm::dbgs(), and dump().
Referenced by dump().
void Tracker::dump | ( | raw_ostream & | OS | ) | const |
Definition at line 179 of file Tracker.cpp.
References OS.
|
inline |
Definition at line 207 of file Tracker.h.
Referenced by llvm::sandboxir::EraseFromParent::revert().
|
inline |
|
inline |
\Returns true if the tracker is recording changes.
Definition at line 212 of file Tracker.h.
References Record.
Referenced by llvm::sandboxir::Instruction::eraseFromParent(), llvm::sandboxir::IRChangeBase::IRChangeBase(), llvm::sandboxir::Instruction::moveBefore(), llvm::sandboxir::Instruction::removeFromParent(), llvm::sandboxir::Value::replaceAllUsesWith(), llvm::sandboxir::User::replaceUsesOfWith(), llvm::sandboxir::Value::replaceUsesWithIf(), and llvm::sandboxir::User::setOperand().
void Tracker::revert | ( | ) |
Stops tracking and reverts to saved state.
Definition at line 162 of file Tracker.cpp.
References assert(), Disabled, Record, and llvm::reverse().
Referenced by llvm::sandboxir::Context::revert().
void Tracker::save | ( | ) |
Turns on IR tracking.
Definition at line 160 of file Tracker.cpp.
References Record.
Referenced by llvm::sandboxir::Context::save().
void Tracker::track | ( | std::unique_ptr< IRChangeBase > && | Change | ) |
Record Change
and take ownership.
This is the main function used to track Sandbox IR changes.
Definition at line 151 of file Tracker.cpp.
References assert(), InMiddleOfCreatingChange, and Record.
Referenced by llvm::sandboxir::Instruction::eraseFromParent(), llvm::sandboxir::Instruction::moveBefore(), llvm::sandboxir::Instruction::removeFromParent(), llvm::sandboxir::Value::replaceAllUsesWith(), llvm::sandboxir::User::replaceUsesOfWith(), llvm::sandboxir::Value::replaceUsesWithIf(), and llvm::sandboxir::User::setOperand().
|
friend |
|
friend |
bool llvm::sandboxir::Tracker::InMiddleOfCreatingChange = false |
Helps catch bugs where we are creating new change objects while in the middle of creating other change objects.
Definition at line 202 of file Tracker.h.
Referenced by llvm::sandboxir::IRChangeBase::IRChangeBase(), and track().