We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bc64ef4 commit 5f38adcCopy full SHA for 5f38adc
src/libasr/codegen/wasm_to_x86.cpp
@@ -130,9 +130,15 @@ class X86Visitor : public WASMDecoder<X86Visitor>,
130
131
void visit_EmtpyBlockType() {}
132
133
- void visit_Br(uint32_t /*label_index*/) {
134
- // Branch is used to jump to the `loop.head`.
135
- m_a.asm_jmp_label(".loop.head_" + unique_id.rbegin()[1]);
+ void visit_Br(uint32_t label_index) {
+ // Branch is used to jump to the `loop.head` or `loop.end`.
+ if (if_unique_id.size() - loop_unique_id.size() == label_index - 1) {
136
+ // cycle/continue or loop.end
137
+ m_a.asm_jmp_label(".loop.head_" + loop_unique_id.back());
138
+ } else {
139
+ // exit/break
140
+ m_a.asm_jmp_label(".loop.end_" + loop_unique_id.back());
141
+ }
142
}
143
144
void visit_Loop() {
0 commit comments