PreviousUpNext

15.3.89  src/lib/compiler/back/low/code/lowhalf-notes.api

## lowhalf-notes.api
#
# Here we customize the generic 'note' facility with support for:
#
#     Conditional-jump branch probabilities.
#     Basic-block execution frequencies.
#     Comments.
#     No-reorder constraint on instructions in a basic block.
#     Control-dependency definitions and uses.
#     no_optimization flag.
#     call-heapcleaner flag.
#     heapcleaner-safepoint flag.
#     heapcleaner_info flag.
#     block-names.
#     empty-block flag.
#     mark-reg
#     print-register-info.
#     no branch-chaining.
#     uses-virtual-frame-pointer flag.
#     return_arg

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



# Client packages can create their own annotations and propagate them;
# client-defined annotations are ignored by the backend lowhalf proper.
#
# TODO: There should be comments to say that the annotations are block
# or instruction annotations. -- Lal.
#
# See also:
#
#     MLRISC Annotations
#     Allen Leung, Lal George
#     circa 1999, 14p
#     http://www.smlnj.org//compiler-notes/annotations.ps



###             "If the programmer can simulate a construct
###              faster than a compiler can implement the
###              construct itself, then the compiler writer
###              has blown it badly."
###                                    -- Guy Steele



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

    api Lowhalf_Notes {
        #
        # The branch probability of conditional branches. 
        # The client can attach this with conditional branches.
        # nnThis has no effect otherwise. 
        #
        # Currently, the annotation is recognized by the static branch prediction
        # mondule. 
        #
        exception BRANCH_PROBABILITY  probability::Probability;
        branch_probability:  nt::Notekind(  probability::Probability );

        # The execution frequency of a basic block 
        # You can attach this at a basic block.
        #
        exception EXECUTION_FREQUENCY  Int;
        execution_freq:  nt::Notekind( Int );

        # No effect at all; this just
        # allows you to insert comments:
        #
        comment:  nt::Notekind( String );

        # Instructions in the block
        # should not be reordered:
        #
        noreorder:  nt::Notekind(  Void );


        # Control dependence definition and use.
        #
        # To use these, the client should generate
        # control dependence virtual registers via cells::new_cell cells::CTRL
        # and attach these annotations to instructions and basic blocks.
        #
        # These annotations are currently recognized by the SSA optimization
        # modules.
        #
        exception CONTROL_DEPENDENCY_DEF  rkj::Codetemp_Info;
        exception CONTROL_DEPENDENCY_USE  rkj::Codetemp_Info;

        ctrl_def:  nt::Notekind(  rkj::Codetemp_Info );
        ctrl_use:  nt::Notekind(  rkj::Codetemp_Info );


        # Attach this annotation to assemblers
        # for pretty printing client defined
        # register information:
        #
        print_register_info:    nt::Notekind (rkj::Codetemp_Info -> String);

        heapcleaner_info:       nt::Notekind( Void );           # Does the compilation unit have heapcleaner information? 


        no_optimization:        nt::Notekind( Void );           # Disable all optimizations in the cccomponent.


        # Mark basic block that calls the heapcleaner:
        #
        call_heapcleaner:       nt::Notekind( Void );
        heapcleaner_safepoint:  nt::Notekind( String );


        # Insert block names
        #
        exception BLOCKNAMES  nt::Notes;
        #
        block_names:  nt::Notekind(  nt::Notes );


        # This annotation inserts an empty basic block
        #
        exception EMPTYBLOCK; 
        empty_block:  nt::Notekind(  Void );


        # Enter information for a register.
        #
        exception MARKREG  rkj::Codetemp_Info -> Void;
        mark_reg:  nt::Notekind (rkj::Codetemp_Info -> Void);


        no_branch_chaining:  nt::Notekind(  Void );                     # Disable branch chaining optimization on a jump.

        uses_virtual_framepointer:  nt::Notekind(  Void );              # Code has reference to the virtual frame pointer -- see src/lib/compiler/back/low/omit-framepointer/free-up-framepointer-in-machcode.api

        return_arg:  nt::Notekind(  rkj::Codetemp_Info );               # Define return arguments of a call (hack for intel32)
    };
end;

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


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext