PreviousUpNext

15.3.176  src/lib/compiler/back/low/tools/arch/sourcecode-making-junk.api

## sourcecode-making-junk.api -- derived from    ~/src/sml/nj/smlnj-110.60/MLRISC/Tools/ADL/mdl-compile.sig
#

# Compiled by:
#     src/lib/compiler/back/low/tools/arch/make-sourcecode-for-backend-packages.lib


# Compiled by:
#     src/lib/compiler/back/low/tools/arch/make-sourcecode-for-backend-packages.lib

# This api is implemented in:
#     src/lib/compiler/back/low/tools/arch/architecture-description.pkg

stipulate
    package ard =  architecture_description;                                                    # architecture_description                      is from   src/lib/compiler/back/low/tools/arch/architecture-description.pkg
    package cst =  adl_raw_syntax_constants;                                                    # adl_raw_syntax_constants                      is from   src/lib/compiler/back/low/tools/adl-syntax/adl-raw-syntax-constants.pkg
    package spp =  simple_prettyprinter;                                                        # simple_prettyprinter                          is from   src/lib/prettyprint/simple/simple-prettyprinter.pkg
    package mst =  adl_symboltable;                                                             # adl_symboltable                               is from   src/lib/compiler/back/low/tools/arch/adl-symboltable.pkg
    package raw =  adl_raw_syntax_form;                                                         # adl_raw_syntax_form                           is from   src/lib/compiler/back/low/tools/adl-syntax/adl-raw-syntax-form.pkg
herein

    # This api is implemented in:
    #     src/lib/compiler/back/low/tools/arch/sourcecode-making-junk.pkg
    #
    api Sourcecode_Making_Junk {
        #

        Seal = WEAK_SEAL        # foo: (weak) Bar
             | STRONG_SEAL      # foo:        Bar
             ;

        # Code generation functions:
        #
        Module = String;
        Arguments = List( String );
        Api_Name = String;

        make_query_by_registerkind:     ard::Architecture_Description -> String -> raw::Declaration;
        forall_user_registersets:       ard::Architecture_Description -> (raw::Register_Set -> X) -> List(X);                                           # Map all real registersets in 'architecture_description' by given function.


        error_handler:                  ard::Architecture_Description -> (String -> String) -> raw::Declaration;                                        # Fn maps architecture_name -> module_name for error handler.

        make_api_name:                  ard::Architecture_Description -> String -> String;                                                              # E.g. "registerkinds" -> "Registerkinds_Intel32"
        make_package_name:              ard::Architecture_Description -> String -> String;                                                              # E.g. "registerkinds" -> "registerkinds_intel32"
        make_generic_package_name:      ard::Architecture_Description -> String -> String;                                                              # E.g. "registerkinds" -> "registerkinds_intel32_g"

        make_code:                      List( raw::Declaration ) -> spp::Prettyprint_Expression;                                                                # Nowhere invoked.
        make_package:                   ard::Architecture_Description -> String -> Api_Name -> List(raw::Declaration) -> spp::Prettyprint_Expression;
        make_api:                       ard::Architecture_Description -> Module -> List(raw::Declaration) -> spp::Prettyprint_Expression;

        make_generic  :                 ard::Architecture_Description -> (String -> String) -> Arguments        -> Seal -> Api_Name -> List( raw::Declaration ) -> spp::Prettyprint_Expression;
        make_generic' :                 ard::Architecture_Description -> (String -> String) -> raw::Declaration -> Seal -> Api_Name -> List( raw::Declaration ) -> spp::Prettyprint_Expression;

        make_sourcecode_filename                                        # E.g., "src/lib/compiler/back/low/intel32/code/registers-intel32.pkg"
          :
          { architecture_description:   ard::Architecture_Description,  # E.g. parsed from "src/lib/compiler/back/low/intel32/one_word_int.architecture-description"> 
            subdir:                     String,                         # E.g. "instruction" (or "") -- understood as being relative to directory containing the architecture description file.
            make_filename:              String -> String                # E.g. maps "intel32" -> "registerkinds-intel32.codemade.pkg"
          }
          -> String;
            #
            # Construct name for an automatically generated sourcefile.
            #   
            # For example if   Architecture_Description is from "src/lib/compiler/back/low/intel32/one_word_int.architecture-description"
            # and              subdir              is      "instruction"
            # and              make_filename       maps    "intel32" -> "registerkinds-intel32.codemade.pkg"
            # then result will be                          "src/lib/compiler/back/low/intel32/code/registerkinds-intel32.codemade.pkg"

        write_sourcecode_file
          :
          { architecture_description:   ard::Architecture_Description,          # architecture description from which we are synthesizing code.
            created_by_package:         String,                                 # Package which synthesized the this sourcefile, e.g. "src/lib/compiler/back/low/tools/arch/make-sourcecode-for-registerkinds-xxx-package.pkg".
            subdir:                     String,                                 # Subdirectory for new sourcecode file, relative to directory containing the architecture description file.
            make_filename:              String -> String,                       # Given architecture name (e.g. "pwrpc32"|"sparc32"|"intel32"|), construct name for sourcefile (e.g. 'registerkinds-intel32.codemade.pkg").
            code:                       List(spp::Prettyprint_Expression)       # Code for new sourcecode file.
          }
          -> Void;
    };
end;


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext