ref: d6ff7f1f2ae3daa13b2d910ff41b6bc4d982d087
parent: f8e816da535fa77a818bf85ac8ce0ab879ef1e84
author: Roberto E. Vargas Caballero <[email protected]>
date: Fri Aug 8 11:12:41 EDT 2014
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.
--- a/cc2/cc2.h
+++ b/cc2/cc2.h
@@ -43,6 +43,8 @@
#define STATIC 'S'
#define CONST '#'
#define LABEL 'L'
+#define OADD '+'
+#define OSUB '-'
extern void error(unsigned nerror, ...);
extern void genaddable(Node *list[]);
--- 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 @@
case CONST:
np->addable = 20;
break;
+ case OADD:
+ case OSUB:
+ xaddable(lp);
+ xaddable(rp);
}
}