MimIR
MimIR is my Intermediate Representation
Loading...
Searching...
No Matches
liveness.h File Reference
#include <algorithm>
#include <array>
#include <memory>
#include <ranges>
#include <mim/def.h>
#include <mim/lam.h>
#include <mim/rewrite.h>
#include "mim/plug/mach/phase.h"
#include "mim/plug/mach/target.h"
Include dependency graph for liveness.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  mim::plug::mach::Liveness
 Liveness of the values of one scheduled function, as a side table. More...
struct  mim::plug::mach::Liveness::Block
class  mim::plug::mach::Assign
 Wraps every use of a value that regs assigns a register in in. More...
struct  mim::plug::mach::ArgLoc
 Where an argument goes: a register of its class, an incoming stack slot, or neither (memory or a dead parameter). More...
struct  mim::plug::mach::Conv
 The convention of a known() function: its param_regs() and the registers a call of it clobbers, all caller-saved. More...

Namespaces

namespace  mim
namespace  mim::plug
namespace  mim::plug::mach
 The mach Plugin

Functions

void mim::plug::mach::for_each_succ (const App *term, auto f)
 Calls f for each block, possibly repeatedly, that the jump term passes control or a return continuation to.
bool mim::plug::mach::is_value (const Def *value, Liveness::Class cls, const Target &target)
 Is value a value of class cls?
Lam * mim::plug::mach::forwarded (const LamMap< Lam * > &forward, Lam *lam)
 Where a jump to lam goes once the blocks that forward skips are skipped.
fe::Vector< const Liveness::Block * > mim::plug::mach::layout (const Liveness &livelive, const LamMap< Lam * > &forward={})
 The blocks of live in emission order: each block is followed by the one it falls through to, where possible.
void mim::plug::mach::for_each_use (const Liveness &livelive, auto f)
 Calls f for each use of a value in live.
void mim::plug::mach::rewrite_blocks (const Liveness &livelive, Rewriter &rw)
 Rewrites the filter and body of each block of live in place.
size_t mim::plug::mach::num_params (Lam *lam)
 The parameters of lam without its return continuation.
ParamRegs mim::plug::mach::param_regs (const Target &target, Lam *fun, const DefMap< size_t > &regs)
 Where the known() function fun receives its parameters, given the registers regs that Color assigned to them.
fe::Vector< ArgLoc > mim::plug::mach::arg_locs (const Target &target, const Def *arg, size_t n, size_t num, const ParamRegs *conv)
 The ArgLocs of the first num of the n arguments in arg under conv, or the ABI if it is nullptr.
const Conv * mim::plug::mach::callee_conv (const LamMap< Conv > &convs, const Liveness::Block &block)
 The Conv of the callee that the call at the end of block returns from, if it has one.
bool mim::plug::mach::clobbered (const Target &target, const Conv *conv, Target::Class cls, size_t r)
 Does a call of a function with the convention conv, or of an ABI function if there is none, clobber r?
const Liveness::Block * mim::plug::mach::call_cont (const Liveness &livelive, Lam *fun, const Liveness::Block &block)
 The block that a call at the end of block returns to, if any.
template<class Keep, class F>
void mim::plug::mach::interferences (const Liveness &livelive, const Liveness::Block &block, Keep keep, F f)
 Calls f (d, v) for each value v that is live at the definition of d or defined along with it.

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.

◆ mim::plug::mach::ArgLoc

struct mim::plug::mach::ArgLoc

Where an argument goes: a register of its class, an incoming stack slot, or neither (memory or a dead parameter).

Definition at line 152 of file liveness.h.

Class Members
optional< size_t > reg
optional< size_t > stack