commit abe45f1ab06229d51a1f62bf0569ae99b804823b
parent d8770d112bcee4c9df1cb4276780bddc818de5a4
Author: Quentin Carbonneaux <quentin.carbonneaux@yale.edu>
Date: Sat, 9 Apr 2016 14:32:07 -0400
enable constant folding
Diffstat:
3 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
@@ -4,7 +4,7 @@ ABI = sysv
V = @
OBJDIR = obj
-SRC = main.c util.c parse.c mem.c ssa.c copy.c live.c $(ABI).c isel.c spill.c rega.c emit.c
+SRC = main.c util.c parse.c mem.c ssa.c copy.c fold.c live.c $(ABI).c isel.c spill.c rega.c emit.c
OBJ = $(SRC:%.c=$(OBJDIR)/%.o)
CFLAGS += -Wall -Wextra -std=c99 -g -pedantic
diff --git a/all.h b/all.h
@@ -533,6 +533,9 @@ void ssa(Fn *);
/* copy.c */
void copy(Fn *);
+/* fold.c */
+void fold(Fn *);
+
/* live.c */
void liveon(BSet *, Blk *, Blk *);
void filllive(Fn *);
diff --git a/main.c b/main.c
@@ -11,6 +11,7 @@ char debug['Z'+1] = {
['M'] = 0, /* memory optimization */
['N'] = 0, /* ssa construction */
['C'] = 0, /* copy elimination */
+ ['F'] = 0, /* constant folding */
['S'] = 0, /* spilling */
['R'] = 0, /* reg. allocation */
};
@@ -48,6 +49,8 @@ func(Fn *fn)
ssa(fn);
filluse(fn);
copy(fn);
+ filluse(fn);
+ fold(fn);
abi(fn);
filluse(fn);
isel(fn);