LLVM  8.0.1
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"
15 #include "llvm/Support/Debug.h"
17 
18 using namespace llvm;
19 
20 #define DEBUG_TYPE "mips-isel"
21 
22 namespace {
23  class MipsModuleDAGToDAGISel : public MachineFunctionPass {
24  public:
25  static char ID;
26 
27  MipsModuleDAGToDAGISel() : MachineFunctionPass(ID) {}
28 
29  // Pass Name
30  StringRef getPassName() const override {
31  return "MIPS DAG->DAG Pattern Instruction Selection";
32  }
33 
34  void getAnalysisUsage(AnalysisUsage &AU) const override {
38  }
39 
40  bool runOnMachineFunction(MachineFunction &MF) override;
41  };
42 
44 }
45 
46 bool MipsModuleDAGToDAGISel::runOnMachineFunction(MachineFunction &MF) {
47  LLVM_DEBUG(errs() << "In MipsModuleDAGToDAGISel::runMachineFunction\n");
48  auto &TPC = getAnalysis<TargetPassConfig>();
49  auto &TM = TPC.getTM<MipsTargetMachine>();
50  TM.resetSubtarget(&MF);
51  return false;
52 }
53 
55  return new MipsModuleDAGToDAGISel();
56 }
AnalysisUsage & addPreserved()
Add the specified Pass class to the set of analyses preserved by this pass.
raw_ostream & errs()
This returns a reference to a raw_ostream for standard error.
This class represents lattice values for constants.
Definition: AllocatorList.h:24
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.
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:285
FunctionPass * createMipsModuleISelDagPass()
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49
#define LLVM_DEBUG(X)
Definition: Debug.h:123