# regor-view-of-machcode-controlflow-graph.api "regor" is a contraction of "register allocator"
#
# Abstract view of a flowgraph required by the new register allocator.
# In order to allow different code representations to share the same
# register allocator core, each code representation should implement
# the following interface to talk to the new register allocator.
#
# -- Allen Leung
# Compiled by:
#
src/lib/compiler/back/low/lib/lowhalf.libstipulate
package fil = file__premicrothread; # file__premicrothread is from
src/lib/std/src/posix/file--premicrothread.pkg package rkj = registerkinds_junk; # registerkinds_junk is from
src/lib/compiler/back/low/code/registerkinds-junk.pkgherein
# This api is implemented (only) in:
#
#
src/lib/compiler/back/low/regor/cluster-regor-g.pkg #
# The above implementation is accepted and re-exported by:
#
#
src/lib/compiler/back/low/regor/regor-ram-merging-g.pkg #
src/lib/compiler/back/low/regor/regor-deadcode-zapper-g.pkg #
# which thus "implement" it in the weak sense of passing it through.
#
api Regor_View_Of_Machcode_Controlflow_Graph {
#
package mcf: Machcode_Form; # Machcode_Form is from
src/lib/compiler/back/low/code/machcode-form.api package rgk: Registerkinds; # Registerkinds is from
src/lib/compiler/back/low/code/registerkinds.api package cig: Codetemp_Interference_Graph # Codetemp_Interference_Graph is from
src/lib/compiler/back/low/regor/codetemp-interference-graph.api = codetemp_interference_graph;
package spl: Register_Spilling; # Register_Spilling is from
src/lib/compiler/back/low/regor/register-spilling.api sharing spl::mcf == mcf; # "mcf" == "machcode_form" (abstract machine code).
sharing mcf::rgk == rgk; # "rgk" == "registerkinds".
Machcode_Controlflow_Graph; # In practice this is at present always mcg::Machcode_Controlflow_Graph
mode: cig::Mode;
# Dump the flowgraph to a stream
#
dump_flowgraph: (String, Machcode_Controlflow_Graph, fil::Output_Stream) -> Void;
get_global_graph_notes: Machcode_Controlflow_Graph -> Ref( note::Notes ); # Global notes on graph.
# Interface for communicating with the new register allocator.
# It is expected that the services will cache enough information
# during build so that the rebuild and spill phases can be execute
# quickly.
#
services
:
Machcode_Controlflow_Graph
->
{ build # Build the graph
:
(cig::Codetemp_Interference_Graph, rkj::Registerkind)
->
List( cig::Move ),
# Spill/rebuild the graph:
#
spill: { copy_instr: spl::Copy_Instr,
spill: spl::Spill,
spill_src: spl::Spill_Src,
spill_copy_tmp: spl::Spill_Copy_Tmp,
reload: spl::Reload,
reload_dst: spl::Reload_Dst,
rename_src: spl::Rename_Src,
graph: cig::Codetemp_Interference_Graph,
nodes: List( cig::Node ),
registerkind: rkj::Registerkind
}
-> List( cig::Move ),
block_num: cig::Program_Point -> Int,
instr_num: cig::Program_Point -> Int,
program_point
:
{ block: Int,
op: Int
}
->
cig::Program_Point
};
};
end;