Liveness of the values of one scheduled function, as a side table. More...
#include <mim/plug/mach/liveness.h>
Classes | |
| struct | Block |
Public Types | |
| using | Class = Target::Class |
| using | Pressure = std::array<size_t, Num_Classes> |
Public Member Functions | |
| Liveness (const FunPhase &phase, Lam *fun, bool solve=false) | |
Bails unless the blocks of the function fun are closed; with solve, it iterates to the fixed point instead. | |
| const Nest & | nest () const |
| The late Nest of the function as it is now. | |
| const auto & | blocks () const |
| In pre-order of the Nest with siblings in topological order, so a block comes after the block it is nested in. | |
| const Block * | block (Lam *lam) const |
| const Target & | target () const |
| bool | local (const Def *def) const |
Is def a parameter of a block or a result of an instruction on a chain, or a projection thereof? | |
| const DefVec & | params (const Block &block) const |
| const DefVec & | defs (const App *insn) const |
| const DefVec & | uses (const App *insn) const |
| const DefVec & | term_uses (const Block &block) const |
| The values the jump at the end reads. | |
Static Public Attributes | |
| static constexpr size_t | npos = size_t(-1) |
Liveness of the values of one scheduled function, as a side table.
A value is a non-memory result of an instruction on a mem.M 0 chain or a non-memory parameter. A parameter is defined at the entry of its block and a jump uses its arguments, so a parameter is never live-in. A branch on a condition code uses its flags; the Bool is a value only if something else uses it. After mach.close, only a block nested in the one block that jumps to it has live-in values.
Definition at line 35 of file liveness.h.
| struct mim::plug::mach::Liveness::Block |
Definition at line 41 of file liveness.h.
| Class Members | ||
|---|---|---|
| Vector< DefVec > | defs | |
| Vector< const App * > | insns | The mem.M 0 chain in execution order. |
| Lam * | lam | |
| DefSet | live_in | |
| DefSet | live_out | |
| Pressure | max_live = {} | Maximum over all program points, per Class; Stack is unbounded. |
| const Node * | node | Its Node in nest(). |
| DefVec | params | |
| size_t | parent | The block it is nested in, or npos for the entry. |
| Vector< size_t > | targets | The blocks its terminator jumps to. |
| DefVec | term_uses | |
| Vector< DefVec > | uses | Per instruction. |
Definition at line 37 of file liveness.h.
| using mim::plug::mach::Liveness::Pressure = std::array<size_t, Num_Classes> |
Definition at line 39 of file liveness.h.
Bails unless the blocks of the function fun are closed; with solve, it iterates to the fixed point instead.
Definition at line 11 of file liveness.cpp.
References mim::Def::blame(), block(), mim::plug::mach::for_each_succ(), mim::Def::is_closed(), mim::Nest::Late, mim::plug::mach::Liveness::Block::live_out, nest(), npos, target(), and mim::plug::mach::Liveness::Block::targets.
Referenced by mim::plug::mach::color_fun(), mim::plug::mach::Close::visit(), mim::plug::mach::Constrain::visit(), mim::plug::mach::Live::visit(), and mim::plug::mach::RegAlloc::visit().
Definition at line 64 of file liveness.h.
Referenced by Liveness(), params(), and term_uses().
|
inline |
In pre-order of the Nest with siblings in topological order, so a block comes after the block it is nested in.
Definition at line 63 of file liveness.h.
Definition at line 73 of file liveness.h.
References mim::plug::mach::Liveness::Block::defs.
| bool mim::plug::mach::Liveness::local | ( | const Def * | def | ) | const |
Is def a parameter of a block or a result of an instruction on a chain, or a projection thereof?
Definition at line 91 of file liveness.cpp.
References mim::Lit::isa().
|
inline |
The late Nest of the function as it is now.
Definition at line 60 of file liveness.h.
Referenced by Liveness().
Definition at line 72 of file liveness.h.
References block().
|
inline |
Definition at line 69 of file liveness.h.
Referenced by Liveness().
Definition at line 74 of file liveness.h.
References mim::plug::mach::Liveness::Block::uses.
|
staticconstexpr |
Definition at line 53 of file liveness.h.
Referenced by Liveness().