## emit-machcode-controlflow-graph-as-asmcode-g.pkg # Was mcg-emit-g.pkg
# Compiled by:
#
src/lib/compiler/back/low/lib/lowhalf.lib# This module takes a flowgraph and an assembly emitter module and
# ties them together into one. The output is sent to asm_stream. # Now to pp, if this code ever gets revived. -- 2013-12-07 CrT
# --Allen
#
# TODO: Need to check for the REORDER/NOREORDER annotation on
# blocks and call P.Client.AsmPseudoOps.to_string function to
# print out the appropriate assembler directive. -- Lal. XXX BUGGO FIXME
#
# 2009-05-21 CrT: This appears to be nowhere inoked.
### "Your question doesn't make any sense.
### You might as well ask whether it is
### possible to grow vegetables from a
### painting, without becoming Wednesday
### first."
###
### -- Abigail, comp.lang.perl.misc
stipulate
package odg = oop_digraph; # oop_digraph is from
src/lib/graph/oop-digraph.pkg package pp = standard_prettyprinter; # standard_prettyprinter is from
src/lib/prettyprint/big/src/standard-prettyprinter.pkg #
Pp = pp::Pp;
herein
generic package put_machcode_controlflow_graph_as_asmcode_g ( # Nowhere referenced
# ===========================================
#
package ie: Machcode_Codebuffer_Pp; # Machcode_Codebuffer_Pp is from
src/lib/compiler/back/low/emit/machcode-codebuffer-pp.api package mcg: Machcode_Controlflow_Graph # Machcode_Controlflow_Graph is from
src/lib/compiler/back/low/mcg/machcode-controlflow-graph.api where
mcf == ie::mcf # "mcf" == "machcode_form" (abstract machine code).
also pop == ie::cst::pop; # "pop" == "pseudo_op".
)
: (weak) Emit_Machcode_Controlflow_Graph_As_Asmcode # Emit_Machcode_Controlflow_Graph_As_Asmcode is from
src/lib/compiler/back/low/emit/emit-machcode-controlflow-graph-as-asmcode.api {
# Export to client packages:
#
package mcg = mcg; # "mcg" == "machcode_controlflow_graph".
fun asm_emit (pp:Pp) (odg::DIGRAPH graph, blocks)
=
{ graph.graph_info
->
mcg::GRAPH_INFO { notes, dataseg_pseudo_ops, decls, ... };
buf = ie::make_codebuffer pp *notes;
# ->
# { put_pseudo_op, put_private_label, put_op, put_bblock_note, put_comment, ... };
fun put_it (id, mcg::BBLOCK { labels, notes, alignment_pseudo_op, ops, ... } )
=
{ case *alignment_pseudo_op
#
THE p => buf.put_pseudo_op p;
NULL => ();
esac;
apply buf.put_private_label *labels;
apply put_note *notes;
apply buf.put_op (reverse *ops);
}
also
fun put_note note
=
if (note::to_string note != "")
#
buf.put_bblock_note note;
fi;
apply put_note *notes;
apply buf.put_pseudo_op (reverse *decls);
buf.put_pseudo_op pseudo_op_basis_type::TEXT;
apply put_it blocks;
apply buf.put_pseudo_op (reverse *dataseg_pseudo_ops);
};
};
end;
## COPYRIGHT (c) 2001 Bell Labs, Lucent Technologies
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2015,
## released per terms of SMLNJ-COPYRIGHT.