## make-sourcecode-for-backend-packages-g.pkg -- derived from ~/src/sml/nj/smlnj-110.60/MLRISC/Tools/ADL/mdl-gen.sml
#
# Generate machine code modules from architecture description
# Compiled by:
#
src/lib/compiler/back/low/tools/arch/make-sourcecode-for-backend-packages.lib### "Why does IBM have divisions and additions
### but no multiplications or subtractions?"
api Make_Sourcecode_For_Backend_Packages {
#
make_sourcecode_for_backend_packages: String -> Void; # 'String' is something like "src/lib/compiler/back/low/intel32/one_word_int.architecture-description" -- gives the path to an architecture description file.
};
stipulate
package ard = architecture_description; # architecture_description is from
src/lib/compiler/back/low/tools/arch/architecture-description.pkg package err = adl_error; # adl_error is from
src/lib/compiler/back/low/tools/line-number-db/adl-error.pkg package smj = sourcecode_making_junk; # sourcecode_making_junk is from
src/lib/compiler/back/low/tools/arch/sourcecode-making-junk.pkg package par = architecture_description_language_parser; # architecture_description_language_parser is from
src/lib/compiler/back/low/tools/arch/architecture-description-language-parser.pkgherein
# Ours generic is invoked in:
#
src/lib/compiler/back/low/tools/arch/make-sourcecode-for-backend-packages.pkg # We get called from:
#
src/lib/compiler/back/low/make-derived-sourcecode-for-all-backends.pkg generic package make_sourcecode_for_backend_packages_g (
# ======================================
#
package reg: Make_Sourcecode_For_Registerkinds_Xxx_Package; # Make_Sourcecode_For_Registerkinds_Xxx_Package is from
src/lib/compiler/back/low/tools/arch/make-sourcecode-for-registerkinds-xxx-package.pkg package cst: Make_Sourcecode_For_Machcode_Xxx_Package; # Make_Sourcecode_For_Machcode_Xxx_Package is from
src/lib/compiler/back/low/tools/arch/make-sourcecode-for-machcode-xxx-package.pkg package asm
:
Make_Sourcecode_For_Translate_Machcode_To_Asmcode_Xxx_G_Package;
# Make_Sourcecode_For_Translate_Machcode_To_Asmcode_Xxx_G_Package is from
src/lib/compiler/back/low/tools/arch/make-sourcecode-for-translate-machcode-to-asmcode-xxx-g-package.pkg package mc
:
Make_Sourcecode_For_Translate_Machcode_To_Execode_Xxx_G_Package;
# Make_Sourcecode_For_Translate_Machcode_To_Execode_Xxx_G_Package is from
src/lib/compiler/back/low/tools/arch/make-sourcecode-for-translate-machcode-to-execode-xxx-g-package.pkg # Currently dummies:
#
package shuffle: Make_Sourcecode_For_Package;
package jumps: Make_Sourcecode_For_Package;
package dasm: Make_Sourcecode_For_Package;
package arc: Adl_Rtl_Comp; # Adl_Rtl_Comp is from
src/lib/compiler/back/low/tools/arch/adl-rtl-comp.api package props: Adl_Gen_Module2; # Adl_Gen_Module2 is from
src/lib/compiler/back/low/tools/arch/adl-gen-module2.api package rewrite: Adl_Gen_Module2;
package gc_rtl_props: Adl_Gen_Module2;
package gc_ssa_props: Adl_Gen_Module2;
# package delay_slots: Md_Gen_Module;
# package sched_props: Md_Gen_Module2;
sharing arc
== rewrite::arc
== gc_rtl_props::arc
== gc_ssa_props::arc
== props::arc
;
)
: (weak) Make_Sourcecode_For_Backend_Packages
{
fun do_it f x
=
if (*err::error_count == 0)
#
f x
except
err::ERROR = ();
fi;
# Generate code:
#
fun make_all_required_sourcefiles architecture_description
=
{ err::open_log_file
(smj::make_sourcecode_filename
{
architecture_description,
subdir => "",
make_filename => \\ architecture_name = sprintf "make-sourcecode-for-backend-packages-%s.log" architecture_name # architecture_name can be "pwrpc32"
| "sparc32" | "intel32".
}
);
#
reg::make_sourcecode_for_registerkinds_xxx_package architecture_description;
cst::make_sourcecode_for_machcode_xxx_package architecture_description;
asm::make_sourcecode_for_translate_machcode_to_asmcode_xxx_g_package architecture_description;
mc::make_sourcecode_for_translate_machcode_to_execode_xxx_g_package architecture_description;
# Currently dummies:
shuffle::make_sourcecode_for_package architecture_description;
dasm::make_sourcecode_for_package architecture_description;
jumps::make_sourcecode_for_package architecture_description;
# delay_slots::gen architecture_description;
# { compiled_rtls = arc::compile architecture_description;
#
# do_it arc::gen compiled_rtls;
# do_it rtl_rewrite::gen compiled_rtls;
# do_it props::gen compiled_rtls;
# do_it gc_rtl_props::gen compiled_rtls;
# do_it gc_ssa_props::gen compiled_rtls;
# do_it sched_props::gen compiled_rtls;
#
# arc::dump_log compiled_rtls;
# };
err::write_to_log_and_stderr (err::errors_and_warnings_summary ());
err::close_log_file ();
};
fun make_sourcecode_for_backend_packages (filename: String) # 'filename' is something like "src/lib/compiler/back/low/intel32/one_word_int.architecture-description" -- path to an architecture description file.
=
{ print("[Processing " + filename + "]\n");
#
err::init ();
#
make_all_required_sourcefiles
(ard::translate_raw_syntax_to_architecture_description (filename, par::load filename)); # Build raw_syntax_tree.
};
fun exit ()
=
if (*err::error_count > 0) winix__premicrothread::process::failure;
else winix__premicrothread::process::success;
fi;
}; # generic package adl_g
end; # stipulate