[hackers] [scc] [cc2] Convert optimize into an apply function || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Wed, 27 Apr 2016 20:46:33 +0200 (CEST)

commit 3fc0e80e34ebf76d739d77aaa0c28cda75369218
Author: Roberto E. Vargas Caballero <Roberto E. Vargas Caballero>
AuthorDate: Mon Apr 25 20:15:16 2016 +0200
Commit: Roberto E. Vargas Caballero <Roberto E. Vargas Caballero>
CommitDate: Mon Apr 25 20:15:16 2016 +0200

    [cc2] Convert optimize into an apply function
    
    This change makes the code more regular.

diff --git a/cc2/cc2.h b/cc2/cc2.h
index e72ea8e..39a952e 100644
--- a/cc2/cc2.h
+++ b/cc2/cc2.h
_AT_@ -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
index 5ea38f0..e9848c6 100644
--- a/cc2/main.c
+++ b/cc2/main.c
_AT_@ -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
index b86d32e..ffc4afa 100644
--- a/cc2/optm.c
+++ b/cc2/optm.c
_AT_@ -2,7 +2,8 @@
 #include "arch.h"
 #include "cc2.h"
 
-void
-optimize(void)
+Node *
+optm(Node *np)
 {
+ return np;
 }
Received on Wed Apr 27 2016 - 20:46:33 CEST

This archive was generated by hypermail 2.3.0 : Wed Apr 27 2016 - 20:48:20 CEST