break;
}
- /* a branch reference was found */
+ if (br == NULL) {
+ /* current mcodeptr is the correct position,
+ afterwards emit the NOPs */
- if (br != NULL) {
- /* calculate the mpc of the branch instruction */
+ codegen_branch_label_add(cd, label, condition, reg, options);
+
+ /* generate NOPs as placeholder for branch code */
+
+ BRANCH_NOPS;
+ return;
+ }
+
+ /* Branch reference was found. */
+
+ /* calculate the mpc of the branch instruction */
- mpc = cd->mcodeptr - cd->mcodebase;
- disp = br->mpc - mpc;
+ mpc = cd->mcodeptr - cd->mcodebase;
+ disp = br->mpc - mpc;
#if defined(ENABLE_STATISTICS)
- count_emit_branch++;
- if ((int8_t)disp == disp) count_emit_branch_8bit++;
- else if ((int16_t)disp == disp) count_emit_branch_16bit++;
- else if ((int32_t)disp == disp) count_emit_branch_32bit++;
+ count_emit_branch++;
+ if ((int8_t)disp == disp) count_emit_branch_8bit++;
+ else if ((int16_t)disp == disp) count_emit_branch_16bit++;
+ else if ((int32_t)disp == disp) count_emit_branch_32bit++;
# if SIZEOF_VOID_P == 8
- else if ((int64_t)disp == disp) count_emit_branch_64bit++;
+ else if ((int64_t)disp == disp) count_emit_branch_64bit++;
# endif
#endif
- emit_branch(cd, disp, condition, reg, options);
+ emit_branch(cd, disp, condition, reg, options);
- /* now remove the branch reference */
-
- list_remove(list, br);
- }
- else {
- /* current mcodeptr is the correct position,
- afterwards emit the NOPs */
+ /* now remove the branch reference */
- codegen_branch_label_add(cd, label, condition, reg, options);
-
- /* generate NOPs as placeholder for branch code */
-
- BRANCH_NOPS;
- }
+ list_remove(list, br);
}
break;
}
- /* a branch reference was found */
+ if (br == NULL) {
+ /* No branch reference found, add the label to the list (use
+ invalid values for condition and register). */
- if (br != NULL) {
- /* calculate the mpc of the branch instruction */
+ codegen_branch_label_add(cd, label, -1, -1, BRANCH_OPT_NONE );
+ return;
+ }
+
+ /* Branch reference was found. */
+
+ /* calculate the mpc of the branch instruction */
- mpc = cd->mcodeptr - cd->mcodebase;
- disp = mpc - br->mpc;
+ mpc = cd->mcodeptr - cd->mcodebase;
+ disp = mpc - br->mpc;
- /* temporary set the mcodeptr */
+ /* temporary set the mcodeptr */
- mcodeptr = cd->mcodeptr;
- cd->mcodeptr = cd->mcodebase + br->mpc;
+ mcodeptr = cd->mcodeptr;
+ cd->mcodeptr = cd->mcodebase + br->mpc;
#if defined(ENABLE_STATISTICS)
- count_emit_branch++;
- if ((int8_t)disp == disp) count_emit_branch_8bit++;
- else if ((int16_t)disp == disp) count_emit_branch_16bit++;
- else if ((int32_t)disp == disp) count_emit_branch_32bit++;
+ count_emit_branch++;
+ if ((int8_t)disp == disp) count_emit_branch_8bit++;
+ else if ((int16_t)disp == disp) count_emit_branch_16bit++;
+ else if ((int32_t)disp == disp) count_emit_branch_32bit++;
# if SIZEOF_VOID_P == 8
- else if ((int64_t)disp == disp) count_emit_branch_64bit++;
+ else if ((int64_t)disp == disp) count_emit_branch_64bit++;
# endif
#endif
- emit_branch(cd, disp, br->condition, br->reg, br->options);
+ emit_branch(cd, disp, br->condition, br->reg, br->options);
- /* restore mcodeptr */
+ /* restore mcodeptr */
- cd->mcodeptr = mcodeptr;
+ cd->mcodeptr = mcodeptr;
- /* now remove the branch reference */
+ /* now remove the branch reference */
- list_remove(list, br);
- }
- else {
- /* add the label to the list (use invalid values for condition
- and register) */
-
- codegen_branch_label_add(cd, label, -1, -1, BRANCH_OPT_NONE );
- }
+ list_remove(list, br);
}