shithub: scc

Download patch

ref: a8877ebf2f19bf0301f90d9bdff9e23605acfe97
parent: 96b6cc1d8be1ad93af98b570e699ff202378cb4b
author: Roberto E. Vargas Caballero <[email protected]>
date: Tue Sep 16 11:27:57 EDT 2014

Remove all the operators from xaddable

This codes were added while we were debugging the communication
between cc1 and cc2, but this step is more or less already done,
so it is clear if we remove these ops and incorporate them
one by one.

--- a/cc2/cgen.c
+++ b/cc2/cgen.c
@@ -109,16 +109,6 @@
 	}
 
 	switch (np->op) {
-	case OCOMMA:
-	case ONEG:   case OCPL:
-	case OOR:    case OAND:
-	case OPTR:   case OADDR:
-	case OINC:
-	case OLT:    case OGT:   case OGE:    case OLE:  case OEQ:  case ONE:
-	case OADD:   case OSUB:  case OASSIG: case OMOD: case ODIV:
-	case OSHL:   case OSHR:
-	case OBAND:  case OBOR:  case OBXOR:
-		break;
 	default:
 		abort();
 	}
@@ -152,10 +142,10 @@
 
 /*
  * calculate addresability as follows
- *     AUTO => 11
- *     REGISTER => 13
- *     STATIC => 12
- *     CONST => 20
+ *     AUTO => 11          value+fp
+ *     REGISTER => 13      register
+ *     STATIC => 12        (value)
+ *     CONST => 20         $value
  */
 static void
 xaddable(Node *np)
@@ -182,22 +172,12 @@
 	case CONST:
 		np->addable = 20;
 		break;
-	case ONEG:   case OCPL:
-	case OPTR:   case OADDR:
-		xaddable(lp);
-		break;
-	case OCOMMA:
-	case OOR:    case OAND:
-	case OLT:    case OGT:  case OGE:  case OLE:  case OEQ:  case ONE:
-	case OINC:
-	case OASSIG: case OADD: case OSUB: case OMOD: case ODIV:
-	case OSHL:   case OSHR:
-	case OBAND:  case OBOR: case OBXOR:
-		xaddable(lp);
-		xaddable(rp);
-		break;
 	default:
-		abort();
+		if (lp)
+			xaddable(lp);
+		if (rp)
+			xaddable(rp);
+		break;
 	}
 
 	if (np->addable > 10)