aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/CodeGenPassBuilder.cpp
diff options
context:
space:
mode:
authorYuanfang Chen <yuanfang.chen@sony.com>2020-09-11 15:56:27 -0700
committerYuanfang Chen <yuanfang.chen@sony.com>2020-09-11 16:41:17 -0700
commit31ecf8d29d81d196374a562c6d2bd2c25a62861e (patch)
treeea17aff0aa4c0e943bce29d06ca3ecb72a889397 /llvm/lib/CodeGen/CodeGenPassBuilder.cpp
parent12292c8b27aca8d173a3a2825f2e8aeb383cc695 (diff)
downloadllvm-31ecf8d29d81d196374a562c6d2bd2c25a62861e.zip
llvm-31ecf8d29d81d196374a562c6d2bd2c25a62861e.tar.gz
llvm-31ecf8d29d81d196374a562c6d2bd2c25a62861e.tar.bz2
[NewPM][CodeGen] Introduce CodeGenPassBuilder to help build codegen pipeline
Following up on D67687. Please refer to the RFC here http://lists.llvm.org/pipermail/llvm-dev/2020-July/143309.html `CodeGenPassBuilder` is the NPM counterpart of `TargetPassConfig` with below differences. - Debugging features (MIR print/verify, disable pass, start/stop-before/after, etc.) living in `TargetPassConfig` are moved to use PassInstrument as much as possible. (Implementation also lives in `TargetPassConfig.cpp`) - `TargetPassConfig` is a polymorphic base (virtual inheritance) to build the target-dependent pipeline whereas `CodeGenPassBuilder` is the CRTP base/helper to implement the target-dependent pipeline. The motivation is flexibility for targets to customize the pipeline, inlining opportunity, and fits the overall NPM value semantics design. - `TargetPassConfig` is a legacy immutable pass to declare hooks for targets to customize some target-independent codegen layer behavior. This is partially ported to TargetMachine::options. The rest, such as `createMachineScheduler/createPostMachineScheduler`, are left out for now. They should be implemented in LLVMTargetMachine in the future. Reviewed By: arsenm Differential Revision: https://reviews.llvm.org/D83608
Diffstat (limited to 'llvm/lib/CodeGen/CodeGenPassBuilder.cpp')
-rw-r--r--llvm/lib/CodeGen/CodeGenPassBuilder.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/CodeGenPassBuilder.cpp b/llvm/lib/CodeGen/CodeGenPassBuilder.cpp
new file mode 100644
index 0000000..7f37f20
--- /dev/null
+++ b/llvm/lib/CodeGen/CodeGenPassBuilder.cpp
@@ -0,0 +1,25 @@
+//===--- CodeGenPassBuilder.cpp --------------------------------------- ---===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This file defines interfaces to access the target independent code
+// generation passes provided by the LLVM backend.
+//
+//===---------------------------------------------------------------------===//
+
+#include "llvm/CodeGen/CodeGenPassBuilder.h"
+
+using namespace llvm;
+
+namespace llvm {
+#define DUMMY_MACHINE_MODULE_PASS(NAME, PASS_NAME, CONSTRUCTOR) \
+ AnalysisKey PASS_NAME::Key;
+#include "llvm/CodeGen/MachinePassRegistry.def"
+#define DUMMY_MACHINE_FUNCTION_PASS(NAME, PASS_NAME, CONSTRUCTOR) \
+ AnalysisKey PASS_NAME::Key;
+#include "llvm/CodeGen/MachinePassRegistry.def"
+} // namespace llvm