shithub: scc

Download patch

ref: eda760b338438afdf9f20d30be45b04042daa74e
parent: 2a651a1e594d8805e6873e45a72aa73ddb6bb505
author: Roberto E. Vargas Caballero <[email protected]>
date: Thu Jul 10 10:55:30 EDT 2014

Remove emitsframe

This function only printed a '{' and the idea was make a bit easier
the parsing of intermediate language, but it was a bit stupid idea.

--- a/cc1/cc1.h
+++ b/cc1/cc1.h
@@ -199,7 +199,7 @@
 };
 
 extern void
-	emitdcl(Symbol *), emitsframe(Symbol *), emiteframe(void),
+	emitdcl(Symbol *), emitefun(void),
 	emitsym(Node *), emitunary(Node *),
 	emitbin(Node *), emitexp(Node *),
 	emitprint(Node *), emitlabel(Symbol *), emitjump(Symbol *, Node *),
--- a/cc1/code.c
+++ b/cc1/code.c
@@ -190,18 +190,14 @@
 void
 emitfun(Symbol *sym)
 {
-	printf("%c%d\tn%s\n",
-	       sym->s.isglobal ? 'X' : 'Y', sym->id, sym->name);
+	printf("%c%d\tn%s%s\n",
+	       sym->s.isglobal ? 'X' : 'Y',
+	       sym->id, sym->name,
+	       sym->s.isdefined ? "\t{" : "");
 }
 
 void
-emitsframe(Symbol *sym)
-{
-	puts("{");
-}
-
-void
-emiteframe(void)
+emitefun(void)
 {
 	puts("}");
 }
--- a/cc1/decl.c
+++ b/cc1/decl.c
@@ -474,9 +474,8 @@
 			} else if (yytoken == '{') {
 				curfun = sym;
 				emitfun(sym);
-				emitsframe(sym);
 				context(NULL, NULL, NULL);
-				emiteframe();
+				emitefun();
 				return;
 			}
 		} while (accept(','));