[hackers] [scc] [cc1] Remove einit in For() || Roberto E. Vargas Caballero
commit cd2811b5ff5949ed1c8b466225a77d7abc983b85
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Sun Jan 22 09:42:04 2017 +0100
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Sun Jan 22 09:42:04 2017 +0100
[cc1] Remove einit in For()
Decl() is emiting the initializer and it means that in some cases
the expression is emitted in the switch and in other cases
after the switch. It is profitable to have the invariant that
the expression is emitted in the switch for all the cases.
diff --git a/cc1/stmt.c b/cc1/stmt.c
index 095329a..16bc3d9 100644
--- a/cc1/stmt.c
+++ b/cc1/stmt.c
_AT_@ -96,7 +96,7 @@ static void
For(Symbol *lbreak, Symbol *lcont, Switch *lswitch)
{
Symbol *begin, *cond;
- Node *econd, *einc, *einit = NULL;
+ Node *econd, *einc;
begin = newlabel();
lcont = newlabel();
_AT_@ -115,7 +115,7 @@ For(Symbol *lbreak, Symbol *lcont, Switch *lswitch)
decl();
break;
default:
- einit = expr();
+ emit(OEXPR, expr());
case ';':
expect(';');
break;
_AT_@ -125,7 +125,6 @@ For(Symbol *lbreak, Symbol *lcont, Switch *lswitch)
einc = (yytoken != ')') ? expr() : NULL;
expect(')');
- emit(OEXPR, einit);
emit(OJUMP, cond);
emit(OBLOOP, NULL);
Received on Sun Jan 22 2017 - 09:52:29 CET
This archive was generated by hypermail 2.3.0
: Sun Jan 22 2017 - 10:00:20 CET