LLVM 19.0.0git
M68kInstructionSelector.cpp
Go to the documentation of this file.
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//===----------------------------------------------------------------------===//
8
10#include "M68kSubtarget.h"
11#include "M68kTargetMachine.h"
14#include "llvm/Support/Debug.h"
15
16#define DEBUG_TYPE "m68k-isel"
17
18using namespace llvm;
19
20#define GET_GLOBALISEL_PREDICATE_BITSET
21#include "M68kGenGlobalISel.inc"
22#undef GET_GLOBALISEL_PREDICATE_BITSET
23
24namespace {
25
26class M68kInstructionSelector : public InstructionSelector {
27public:
28 M68kInstructionSelector(const M68kTargetMachine &TM, const M68kSubtarget &STI,
29 const M68kRegisterBankInfo &RBI);
30
31 bool select(MachineInstr &I) override;
32 static const char *getName() { return DEBUG_TYPE; }
33
34private:
35 bool selectImpl(MachineInstr &I, CodeGenCoverage &CoverageInfo) const;
36
37 const M68kTargetMachine &TM;
38 const M68kInstrInfo &TII;
39 const M68kRegisterInfo &TRI;
40 const M68kRegisterBankInfo &RBI;
41
42#define GET_GLOBALISEL_PREDICATES_DECL
43#include "M68kGenGlobalISel.inc"
44#undef GET_GLOBALISEL_PREDICATES_DECL
45
46#define GET_GLOBALISEL_TEMPORARIES_DECL
47#include "M68kGenGlobalISel.inc"
48#undef GET_GLOBALISEL_TEMPORARIES_DECL
49};
50
51} // end anonymous namespace
52
53#define GET_GLOBALISEL_IMPL
54#include "M68kGenGlobalISel.inc"
55#undef GET_GLOBALISEL_IMPL
56
57M68kInstructionSelector::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),
62
64#include "M68kGenGlobalISel.inc"
67#include "M68kGenGlobalISel.inc"
69{
70}
71
72bool M68kInstructionSelector::select(MachineInstr &I) {
73 // Certain non-generic instructions also need some special handling.
74 if (!isPreISelGenericOpcode(I.getOpcode()))
75 return true;
76
77 if (selectImpl(I, *CoverageInfo))
78 return true;
79
80 return false;
81}
82
83namespace llvm {
86 const M68kSubtarget &Subtarget,
87 const M68kRegisterBankInfo &RBI) {
88 return new M68kInstructionSelector(TM, Subtarget, RBI);
89}
90} // end namespace llvm
#define DEBUG_TYPE
const HexagonInstrInfo * TII
#define GET_GLOBALISEL_PREDICATES_INIT
#define GET_GLOBALISEL_TEMPORARIES_INIT
This file declares the targeting of the RegisterBankInfo class for M68k.
This file declares the M68k specific subclass of TargetSubtargetInfo.
This file declares the M68k specific subclass of TargetMachine.
#define I(x, y, z)
Definition: MD5.cpp:58
unsigned const TargetRegisterInfo * TRI
const char LLVMTargetMachineRef TM
static StringRef getName(Value *V)
virtual bool select(MachineInstr &I)=0
Select the (possibly generic) instruction I to only use target-specific opcodes.
This class provides the information for the target register banks.
Representation of each machine instruction.
Definition: MachineInstr.h:68
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
bool isPreISelGenericOpcode(unsigned Opcode)
Check whether the given Opcode is a generic opcode that is not supposed to appear after ISel.
Definition: TargetOpcodes.h:30
InstructionSelector * createM68kInstructionSelector(const M68kTargetMachine &TM, const M68kSubtarget &Subtarget, const M68kRegisterBankInfo &RBI)