[ORC] Add std::tuple support to SimplePackedSerialization.
[llvm-project.git] / llvm / lib / Target / M68k / GlSel / M68kInstructionSelector.cpp
blob9ac4ab9a5ba1f83b4da8ebf7ae679e32d6fd0b43
1 //===- M68kInstructionSelector.cpp ------------------------------*- C++ -*-===//
2 //===----------------------------------------------------------------------===//
3 /// \file
4 /// This file implements the targeting of the InstructionSelector class for
5 /// M68k.
6 /// \todo This should be generated by TableGen.
7 //===----------------------------------------------------------------------===//
9 #include "M68kRegisterBankInfo.h"
10 #include "M68kSubtarget.h"
11 #include "M68kTargetMachine.h"
12 #include "llvm/CodeGen/GlobalISel/InstructionSelector.h"
13 #include "llvm/CodeGen/GlobalISel/InstructionSelectorImpl.h"
14 #include "llvm/Support/Debug.h"
16 #define DEBUG_TYPE "m68k-isel"
18 using namespace llvm;
20 #define GET_GLOBALISEL_PREDICATE_BITSET
21 #include "M68kGenGlobalISel.inc"
22 #undef GET_GLOBALISEL_PREDICATE_BITSET
24 namespace {
26 class M68kInstructionSelector : public InstructionSelector {
27 public:
28 M68kInstructionSelector(const M68kTargetMachine &TM, const M68kSubtarget &STI,
29 const M68kRegisterBankInfo &RBI);
31 bool select(MachineInstr &I) override;
32 static const char *getName() { return DEBUG_TYPE; }
34 private:
35 bool selectImpl(MachineInstr &I, CodeGenCoverage &CoverageInfo) const;
37 const M68kTargetMachine &TM;
38 const M68kInstrInfo &TII;
39 const M68kRegisterInfo &TRI;
40 const M68kRegisterBankInfo &RBI;
42 #define GET_GLOBALISEL_PREDICATES_DECL
43 #include "M68kGenGlobalISel.inc"
44 #undef GET_GLOBALISEL_PREDICATES_DECL
46 #define GET_GLOBALISEL_TEMPORARIES_DECL
47 #include "M68kGenGlobalISel.inc"
48 #undef GET_GLOBALISEL_TEMPORARIES_DECL
51 } // end anonymous namespace
53 #define GET_GLOBALISEL_IMPL
54 #include "M68kGenGlobalISel.inc"
55 #undef GET_GLOBALISEL_IMPL
57 M68kInstructionSelector::M68kInstructionSelector(
58 const M68kTargetMachine &TM, const M68kSubtarget &STI,
59 const M68kRegisterBankInfo &RBI)
60 : InstructionSelector(), TM(TM), TII(*STI.getInstrInfo()),
61 TRI(*STI.getRegisterInfo()), RBI(RBI),
63 #define GET_GLOBALISEL_PREDICATES_INIT
64 #include "M68kGenGlobalISel.inc"
65 #undef GET_GLOBALISEL_PREDICATES_INIT
66 #define GET_GLOBALISEL_TEMPORARIES_INIT
67 #include "M68kGenGlobalISel.inc"
68 #undef GET_GLOBALISEL_TEMPORARIES_INIT
72 bool M68kInstructionSelector::select(MachineInstr &I) {
73 // Certain non-generic instructions also need some special handling.
74 if (!isPreISelGenericOpcode(I.getOpcode()))
75 return true;
77 if (selectImpl(I, *CoverageInfo))
78 return true;
80 return false;
83 namespace llvm {
84 InstructionSelector *
85 createM68kInstructionSelector(const M68kTargetMachine &TM,
86 const M68kSubtarget &Subtarget,
87 const M68kRegisterBankInfo &RBI) {
88 return new M68kInstructionSelector(TM, Subtarget, RBI);
90 } // end namespace llvm