summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2014-10-07 20:48:11 -0400
committerOri Bernstein <ori@eigenstate.org>2014-10-07 20:48:11 -0400
commit217a65d3c047bcdec44155f2688e3b1bdfd2414f (patch)
tree309a5959d8e96b8215296e97251c57ced77fd803
parent7088e222cf1b0ae17607ce0ac232067a172b851e (diff)
downloadmc-217a65d3c047bcdec44155f2688e3b1bdfd2414f.tar.gz
Add '-c' (extracheck) option to mc
To enable flaky checks. Checks guarded by this will eventually get enabled by default.
-rw-r--r--6/asm.h3
-rw-r--r--6/main.c4
-rw-r--r--6/simp.c2
3 files changed, 8 insertions, 1 deletions
diff --git a/6/asm.h b/6/asm.h
index d0b009f..c0c1e1d 100644
--- a/6/asm.h
+++ b/6/asm.h
@@ -187,6 +187,9 @@ struct Isel {
extern char *modenames[];
+/* options */
+extern int extracheck;
+
/* entry points */
void genblob(FILE *fd, Node *blob, Htab *globls, Htab *strtab);
void genasm(FILE *fd, Func *fn, Htab *globls, Htab *strtab);
diff --git a/6/main.c b/6/main.c
index ea57cb5..302d0e3 100644
--- a/6/main.c
+++ b/6/main.c
@@ -22,6 +22,7 @@
Node *file;
char debugopt[128];
int writeasm;
+int extracheck;
char *outfile;
char **incpaths;
size_t nincpaths;
@@ -30,6 +31,7 @@ static void usage(char *prog)
{
printf("%s [-h] [-o outfile] [-d[dbgopts]] inputs\n", prog);
printf("\t-h\tPrint this help\n");
+ printf("\t-c\tEnable additional (possibly flaky) checking\n");
printf("\t-S\tWrite out `input.s` when compiling\n");
printf("\t-I path\tAdd 'path' to use search path\n");
printf("\t-d\tPrint debug dumps. Recognized options: f r p i\n");
@@ -138,6 +140,8 @@ int main(int argc, char **argv)
usage(argv[0]);
exit(0);
break;
+ case 'c':
+ extracheck = 1;
case 'd':
while (ctx.optarg && *ctx.optarg)
debugopt[*ctx.optarg++ & 0x7f]++;
diff --git a/6/simp.c b/6/simp.c
index 134e94e..4c13186 100644
--- a/6/simp.c
+++ b/6/simp.c
@@ -1748,7 +1748,7 @@ static Func *simpfn(Simp *s, char *name, Node *dcl)
}
cfg = mkcfg(dcl, s->stmts, s->nstmts);
- if (debugopt['C'])
+ if (extracheck)
check(cfg);
if (debugopt['t'] || debugopt['s'])
dumpcfg(cfg, stdout);