-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adjust
Analysis
/GenKillAnalysis
interaction.
`Analysis` has six methods of note: - `apply_statement_effect` - `apply_before_statement_effect` - `apply_terminator_effect` - `apply_before_terminator_effect` - `apply_call_return_effect` - `apply_switch_int_edge_effects` `GenKillAnalysis` has six similar methods of note: - `statement_effect` - `before_statement_effect` - `terminator_effect` - `before_terminator_effect` - `call_return_effect` - `switch_int_edge_effects` Every `GenKillAnalysis` also implicitly impls `Analysis`, thanks to this blanket impl: ``` impl<'tcx, A> Analysis<'tcx> for A where A: GenKillAnalysis<'tcx>, A::Domain: GenKill<A::Idx> + BitSetExt<A::Idx>, ``` which forwards `apply_statement_effect` to `statement_effect`, and so on. This is a nice symmetry, but it's misleading. The latter four `GenKillAnalysis` methods (`terminator_effect`, ...) are only called from the latter four `Analysis` methods (`apply_terminator_effect`, ...). In reality, to implement a `GenKillAnalysis` you want to implement the first two `GenKillAnalysis` methods (which take `impl GenKill` args) and the latter four `Analysis` methods (which can take `Self::Domain` args). This commit adjusts things accordingly. - The latter four methods in `GenKillAnalysis` are removed. - The blanket impl of `Analysis` for any type implementing `GenKillAnalysis` is removed. - Each gen-kill analysis now implements the two `GenKillAnalysis` methods and the four latter `Analysis` methods. - Each gen-kill analysis also implicitly implements the first two `Analysis` methods by using new macros `fn_apply_before_statement_effect_gen_kill!` and `fn_apply_statement_effect_gen_kill!` that just define a method that forwards on to the corresponding `GenKillAnalysis` method. Overall this is a little less code and I find the whole structure easier to understand.
- Loading branch information
1 parent
1b35beb
commit db7352d
Showing
6 changed files
with
123 additions
and
154 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.