Go to the documentation of this file.
23 #define DEBUG_TYPE "mir-check-debugify"
29 struct CheckDebugMachineModule :
public ModulePass {
30 bool runOnModule(
Module &
M)
override {
31 NamedMDNode *NMD =
M.getNamedMetadata(
"llvm.mir.debugify");
33 errs() <<
"WARNING: Please run mir-debugify to generate "
34 "llvm.mir.debugify metadata first.\n";
39 getAnalysis<MachineModuleInfoWrapperPass>().getMMI();
41 auto getDebugifyOperand = [&](
unsigned Idx) ->
unsigned {
46 "llvm.mir.debugify should have exactly 2 operands!");
47 unsigned NumLines = getDebugifyOperand(0);
48 unsigned NumVars = getDebugifyOperand(1);
60 if (
MI.isDebugValue())
63 if (
DL &&
DL.getLine() != 0) {
64 MissingLines.reset(
DL.getLine() - 1);
69 errs() <<
"WARNING: Instruction with empty DebugLoc in function ";
70 errs() <<
F.getName() <<
" --";
78 if (!
MI.isDebugValue())
83 (void)to_integer(
LocalVar->getName(), Var, 10);
84 assert(Var <= NumVars &&
"Unexpected name for DILocalVariable");
85 MissingVars.reset(Var - 1);
91 for (
unsigned Idx : MissingLines.set_bits()) {
92 errs() <<
"WARNING: Missing line " << Idx + 1 <<
"\n";
96 for (
unsigned Idx : MissingVars.set_bits()) {
97 errs() <<
"WARNING: Missing variable " << Idx + 1 <<
"\n";
100 errs() <<
"Machine IR debug info check: ";
101 errs() << (
Fail ?
"FAIL" :
"PASS") <<
"\n";
120 "Machine Check Debug Module",
false,
false)
125 return new CheckDebugMachineModule();
ModulePass * createCheckDebugMachineModulePass()
Creates MIR Check Debug pass.
This is an optimization pass for GlobalISel generic memory operations.
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
unsigned getNumOperands() const
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
INITIALIZE_PASS_BEGIN(CheckDebugMachineModule, DEBUG_TYPE, "Machine Check Debug Module", false, false) INITIALIZE_PASS_END(CheckDebugMachineModule
raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
Represent the analysis usage information of a pass.
This class contains meta information specific to a module.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
virtual void print(raw_ostream &OS, const Module *M) const
print - Print out the internal state of the pass.
const MDOperand & getOperand(unsigned I) const
Representation of each machine instruction.
MDNode * getOperand(unsigned i) const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
A Module instance is used to store all the information related to an LLVM module.
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
void setPreservesAll()
Set by analyses that do not transform their input at all.
MachineFunction * getMachineFunction(const Function &F) const
Returns the MachineFunction associated to IR function F if there is one, otherwise nullptr.
COFF::MachineTypes Machine
AnalysisUsage & addRequired()