MimIR
MimIR is my Intermediate Representation
Loading...
Searching...
No Matches
mim::plug::mach::Liveness Class Reference

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)

Detailed Description

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.


Class Documentation

◆ mim::plug::mach::Liveness::Block

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.

Member Typedef Documentation

◆ Class

Definition at line 37 of file liveness.h.

◆ Pressure

using mim::plug::mach::Liveness::Pressure = std::array<size_t, Num_Classes>

Definition at line 39 of file liveness.h.

Constructor & Destructor Documentation

◆ Liveness()

mim::plug::mach::Liveness::Liveness ( const FunPhase & phase,
Lam * fun,
bool solve = false )

Member Function Documentation

◆ block()

const Block * mim::plug::mach::Liveness::block ( Lam * lam) const
inline

Definition at line 64 of file liveness.h.

Referenced by Liveness(), params(), and term_uses().

◆ blocks()

const auto & mim::plug::mach::Liveness::blocks ( ) const
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.

◆ defs()

const DefVec & mim::plug::mach::Liveness::defs ( const App * insn) const
inline

Definition at line 73 of file liveness.h.

References mim::plug::mach::Liveness::Block::defs.

◆ local()

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().

◆ nest()

const Nest & mim::plug::mach::Liveness::nest ( ) const
inline

The late Nest of the function as it is now.

Definition at line 60 of file liveness.h.

Referenced by Liveness().

◆ params()

const DefVec & mim::plug::mach::Liveness::params ( const Block & block) const
inline

Definition at line 72 of file liveness.h.

References block().

◆ target()

const Target & mim::plug::mach::Liveness::target ( ) const
inline

Definition at line 69 of file liveness.h.

Referenced by Liveness().

◆ term_uses()

const DefVec & mim::plug::mach::Liveness::term_uses ( const Block & block) const
inline

The values the jump at the end reads.

Definition at line 76 of file liveness.h.

References block().

◆ uses()

const DefVec & mim::plug::mach::Liveness::uses ( const App * insn) const
inline

Definition at line 74 of file liveness.h.

References mim::plug::mach::Liveness::Block::uses.

Member Data Documentation

◆ npos

size_t mim::plug::mach::Liveness::npos = size_t(-1)
staticconstexpr

Definition at line 53 of file liveness.h.

Referenced by Liveness().


The documentation for this class was generated from the following files: