From 2303c52fa72fb988e6e32a0049e4c2f6f1de041c Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Mon, 1 Nov 2021 16:30:08 +0100 Subject: [PATCH] :bug: more fixes and tests --- src/emit/emit.c | 8 ++------ tests/pp/{pragma.gw => pragma_memoize.gw} | 0 tests/pp/pragma_unroll.gw | 4 ++++ 3 files changed, 6 insertions(+), 6 deletions(-) rename tests/pp/{pragma.gw => pragma_memoize.gw} (100%) create mode 100644 tests/pp/pragma_unroll.gw diff --git a/src/emit/emit.c b/src/emit/emit.c index 9587c530..087a3a56 100644 --- a/src/emit/emit.c +++ b/src/emit/emit.c @@ -2252,16 +2252,12 @@ ANN static inline void unroll_init(const Emitter emit, const m_uint n) { } ANN static inline m_bool unroll_run(const Emitter emit, - const struct Looper *loop) { + struct Looper *const loop) { const Instr instr = loop->unroll ? loop->unroll(emit, loop) : NULL; CHECK_BB(scoped_stmt(emit, loop->stmt, 1)); if(instr) -// instr->m_val = emit_code_size(emit) + 13; // pass after goto -printf("code size %lu\n", emit_code_size(emit)); -// instr->m_val = 46; - vector_add(&loop->unroll_v, (m_uint)instr); + vector_add(&loop->unroll_v, (m_uint)instr); return GW_OK; -// return emit_stmt(emit, loop->stmt, 1); } ANN static m_bool _unroll(const Emitter emit, struct Looper *loop) { diff --git a/tests/pp/pragma.gw b/tests/pp/pragma_memoize.gw similarity index 100% rename from tests/pp/pragma.gw rename to tests/pp/pragma_memoize.gw diff --git a/tests/pp/pragma_unroll.gw b/tests/pp/pragma_unroll.gw new file mode 100644 index 00000000..9dd92231 --- /dev/null +++ b/tests/pp/pragma_unroll.gw @@ -0,0 +1,4 @@ +#! contains 23 +#pragma unroll 2 +foreach(a, i : [ 0, 1, 3 ]) + <<< a, i >>>; -- 2.43.0