11#include "mlir/Support/IndentedOstream.h"
16static void dump(
DIModule &module, raw_indented_ostream &os);
19 os <<
"Variable " << variable.
name;
21 os <<
" at " << variable.
loc;
25 if (
auto blockArg = dyn_cast_or_null<BlockArgument>(variable.
value)) {
26 os <<
"Arg " << blockArg.getArgNumber() <<
" of "
27 << blockArg.getOwner()->getParentOp()->getName();
28 }
else if (
auto result = dyn_cast_or_null<OpResult>(variable.
value)) {
29 os <<
"Result " << result.getResultNumber() <<
" of "
30 << result.getDefiningOp()->getName();
32 os <<
" of type " << variable.
value.getType() <<
" at "
33 << variable.
value.getLoc() <<
"\n";
39 os <<
"Instance " << instance.
name <<
" of " << instance.module->
name;
41 os <<
" for " << instance.
op->getName() <<
" at " << instance.
op->getLoc();
43 if (instance.module->isInline) {
45 dump(*instance.module, os);
51 os <<
"Module " <<
module.name;
53 os <<
" for " <<
module.op->getName() << " at " << module.op->getLoc();
56 for (
auto *variable :
module.variables)
58 for (
auto *instance :
module.instances)
64 os <<
"DebugInfo for " << di.
operation->getName() <<
" at "
68 dump(*nameAndModule.second, os);
72LogicalResult debug::dumpDebugInfo(Operation *module, llvm::raw_ostream &os) {
74 raw_indented_ostream indentedOs(os);
static void dump(DIModule &module, raw_indented_ostream &os)
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
Operation * op
The operation that generated this instance.
StringAttr name
The name of this instance.
Operation * op
The operation that generated this level of hierarchy.
Value value
The SSA value representing the value of this variable.
StringAttr name
The name of this variable.
LocationAttr loc
The location of the variable's declaration.
Debug information attached to an operation and the operations nested within.
Operation * operation
The operation that was passed to the constructor.
llvm::MapVector< StringAttr, DIModule * > moduleNodes
A mapping from module name to module debug info.