diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | profile.c | 34 |
2 files changed, 4 insertions, 35 deletions
@@ -1,8 +1,3 @@ -2016-03-02 Arnold D. Robbins <arnold@skeeve.com> - - * debug.c (print_instruction): Add additional stuff for - Op_K_if and Op_K_else. - 2016-03-01 Arnold D. Robbins <arnold@skeeve.com> * debug.c (print_instruction): For Op_comment, add notation as @@ -192,22 +192,6 @@ pp_free(NODE *n) freenode(n); } -/* get_next_real_inst --- skip Op_comment */ - -static INSTRUCTION * -get_next_real_inst(INSTRUCTION *pc) -{ - if (pc == NULL) - return pc; - - for (; pc != NULL && pc->opcode == Op_comment; pc = pc->nexti) { -fprintf(stderr, "%s: opcode is %s\n", __func__, opcode2str(pc->opcode)); - continue; - } - - return pc; -} - /* pprint --- pretty print a program segment */ static void @@ -223,7 +207,6 @@ pprint(INSTRUCTION *startp, INSTRUCTION *endp, int flags) char *tmp; int rule; static int rule_count[MAXRULE]; - INSTRUCTION *next_real; for (pc = startp; pc != endp; pc = pc->nexti) { if (pc->source_line > 0) @@ -759,16 +742,8 @@ cleanup: t1 = pp_pop(); if (is_binary(t1->type)) pp_parenthesize(t1); - if (pc->source_line > 0) { /* don't print implicit 'return' at end of function */ - if (pc->nexti->opcode != Op_comment || pc->nexti->memory->comment_type != EOL_COMMENT) - fprintf(prof_fp, "%s %s\n", op2str(pc->opcode), t1->pp_str); - else { - fprintf(prof_fp, "%s %s", op2str(pc->opcode), t1->pp_str); - // print the comment - print_comment(pc->nexti, 0); - pc = pc->nexti; /* skip it */ - } - } + if (pc->source_line > 0) /* don't print implicit 'return' at end of function */ + fprintf(prof_fp, "%s %s\n", op2str(pc->opcode), t1->pp_str); pp_free(t1); break; @@ -954,9 +929,8 @@ cleanup: */ fprintf(prof_fp, "} %s ", op2str(pc->opcode)); - next_real = get_next_real_inst(pc->nexti); - if (next_real->nexti->opcode == Op_K_if - && pc->branch_end == next_real->nexti->branch_else->nexti) { + if (pc->nexti->nexti->opcode == Op_K_if + && pc->branch_end == pc->nexti->nexti->branch_else->lasti) { pprint(pc->nexti, pc->branch_end, IN_ELSE_IF); } else { fprintf(prof_fp, "{\n"); |