PreviousUpNext

15.4.441  src/lib/compiler/back/low/treecode/treecode-codebuffer-g.pkg

## treecode-codebuffer-g.pkg
#
# See comments in src/lib/compiler/back/low/treecode/treecode-codebuffer.api

# Compiled by:
#     src/lib/compiler/back/low/lib/lowhalf.lib



###                  "The difference between scientists and engineers
###                   is that when engineers screw up, people die."
###
###                      -- Frederick Orthlieb, engineering professor



stipulate
    package rkj =  registerkinds_junk;                                                                          # registerkinds_junk    is from   src/lib/compiler/back/low/code/registerkinds-junk.pkg
herein

    # We get invoked (only) from:
    #
    #     src/lib/compiler/back/low/main/pwrpc32/backend-lowhalf-pwrpc32.pkg
    #     src/lib/compiler/back/low/main/sparc32/backend-lowhalf-sparc32.pkg
    #     src/lib/compiler/back/low/main/intel32/backend-lowhalf-intel32-g.pkg
    #
    generic package   treecode_codebuffer_g   (
        #             =====================
        #
        package tcf: Treecode_Form;                                                                             # Treecode_Form         is from   src/lib/compiler/back/low/treecode/treecode-form.api

        # codebuffer_g specialized with                                                                         # codebuffer_g          is from   src/lib/compiler/back/low/code/codebuffer-g.pkg
        # architecture-specific pseudo-ops;
        #
        package cst: Codebuffer;                                                                                # Codebuffer            is from   src/lib/compiler/back/low/code/codebuffer.api
    )
    : (weak) Treecode_Codebuffer                                                                                # Treecode_Codebuffer   is from   src/lib/compiler/back/low/treecode/treecode-codebuffer.api
    {
        # Export to client packages:
        #
        package tcf = tcf;
        package cst = cst;




        # Instruction streams
        #
        Treecode_Codebuffer (I, A_registerset, A_cfg)
            =
            cst::Codebuffer (I, List(tcf::Note), A_registerset, A_cfg);


        # treecode extension mechanism -- see http://www.cs.nyu.edu/leunga/MLRISC/Doc/html/mltree-ext.html
        #
        Reducer (A_instruction, A_registerset, A_operand, A_addressing_mode, A_cfg)
            =
            REDUCER { reduce_int_expression:    tcf::Int_Expression   -> rkj::Codetemp_Info,
                      reduce_float_expression:  tcf::Float_Expression -> rkj::Codetemp_Info,
                      reduce_flag_expression:   tcf::Flag_Expression  -> rkj::Codetemp_Info,                    # flag expressions handle zero/parity/overflow/... flag stuff.

                      reduce_void_expression:   (tcf::Void_Expression, List(tcf::Note)) -> Void,                # Reduce statement to equivalent instructions.
                      operand:                  tcf::Int_Expression -> A_operand,                               # Reduce expression to operand (usually an immediate or register value).
                      reduce_operand:           A_operand -> rkj::Codetemp_Info,                                # Move a native operand into a register.

                      address_of:               tcf::Int_Expression -> A_addressing_mode,                       # Reduce an expression to a memory address.
                      put_op:                   (A_instruction, List( tcf::Note )) -> Void,                     # Emit an instruction with an annotation.

                      codestream:               Treecode_Codebuffer (A_instruction, A_registerset, A_cfg),      # The native-instruction output stream.

                      treecode_stream:          Treecode_Codebuffer                                             # Treecode output stream.
                                                  ( tcf::Void_Expression,
                                                    List( tcf::Expression ),
                                                    A_cfg
                                                  )
                    };

    };
end;


## COPYRIGHT (c) 2001 Lucent Technologies, Bell Laboratories.
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2015,
## released per terms of SMLNJ-COPYRIGHT.


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext