LLVM 20.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
19using namespace llvm;
20
21#define DEBUG_TYPE "mips-isel"
22
23namespace {
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
44 char MipsModuleDAGToDAGISel::ID = 0;
45}
46
47bool 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}
#define LLVM_DEBUG(X)
Definition: Debug.h:101
Target-Independent Code Generator Pass Configuration Options pass.
Represent the analysis usage information of a pass.
AnalysisUsage & addRequired()
AnalysisUsage & addPreserved()
Add the specified Pass class to the set of analyses preserved by this pass.
FunctionPass class - This class is used to implement most global optimizations.
Definition: Pass.h:310
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
virtual bool runOnMachineFunction(MachineFunction &MF)=0
runOnMachineFunction - This method must be overloaded to perform the desired machine code transformat...
virtual StringRef getPassName() const
getPassName - Return a nice clean name for a pass.
Definition: Pass.cpp:81
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
Target-Independent Code Generator Pass Configuration Options.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition: CallingConv.h:24
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
FunctionPass * createMipsModuleISelDagPass()
raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.