scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit d6ff7f1f2ae3daa13b2d910ff41b6bc4d982d087
parent f8e816da535fa77a818bf85ac8ce0ab879ef1e84
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Fri,  8 Aug 2014 15:12:41 +0200

Add stub of addresability of OADD and OSUB

This is only a stub, and it is not clear what I have to do, but
it is first step.

Diffstat:
Mcc2/cc2.h | 2++
Mcc2/cgen.c | 8++++++++
2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/cc2/cc2.h b/cc2/cc2.h @@ -43,6 +43,8 @@ enum nerrors { #define STATIC 'S' #define CONST '#' #define LABEL 'L' +#define OADD '+' +#define OSUB '-' extern void error(unsigned nerror, ...); extern void genaddable(Node *list[]); diff --git a/cc2/cgen.c b/cc2/cgen.c @@ -15,11 +15,15 @@ static void xaddable(Node *np) { + Node *lp, *rp; + if (!np) return; np->complex = 0; np->addable = 0; + lp = np->left; + rp = np->right; switch (np->op) { case AUTO: np->addable = 11; @@ -33,6 +37,10 @@ xaddable(Node *np) case CONST: np->addable = 20; break; + case OADD: + case OSUB: + xaddable(lp); + xaddable(rp); } }