LLVM 23.0.0git
TransactionAlwaysRevert.h
Go to the documentation of this file.
1//===- TransactionAlwaysRevert.h --------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This is a region pass that always reverts the transaction without checking
10// its cost. This is mainly used as a final pass in lit tests.
11//
12
13#ifndef LLVM_TRANSFORMS_VECTORIZE_SANDBOXVECTORIZER_PASSES_TRANSACTIONALWAYSREVERT_H
14#define LLVM_TRANSFORMS_VECTORIZE_SANDBOXVECTORIZER_PASSES_TRANSACTIONALWAYSREVERT_H
15
16#include "llvm/SandboxIR/Pass.h"
18
19namespace llvm::sandboxir {
20
22public:
24 assert(AuxArg.empty() && "This pass ignores aux arg!");
25 }
26 bool runOnRegion(Region &Rgn, const Analyses &A) final {
27 auto &Tracker = Rgn.getContext().getTracker();
28 bool HasChanges = !Tracker.empty();
30 return HasChanges;
31 }
32};
33
34} // namespace llvm::sandboxir
35
36#endif // LLVM_TRANSFORMS_VECTORIZE_SANDBOXVECTORIZER_PASSES_TRANSACTIONALWAYSREVERT_H
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
constexpr bool empty() const
Check if the string is empty.
Definition StringRef.h:141
Tracker & getTracker()
Definition Context.h:240
RegionPass(StringRef Name)
Name can't contain any spaces or start with '-'.
Definition Pass.h:87
The tracker collects all the change objects and implements the main API for saving / reverting / acce...
Definition Tracker.h:450
LLVM_ABI void revert(bool RevertAll=false)
Stops tracking and reverts to saved state.
Definition Tracker.cpp:341
bool empty() const
\Returns true if there are no changes tracked.
Definition Tracker.h:485
Context & getContext() const
Definition Tracker.h:483
bool runOnRegion(Region &Rgn, const Analyses &A) final
\Returns true if it modifies R.