26#define DEBUG_TYPE "mir-strip-debug"
33 OnlyDebugifiedDefault(
"mir-strip-debugify-only",
34 cl::desc(
"Should mir-strip-debug only strip debug "
35 "info from debugified modules by default"),
38bool stripDebugMachineModuleImpl(
39 Module &M,
bool OnlyDebugified,
42 NamedMDNode *DebugifyMD = M.getNamedMetadata(
"llvm.debugify");
45 " (debugify metadata not found)?\n");
58 if (
MI.isDebugInstr()) {
63 if (
MI.getNumOperands() > 1) {
70 if (
MI.getDebugLoc()) {
86struct StripDebugMachineModule :
public ModulePass {
87 bool runOnModule(
Module &M)
override {
89 getAnalysis<MachineModuleInfoWrapperPass>().getMMI();
90 return stripDebugMachineModuleImpl(
96 StripDebugMachineModule() : StripDebugMachineModule(OnlyDebugifiedDefault) {}
97 StripDebugMachineModule(
bool OnlyDebugified)
111char StripDebugMachineModule::ID = 0;
116 "Machine Strip Debug Module",
false,
false)
121 return new StripDebugMachineModule(OnlyDebugified);
128 const bool Changed = stripDebugMachineModuleImpl(
Module.h This file contains the declarations for the Module class.
This header defines various interfaces for pass management in LLVM.
FunctionAnalysisManager FAM
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
#define INITIALIZE_PASS_BEGIN(passName, arg, name, cfg, analysis)
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
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.
LLVM_ABI void setPreservesCFG()
This function should be called by the pass, iff they do not:
Represents analyses that only rely on functions' control flow.
This analysis create MachineFunction for given Function.
Representation of each machine instruction.
An analysis that produces MachineModuleInfo for a module.
This class contains meta information specific to a module.
LLVM_ABI MachineFunction * getMachineFunction(const Function &F) const
Returns the MachineFunction associated to IR function F if there is one, otherwise nullptr.
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
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.
PreservedAnalyses & preserveSet()
Mark an analysis set as preserved.
PreservedAnalyses & preserve()
Mark an analysis as preserved.
LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM)
An efficient, type-erasing, non-owning reference to a callable.
Pass manager infrastructure for declaring and invalidating analyses.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
initializer< Ty > init(const Ty &Val)
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI ModulePass * createStripDebugMachineModuleLegacyPass(bool OnlyDebugified)
Creates MIR Strip Debug pass.
iterator_range< early_inc_iterator_impl< detail::IterOfRange< RangeT > > > make_early_inc_range(RangeT &&Range)
Make a range that does early increment to allow mutation of the underlying range without disrupting i...
InnerAnalysisManagerProxy< FunctionAnalysisManager, Module > FunctionAnalysisManagerModuleProxy
Provide the FunctionAnalysisManager to Module proxy.
LLVM_ABI bool stripDebugifyMetadata(Module &M)
Strip out all of the metadata and debug info inserted by debugify.
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
AnalysisManager< Function > FunctionAnalysisManager
Convenience typedef for the Function analysis manager.
AnalysisManager< Module > ModuleAnalysisManager
Convenience typedef for the Module analysis manager.