## make-sourcecode-for-backend-intel32.pkg -- derived from ~/src/sml/nj/smlnj-110.60/MLRISC/Tools/ADL/mdl-gen.sml
#
# Use architecture-description info to generate machine-specific backend lowehalf packages.
# Compiled by:
#
src/lib/compiler/back/low/tools/arch/make-sourcecode-for-backend-packages.lib# We get used in:
# sh/make-sourcecode-for-backend-intel32
### "Why would you want more than one machine language?"
###
### -- Johnny von Neumann, 1954
api Make_Sourcecode_For_Backend_Intel32 {
#
make_sourcecode_for_backend_intel32: String -> Void; # 'String' is something like "src/lib/compiler/back/low/intel32/one_word_int.architecture-description" -- gives the path to an architecture desription 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.pkg #
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 #
package shuffle = adl_dummy; # adl_dummy is from
src/lib/compiler/back/low/tools/arch/adl-dummygen.pkg package jumps = adl_dummy; # adl_dummy is from
src/lib/compiler/back/low/tools/arch/adl-dummygen.pkg package dasm = adl_dummy; # adl_dummy is from
src/lib/compiler/back/low/tools/arch/adl-dummygen.pkg #
herein
# We get called from:
# sh/make-sourcecode-for-backend-intel32
package make_sourcecode_for_backend_intel32
: (weak) Make_Sourcecode_For_Backend_Intel32
{
stipulate
package props = adl_gen_instruction_props ( adl_rtl_comp ); # adl_gen_instruction_props is from
src/lib/compiler/back/low/tools/arch/adl-gen-instruction-props.pkg package rewrite = adl_gen_rewrite ( adl_rtl_comp ); # adl_gen_rewrite is from
src/lib/compiler/back/low/tools/arch/adl-gen-rewrite.pkg package rtl_comp = adl_rtl_comp ; # adl_rtl_comp is from
src/lib/compiler/back/low/tools/arch/adl-rtl-comp.pkg package gc_rtl_props = adl_gen_rtl_props ( adl_rtl_comp ); # adl_gen_rtl_props is from
src/lib/compiler/back/low/tools/arch/adl-gen-rtlprops.pkg package gc_ssa_props = adl_gen_ssa_props ( adl_rtl_comp ); # adl_gen_ssa_props is from
src/lib/compiler/back/low/tools/arch/adl-gen-ssaprops.pkg# sharing rtl_comp
# == rewrite::rtl_comp
# == gc_rtl_props::rtl_comp
# == gc_ssa_props::rtl_comp
# == props::rtl_comp
# ;
herein
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-%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;
# These are all just dummies:
#
shuffle::make_sourcecode_for_package architecture_description;
jumps::make_sourcecode_for_package architecture_description;
dasm::make_sourcecode_for_package architecture_description;
# delay_slots::gen architecture_description;
# { compiled_rtls = rtl_comp::compile architecture_description;
#
# do_it rtl_comp::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;
#
# rtl_comp::dump_log compiled_rtls;
# };
error_summary = err::errors_and_warnings_summary ();
err::write_to_log error_summary;
err::close_log_file ();
print (" make-sourcecode-for-backend-intel32.pkg: Done. " + error_summary + "\n");
};
fun make_sourcecode_for_backend_intel32 (filename: String) # 'filename' is something like "src/lib/compiler/back/low/intel32/one_word_int.architecture-description" -- path to an architecture description file.
=
{ print(" make-sourcecode-for-backend-intel32.pkg: 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;
end; # stipulate
}; # package make_sourcecode_for_backend_intel32
end; # stipulate