shithub: scc

Download patch

ref: f1cee29eb08319cf970b8777a8fcd57b111bfad5
parent: 5ce98041ac6706539aac39a2c9e32a43db3e6bd8
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Sat Aug 9 07:41:31 EDT 2014

Remove copy of cgen.c

This copy was there due to some error in some commit.

--- a/cgen.c
+++ /dev/null
@@ -1,53 +1,0 @@
-
-#include <assert.h>
-#include <stddef.h>
-#include <stdint.h>
-
-#include "cc2.h"
-
-struct addrtype {
-	char op;
-	char left;
-	char right;
-	char addrtype;
-} addrtbl[] = {
-	{'A', 0, 0, 1},
-	{'#', 0, 0, 2},
-	{'+', 1, 2, 3},
-	{0},
-};
-
-struct nodeattr {
-	char addrtype;
-	char sethi;
-};
-
-struct nodeattr
-genaddr(Node *np)
-{
-	struct nodeattr left, right;
-	struct addrtype *bp;
-
-	left = (np->left) ? genaddr(np->left) : (struct nodeattr) {0, -1};
-	right = (np->right) ? genaddr(np->right) : (struct nodeattr) {0, -1};
-
-	for (bp = addrtbl; bp->op; ++bp) {
-		if (bp->op == np->op &&
-		    left.addrtype == bp->left &&
-		    right.addrtype == bp->right) {
-			break;
-		}
-	}
-
-	if ((np->addrtype = bp->addrtype) == 0) {
-		np->sethi = 0;
-	} else if (right.sethi < 0) {
-		np->sethi = (left.sethi > 1) ? left.sethi : 1;
-	} else  {
-		int8_t d = left.sethi - right.sethi;
-		np->sethi = ((d < 0) ? right.sethi : left.sethi) + 1;
-	}
-
-	return (struct nodeattr) {np->addrtype, np->sethi};
-}
-
--