summaryrefslogtreecommitdiff
path: root/mi
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2015-09-27 02:29:24 -0700
committerOri Bernstein <ori@eigenstate.org>2015-09-27 03:10:27 -0700
commit056ef88fc6d281ae626ddf2c598afe2abdb06888 (patch)
tree365360a966fd895ac3c2b117c1e2a6fce4f23730 /mi
parentcde7e0d999cf3d56f48d830cf3149f779d86fb31 (diff)
downloadmc-056ef88fc6d281ae626ddf2c598afe2abdb06888.tar.gz
Working closures.
Diffstat (limited to 'mi')
-rw-r--r--mi/cfg.c73
-rw-r--r--mi/dfcheck.c1
2 files changed, 39 insertions, 35 deletions
diff --git a/mi/cfg.c b/mi/cfg.c
index 4557c5e..94664c6 100644
--- a/mi/cfg.c
+++ b/mi/cfg.c
@@ -266,49 +266,54 @@ Cfg *mkcfg(Node *fn, Node **nl, size_t nn)
return cfg;
}
-void dumpcfg(Cfg *cfg, FILE *fd)
+void dumpbb(Bb *bb, FILE *fd)
{
- size_t i, j;
- Bb *bb;
+ size_t i;
char *sep;
- for (j = 0; j < cfg->nbb; j++) {
- bb = cfg->bb[j];
- if (!bb)
- continue;
- fprintf(fd, "\n");
- fprintf(fd, "Bb: %d labels=(", bb->id);
- sep = "";
- for (i = 0; i < bb->nlbls; i++) {;
- fprintf(fd, "%s%s", bb->lbls[i], sep);
+ fprintf(fd, "Bb: %d labels=(", bb->id);
+ sep = "";
+ for (i = 0; i < bb->nlbls; i++) {;
+ fprintf(fd, "%s%s", bb->lbls[i], sep);
+ sep = ",";
+ }
+ fprintf(fd, ")\n");
+
+ /* in edges */
+ fprintf(fd, "Pred: ");
+ sep = "";
+ for (i = 0; i < bsmax(bb->pred); i++) {
+ if (bshas(bb->pred, i)) {
+ fprintf(fd, "%s%zd", sep, i);
sep = ",";
}
- fprintf(fd, ")\n");
+ }
+ fprintf(fd, "\n");
- /* in edges */
- fprintf(fd, "Pred: ");
- sep = "";
- for (i = 0; i < bsmax(bb->pred); i++) {
- if (bshas(bb->pred, i)) {
- fprintf(fd, "%s%zd", sep, i);
- sep = ",";
- }
+ /* out edges */
+ fprintf(fd, "Succ: ");
+ sep = "";
+ for (i = 0; i < bsmax(bb->succ); i++) {
+ if (bshas(bb->succ, i)) {
+ fprintf(fd, "%s%zd", sep, i);
+ sep = ",";
}
- fprintf(fd, "\n");
+ }
+ fprintf(fd, "\n");
- /* out edges */
- fprintf(fd, "Succ: ");
- sep = "";
- for (i = 0; i < bsmax(bb->succ); i++) {
- if (bshas(bb->succ, i)) {
- fprintf(fd, "%s%zd", sep, i);
- sep = ",";
- }
- }
- fprintf(fd, "\n");
+ for (i = 0; i < bb->nnl; i++)
+ dump(bb->nl[i], fd);
+ fprintf(fd, "\n");
+}
- for (i = 0; i < bb->nnl; i++)
- dump(bb->nl[i], fd);
+void dumpcfg(Cfg *cfg, FILE *fd)
+{
+ size_t i;
+
+ for (i = 0; i < cfg->nbb; i++) {
+ if (!cfg->bb[i])
+ continue;
fprintf(fd, "\n");
+ dumpbb(cfg->bb[i], fd);
}
}
diff --git a/mi/dfcheck.c b/mi/dfcheck.c
index a7257cc..316bf65 100644
--- a/mi/dfcheck.c
+++ b/mi/dfcheck.c
@@ -70,7 +70,6 @@ static void checkreach(Cfg *cfg)
Bb *bb;
r = reaching(cfg);
-// dumpcfg(cfg, stdout);
for (i = 0; i < cfg->nbb; i++) {
bb = cfg->bb[i];
if (!bb)