LLVM  14.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 
9 #include "M68kRegisterBankInfo.h"
10 #include "M68kSubtarget.h"
11 #include "M68kTargetMachine.h"
14 #include "llvm/Support/Debug.h"
15 
16 #define DEBUG_TYPE "m68k-isel"
17 
18 using namespace llvm;
19 
20 #define GET_GLOBALISEL_PREDICATE_BITSET
21 #include "M68kGenGlobalISel.inc"
22 #undef GET_GLOBALISEL_PREDICATE_BITSET
23 
24 namespace {
25 
26 class M68kInstructionSelector : public InstructionSelector {
27 public:
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 
34 private:
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 
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),
62 
64 #include "M68kGenGlobalISel.inc"
67 #include "M68kGenGlobalISel.inc"
69 {
70 }
71 
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 
83 namespace llvm {
86  const M68kSubtarget &Subtarget,
87  const M68kRegisterBankInfo &RBI) {
88  return new M68kInstructionSelector(TM, Subtarget, RBI);
89 }
90 } // end namespace llvm
getName
static StringRef getName(Value *V)
Definition: ProvenanceAnalysisEvaluator.cpp:42
llvm
This file implements support for optimizing divisions by a constant.
Definition: AllocatorList.h:23
llvm::M68kTargetMachine
Definition: M68kTargetMachine.h:29
M68kTargetMachine.h
include
include(LLVM-Build) add_subdirectory(IR) add_subdirectory(FuzzMutate) add_subdirectory(FileCheck) add_subdirectory(InterfaceStub) add_subdirectory(IRReader) add_subdirectory(CodeGen) add_subdirectory(BinaryFormat) add_subdirectory(Bitcode) add_subdirectory(Bitstream) add_subdirectory(DWARFLinker) add_subdirectory(Extensions) add_subdirectory(Frontend) add_subdirectory(Transforms) add_subdirectory(Linker) add_subdirectory(Analysis) add_subdirectory(LTO) add_subdirectory(MC) add_subdirectory(MCA) add_subdirectory(Object) add_subdirectory(ObjectYAML) add_subdirectory(Option) add_subdirectory(Remarks) add_subdirectory(DebugInfo) add_subdirectory(DWP) add_subdirectory(ExecutionEngine) add_subdirectory(Target) add_subdirectory(AsmParser) add_subdirectory(LineEditor) add_subdirectory(ProfileData) add_subdirectory(Passes) add_subdirectory(TextAPI) add_subdirectory(ToolDrivers) add_subdirectory(XRay) if(LLVM_INCLUDE_TESTS) add_subdirectory(Testing) endif() add_subdirectory(WindowsManifest) set(LLVMCONFIGLIBRARYDEPENDENCIESINC "$
Definition: CMakeLists.txt:1
llvm::isPreISelGenericOpcode
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
llvm::M68kRegisterInfo
Definition: M68kRegisterInfo.h:30
TRI
unsigned const TargetRegisterInfo * TRI
Definition: MachineSink.cpp:1567
select
into xmm2 addss xmm2 xmm1 xmm3 addss xmm3 movaps xmm0 unpcklps xmm0 ret seems silly when it could just be one addps Expand libm rounding functions main should enable SSE DAZ mode and other fast SSE modes Think about doing i64 math in SSE regs on x86 This testcase should have no SSE instructions in and only one load from a constant double ret double C the select is being which prevents the dag combiner from turning select(load CPI1)
TII
const HexagonInstrInfo * TII
Definition: HexagonCopyToCombine.cpp:129
GET_GLOBALISEL_PREDICATES_INIT
#define GET_GLOBALISEL_PREDICATES_INIT
llvm::M68kSubtarget
Definition: M68kSubtarget.h:45
M68kRegisterBankInfo.h
InstructionSelector.h
llvm::InstructionSelector
Provides the logic to select generic machine instructions.
Definition: InstructionSelector.h:423
GET_GLOBALISEL_TEMPORARIES_INIT
#define GET_GLOBALISEL_TEMPORARIES_INIT
llvm::CodeGenCoverage
Definition: CodeGenCoverage.h:20
llvm::MachineInstr
Representation of each machine instruction.
Definition: MachineInstr.h:64
DEBUG_TYPE
#define DEBUG_TYPE
Definition: M68kInstructionSelector.cpp:16
I
#define I(x, y, z)
Definition: MD5.cpp:59
llvm::M68kRegisterBankInfo
This class provides the information for the target register banks.
Definition: M68kRegisterBankInfo.h:34
InstructionSelectorImpl.h
llvm::M68kInstrInfo
Definition: M68kInstrInfo.h:237
M68kSubtarget.h
llvm::createM68kInstructionSelector
InstructionSelector * createM68kInstructionSelector(const M68kTargetMachine &TM, const M68kSubtarget &Subtarget, const M68kRegisterBankInfo &RBI)
Definition: M68kInstructionSelector.cpp:85
TM
const char LLVMTargetMachineRef TM
Definition: PassBuilderBindings.cpp:47
llvm::mca::selectImpl
static uint64_t selectImpl(uint64_t CandidateMask, uint64_t &NextInSequenceMask)
Definition: ResourceManager.cpp:26
Debug.h