Singlepass: refactor condition jumps to single fn (jmp_on_condition)
#5750
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
For the purpose of the upcoming RISC-V support (#5711), I would like to merge the
location_cmp/emit_relaxed_cmpandjmp_on_$conditioninto a single function. Mainly motivated by the fact the RISC-V architecture does not profile the FLAGS register used for the jump instruction. On the other hand, it provides direct compare and jump instructions that, with register operations, directly map to the newly introducedjmp_on_condition. Right now, the RISC-V PR contains unnecessary changes where a new temporary register is first used for comparison, and thenjmp_on_true/falsefunction do the actual jump.Note the currently used approach might be seen tricky as the codegen is responsible that no other FLAGS-modifying instructions sneaks in between the CMP and the consequent JUMP instruction.