Files
mercury/scripts/canonical_grade.sh-subr
Paul Bone 83a6f14708 Create a threadscope grade component.
Threadscope grades are enabled by using the grade component 'threadscope'.
They are supported only with low-lavel C parallel grades.  Support for
threadscope in high level C grades is intended in the future but does not work
now.

runtime/mercury_conf_param.h:
    Create the MR_THREADSCOPE macro that is defined if the grade is a
    threadscope grade.

    Define MR_PROFILE_FOR_PARALLEL_EXECUTION if MR_THREADSCOPE is defined.

    Emit an error if MR_LL_PARALLEL_CONJ is defined before it is implied by
    MR_THREADSAFE and ! MR_HIGHLEVEL_CODE

runtime/mercury_grade.h
    Update the grade symbol for the threadscope grade component.

runtime/mercury_atomic_ops.c:
runtime/mercury_atomic_ops.h:
runtime/mercury_context.c:
runtime/mercury_context.h:
runtime/mercury_engine.c:
runtime/mercury_engine.h:
runtime/mercury_thread.c:
runtime/mercury_threadscope.c:
runtime/mercury_threadscope.h:
runtime/mercury_wrapper.c:
    Now that MR_PROFILE_FOR_IMPLICIT_PARALLELISM is implied by MR_THREADSAFE we
    don't need to test for MR_THREADSAFE when we test for
    MR_PROFILE_FOR_IMPLICIT_PARALLELISM.  The same is true for
    MR_LL_PARALLEL_CONJ which is implied by MR_THREADSAFE &&
    !MR_HIGHLEVEL_CODE.

    Replace some occurances of MR_PROFILE_FOR_IMPLICIT_PARALLELISM with
    MR_THREADSCOPE where the conditionally compiled code is used to support
    threadscope profiling.

scripts/init_grade_options.sh-subr:
scripts/canonical_grade.sh-subr:
scripts/parse_grade_options.sh-subr:
scripts/final_grade_options.sh-subr:
scripts/mgnuc.in:
compiler/handle_options.m:
compiler/options.m:
compiler/compile_target_code.m:
configure.in:
    Add support for the new grade component.

    Pass -DMR_THREADSCOPE to the C compiler when using a threadscope grade.

    Add assertions to ensure that the 'threadscope' grade component is used
    only with the 'par' grade component.

doc/user_guide.texi:
    Added commented-out documentation for the threadscope greate component.

    Adjusted documentation of the --profile-parallel-execution runtime option
    to describe the correct prerequisite compile time options.

    Added my name to the authors list.

runtime/mercury_context.c:
    Corrected grammar and prose in comments in the MR_do_join_and_continue code.
2010-01-10 04:53:40 +00:00

196 lines
5.4 KiB
Bash

