diff options
| author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-11-29 09:35:44 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-07 21:05:15 -0700 |
| commit | 12e60e8379aff9674549f0ad1e263a946c5ccc36 (patch) | |
| tree | 490e8fafde38c392ba18ecfe1fc6b3b301a30c9c | |
| parent | d2819bbda2bf7402ff95219ffba99f1621134a0d (diff) | |
| download | sparse-dev-12e60e8379aff9674549f0ad1e263a946c5ccc36.tar.gz | |
Associate pseudos with the symbol name whose value they got.
This is purely for debugging. It's only used to show what symbol
a pseudo might be (and I stress "might", since CSE can and does
screw it up) associated with.
Also print out the def list for a basic block when verbose.
It all makes it a bit easier to guess what's up.
| -rw-r--r-- | flow.c | 2 | ||||
| -rw-r--r-- | linearize.c | 18 | ||||
| -rw-r--r-- | linearize.h | 1 | ||||
| -rw-r--r-- | memops.c | 1 |
4 files changed, 19 insertions, 3 deletions
@@ -255,6 +255,7 @@ no_dominance: found_dominator: br = delete_last_instruction(&parent->insns); phi = alloc_phi(parent, one->target, one->size); + phi->ident = phi->ident ? : pseudo->ident; add_instruction(&parent->insns, br); use_pseudo(phi, add_pseudo(dominators, phi)); } END_FOR_EACH_PTR(parent); @@ -277,6 +278,7 @@ void rewrite_load_instruction(struct instruction *insn, struct pseudo_list *domi FOR_EACH_PTR(dominators, phi) { if (new != phi->def->src1) goto complex_phi; + new->ident = new->ident ? : phi->ident; } END_FOR_EACH_PTR(phi); /* diff --git a/linearize.c b/linearize.c index 31e1d39f..a3a5a385 100644 --- a/linearize.c +++ b/linearize.c @@ -79,6 +79,7 @@ static const char *show_pseudo(pseudo_t pseudo) static int n; static char buffer[4][64]; char *buf; + int i; if (!pseudo) return "no pseudo"; @@ -115,7 +116,9 @@ static const char *show_pseudo(pseudo_t pseudo) } } case PSEUDO_REG: - snprintf(buf, 64, "%%r%d", pseudo->nr); + i = snprintf(buf, 64, "%%r%d", pseudo->nr); + if (pseudo->ident) + sprintf(buf+i, "(%s)", show_ident(pseudo->ident)); break; case PSEUDO_VAL: { long long value = pseudo->value; @@ -129,7 +132,9 @@ static const char *show_pseudo(pseudo_t pseudo) snprintf(buf, 64, "%%arg%d", pseudo->nr); break; case PSEUDO_PHI: - snprintf(buf, 64, "%%phi%d", pseudo->nr); + i = snprintf(buf, 64, "%%phi%d", pseudo->nr); + if (pseudo->ident) + sprintf(buf+i, "(%s)", show_ident(pseudo->ident)); break; default: snprintf(buf, 64, "<bad pseudo type %d>", pseudo->type); @@ -388,10 +393,10 @@ void show_instruction(struct instruction *insn) static void show_bb(struct basic_block *bb) { struct instruction *insn; - pseudo_t needs; printf(".L%p:\n", bb); if (verbose) { + pseudo_t needs, defines; printf("%s:%d\n", input_streams[bb->pos.stream].name, bb->pos.line); FOR_EACH_PTR(bb->needs, needs) { @@ -412,6 +417,10 @@ static void show_bb(struct basic_block *bb) } } END_FOR_EACH_PTR(needs); + FOR_EACH_PTR(bb->defines, defines) { + printf(" **defines %s **\n", show_pseudo(defines)); + } END_FOR_EACH_PTR(defines); + if (bb->parents) { struct basic_block *from; FOR_EACH_PTR(bb->parents, from) { @@ -692,6 +701,7 @@ static pseudo_t symbol_pseudo(struct entrypoint *ep, struct symbol *sym) pseudo = __alloc_pseudo(0); pseudo->type = PSEUDO_SYM; pseudo->sym = sym; + pseudo->ident = sym->ident; sym->pseudo = pseudo; add_symbol(&ep->accesses, sym); } @@ -1525,6 +1535,7 @@ pseudo_t linearize_statement(struct entrypoint *ep, struct statement *stmt) add_instruction(&bb_return->insns, phi_node); } phi = alloc_phi(active, src, expr->ctype->bit_size); + phi->ident = &return_ident; use_pseudo(phi, add_pseudo(&phi_node->phi_list, phi)); } add_goto(ep, bb_return); @@ -1782,6 +1793,7 @@ static struct entrypoint *linearize_fn(struct symbol *sym, struct symbol *base_t merge_phi_sources = 1; do { cleanup_and_cse(ep); + simplify_flow(ep); pack_basic_blocks(ep); } while (repeat_phase & REPEAT_CSE); diff --git a/linearize.h b/linearize.h index 72cf4dda..0db5a437 100644 --- a/linearize.h +++ b/linearize.h @@ -22,6 +22,7 @@ struct pseudo { int nr; enum pseudo_type type; struct pseudo_ptr_list *users; + struct ident *ident; union { struct symbol *sym; struct instruction *def; @@ -64,6 +64,7 @@ no_dominance: found_dominator: br = delete_last_instruction(&parent->insns); phi = alloc_phi(parent, one->target, one->size); + phi->ident = phi->ident ? : one->target->ident; add_instruction(&parent->insns, br); use_pseudo(phi, add_pseudo(dominators, phi)); } END_FOR_EACH_PTR(parent); |
