18#ifndef LLVM_SANDBOXIR_PASSMANAGER_H
19#define LLVM_SANDBOXIR_PASSMANAGER_H
34template <
typename ParentPass,
typename ContainedPass>
84 "setPassPipeline called on a non-empty sandboxir::PassManager");
93 std::string PipelineStr = std::string(Pipeline) +
EndToken;
98 errs() <<
"Found empty pass name.\n";
104 if (
Pass ==
nullptr) {
105 errs() <<
"Pass '" <<
PassName <<
"' not registered!\n";
115 } CurrentState = State::ScanName;
116 int PassBeginIdx = 0;
121 switch (CurrentState) {
122 case State::ScanName:
126 ArgsBeginIdx =
Idx + 1;
128 CurrentState = State::ScanArgs;
132 errs() <<
"Unexpected '>' in pass pipeline.\n";
139 PassBeginIdx =
Idx + 1;
142 case State::ScanArgs:
151 if (NestedArgs == 0) {
154 CurrentState = State::ArgsEnded;
155 }
else if (NestedArgs < 0) {
156 errs() <<
"Unexpected '>' in pass pipeline.\n";
162 errs() <<
"Missing '>' in pass pipeline. End-of-string reached while "
163 "reading arguments for pass '"
168 case State::ArgsEnded:
172 PassBeginIdx =
Idx + 1;
173 CurrentState = State::ScanName;
175 errs() <<
"Expected delimiter or end-of-string after pass "
200 for (
const auto &PassPtr :
Passes)
201 PassPtr->printPipeline(
OS);
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
This file defines the DenseMap class.
static bool runOnFunction(Function &F, bool PostInlining)
static StringRef getName(Value *V)
static const char PassName[]
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
constexpr bool empty() const
empty - Check if the string is empty.
StringRef slice(size_t Start, size_t End) const
Return a reference to the substring from [Start, End).
This class implements an extremely fast bulk output stream that can only output to a stream.
FunctionPassManager(StringRef Name, StringRef Pipeline, CreatePassFunc CreatePass)
FunctionPassManager(StringRef Name)
PassManager(const PassManager &)=delete
static constexpr const char PassDelimToken
void addPass(std::unique_ptr< ContainedPass > Pass)
Adds Pass to the pass pipeline.
void printPipeline(raw_ostream &OS) const override
Similar to print() but prints one pass per line. Used for testing.
std::function< std::unique_ptr< ContainedPass >(StringRef, StringRef)> CreatePassFunc
static constexpr const char EndToken
PassManager(StringRef Name)
void setPassPipeline(StringRef Pipeline, CreatePassFunc CreatePass)
Parses Pipeline as a comma-separated sequence of pass names and sets the pass pipeline,...
PassManager(PassManager &&)=default
void print(raw_ostream &OS) const override
PassManager(StringRef Name, StringRef Pipeline, CreatePassFunc CreatePass)
PassManager & operator=(const PassManager &)=delete
LLVM_DUMP_METHOD void dump() const override
static constexpr const char EndArgsToken
virtual ~PassManager()=default
static constexpr const char BeginArgsToken
SmallVector< std::unique_ptr< ContainedPass > > Passes
The list of passes that this pass manager will run.
The base class of a Sandbox IR Pass.
virtual void print(raw_ostream &OS) const
RegionPassManager(StringRef Name)
RegionPassManager(StringRef Name, StringRef Pipeline, CreatePassFunc CreatePass)
The main job of the Region is to point to new instructions generated by vectorization passes.
@ C
The default llvm calling convention, compatible with C.
auto enumerate(FirstRange &&First, RestRanges &&...Rest)
Given two or more input ranges, returns a new range whose values are tuples (A, B,...
void interleave(ForwardIterator begin, ForwardIterator end, UnaryFunctor each_fn, NullaryFunctor between_fn)
An STL-style algorithm similar to std::for_each that applies a second functor between every pair of e...
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
LLVM_ABI raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.