aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Target/XCore
diff options
context:
space:
mode:
authorNick Desaulniers <ndesaulniers@google.com>2022-12-21 13:11:36 -0800
committerNick Desaulniers <ndesaulniers@google.com>2022-12-21 13:25:15 -0800
commit19a004b46882f02ed5488f691abbbdc83bcc3ce4 (patch)
tree5c55a005c2a1dfcf929913947419e516643892c2 /llvm/lib/Target/XCore
parent84038cf914f6a0060477ba35bafbff2fd0c49fe0 (diff)
downloadllvm-19a004b46882f02ed5488f691abbbdc83bcc3ce4.zip
llvm-19a004b46882f02ed5488f691abbbdc83bcc3ce4.tar.gz
llvm-19a004b46882f02ed5488f691abbbdc83bcc3ce4.tar.bz2
[llvm][SelectionDAGISel] support -{start|stop}-{before|after}= for remaining targets
Follow up to the series: 1. https://reviews.llvm.org/D140161 2. https://reviews.llvm.org/D140349 3. https://reviews.llvm.org/D140331 4. https://reviews.llvm.org/D140323 Completes the work from the previous two for remaining targets. This creates the following named passes that can be run via `llc -{start|stop}-{before|after}`: - arc-isel - arm-isel - avr-isel - bpf-isel - csky-isel - hexagon-isel - lanai-isel - loongarch-isel - m68k-isel - msp430-isel - mips-isel - nvptx-isel - ppc-codegen - riscv-isel - sparc-isel - systemz-isel - ve-isel - wasm-isel - xcore-isel A nice way to write tests for SelectionDAGISel might be to use a RUN: line like: llc -mtriple=<triple> -start-before=<arch>-isel -stop-after=finalize-isel -o - Fixes: https://github.com/llvm/llvm-project/issues/59538 Reviewed By: asb, zixuan-wu Differential Revision: https://reviews.llvm.org/D140364
Diffstat (limited to 'llvm/lib/Target/XCore')
-rw-r--r--llvm/lib/Target/XCore/XCore.h2
-rw-r--r--llvm/lib/Target/XCore/XCoreISelDAGToDAG.cpp11
-rw-r--r--llvm/lib/Target/XCore/XCoreTargetMachine.cpp2
3 files changed, 11 insertions, 4 deletions
diff --git a/llvm/lib/Target/XCore/XCore.h b/llvm/lib/Target/XCore/XCore.h
index 6118775..aae1e34 100644
--- a/llvm/lib/Target/XCore/XCore.h
+++ b/llvm/lib/Target/XCore/XCore.h
@@ -21,6 +21,7 @@
namespace llvm {
class FunctionPass;
class ModulePass;
+ class PassRegistry;
class TargetMachine;
class XCoreTargetMachine;
@@ -30,6 +31,7 @@ namespace llvm {
FunctionPass *createXCoreISelDag(XCoreTargetMachine &TM,
CodeGenOpt::Level OptLevel);
ModulePass *createXCoreLowerThreadLocalPass();
+ void initializeXCoreDAGToDAGISelPass(PassRegistry &);
} // end namespace llvm;
diff --git a/llvm/lib/Target/XCore/XCoreISelDAGToDAG.cpp b/llvm/lib/Target/XCore/XCoreISelDAGToDAG.cpp
index 9369114..3cb806a 100644
--- a/llvm/lib/Target/XCore/XCoreISelDAGToDAG.cpp
+++ b/llvm/lib/Target/XCore/XCoreISelDAGToDAG.cpp
@@ -31,6 +31,9 @@
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
+#define DEBUG_TYPE "xcore-isel"
+#define PASS_NAME "XCore DAG->DAG Pattern Instruction Selection"
+
/// XCoreDAGToDAGISel - XCore specific code to select XCore machine
/// instructions for SelectionDAG operations.
///
@@ -40,6 +43,8 @@ namespace {
public:
static char ID;
+ XCoreDAGToDAGISel() = delete;
+
XCoreDAGToDAGISel(XCoreTargetMachine &TM, CodeGenOpt::Level OptLevel)
: SelectionDAGISel(ID, TM, OptLevel) {}
@@ -69,10 +74,6 @@ namespace {
bool SelectInlineAsmMemoryOperand(const SDValue &Op, unsigned ConstraintID,
std::vector<SDValue> &OutOps) override;
- StringRef getPassName() const override {
- return "XCore DAG->DAG Pattern Instruction Selection";
- }
-
// Include the pieces autogenerated from the target description.
#include "XCoreGenDAGISel.inc"
};
@@ -80,6 +81,8 @@ namespace {
char XCoreDAGToDAGISel::ID = 0;
+INITIALIZE_PASS(XCoreDAGToDAGISel, DEBUG_TYPE, PASS_NAME, false, false)
+
/// createXCoreISelDag - This pass converts a legalized DAG into a
/// XCore-specific DAG, ready for instruction scheduling.
///
diff --git a/llvm/lib/Target/XCore/XCoreTargetMachine.cpp b/llvm/lib/Target/XCore/XCoreTargetMachine.cpp
index fe9490a..410c854 100644
--- a/llvm/lib/Target/XCore/XCoreTargetMachine.cpp
+++ b/llvm/lib/Target/XCore/XCoreTargetMachine.cpp
@@ -106,6 +106,8 @@ void XCorePassConfig::addPreEmitPass() {
// Force static initialization.
extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeXCoreTarget() {
RegisterTargetMachine<XCoreTargetMachine> X(getTheXCoreTarget());
+ PassRegistry &PR = *PassRegistry::getPassRegistry();
+ initializeXCoreDAGToDAGISelPass(PR);
}
TargetTransformInfo