21#define DEBUG_TYPE "mir-strip-debug"
27 OnlyDebugifiedDefault(
"mir-strip-debugify-only",
28 cl::desc(
"Should mir-strip-debug only strip debug "
29 "info from debugified modules by default"),
32struct StripDebugMachineModule :
public ModulePass {
35 NamedMDNode *DebugifyMD = M.getNamedMetadata(
"llvm.debugify");
38 " (debugify metadata not found)?\n");
44 getAnalysis<MachineModuleInfoWrapperPass>().getMMI();
54 if (
MI.isDebugInstr()) {
59 if (
MI.getNumOperands() > 1) {
66 if (
MI.getDebugLoc()) {
82 StripDebugMachineModule() : StripDebugMachineModule(OnlyDebugifiedDefault) {}
83 StripDebugMachineModule(
bool OnlyDebugified)
97char StripDebugMachineModule::ID = 0;
102 "Machine Strip Debug Module",
false,
false)
107 return new StripDebugMachineModule(OnlyDebugified);
COFF::MachineTypes Machine
static ManagedStatic< cl::opt< bool, true >, CreateDebug > Debug
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
#define INITIALIZE_PASS_BEGIN(passName, arg, name, cfg, analysis)
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.
void setPreservesCFG()
This function should be called by the pass, iff they do not:
instr_iterator erase(instr_iterator I)
Remove an instruction from the instruction list and delete it.
Representation of each machine instruction.
This class contains meta information specific to a module.
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...
virtual bool runOnModule(Module &M)=0
runOnModule - Virtual method overriden by subclasses to process the module being operated on.
A Module instance is used to store all the information related to an LLVM module.
virtual void getAnalysisUsage(AnalysisUsage &) const
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
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.
ModulePass * createStripDebugMachineModulePass(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...
bool stripDebugifyMetadata(Module &M)
Strip out all of the metadata and debug info inserted by debugify.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.