28 M.renumberMetadataForAssembly();
58 std::string MachineFunctions;
63 StringRef getPassName()
const override {
return "MIR Printing Pass"; }
65 void getAnalysisUsage(AnalysisUsage &AU)
const override {
73 raw_string_ostream StrOS(Str);
75 MachineModuleInfo *MMI =
76 &getAnalysis<MachineModuleInfoWrapperPass>().getMMI();
78 const VirtRegMap *VRM =
nullptr;
79 if (
auto *W = getAnalysisIfAvailable<VirtRegMapWrapperLegacy>())
82 MachineModuleSlotTracker MST(
84 MST.renumberMetadataForAssembly();
86 MachineFunctions.append(Str);
90 bool doFinalization(
Module &M)
override {
91 M.renumberMetadataForAssembly();
93 OS << MachineFunctions;
98char MIRPrintingPass::ID = 0;
103INITIALIZE_PASS(MIRPrintingPass,
"mir-printer",
"MIR Printer",
false,
false)
106 return new MIRPrintingPass(OS);
Module.h This file contains the declarations for the Module class.
Machine Check Debug Module
FunctionAnalysisManager FAM
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
PassT::Result * getCachedResult(IRUnitT &IR) const
Get the cached result of an analysis pass for a given IR unit.
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
AnalysisUsage & addUsedIfAvailable()
Add the specified Pass class to the set of analyses used by this pass.
void setPreservesAll()
Set by analyses that do not transform their input at all.
This analysis create MachineFunction for given Function.
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.
LLVM_ABI MachineFunction * getMachineFunction(const Function &F) const
Returns the MachineFunction associated to IR function F if there is one, otherwise nullptr.
void renumberMetadataForAssembly()
Renumber module and machine metadata for canonical MIR output.
A Module instance is used to store all the information related to an LLVM module.
A set of analyses that are preserved following a run of a transformation pass.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
LLVM_ABI PreservedAnalyses run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM)
LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &MFAM)
This class implements an extremely fast bulk output stream that can only output to a stream.
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI MachineFunctionPass * createPrintMIRPass(raw_ostream &OS)
MIRPrinting pass - this pass prints out the LLVM IR into the given stream using the MIR serialization...
AnalysisManager< MachineFunction > MachineFunctionAnalysisManager
LLVM_ABI void printMIR(raw_ostream &OS, const Module &M)
Print LLVM IR using the MIR serialization format to the given output stream.
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
LLVM_ABI char & MIRPrintingPassID
MIRPrintingPass - this pass prints out the LLVM IR using the MIR serialization format.
AnalysisManager< Module > ModuleAnalysisManager
Convenience typedef for the Module analysis manager.