]> Nishi Git Mirror - gwion.git/commitdiff
:bug: more fixes and tests
authorJérémie Astor <fennecdjay@gmail.com>
Mon, 1 Nov 2021 15:30:08 +0000 (16:30 +0100)
committerJérémie Astor <fennecdjay@gmail.com>
Mon, 1 Nov 2021 15:30:08 +0000 (16:30 +0100)
src/emit/emit.c
tests/pp/pragma_memoize.gw [moved from tests/pp/pragma.gw with 100% similarity]
tests/pp/pragma_unroll.gw [new file with mode: 0644]

index 9587c5305e39d834f674225c77a5e196bb98b979..087a3a56dfab9b03dae101c55dd14e59d1b67005 100644 (file)
@@ -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_unroll.gw b/tests/pp/pragma_unroll.gw
new file mode 100644 (file)
index 0000000..9dd9223
--- /dev/null
@@ -0,0 +1,4 @@
+#! contains 23
+#pragma unroll 2
+foreach(a, i : [ 0, 1, 3 ])
+  <<< a, i >>>;