You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
case H_FOR:
compile_expression();
/* We will loop back to the conditional */
gen_label("_l", h.h_name);
/* A blank conditional on the for is a C oddity and means 'always true' */
if (compile_expression() != VOID) {
/* Exit the loop if false */
gen_jfalse("_b", h.h_name);
}
/* Jump top the main body if not */
gen_jump("_n", h.h_name);
This will output the following code:
In most cases, the update part is small and the body is large. Therefore, jeq is expanded to 5 bytes (bne + jmp).
If changing jeq to jne and switch the jmp and destination, It can reduce the number of unnecessary jmps.
L29_l: ;; condition
tsx
ldb 1,x
cmpb #8
jsr boollt
jeq L29_b
jmp L29_n
L29_c: ;; update
tsx
inc 1,x
;
jmp L29_l
L29_n: ;; body
:
:
L29_b: ;; end of body
The text was updated successfully, but these errors were encountered:
backend.c, which processes the for statement:
This will output the following code:
In most cases, the update part is small and the body is large. Therefore, jeq is expanded to 5 bytes (bne + jmp).
If changing jeq to jne and switch the jmp and destination, It can reduce the number of unnecessary jmps.
The text was updated successfully, but these errors were encountered: