PreviousUpNext

15.4.507  src/lib/compiler/back/top/main/anormcode-sequencer-controls.pkg

## anormcode-sequencer-controls.pkg
#
# The default sequence of transforms to apply to anormcode.

# Compiled by:
#     src/lib/compiler/core.sublib


stipulate
    package ci  =  global_control_index;                                # global_control_index          is from   src/lib/global-controls/global-control-index.pkg
    package cj  =  global_control_junk;                                 # global_control_junk                   is from   src/lib/global-controls/global-control-junk.pkg
    package ctl =  global_control;                                      # global_control                is from   src/lib/global-controls/global-control.pkg
herein

    package anormcode_sequencer_controls #  : Anormcode_Sequencer_Controls 
    {
        stipulate

            menu_slot =  [10, 11, 1];
            obscurity =  5;
            prefix    =  "highcode";

            registry = ci::make { help => "optimizer (highcode) settings" };
                                                                                    my _ = 
            basic_control::note_subindex (prefix, registry, menu_slot);

            bool_cvt =  cj::cvt::bool;
            int_cvt  =  cj::cvt::int;
            sl_cvt   =  cj::cvt::string_list;

            next_menu_slot = REF 0;

            fun make
                  ( c,
                    name,
                    help,
                    d
                  )
                =
                {   r         =  REF d;
                    menu_slot = *next_menu_slot;

                    control
                        =
                        ctl::make_control
                          {
                            name,
                            menu_slot => [menu_slot],
                            help,
                            control => r,
                            obscurity
                          };

                    next_menu_slot :=  menu_slot + 1;

                    ci::note_control
                        #
                        registry
                        #
                        { control         =>  ctl::make_string_control  c  control,
                          dictionary_name =>  THE (cj::dn::to_upper "HIGHCODE_" name)
                        };
                    r;
                };
        herein

            print                =  make (bool_cvt, "print", "show IR", FALSE);
            print_phases         =  make (bool_cvt, "print_phases", "show phases", FALSE);
            print_function_types =  make (bool_cvt, "print_function_types", "show function types", FALSE);

            # `do_crossmodule_anormcode_inlining' should probably be called just after
            # `improve_mutually_recursive_anormcode_functions' since
            # `improve_anormcode' might eliminate some uncurry wrappers which are
            # locally unused but could be cross-module inlined.
            #
            anormcode_passes
                =
                make (
                    sl_cvt,                                                     # "sl_cvt" is probably "convert_string_list"
                    "phases",
                    "highcode phases",                                          # Should probably be renamed "anormcode passes".
                    [ #
                      # Our pass names here get interpreted by runphase() in:
                      #
                      #     src/lib/compiler/back/top/main/backend-tophalf-g.pkg
                      #   
                      "improve_anormcode_quickly",                              # Cruder but quicker than "improve_anormcode"
                      "improve_mutually_recursive_anormcode_functions",
                      "improve_anormcode",
                      "specialize_anormcode_to_least_general_type",
                      "loopify_anormcode",
                      "improve_mutually_recursive_anormcode_functions",
                      "do_crossmodule_anormcode_inlining",
                      "improve_anormcode",
                      "insert_anormcode_boxing_and_coercion_code",
                      "improve_anormcode",
                      "drop_types_from_anormcode",
                    # "eliminate_array_bounds_checks_in_anormcode",
                      "improve_anormcode",
                      "improve_mutually_recursive_anormcode_functions",
                      "improve_anormcode+eta"
                    ]
                );

            inline_threshold = make (int_cvt, "inline_threshold",
                                       "inline threshold", 16);
            #  split_threshold  = REF 0 

            unroll_threshold = make (int_cvt, "unroll_threshold",
                                       "unroll threshold", 20);
            maxargs = make (int_cvt, "maxargs", "max number of arguments", 6);
            dropinvariant = make (bool_cvt, "dropinvariant", "dropinvariant", TRUE);

            specialize = make (bool_cvt, "specialize",
                                  "whether to specialize", TRUE);

            #  lift_literals    = REF FALSE 

            sharewrap = make (bool_cvt, "sharewrap",
                                 "whether to share wrappers", TRUE);

            saytappinfo = make (bool_cvt, "saytappinfo",
                                   "whether to show typelifting stats", FALSE);

            #  only for temporary debugging 
            #
            misc = REF 0;

            #  highcode internal type-checking controls 
            #
            check = make (bool_cvt, "check", "whether to typecheck the IR", FALSE);

            #  fails on lowhalf / * / *RegAlloc.sml
            # 
            check_sumtypes = make (bool_cvt, "check_sumtypes",
                                      "typecheck sumtypes", FALSE);

            #  loops on the make cm.sml
            # 
            check_kinds = make (bool_cvt, "check_kinds",
                                  "check kinding information", TRUE);

            # Non-exported stuff:
            #
            my recover:  Ref (Int -> Void)
                      =  REF (\\ x =  ());
        end;
    };
end;


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext