[llvm] [SandboxVectorizer] Use sbvec-passes flag to create a pipeline of Region passes after BottomUpVec. (PR #111223)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 8 15:21:15 PDT 2024
================
@@ -10,10 +10,69 @@
#include "llvm/ADT/SmallVector.h"
#include "llvm/SandboxIR/Function.h"
#include "llvm/SandboxIR/Instruction.h"
-
-using namespace llvm::sandboxir;
+#include "llvm/Support/CommandLine.h"
+#include "llvm/Transforms/Vectorize/SandboxVectorizer/Passes/NullPass.h"
namespace llvm::sandboxir {
+
+static cl::opt<bool>
+ PrintPassPipeline("sbvec-print-pass-pipeline", cl::init(false), cl::Hidden,
+ cl::desc("Prints the pass pipeline and returns."));
+
+/// A magic string for the default pass pipeline.
+static const char *DefaultPipelineMagicStr = "*";
+
+static cl::opt<std::string> UserDefinedPassPipeline(
+ "sbvec-passes", cl::init(DefaultPipelineMagicStr), cl::Hidden,
+ cl::desc("Comma-separated list of vectorizer passes. If not set "
+ "we run the predefined pipeline."));
+
+static std::unique_ptr<RegionPass> createRegionPass(StringRef Name) {
+#define REGION_PASS(NAME, CREATE_PASS) \
+ if (Name == NAME) \
+ return std::make_unique<decltype(CREATE_PASS)>(CREATE_PASS);
+#include "PassRegistry.def"
+ return nullptr;
+}
+
+/// Adds to `RPM` a sequence of region passes described by `Pipeline`.
+static void parseAndCreatePassPipeline(RegionPassManager &RPM,
----------------
vporpo wrote:
Well, conceptually parsing the pass pipeline string and building passes should not be a static function in BottomUpVec.cpp because it is a pass-manager task, not a vectorization-specific task.
Oh yes, the creator function would need to have access to the passes. Hmm could we perhaps keep the creator function here in a lambda `createPass(Name)` and pass the lambda as an argument to the parse function?
https://github.com/llvm/llvm-project/pull/111223
More information about the llvm-commits
mailing list