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

Make serialising Yk IR instructions more flexible. #137

Merged
merged 1 commit into from
Apr 23, 2024

Conversation

vext01
Copy link

@vext01 vext01 commented Apr 23, 2024

Initially, each LLVM IR instruction had to be lowered to exactly one Yk IR instruction. Why? Because it was easy to implement.

Later we realised we needed to skip certain LLVM instructions (e.g. debug calls).

At this point we added complexity. Due to the way the deserialiser works, we need to emit an instruction count field before emitting the instructions themselves. Therefore we had to first count how many instructions would be emitted in an initial loop, emit this count, then emit the instructions themselves in a second loop.

This change removes the need for the first loop by "patching up" a placeholder instruction count field once the number of instructions is known.

In turn this simplifies the code quite a bit, making it easier to maintain, but also will make it easier for one LLVM instruction to be lowered to more than one Yk IR instruction. For example, we might opt to lower an LLVM switch instruction into a series of Yk IR conditional instructions.

No functional change. No runtime changes required.

Initially, each LLVM IR instruction had to be lowered to exactly
one Yk IR instruction. Why? Because it was easy to implement.

Later we realised we needed to skip certain LLVM instructions (e.g.
debug calls).

At this point we added complexity. Due to the way the deserialiser
works, we need to emit an instruction count field before emitting the
instructions themselves. Therefore we had to first count how many
instructions would be emitted in an initial loop, emit this count, then
emit the instructions themselves in a second loop.

This change removes the need for the first loop by "patching up" a
placeholder instruction count field once the number of instructions is
known.

In turn this simplifies the code quite a bit, making it easier to
maintain, but also will make it easier for one LLVM instruction to be
lowered to more than one Yk IR instruction. For example, we might opt to
lower an LLVM switch instruction into a series of Yk IR conditional
instructions.

No functional change. No runtime changes required.
@ltratt ltratt added this pull request to the merge queue Apr 23, 2024
Merged via the queue into ykjit:main with commit 9cb7ad9 Apr 23, 2024
2 checks passed
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

Successfully merging this pull request may close these issues.

2 participants