PreviousUpNext

15.3.173  src/lib/compiler/back/low/tools/arch/architecture-description.api

## architecture-description.api -- derived from    ~/src/sml/nj/smlnj-110.60/MLRISC/Tools/ADL/mdl-compile.sig
#
# Digest architecture description into internal form.

# Our architecture descriptions are
#
#     src/lib/compiler/back/low/intel32/one_word_int.architecture-description
#     src/lib/compiler/back/low/pwrpc32/pwrpc32.architecture-description
#     src/lib/compiler/back/low/sparc32/sparc32.architecture-description
#
# The parser in
#
#     src/lib/compiler/back/low/tools/parser/architecture-description-language.grammar
#
# convert the selected file into the parsetree format specified in
#
#     src/lib/compiler/back/low/tools/adl-syntax/adl-raw-syntax-form.api
#
# which gets supplied to our 'compile' entrypoint.

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



stipulate
    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/architecture-description.pkg
    #
    api Architecture_Description {
        #
        Architecture_Description;                                                                       # architecture description -- our result type.
        Filename = String;

        ########################################################################
        # Digest architecture description file parsetree into internal form.
        # This is our major entrypoint:
        #
        translate_raw_syntax_to_architecture_description:    (Filename, List(raw::Declaration)) -> Architecture_Description;                    # Digest architecture-description raw-syntax parsetree into internal form.
        #
        ########################################################################

        # Fetch various fields from an architecture description:
        #
        endian_of:                              Architecture_Description -> raw::Endian;                        # LITTLE for INTEL32 (x86), BIG for SPARC32 and PWRPC32.
        asm_case_of:                            Architecture_Description -> raw::Assemblycase;                  # Should generated assembly code be UPPERCASE, LOWERCASE or VERBATIM?
        architecture_name_of:                   Architecture_Description -> String;                             # Architecture name ("intel32"|"sparc32"|"pwrpc32") -- 'foo' from the 'architecture foo = ' line
        architecture_description_file_of:       Architecture_Description -> String;                             # 'filename' is something like "src/lib/compiler/back/low/intel32/one_word_int.architecture-description"
        symboltable_of:                         Architecture_Description -> mst::Symboltable;                   #
        registersets_of:                        Architecture_Description -> List( raw::Register_Set );
        special_registers_of:                   Architecture_Description -> List( raw::Special_Register );
        instruction_formats_of:                 Architecture_Description -> List( (Null_Or(Int), raw::Instruction_Format));
        resources_of:                           Architecture_Description -> List( raw::Id );
        pipelines_of:                           Architecture_Description -> List( raw::Pipeline );
        cpus_of:                                Architecture_Description -> List( raw::Cpu );
        latencies_of:                           Architecture_Description -> List( raw::Latency );
        base_ops_of:                    Architecture_Description -> List( raw::Constructor );

    #   registersets:                           Architecture_Description -> List( raw::Register_Set );          # All registerkinds with registersets 
    #   registersets_aliases:                   Architecture_Description -> List( raw::Register_Set );          # include all aliases 

        debugging:                              Architecture_Description -> String -> Bool;
        find_registerset_by_name:               Architecture_Description -> String -> raw::Register_Set;
        find_instruction_sumtype:               Architecture_Description -> String -> raw::Sumtype;             # For query string "binaryOp" returns sumtype named "binaryOp" from package Instruction in architecture description.
        has_copy_impl:                          Architecture_Description -> Bool;



        #  Extract info from the symboltable 
        #
        decl_of:                                Architecture_Description -> String -> raw::Declaration;         # Body of package.
        generic_arg_of:                         Architecture_Description -> String -> raw::Declaration;         # Generic argument.
        type_of:                                Architecture_Description -> String -> raw::Declaration;         # Type definitions.
        
        # Require the definitions of these things 
        #
        require:   Architecture_Description
                      -> String
                      -> { values: List( raw::Id ),
                           types:  List( raw::Id )
                         } 
                      -> Void;

    };
end;


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext