Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor CondBr: remove abstraction or actually pass in registers to compare #179

Open
mooori opened this issue Jan 3, 2024 · 0 comments

Comments

@mooori
Copy link

mooori commented Jan 3, 2024

According to my understanding, CondBr currently receives an IntegerCompare as kind. However, the registers rs1 and rs2 of this IntegerCompare don’t contain values to compare. Instead rs1 contains the result of the comparison related to CondBr and rs2 is set to zero_reg. This is based on:

Potential refactorings

1) Change CondBr structure

Brought up by @nagisa in this comment:

Change CondBr to something like CondBr { condition: ..., target: ..., rs1: ... } which would no longer imply that it compares stuff internally.

2) Compare stuff in CondBr

To avoid misinterpretations of the kind field of CondBr. I assume in this case rs1 and rs2 should be the registers to be compared.

Notes

@Akashin pointed out that later on it might be necessary to use CondBr in ways incompatible with the refactoring described in 1). Such use cases can be found in emit.rs, though they are currently commented out. More generally, it might be too early to refactor CondBr now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant