scc

Simple C99 Compiler
Log | Files | Refs | README | LICENSE

commit 3fc0e80e34ebf76d739d77aaa0c28cda75369218
parent 0f3dfe60dbc570744ada7af40efd74c2950cb7ba
Author: Roberto E. Vargas Caballero <Roberto E. Vargas Caballero>
Date:   Mon, 25 Apr 2016 20:15:16 +0200

[cc2] Convert optimize into an apply function

This change makes the code more regular.

Diffstat:
cc2/cc2.h | 2+-
cc2/main.c | 2+-
cc2/optm.c | 5+++--
3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/cc2/cc2.h b/cc2/cc2.h @@ -186,7 +186,7 @@ extern void error(unsigned nerror, ...); extern void parse(void); /* optm.c */ -extern void optimize(void); +extern Node *optm(Node *np); /* cgen.c */ extern Node *sethi(Node *np); diff --git a/cc2/main.c b/cc2/main.c @@ -38,7 +38,7 @@ main(void) while (moreinput()) { parse(); - optimize(); + apply(optm); apply(sethi); apply(cgen); peephole(); diff --git a/cc2/optm.c b/cc2/optm.c @@ -2,7 +2,8 @@ #include "arch.h" #include "cc2.h" -void -optimize(void) +Node * +optm(Node *np) { + return np; }