Skip to content

Commit 26897ed

Browse files
jgu222igcbot
authored andcommitted
Make dump() no arg function. Add dumptofile(filename).
Those two are expected to be invoked inside debugger.
1 parent 061f114 commit 26897ed

File tree

6 files changed

+26
-7
lines changed

6 files changed

+26
-7
lines changed

visa/FlowGraph.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4574,7 +4574,7 @@ void FlowGraph::print(std::ostream& OS) const
45744574
<< (builder->getIsKernel() ? " [kernel]" : " [non-kernel function]")
45754575
<< "\n\n";
45764576
for (auto BB : BBs) {
4577-
BB->dump(OS);
4577+
BB->print(OS);
45784578
}
45794579
}
45804580

@@ -4583,6 +4583,12 @@ void FlowGraph::dump() const
45834583
print(std::cerr);
45844584
}
45854585

4586+
void FlowGraph::dumptofile(const char* Filename) const
4587+
{
4588+
std::fstream ofile(Filename, std::ios::out);
4589+
print(ofile);
4590+
}
4591+
45864592
FlowGraph::~FlowGraph()
45874593
{
45884594
// even though G4_BBs are allocated in a mem pool and freed in one shot,

visa/FlowGraph.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,8 @@ class FlowGraph
643643
void findNestedDivergentBBs(std::unordered_map<G4_BB*, int>& nestedDivergentBBs);
644644

645645
void print(std::ostream& OS) const;
646-
void dump() const;
646+
void dump() const; // used in debugger
647+
void dumptofile(const char* Filename) const; // used in debugger
647648
private:
648649
// Use normalized region descriptors for each source operand if possible.
649650
void normalizeRegionDescriptors();

visa/G4_BB.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1454,7 +1454,12 @@ const char* G4_BB::getBBTypeStr() const
14541454
return " ";
14551455
}
14561456

1457-
void G4_BB::dump(std::ostream& OS) const
1457+
void G4_BB::dump() const
1458+
{
1459+
print(std::cerr);
1460+
}
1461+
1462+
void G4_BB::print(std::ostream& OS) const
14581463
{
14591464
OS << "BB" << getId() << ":";
14601465
if (getBBType())

visa/G4_BB.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,8 @@ class G4_BB
321321
/// Dump instructions into the standard error.
322322
const char* getBBTypeStr() const;
323323

324-
void dump(std::ostream& os = std::cerr) const;
324+
void print(std::ostream& os = std::cerr) const;
325+
void dump() const; // used in debugger
325326
void dumpDefUse(std::ostream& os = std::cerr) const;
326327

327328
// reset this BB's instruction's local id so they are [0,..#BBInst-1]

visa/G4_Kernel.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -577,9 +577,14 @@ void G4_Kernel::evalAddrExp()
577577
}
578578
}
579579

580-
void G4_Kernel::dump(std::ostream& OS) const
580+
void G4_Kernel::dump() const
581581
{
582-
fg.print(OS);
582+
fg.print(std::cerr);
583+
}
584+
585+
void G4_Kernel::dumptofile(const char* Filename) const
586+
{
587+
fg.dumptofile(Filename);
583588
}
584589

585590
void G4_Kernel::dumpDotFile(const char* appendix)

visa/G4_Kernel.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,8 @@ class G4_Kernel
251251
void evalAddrExp();
252252

253253
/// dump this kernel to the standard error
254-
void dump(std::ostream& OS = std::cerr) const;
254+
void dump() const; // used in debugger
255+
void dumptofile(const char* Filename) const; // used in debugger
255256
void dumpDotFile(const char* appendix);
256257
void emit_asm(std::ostream& output, bool beforeRegAlloc, void * binary, uint32_t binarySize);
257258
void emit_RegInfo();

0 commit comments

Comments
 (0)