LLVM  15.0.0git
MipsModuleISelDAGToDAG.cpp
Go to the documentation of this file.
1 //===----------------------------------------------------------------------===//
2 // Instruction Selector Subtarget Control
3 //===----------------------------------------------------------------------===//
4 
5 //===----------------------------------------------------------------------===//
6 // This file defines a pass used to change the subtarget for the
7 // Mips Instruction selector.
8 //
9 //===----------------------------------------------------------------------===//
10 
11 #include "Mips.h"
12 #include "MipsTargetMachine.h"
16 #include "llvm/Support/Debug.h"
18 
19 using namespace llvm;
20 
21 #define DEBUG_TYPE "mips-isel"
22 
23 namespace {
24  class MipsModuleDAGToDAGISel : public MachineFunctionPass {
25  public:
26  static char ID;
27 
28  MipsModuleDAGToDAGISel() : MachineFunctionPass(ID) {}
29 
30  // Pass Name
31  StringRef getPassName() const override {
32  return "MIPS DAG->DAG Pattern Instruction Selection";
33  }
34 
35  void getAnalysisUsage(AnalysisUsage &AU) const override {
39  }
40 
41  bool runOnMachineFunction(MachineFunction &MF) override;
42  };
43 
45 }
46 
47 bool MipsModuleDAGToDAGISel::runOnMachineFunction(MachineFunction &MF) {
48  LLVM_DEBUG(errs() << "In MipsModuleDAGToDAGISel::runMachineFunction\n");
49  auto &TPC = getAnalysis<TargetPassConfig>();
50  auto &TM = TPC.getTM<MipsTargetMachine>();
51  TM.resetSubtarget(&MF);
52  return false;
53 }
54 
56  return new MipsModuleDAGToDAGISel();
57 }
llvm::MipsTargetMachine
Definition: MipsTargetMachine.h:27
StackProtector.h
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:17
llvm::MachineFunctionPass
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
Definition: MachineFunctionPass.h:30
llvm::errs
raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
Definition: raw_ostream.cpp:893
MipsTargetMachine.h
llvm::MachineFunctionPass::getAnalysisUsage
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
Definition: MachineFunctionPass.cpp:103
LLVM_DEBUG
#define LLVM_DEBUG(X)
Definition: Debug.h:101
llvm::StackProtector
Definition: StackProtector.h:36
llvm::AnalysisUsage
Represent the analysis usage information of a pass.
Definition: PassAnalysisSupport.h:47
Mips.h
llvm::createMipsModuleISelDagPass
FunctionPass * createMipsModuleISelDagPass()
Definition: MipsModuleISelDAGToDAG.cpp:55
llvm::CallingConv::ID
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition: CallingConv.h:24
llvm::TargetPassConfig
Target-Independent Code Generator Pass Configuration Options.
Definition: TargetPassConfig.h:84
TargetPassConfig.h
MachineFunctionPass.h
llvm::MachineFunction
Definition: MachineFunction.h:257
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
llvm::AnalysisUsage::addPreserved
AnalysisUsage & addPreserved()
Add the specified Pass class to the set of analyses preserved by this pass.
Definition: PassAnalysisSupport.h:98
TM
const char LLVMTargetMachineRef TM
Definition: PassBuilderBindings.cpp:47
llvm::FunctionPass
FunctionPass class - This class is used to implement most global optimizations.
Definition: Pass.h:308
llvm::AnalysisUsage::addRequired
AnalysisUsage & addRequired()
Definition: PassAnalysisSupport.h:75
raw_ostream.h
Debug.h
llvm::Intrinsic::ID
unsigned ID
Definition: TargetTransformInfo.h:38