## liveness.api -- Computing live variables.
# Compiled by:
#
src/lib/compiler/back/low/lib/lowhalf.libstipulate
package iht = int_hashtable; # int_hashtable is from
src/lib/src/int-hashtable.pkg package rkj = registerkinds_junk; # registerkinds_junk is from
src/lib/compiler/back/low/code/registerkinds-junk.pkgherein
api Liveness {
#
package mcg: Machcode_Controlflow_Graph; # Machcode_Controlflow_Graph is from
src/lib/compiler/back/low/mcg/machcode-controlflow-graph.api Liveness_Table
=
iht::Hashtable( rkj::cos::Colorset );
Du = ( List( rkj::Codetemp_Info ), # "du" == "definition/use"
List( rkj::Codetemp_Info )
);
# One def/use step (given def/use function, take du after instruction
# to du before instruction
#
du_step: (mcg::mcf::Machine_Op -> Du)
->
(mcg::mcf::Machine_Op, Du)
->
Du;
# One step for liveness (on a per-instruction basis)
#
live_step: (mcg::mcf::Machine_Op -> Du)
->
(mcg::mcf::Machine_Op, rkj::cos::Colorset)
->
rkj::cos::Colorset;
liveness: { def_use: mcg::mcf::Machine_Op -> Du,
#
get_codetemps_of_our_kind: rkj::cls::Codetemplists -> List( rkj::Codetemp_Info )
}
->
mcg::Machcode_Controlflow_Graph
->
{ live_in: Liveness_Table,
live_out: Liveness_Table
};
};
end;