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. | |
template<typename ChangeT , typename... ArgsT> | |
bool | emplaceIfTracking (ArgsT... Args) |
A convenience wrapper for track() that constructs and tracks the Change object if tracking is enabled. | |
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 | |
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 104 of file Tracker.cpp.
References assert().
void Tracker::accept | ( | ) |
Stops tracking and accept changes.
Definition at line 257 of file Tracker.cpp.
References assert(), Disabled, and Record.
Referenced by llvm::sandboxir::Context::accept().
void Tracker::dump | ( | ) | const |
Definition at line 273 of file Tracker.cpp.
References llvm::dbgs(), and dump().
Referenced by dump().
void Tracker::dump | ( | raw_ostream & | OS | ) | const |
Definition at line 266 of file Tracker.cpp.
References llvm::enumerate(), Idx, and OS.
|
inline |
A convenience wrapper for track()
that constructs and tracks the Change object if tracking is enabled.
\Returns true if tracking is enabled.
Definition at line 356 of file Tracker.h.
References isTracking(), and track().
Referenced by llvm::sandboxir::PHINode::addIncoming(), llvm::sandboxir::Instruction::copyFastMathFlags(), llvm::sandboxir::Instruction::insertBefore(), llvm::sandboxir::Instruction::insertInto(), llvm::sandboxir::Instruction::moveBefore(), llvm::sandboxir::Context::registerValue(), llvm::sandboxir::Instruction::removeFromParent(), llvm::sandboxir::PHINode::removeIncomingValue(), llvm::sandboxir::User::replaceUsesOfWith(), llvm::sandboxir::Value::replaceUsesWithIf(), llvm::sandboxir::Use::set(), llvm::sandboxir::AtomicCmpXchgInst::setAlignment(), llvm::sandboxir::AllocaInst::setAlignment(), llvm::sandboxir::AllocaInst::setAllocatedType(), llvm::sandboxir::CallBrInst::setDefaultDest(), llvm::sandboxir::AtomicCmpXchgInst::setFailureOrdering(), llvm::sandboxir::Instruction::setFast(), llvm::sandboxir::Instruction::setFastMathFlags(), llvm::sandboxir::Instruction::setHasAllowContract(), llvm::sandboxir::Instruction::setHasAllowReassoc(), llvm::sandboxir::Instruction::setHasAllowReciprocal(), llvm::sandboxir::Instruction::setHasApproxFunc(), llvm::sandboxir::Instruction::setHasNoInfs(), llvm::sandboxir::Instruction::setHasNoNaNs(), llvm::sandboxir::Instruction::setHasNoSignedWrap(), llvm::sandboxir::Instruction::setHasNoSignedZeros(), llvm::sandboxir::Instruction::setHasNoUnsignedWrap(), llvm::sandboxir::PHINode::setIncomingBlock(), llvm::sandboxir::PHINode::setIncomingValue(), llvm::sandboxir::CallBrInst::setIndirectDest(), llvm::sandboxir::Instruction::setIsExact(), llvm::sandboxir::User::setOperand(), llvm::sandboxir::AtomicCmpXchgInst::setSuccessOrdering(), llvm::sandboxir::AtomicCmpXchgInst::setSyncScopeID(), llvm::sandboxir::AllocaInst::setUsedWithInAlloca(), llvm::sandboxir::LoadInst::setVolatile(), llvm::sandboxir::StoreInst::setVolatile(), llvm::sandboxir::AtomicCmpXchgInst::setVolatile(), llvm::sandboxir::AtomicCmpXchgInst::setWeak(), and llvm::sandboxir::Use::swap().
|
inline |
Definition at line 336 of file Tracker.h.
Referenced by llvm::sandboxir::EraseFromParent::revert().
|
inline |
|
inline |
\Returns true if the tracker is recording changes.
Definition at line 363 of file Tracker.h.
References Record.
Referenced by emplaceIfTracking(), llvm::sandboxir::Instruction::eraseFromParent(), llvm::sandboxir::Value::replaceAllUsesWith(), llvm::sandboxir::User::replaceUsesOfWith(), and track().
void Tracker::revert | ( | ) |
Stops tracking and reverts to saved state.
Definition at line 249 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 247 of file Tracker.cpp.
References Record.
Referenced by llvm::sandboxir::Context::save().
|
inline |
Record Change
and take ownership.
This is the main function used to track Sandbox IR changes.
Definition at line 339 of file Tracker.h.
References assert(), InMiddleOfCreatingChange, isTracking(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), and Record.
Referenced by emplaceIfTracking(), llvm::sandboxir::Instruction::eraseFromParent(), and llvm::sandboxir::Value::replaceAllUsesWith().
|
friend |
bool llvm::sandboxir::Tracker::InMiddleOfCreatingChange = false |