


## 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.
# --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.pkgherein
generic package put_machcode_controlflow_graph_as_asmcode_g ( # Nowhere referenced
# ===========================================
#
package ie: Machcode_Codebuffer; # Machcode_Codebuffer is from src/lib/compiler/back/low/emit/machcode-codebuffer.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 (odg::DIGRAPH graph, blocks)
=
{ graph.graph_info
->
mcg::GRAPH_INFO { notes, dataseg_pseudo_ops, decls, ... };
buf = ie::make_codebuffer *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-2012,
## released under Gnu Public Licence version 3.


