PreviousUpNext

15.4.334  src/lib/compiler/back/low/pwrpc32/code/instruction-frequency-properties-pwrpc32-g.pkg

## instruction-frequency-properties-pwrpc32-g.pkg

# Compiled by:
#     src/lib/compiler/back/low/pwrpc32/backend-pwrpc32.lib

# Extract frequency information from the PowerPC architecture
#
# -- Allen Leung



###              "Smooth shapes are very rare in the wild but
###               extremely important in the ivory tower and the factory."
###
###                                    -- Benoit Mandelbrot


# We are nowhere invoked.
 
generic package   instruction_frequency_properties_pwrpc32_g   (
    #             ==========================================
    #
    mcf:  Machcode_Pwrpc32                                              # Machcode_Pwrpc32                      is from   src/lib/compiler/back/low/pwrpc32/code/machcode-pwrpc32.codemade.api
)
: (weak) Instruction_Frequency_Properties                               # Instruction_Frequency_Properties      is from   src/lib/compiler/back/low/code/instruction-frequency-properties.api
{
    # Export to client packages:
    #
    package mcf = mcf;                                                  # "mcf" == "machcode_form" (abstract machine code).

    p10  = probability::percent 10;                                     # probability                           is from   src/lib/compiler/back/low/library/probability.pkg
    p50  = probability::percent 50;
    p90  = probability::percent 90;
    p100 = probability::always;

    fun branch_probability_pwrpc32 (mcf::BC _) => p50;
        branch_probability_pwrpc32 (mcf::BCLR { labels => [], bo => mcf::ALWAYS, ... } ) => p100;
        branch_probability_pwrpc32 (mcf::BCLR { labels, bo=>mcf::ALWAYS, ... } ) => probability::prob (1, length labels);
        branch_probability_pwrpc32 (mcf::BCLR { labels => [], bo, ... } ) => p50;
        branch_probability_pwrpc32 (mcf::BCLR { labels, bo, ... } ) => probability::prob (1, length labels);
        branch_probability_pwrpc32 _ => probability::never;
    end;                                                        #  non-branch 

    fun branch_probability (mcf::NOTE { note, op, ... } )
            =>
            case (lowhalf_notes::branch_probability.peek note)
                #              
                THE b =>   b;
                NULL  =>   branch_probability  op;
            esac;

        branch_probability (mcf::BASE_OP i) => branch_probability_pwrpc32 i;
        branch_probability _ => probability::never;
    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