Expand description
Who reads what, counted by occurrence.
Two passes want the same question answered and neither of them wants to be the place the answer is defined. Dead code elimination asks whether anything reads a value, and width narrowing asks whether exactly one thing does, which is the difference between a rewrite that replaces an instruction and a rewrite that adds a second one beside it.
This is a count and not an analysis. It is built by walking the function, it goes stale the moment anything is rewritten, and the pass that rewrites is the one that keeps it in step. When there is an analysis manager it will hold a real use list with the instruction on the other end of each use, and this will be the thing that list replaces.
Functionsยง
- chase
- Where a redirection ends up, following the ones already in the map.
- count
- How many times each value is used, indexed by
Value::index. - operands
- Every value this instruction reads, with a repeat for each time it reads it.
- substitute
- Points every reader of a value at another value, for every pair in the map.