commit 07f70acdb3d9ceacf52f66dcfe6c4d2c0b6059eb
parent 04bf83528662711fca73d47d49ef64fd39cf431c
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Thu, 26 Dec 2024 10:04:27 +0100
cc1: Include OBLOOP and OELOOP in the loop body
These two ops can help to identify variables that can be
pushed/poped or directly using register banking.
Diffstat:
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/cmd/scc-cc/cc1/stmt.c b/src/cmd/scc-cc/cc1/stmt.c
@@ -96,12 +96,12 @@ While(Symbol *lbreak, Symbol *lcont, Switch *lswitch)
emit(OJUMP, lcont);
- emit(OBLOOP, NULL);
emit(OLABEL, begin);
+ emit(OBLOOP, NULL);
stmt(lbreak, lcont, lswitch);
emit(OLABEL, lcont);
- branch(begin, np);
emit(OELOOP, NULL);
+ branch(begin, np);
emit(OLABEL, lbreak);
}
@@ -142,14 +142,14 @@ For(Symbol *lbreak, Symbol *lcont, Switch *lswitch)
if (econd)
emit(OJUMP, cond);
- emit(OBLOOP, NULL);
emit(OLABEL, begin);
+ emit(OBLOOP, NULL);
stmt(lbreak, lcont, lswitch);
emit(OLABEL, lcont);
emit(OEXPR, einc);
emit(OLABEL, cond);
- branch(begin, econd);
emit(OELOOP, NULL);
+ branch(begin, econd);
emit(OLABEL, lbreak);
@@ -168,8 +168,8 @@ Dowhile(Symbol *lbreak, Symbol *lcont, Switch *lswitch)
expect(DO);
- emit(OBLOOP, NULL);
emit(OLABEL, begin);
+ emit(OBLOOP, NULL);
stmt(lbreak, lcont, lswitch);
expect(WHILE);
@@ -177,8 +177,8 @@ Dowhile(Symbol *lbreak, Symbol *lcont, Switch *lswitch)
expect(';');
emit(OLABEL, lcont);
- branch(begin, np);
emit(OELOOP, NULL);
+ branch(begin, np);
emit(OLABEL, lbreak);
}