From: 박종현/동작제어Lab(SR)/Staff Engineer/삼성전자 Date: Thu, 6 Dec 2018 06:29:01 +0000 (+0900) Subject: [enco] Support block dump (#2528) X-Git-Tag: nncc_backup~1177 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=00451bb168ef4fb599fffec067545879ed2b1cc5;p=platform%2Fcore%2Fml%2Fnnfw.git [enco] Support block dump (#2528) This commit implement "enco_dump_block" debugging helper which shows all the instructions in a given block. Signed-off-by: Jonghyun Park --- diff --git a/contrib/enco/core/src/Support/Debugging.cpp b/contrib/enco/core/src/Support/Debugging.cpp index 987fa1d..519fd1b 100644 --- a/contrib/enco/core/src/Support/Debugging.cpp +++ b/contrib/enco/core/src/Support/Debugging.cpp @@ -387,3 +387,27 @@ DEBUGGING_API_P(enco_dump_all_instrs, coco::Module, m) std::cout << desc << std::endl; } } + +/** + * SECTION: Block + */ +namespace +{ + +pp::LinearDocument describe(const coco::Block *blk) +{ + pp::LinearDocument doc; + + for (auto ins = blk->instr()->head(); ins; ins = ins->next()) + { + auto setter = [ins](pp::LinearDocument &doc) { doc.append(describe(ins)); }; + auto desc = section("instr").build(setter); + doc.append(desc); + } + + return doc; +} + +} // namespace + +DEBUGGING_API_P(enco_dump_block, coco::Block, blk) { std::cout << describe(blk) << std::endl; } diff --git a/contrib/enco/core/src/Support/Debugging.h b/contrib/enco/core/src/Support/Debugging.h index bf1d625..a3a36cc 100644 --- a/contrib/enco/core/src/Support/Debugging.h +++ b/contrib/enco/core/src/Support/Debugging.h @@ -81,6 +81,14 @@ DEBUGGING_API_P(enco_dump_all_ops, coco::Module); */ DEBUGGING_API_P(enco_dump_all_instrs, coco::Module); +/** + * Print the details of all the instruction in a given block + * + * (gdb) call enco_dump_block(b) + * (gdb) call enco_dump_block(0x...) + */ +DEBUGGING_API_P(enco_dump_block, coco::Block); + #undef DEBUGGING_API_P #endif // __ENCO_SUPPORT_DEBUGGING_H__