ref: b06516b170729a996782aec041f680b174ab0536
parent: 39bfe028452628178b06c1f0544fd7aca1660da0
author: Roberto E. Vargas Caballero <[email protected]>
date: Mon Apr 25 16:15:16 EDT 2016
[cc2] Convert optimize into an apply function This change makes the code more regular.
--- a/cc2/cc2.h
+++ b/cc2/cc2.h
@@ -186,7 +186,7 @@
extern void parse(void);
/* optm.c */
-extern void optimize(void);
+extern Node *optm(Node *np);
/* cgen.c */
extern Node *sethi(Node *np);
--- a/cc2/main.c
+++ b/cc2/main.c
@@ -38,7 +38,7 @@
while (moreinput()) {
parse();
- optimize();
+ apply(optm);
apply(sethi);
apply(cgen);
peephole();
--- 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;
}