#---------------------------------------------------------------------------#
# vim: ft=sh
#---------------------------------------------------------------------------#
# Copyright (C) 2000-2007, 2010 The University of Melbourne.
# This file may only be copied under the terms of the GNU General
# Public License - see the file COPYING in the Mercury distribution.
#---------------------------------------------------------------------------#
#
# canonical_grade.sh-subr:
# An `sh' subroutine for computing a canonical grade string based on
# the values of grade-related options.
# It is used by the `ml', `c2init' and `canonical_grade' scripts.
#
# The code here should be inserted after init_grade_options.sh-subr,
# parse_grade_options.sh-subr and final_grade_options.sh-subr, which
# together define a set of shell variables giving the values of the
# various grade options.
#
# Canonical_grade.sh-subr defines the variable GRADE, which will contain
# the canonical string for the grade implied by the option values.
#
# If the option values are inconsistent, this script fragment will
# print an error message and exit with failure.
#
# IMPORTANT: any changes to the handling of grades here may also require
# changes to all the files indicated by runtime/mercury_grade.h.
case $non_local_gotos,$global_regs in
true,true) GRADE="fast" ;;
true,false) GRADE="jump" ;;
false,true) GRADE="reg" ;;
false,false) GRADE="none" ;;
esac
case $asm_labels in
true) GRADE="asm_$GRADE" ;;
false) ;;
esac
case $highlevel_code,$highlevel_data,$GRADE,$target in
true,true,none,*)
case $target in
c|asm) GRADE="hl" ;;
il) GRADE="il" ;;
java) GRADE="java" ;;
*)
progname=`basename $0`
echo "$progname: unknown target: $target"
exit 1
;;
esac
;;
true,false,none,*)
case $target in
c|asm) GRADE="hlc" ;;
il) GRADE="ilc" ;;
*)
progname=`basename $0`
echo "$progname: unsupported target: $target"
exit 1
;;
esac
;;
false,false,*,*)
# GRADE was set above
;;
false,true,*,*)
progname=`basename $0`
echo "$progname: error: \`--high-level-data' requires \`--high-level-code'" 1>&2
exit 1
;;
*)
echo "$progname: error: \`--high-level-code' is incompatible with the use of" 1>&2
echo "$progname: error: low-level gcc extensions implied by grade \`$GRADE'" 1>&2
exit 1
;;
esac
case $gcc_nested_functions,$highlevel_code in
true,true) GRADE="${GRADE}_nest" ;;
*) ;;
esac
case $thread_safe,$threadscope in
true,false) GRADE="$GRADE.par" ;;
true,true) GRADE="$GRADE.par.threadscope" ;;
false,false) ;;
*)
echo "$progname: error: The 'threadscope' grade component may only be" 1>&2
echo "$progname: error: used in parallel grades"
exit 1
;;
esac
case $gc_method in
conservative) GRADE="$GRADE.gc" ;; # deprecated; alias for boehm
boehm) GRADE="$GRADE.gc" ;;
boehm_debug) GRADE="$GRADE.gcd" ;;
mps) GRADE="$GRADE.mps" ;;
accurate) GRADE="$GRADE.agc" ;;
esac
case $profile_time,$profile_calls,$profile_memory,$profile_deep in
true,true,false,false) GRADE="$GRADE.prof" ;;
true,false,false,false) GRADE="$GRADE.proftime" ;;
false,true,false,false) GRADE="$GRADE.profcalls" ;;
true,true,true,false) GRADE="$GRADE.profall" ;;
false,true,true,false) GRADE="$GRADE.memprof" ;;
false,false,false,true) GRADE="$GRADE.profdeep" ;;
false,false,false,false) ;;
*) progname=`basename $0`
echo "$progname: error: invalid combination of profiling options." 1>&2
exit 1
;;
esac
case $record_term_sizes_as_words,$record_term_sizes_as_cells in
true,false) GRADE="$GRADE.tsw" ;;
false,true) GRADE="$GRADE.tsc" ;;
false,false) ;;
*) progname=`basename $0`
echo "$progname: error: invalid combination of term size profiling options." 1>&2
exit 1
;;
esac
case $use_trail,$trail_segments in
true,false) GRADE="$GRADE.tr" ;;
true,true) GRADE="$GRADE.trseg" ;;
false,false) ;;
*) progname=`basename $0`
echo "$progname: error: invalid combination of trailing options." 1>&2
exit 1
;;
esac
case $use_minimal_model_stack_copy,$use_minimal_model_own_stacks,$minimal_model_debug in
true,false,false) GRADE="$GRADE.mmsc" ;;
true,false,true) GRADE="$GRADE.dmmsc" ;;
false,true,false) GRADE="$GRADE.mmos" ;;
false,true,true) GRADE="$GRADE.dmmos" ;;
*) ;;
esac
case $single_prec_float in
true) GRADE="$GRADE.spf" ;;
false) ;;
esac
# We ignore the value of $picreg in computing the name of the grade
# that we will use as a directory name in the Mercury linker.
# case $picreg in
# true) GRADE="$GRADE.picreg" ;;
# false) ;;
# esac
case $debug,$decl_debug,$ss_debug in
true,true,false) GRADE="$GRADE.decldebug" ;;
true,false,false) GRADE="$GRADE.debug" ;;
false,false,true) GRADE="$GRADE.ssdebug" ;;
false,false,false) ;;
*) progname=`basename $0`
echo "$progname: error: invalid combination of debugging options." 1>&2
exit 1
;;
esac
case $ll_debug in
true) GRADE="$GRADE.ll_debug" ;;
*) ;;
esac;
case $extend_stacks,$stack_segments in
true,false) GRADE="$GRADE.exts" ;;
false,true) GRADE="$GRADE.stseg" ;;
false,false) ;;
*) progname=`basename $0`
echo "$progname: error: invalid combination of stack extension options." 1>&2
exit 1
;;
esac
case $use_regions in
true)
case $use_regions_debug,$use_regions_profiling in
false,false) GRADE="$GRADE.rbmm" ;;
false,true) GRADE="$GRADE.rbmmp" ;;
true,false) GRADE="$GRADE.rbmmd" ;;
true,true) GRADE="$GRADE.rbmmdp" ;;
esac
;;
false)
;;
esac