[hackers] [scc] [cc1] Select branch or jump in For() || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Wed, 27 Jan 2016 16:59:16 +0100 (CET)

commit c56363ebc297fa01ebe8ee7b5ebb0626bc629676
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Wed Jan 27 16:25:41 2016 +0100
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Wed Jan 27 16:25:41 2016 +0100

    [cc1] Select branch or jump in For()
    
    For can have a sustain condition or not,
    and if it has not a condition then we have
    to emit a jump, and otherwise a branch.

diff --git a/cc1/stmt.c b/cc1/stmt.c
index 0b40b7c..4ad074c 100644
--- a/cc1/stmt.c
+++ b/cc1/stmt.c
_AT_@ -110,7 +110,7 @@ For(Symbol *lbreak, Symbol *lcont, Caselist *lswitch)
         stmt(end, begin, lswitch);
         emit(OEXPR, einc);
         emit(OLABEL, cond);
- emit(OBRANCH, begin);
+ emit((econd) ? OBRANCH : OJUMP, begin);
         emit(OEXPR, econd);
         emit(OELOOP, NULL);
         emit(OLABEL, end);
diff --git a/cc1/tests/test010.c b/cc1/tests/test010.c
index b69ccb9..cd6d4ac 100644
--- a/cc1/tests/test010.c
+++ b/cc1/tests/test010.c
_AT_@ -42,7 +42,8 @@ L14
         j L11
 
 L13
- y L11
+ j L11
+
         b
 L12
         e
Received on Wed Jan 27 2016 - 16:59:16 CET

This archive was generated by hypermail 2.3.0 : Wed Jan 27 2016 - 17:00:56 CET