1 /* $Id: cs_debug.c,v 1.8 1994/06/24 10:22:03 ceriel Exp $ */
3 * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
4 * See the copyright notice in the ACK home directory, in the file "Copyright".
8 #include "../share/types.h"
9 #include "../share/debug.h"
10 #include "../share/lset.h"
14 #include "cs_entity.h"
18 extern char em_mnem[]; /* The mnemonics of the EM instructions. */
23 /* Makes the instruction in `lnp' human readable. Only lines that
24 * can occur in expressions that are going to be eliminated are
27 if (INSTR(lnp) < sp_fmnem && INSTR(lnp) > sp_lmnem) {
28 fprintf(stderr,"*** ?\n");
32 fprintf(stderr,"%s", &em_mnem[4 * (INSTR(lnp)-sp_fmnem)]);
37 fprintf(stderr," %d", SHORT(lnp));
40 fprintf(stderr," %d", OBJ(lnp)->o_id);
43 fprintf(stderr," %ld", OFFSET(lnp));
55 /* Shows all instructions in an occurrence. */
57 register line_p lnp, next;
60 for (lnp = ocp->oc_lfirst; lnp != (line_p) 0; lnp = next) {
61 next = lnp == ocp->oc_llast ? (line_p) 0 : lnp->l_next;
75 /* Shows an available expression. */
76 showinstr(avp->av_found);
77 fprintf(stderr,"result %d,", avp->av_result);
78 fprintf(stderr,"occurred %d times\n", Lnrelems(avp->av_occurs) + 1);
84 register avail_p ravp;
86 fprintf(stderr,"AVAILABLE EXPRESSIONS\n");
88 for (ravp = avails; ravp != (avail_p) 0; ravp = ravp->av_before) {
94 STATIC char *enkinds[] = {
101 "address of external",
102 "address of offsetted",
103 "address of local base",
104 "address of argument base",
117 fprintf(stderr,"ENTITIES\n");
118 for (i = Lfirst(entities); i != (Lindex) 0; i = Lnext(i, entities)) {
119 register entity_p rep = en_elem(i);
121 fprintf(stderr,"%s,", enkinds[rep->en_kind]);
122 fprintf(stderr,"size %ld,", rep->en_size);
123 fprintf(stderr,"valno %d,", rep->en_vn);
124 switch (rep->en_kind) {
126 fprintf(stderr,"$%ld\n", rep->en_val);
130 fprintf(stderr,"%ld(LB)\n", rep->en_loc);
133 fprintf(stderr,"*%d\n", rep->en_ind);
137 fprintf(stderr,"%ld(%d)\n", rep->en_off, rep->en_base);
141 fprintf(stderr,"%ld levels\n", rep->en_levels);
144 fprintf(stderr,"%d[%d], ",rep->en_arbase,rep->en_index);
145 fprintf(stderr,"rom at %d\n", rep->en_adesc);
148 fprintf(stderr,"\n");