# lowhalf IR
# This is for performing whole program analysis.
# All optimizations are based on this representation.
# It provides a few useful views: dominator tree, control dependence graph,
# loop nesting (interval) package etc. Also there is a mechanism to
# incrementally attach additional views to the IR. The SSA infrastructure
# is implemented in such a manner.
# -- Allen Leung
api LOWHALF_IR =
package i: Machcode
package mcg: Machcode_Controlflow_Graph
package dom: Dominator_Tree
package cdg: CONTROL_DEPENDENCE_GRAPH
package loop: Loop_Structure
package util: Local_Machcode_Controlflow_Graph_Transformations
sharing Util::mcg = mcg
sharing mcg::I = I
sharing Loop::Dom = CDG::Dom = Dom
type mcg = mcg::mcg
type IR = mcg::mcg # The IR looks just like a machcode_controlflow_graph!
type dom = (mcg::block, mcg::edge_info, mcg::info) Dom::dominator_tree
type pdom = (mcg::block, mcg::edge_info, mcg::info) Dom::postdominator_tree
type cdg = (mcg::block, mcg::edge_info, mcg::info) CDG::cdg
type loop = (mcg::block, mcg::edge_info, mcg::info) Loop::loop_structure
# Extract various views from an IR.
# These are computed by need.
my dom: IR -> dom
my pdom: IR -> pdom
my doms: IR -> dom * pdom
my cdg: IR -> cdg
my loop: IR -> loop
# Signal that the IR has been changed
my changed: IR -> Void
# View as a picture
my view: String -> IR -> Void # view some facet of the IR
my views: List( String ) -> IR -> Void # view a set of facets
my viewSubgraph: IR -> mcg -> Void # view a subgraph of the IR
# This function allows the client to design a new view and extend
# the functionality of the IR
my memo: String -> (IR -> A_facet) -> IR -> A_facet
my addLayout: String -> (IR -> graph_layout::layout) -> Void