ref: d6ff7f1f2ae3daa13b2d910ff41b6bc4d982d087
dir: /cc2/cgen.c/
#include <assert.h> #include <stddef.h> #include <stdint.h> #include "cc2.h" /* * calculate addresability as follows * AUTO => 11 * REGISTER => 13 * STATIC => 12 * CONST => 20 */ 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; break; case REGISTER: np->addable = 13; break; case STATIC: np->addable = 12; break; case CONST: np->addable = 20; break; case OADD: case OSUB: xaddable(lp); xaddable(rp); } } void genaddable(Node *list[]) { Node *np; while ((np = *list++) != NULL) xaddable(np); }