Skip to content

Commit 7378a52

Browse files
authored
Merge pull request #223 from ChAoSUnItY/fix/ir-dumping
Improve IR dumping information
2 parents 11785eb + 1195c89 commit 7378a52

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/arm-codegen.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,10 @@ void cfg_flatten(void)
147147
elf_offset += 24;
148148

149149
for (func = FUNC_LIST.head; func; func = func->next) {
150-
ph2_ir_t *flatten_ir;
151-
152150
/* reserve stack */
153-
flatten_ir = add_ph2_ir(OP_define);
151+
ph2_ir_t *flatten_ir = add_ph2_ir(OP_define);
154152
flatten_ir->src0 = func->stack_size;
153+
strncpy(flatten_ir->func_name, func->return_def.var_name, MAX_VAR_LEN);
155154

156155
for (basic_block_t *bb = func->bbs; bb; bb = bb->rpo_next) {
157156
bb->elf_offset = elf_offset;

src/riscv-codegen.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ void cfg_flatten(void)
124124
/* reserve stack */
125125
ph2_ir_t *flatten_ir = add_ph2_ir(OP_define);
126126
flatten_ir->src0 = func->stack_size;
127+
strncpy(flatten_ir->func_name, func->return_def.var_name, MAX_VAR_LEN);
127128

128129
for (basic_block_t *bb = func->bbs; bb; bb = bb->rpo_next) {
129130
bb->elf_offset = elf_offset;

src/ssa.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -991,7 +991,7 @@ void bb_dump(FILE *fd, func_t *func, basic_block_t *bb)
991991
printf("Warning: normal BB with condition\n");
992992

993993
fprintf(fd, "subgraph cluster_%p {\n", bb);
994-
fprintf(fd, "label=\"BasicBlock %p\"\n", bb);
994+
fprintf(fd, "label=\"BasicBlock %p (%s)\"\n", bb, bb->bb_label_name);
995995

996996
insn_t *insn = bb->insn_list.head;
997997
if (!insn)
@@ -1170,7 +1170,7 @@ void dump_cfg(char name[])
11701170
for (func_t *func = FUNC_LIST.head; func; func = func->next) {
11711171
func->visited++;
11721172
fprintf(fd, "subgraph cluster_%p {\n", func);
1173-
fprintf(fd, "label=\"%p\"\n", func);
1173+
fprintf(fd, "label=\"%p (%s)\"\n", func, func->return_def.var_name);
11741174
bb_dump(fd, func, func->bbs);
11751175
fprintf(fd, "}\n");
11761176
}

0 commit comments

Comments
 (0)