LLVM 20.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 45 of file Tracker.cpp.
References assert().
void Tracker::accept | ( | ) |
Stops tracking and accept changes.
Definition at line 175 of file Tracker.cpp.
References assert(), Disabled, and Record.
Referenced by llvm::sandboxir::Context::accept().
void Tracker::dump | ( | ) | const |
Definition at line 190 of file Tracker.cpp.
References llvm::dbgs(), and dump().
Referenced by dump().
void Tracker::dump | ( | raw_ostream & | OS | ) | const |
Definition at line 184 of file Tracker.cpp.
References OS.
|
inline |
Definition at line 228 of file Tracker.h.
Referenced by llvm::sandboxir::EraseFromParent::revert().
|
inline |
|
inline |
\Returns true if the tracker is recording changes.
Definition at line 233 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(), llvm::sandboxir::User::setOperand(), and llvm::sandboxir::Use::swap().
void Tracker::revert | ( | ) |
Stops tracking and reverts to saved state.
Definition at line 167 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 165 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 156 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(), llvm::sandboxir::User::setOperand(), and llvm::sandboxir::Use::swap().
|
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 223 of file Tracker.h.
Referenced by llvm::sandboxir::IRChangeBase::IRChangeBase(), and track().