You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`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.
0 commit comments