[llvm] [SandboxIR] Pass registry (PR #108084)
Arthur Eubanks via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 10 14:00:03 PDT 2024
================
@@ -65,6 +66,34 @@ class FunctionPassManager final
bool runOnFunction(Function &F) final;
};
+/// Owns the passes and provides an API to get a pass by its name.
+class PassRegistry {
+ SmallVector<std::unique_ptr<Pass>, 8> Passes;
+ DenseMap<StringRef, Pass *> NameToPassMap;
+
+public:
+ PassRegistry() = default;
+ /// Registers \p PassPtr and takes ownership.
+ Pass *registerPass(std::unique_ptr<Pass> &&PassPtr) {
----------------
aeubanks wrote:
maybe this should return a reference instead of a pointer since it'll never be null?
https://github.com/llvm/llvm-project/pull/108084
More information about the llvm-commits
mailing list