summaryrefslogtreecommitdiffstats
path: root/mlir/lib/ExecutionEngine
diff options
context:
space:
mode:
authorRiver Riddle <riverriddle@google.com>2019-02-27 14:45:36 -0800
committerjpienaar <jpienaar@google.com>2019-03-29 16:48:29 -0700
commit091ff3dc3f077b9a62ccf041689318a99443dfdf (patch)
tree95c3df05aefd350a7d893cce124117f67cc28cc3 /mlir/lib/ExecutionEngine
parente31c23853b323c5531fe914c596cb7857f8243fb (diff)
downloadbcm5719-llvm-091ff3dc3f077b9a62ccf041689318a99443dfdf.tar.gz
bcm5719-llvm-091ff3dc3f077b9a62ccf041689318a99443dfdf.zip
Add support for registering pass pipelines to the PassRegistry. This is done by providing a static registration facility PassPipelineRegistration that works similarly to PassRegistration except for it also takes a function that will add necessary passes to a provided PassManager.
void pipelineBuilder(PassManager &pm) { pm.addPass(new MyPass()); pm.addPass(new MyOtherPass()); } static PassPipelineRegistration Unused("unused", "Unused pass", pipelineBuilder); This is also useful for registering specializations of existing passes: Pass *createFooPass10() { return new FooPass(10); } static PassPipelineRegistration Unused("unused", "Unused pass", createFooPass10); PiperOrigin-RevId: 235996282
Diffstat (limited to 'mlir/lib/ExecutionEngine')
-rw-r--r--mlir/lib/ExecutionEngine/ExecutionEngine.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/mlir/lib/ExecutionEngine/ExecutionEngine.cpp b/mlir/lib/ExecutionEngine/ExecutionEngine.cpp
index 1a3dd6ffff0..f0835da77d4 100644
--- a/mlir/lib/ExecutionEngine/ExecutionEngine.cpp
+++ b/mlir/lib/ExecutionEngine/ExecutionEngine.cpp
@@ -22,6 +22,7 @@
#include "mlir/ExecutionEngine/ExecutionEngine.h"
#include "mlir/IR/Function.h"
#include "mlir/IR/Module.h"
+#include "mlir/Pass/Pass.h"
#include "mlir/Pass/PassManager.h"
#include "mlir/Target/LLVMIR.h"
#include "mlir/Transforms/Passes.h"
@@ -161,20 +162,20 @@ static inline Error make_string_error(const llvm::Twine &message) {
llvm::inconvertibleErrorCode());
}
-// Given a list of PassInfo coming from a higher level, creates the passes to
-// run as an owning vector and appends the extra required passes to lower to
-// LLVMIR. Currently, these extra passes are:
+// Given a list of PassRegistryEntry coming from a higher level, populates the
+// given pass manager and appends the default set of required passes to lower to
+// LLVMIR.
+// Currently, these passes are:
// - constant folding
// - CSE
// - canonicalization
// - affine lowering
-static void
-getDefaultPasses(PassManager &manager,
- const std::vector<const mlir::PassInfo *> &mlirPassInfoList) {
+static void getDefaultPasses(
+ PassManager &manager,
+ const std::vector<const mlir::PassRegistryEntry *> &mlirPassRegistryList) {
// Run each of the passes that were selected.
- for (const auto *passInfo : mlirPassInfoList) {
- manager.addPass(passInfo->createPass());
- }
+ for (const auto *passEntry : mlirPassRegistryList)
+ passEntry->addToPipeline(manager);
// Append the extra passes for lowering to MLIR.
manager.addPass(mlir::createConstantFoldPass());
OpenPOWER on IntegriCloud