PreviousUpNext

15.3.203  src/lib/compiler/back/low/treecode/treecode-rtl.api

## treecode-rtl.api   -- derived from ~/src/sml/nj/smlnj-110.58/new/new/src/MLRISC/mltree/mltree-rtl.sig
#
# This api describes the internal RTL ("register transfer language") representation.
# The internal representation differs from the user representation it that
# it is lambda-lifted, i.e., instead of having references like REG (32, 123),
# it has references like PARAM i, which refers to the ith parameter.

# This representation is chosen so that multiple instructions can
# share the same rtl template.  Also, so that the templates can be
# created once before compilation begins. 

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


stipulate
    package tcp =  treecode_pith;                                       # treecode_pith                         is from   src/lib/compiler/back/low/treecode/treecode-pith.pkg
herein

    api Treecode_Rtl {                                                  # RTL is "Register Transfer Language"
        #
        package tcf:  Treecode_Form;                                    # Treecode_Form                         is from   src/lib/compiler/back/low/treecode/treecode-form.api
        package tcj:  Treecode_Hashing_Equality_And_Display;            # Treecode_Hashing_Equality_And_Display is from   src/lib/compiler/back/low/treecode/treecode-hashing-equality-and-display.api
        package tcr:  Treecode_Rewrite;                                 # Treecode_Rewrite                      is from   src/lib/compiler/back/low/treecode/treecode-rewrite.api
        package fld:  Treecode_Fold;                                    # Treecode_Fold                         is from   src/lib/compiler/back/low/treecode/treecode-fold.api

        sharing tcj::tcf
             == tcr::tcf
             == fld::tcf
             ==      tcf                                                # "tcf" == "treecode_form".
             ;

        Type       =  tcf::Int_Bitsize;
        Rtl        =  tcf::Void_Expression;
        Expression =  tcf::Int_Expression;

        Flag_Expression =  tcf::Flag_Expression;                        # Flag expressions handle zero/parity/overflow/... flag stuff.

        Div_Rounding_Mode = tcf::d::Div_Rounding_Mode;                  # d:: is a special rounding mode just for divide instructions.

        Pos = IN  Int
            | OUT Int
            | IO (Int, Int)              #  Def/use 
            ;


        #########################################################################
        # Basic Operations

        show_rtl
            :
            { def:              Int                 ->  String, 
              uses:             Int                 ->  String, 
              region_def:       tcf::rgn::Ramregion ->  String, 
              region_use:       tcf::rgn::Ramregion ->  String
            }
            -> tcf::Prettyprint_Fns;

        rtl_to_string:  Rtl -> String;
        exp_to_string:  Expression -> String;
        hash_rtl:       Rtl -> Unt;
        eq_rtl:        (Rtl, Rtl) -> Bool;



        #########################################################################
        # Construction 

        new_op
            :
            { name:             String,
              attributes:       tcp::Attributes
            }
            ->
            tcp::Misc_Op;

        new:     Rtl -> Rtl;
        pin:     Rtl -> Rtl;
        copy:    Rtl;                           # COPY
        jmp:     Rtl;                           # JMP



        #########################################################################
        # Type queries 

        is_conditional_branch:  Rtl -> Bool;
        is_jump:                    Rtl -> Bool;
        is_looker:              Rtl -> Bool;



        #########################################################################
        # Def/use queries.

        def_use:                    Rtl -> (List(Expression), List(Expression));



        #########################################################################
        # Assign positions to all arguments

        exception NOT_AN_ARGUMENT;

        arg_pos:        Rtl -> (List((Expression, Int)), List((Expression, Int)));
        arg_of: Rtl -> String -> (Expression, Pos);



        #########################################################################
        # Number of arguments that an rtl maps into

        Arity = ZERO | ONE | MANY;

        arity:                Expression -> Arity;              # Number of values.
        non_const_arity:      Expression -> Arity;              # Number of non-constant values.



        #########################################################################
        # Extract naming constraints, if any

        naming_constraints
            :
            (List(Expression), List(Expression))
            ->
            { fixed_defs:   List((Expression, Int)),    # These define fixed locations.
              fixed_uses:   List((Expression, Int)),    # These define fixed locations.
              two_address:  List( Expression )          # These are both src and dst.
            };


        #########################################################################
        # Code motion queries 

        can't_move_up:  Rtl -> Bool;
        can't_move_down:        Rtl -> Bool;
        pinned:         Rtl -> Bool;
        has_side_effect:        Rtl -> Bool;
        can't_be_removed:       Rtl -> Bool;
    };
end;


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext