WIP: derive and expose address keyed GP register liveness - #290
Open
leftbyte wants to merge 7 commits into
Open
Conversation
leftbyte
force-pushed
the
dphung/pir-req3-register-liveness
branch
from
August 7, 2026 01:45
ccd94a6 to
af5441e
Compare
added 6 commits
August 6, 2026 18:53
Add ASTILiveness, which computes NZCV flag live-in/live-out per instruction address for a function by building per-address use/kill sets from the per-instruction flag-reaching-def facts and running a backward live-variable fixpoint over the CFG. Block instructions are ordered with the same lexicographic sort BasicBlock uses, which also tolerates the analysis's inlined-instruction addresses.
Add a flag-liveness map (keyed by instruction address) to ASTProvenance with the standard getter/setter, and round-trip it through serialize/deserialize alongside the other provenance facts.
Compute flag-liveness in mk_asts, alongside set_ast_provenance, so it flows through the same builder path as the other provenance facts (rather than only on the results-ast command path). The computation is auxiliary and guarded so a failure cannot abort AST generation.
Extend ASTILiveness with register_liveness, computing GP-register live-in/live-out per instruction address from the per-instruction reaching-def facts (restricted to the architecture register set to exclude spill slots and stack temporaries), reusing the shared use/kill and backward-fixpoint engine already used for flag-liveness.
Add a register-liveness map (keyed by instruction address) to ASTProvenance with the standard getter/setter, and round-trip it through serialize/deserialize alongside the other provenance facts.
Compute register-liveness in mk_asts, alongside set_ast_provenance and the flag-liveness computation, so it flows through the same builder path as the other provenance facts. The computation is auxiliary and guarded so a failure cannot abort AST generation.
leftbyte
force-pushed
the
dphung/pir-req3-register-liveness
branch
from
August 7, 2026 04:54
af5441e to
18827d3
Compare
…3-register-liveness
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR is stacked on top of #289.
Same mechanism as PR #289, applied to general-purpose registers: derives register live-in/live-out per instruction address from the reaching-def facts. Gives a sound answer to "which registers are live across this point".
This metadata is used in the patcher's predicated-if register-safety check to fall back to a (register-safe) trampoline when the in-place body would clobber a register live at the region exit.