30 MachineModuleSlotTracker MST(
37 MST.renumberMetadataForAssembly();
42 M.renumberMetadataForAssembly();
46 if (
F.isDeclaration() ||
F.hasAvailableExternallyLinkage())
51 printMachineFunction(MF,
FAM, MFAM);
63 std::string MachineFunctions;
68 StringRef getPassName()
const override {
return "MIR Printing Pass"; }
70 void getAnalysisUsage(AnalysisUsage &AU)
const override {
78 raw_string_ostream StrOS(Str);
80 MachineModuleInfo *MMI =
81 &getAnalysis<MachineModuleInfoWrapperPass>().getMMI();
83 const VirtRegMap *VRM =
nullptr;
84 if (
auto *W = getAnalysisIfAvailable<VirtRegMapWrapperLegacy>())
87 MachineModuleSlotTracker MST(
89 MST.renumberMetadataForAssembly();
91 MachineFunctions.append(Str);
95 bool doFinalization(
Module &M)
override {
96 M.renumberMetadataForAssembly();
98 OS << MachineFunctions;
103char MIRPrintingPass::ID = 0;
108 return new MIRPrintingPass(OS);
Module.h This file contains the declarations for the Module class.
Machine Check Debug Module
FunctionAnalysisManager FAM
ModuleAnalysisManager MAM
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.
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(Module &M, ModuleAnalysisManager &MAM)
Print the module and all its machine functions.
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...
InnerAnalysisManagerProxy< FunctionAnalysisManager, Module > FunctionAnalysisManagerModuleProxy
Provide the FunctionAnalysisManager to Module proxy.
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.
InnerAnalysisManagerProxy< MachineFunctionAnalysisManager, Function > MachineFunctionAnalysisManagerFunctionProxy
AnalysisManager< Function > FunctionAnalysisManager
Convenience typedef for the Function analysis manager.
AnalysisManager< Module > ModuleAnalysisManager
Convenience typedef for the Module analysis manager.