## instruction-frequency-properties-sparc32-g.pkg
# Compiled by:
#
src/lib/compiler/back/low/sparc32/backend-sparc32.lib# Extract frequency information from the sparc architecture
#
# -- Allen Leung
### "If my impressions are correct, our educational planing mill
### cuts down all the knots of genius, and reduces the best
### of the men who go through it to much the same standard."
###
### -- Simon Newcomb
# This generic is invoked nowhere:
#
generic package instruction_frequency_properties_sparc32_g (
# ==========================================
#
mcf: Machcode_Sparc32 # Machcode_Sparc32 is from
src/lib/compiler/back/low/sparc32/code/machcode-sparc32.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;
p50 = probability::percent 50;
p90 = probability::percent 90;
p100 = probability::always;
fun cond mcf::BA => p100;
cond mcf::BE => p10;
cond mcf::BNE => p90;
cond _ => p50;
end;
fun fcond mcf::FBA => p100;
fcond mcf::FBE => p10;
fcond mcf::FBNE => p90;
fcond _ => p50;
end;
fun sparc_branch_probability (mcf::BICC { b, ... } ) => cond b;
sparc_branch_probability (mcf::FBFCC { b, ... } ) => fcond b;
sparc_branch_probability (mcf::BP { b, ... } ) => cond b;
sparc_branch_probability (mcf::BR _) => p50;
sparc_branch_probability (mcf::JMP _) => p100;
sparc_branch_probability (mcf::RET _) => p100;
sparc_branch_probability _ => 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) => sparc_branch_probability 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.