LLVM  5.0.0
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"
14 #include "llvm/Support/Debug.h"
16 
17 using namespace llvm;
18 
19 #define DEBUG_TYPE "mips-isel"
20 
21 namespace {
22  class MipsModuleDAGToDAGISel : public MachineFunctionPass {
23  public:
24  static char ID;
25 
26  MipsModuleDAGToDAGISel() : MachineFunctionPass(ID) {}
27 
28  // Pass Name
29  StringRef getPassName() const override {
30  return "MIPS DAG->DAG Pattern Instruction Selection";
31  }
32 
33  void getAnalysisUsage(AnalysisUsage &AU) const override {
36  }
37 
38  bool runOnMachineFunction(MachineFunction &MF) override;
39  };
40 
42 }
43 
44 bool MipsModuleDAGToDAGISel::runOnMachineFunction(MachineFunction &MF) {
45  DEBUG(errs() << "In MipsModuleDAGToDAGISel::runMachineFunction\n");
46  auto &TPC = getAnalysis<TargetPassConfig>();
47  auto &TM = TPC.getTM<MipsTargetMachine>();
48  TM.resetSubtarget(&MF);
49  return false;
50 }
51 
53  return new MipsModuleDAGToDAGISel();
54 }
raw_ostream & errs()
This returns a reference to a raw_ostream for standard error.
void resetSubtarget(MachineFunction *MF)
Reset the subtarget for the Mips target.
AnalysisUsage & addRequired()
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
Target-Independent Code Generator Pass Configuration Options.
TracePC TPC
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
Represent the analysis usage information of a pass.
FunctionPass class - This class is used to implement most global optimizations.
Definition: Pass.h:298
FunctionPass * createMipsModuleISelDagPass()
#define DEBUG(X)
Definition: Debug.h:118
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49