diff options
author | steven <steven@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-05-25 10:31:43 +0000 |
---|---|---|
committer | steven <steven@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-05-25 10:31:43 +0000 |
commit | 242d1ee6c39412df039aa819772f14592f7bdee5 (patch) | |
tree | c8ab9fbf060c20d9e04751197d11b9393d752bd0 /gcc/sched-int.h | |
parent | dbbbd81b70fb4b111b7a410e497f9126805d1aad (diff) | |
download | gcc-242d1ee6c39412df039aa819772f14592f7bdee5.tar.gz |
* sched-int.h (ds_t, dw_t): Make unsigned int.
Fix documentation that describes how all the ds_t bits are used.
Reserve the last bit for delayed-branch scheduling.
(BITS_PER_DEP_STATUS): Move to ds_t typedef.
(BITS_PER_DEP_WEAK): Fix definition and documentation.
(gen_dep_weak_1): Remove prototype.
* sched-deps.c (get_dep_weak_1): Make static.
* target.def (speculate_insn, needs_block_p, gen_spec_check,
get_insn_spec_ds, get_insn_checked_ds): Adjust hook prototypes.
* doc/tm.texi: Regenerate.
* config/ia64/ia64.c (ia64_needs_block_p): Update prototype.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@199325 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/sched-int.h')
-rw-r--r-- | gcc/sched-int.h | 102 |
1 files changed, 68 insertions, 34 deletions
diff --git a/gcc/sched-int.h b/gcc/sched-int.h index 9ab33744780..90d5b05c75e 100644 --- a/gcc/sched-int.h +++ b/gcc/sched-int.h @@ -193,10 +193,11 @@ extern void sched_create_recovery_edges (basic_block, basic_block, extern state_t curr_state; /* Type to represent status of a dependence. */ -typedef int ds_t; +typedef unsigned int ds_t; +#define BITS_PER_DEP_STATUS HOST_BITS_PER_INT /* Type to represent weakness of speculative dependence. */ -typedef int dw_t; +typedef unsigned int dw_t; extern enum reg_note ds_to_dk (ds_t); extern ds_t dk_to_ds (enum reg_note); @@ -743,6 +744,7 @@ struct _haifa_deps_insn_data unsigned int cant_move : 1; }; + /* Bits used for storing values of the fields in the following structure. */ #define INCREASE_BITS 8 @@ -952,33 +954,53 @@ extern vec<haifa_deps_insn_data_def> h_d_i_d; #define IS_SPECULATION_BRANCHY_CHECK_P(INSN) \ (RECOVERY_BLOCK (INSN) != NULL && RECOVERY_BLOCK (INSN) != EXIT_BLOCK_PTR) -/* Dep status (aka ds_t) of the link encapsulates information, that is needed - for speculative scheduling. Namely, it is 4 integers in the range - [0, MAX_DEP_WEAK] and 3 bits. - The integers correspond to the probability of the dependence to *not* - exist, it is the probability, that overcoming of this dependence will - not be followed by execution of the recovery code. Nevertheless, - whatever high the probability of success is, recovery code should still - be generated to preserve semantics of the program. To find a way to - get/set these integers, please refer to the {get, set}_dep_weak () - functions in sched-deps.c . - The 3 bits in the DEP_STATUS correspond to 3 dependence types: true-, - output- and anti- dependence. It is not enough for speculative scheduling - to know just the major type of all the dependence between two instructions, - as only true dependence can be overcome. - There also is the 4-th bit in the DEP_STATUS (HARD_DEP), that is reserved - for using to describe instruction's status. It is set whenever instruction - has at least one dependence, that cannot be overcame. - See also: check_dep_status () in sched-deps.c . */ + +/* Dep status (aka ds_t) of the link encapsulates all information for a given + dependency, including everything that is needed for speculative scheduling. + + The lay-out of a ds_t is as follows: + + 1. Integers corresponding to the probability of the dependence to *not* + exist. This is the probability that overcoming this dependence will + not be followed by execution of the recovery code. Note that however + high this probability is, the recovery code should still always be + generated to preserve semantics of the program. + + The probability values can be set or retrieved using the functions + the set_dep_weak() and get_dep_weak() in sched-deps.c. The values + are always in the range [0, MAX_DEP_WEAK]. + + BEGIN_DATA : BITS_PER_DEP_WEAK + BE_IN_DATA : BITS_PER_DEP_WEAK + BEGIN_CONTROL : BITS_PER_DEP_WEAK + BE_IN_CONTROL : BITS_PER_DEP_WEAK + + The basic type of DS_T is a host int. For a 32-bits int, the values + will each take 6 bits. -/* We exclude sign bit. */ -#define BITS_PER_DEP_STATUS (HOST_BITS_PER_INT - 1) + 2. The type of dependence. This supercedes the old-style REG_NOTE_KIND + values. TODO: Use this field instead of DEP_TYPE, or make DEP_TYPE + extract the dependence type from here. -/* First '6' stands for 4 dep type bits and the HARD_DEP and DEP_CANCELLED - bits. - Second '4' stands for BEGIN_{DATA, CONTROL}, BE_IN_{DATA, CONTROL} - dep weakness. */ -#define BITS_PER_DEP_WEAK ((BITS_PER_DEP_STATUS - 6) / 4) + dep_type : 4 => DEP_{TRUE|OUTPUT|ANTI|CONTROL} + + 3. Various flags: + + HARD_DEP : 1 => Set if an instruction has a non-speculative + dependence. This is an instruction property + so this bit can only appear in the TODO_SPEC + field of an instruction. + DEP_POSTPONED : 1 => Like HARD_DEP, but the hard dependence may + still be broken by adjusting the instruction. + DEP_CANCELLED : 1 => Set if a dependency has been broken using + some form of speculation. + RESERVED : 1 => Reserved for use in the delay slot scheduler. + + See also: check_dep_status () in sched-deps.c . */ + +/* The number of bits per weakness probability. There are 4 weakness types + and we need 8 bits for other data in a DS_T. */ +#define BITS_PER_DEP_WEAK ((BITS_PER_DEP_STATUS - 8) / 4) /* Mask of speculative weakness in dep_status. */ #define DEP_WEAK_MASK ((1 << BITS_PER_DEP_WEAK) - 1) @@ -996,7 +1018,9 @@ extern vec<haifa_deps_insn_data_def> h_d_i_d; #define MIN_DEP_WEAK 1 /* This constant represents 100% probability. - E.g. it is used to represent weakness of dependence, that doesn't exist. */ + E.g. it is used to represent weakness of dependence, that doesn't exist. + This value never appears in a ds_t, it is only used for computing the + weakness of a dependence. */ #define NO_DEP_WEAK (MAX_DEP_WEAK + MIN_DEP_WEAK) /* Default weakness of speculative dependence. Used when we can't say @@ -1011,8 +1035,10 @@ enum SPEC_TYPES_OFFSETS { BE_IN_CONTROL_BITS_OFFSET = BEGIN_CONTROL_BITS_OFFSET + BITS_PER_DEP_WEAK }; -/* The following defines provide numerous constants used to distinguish between - different types of speculative dependencies. */ +/* The following defines provide numerous constants used to distinguish + between different types of speculative dependencies. They are also + used as masks to clear/preserve the bits corresponding to the type + of dependency weakness. */ /* Dependence can be overcome with generation of new data speculative instruction. */ @@ -1058,15 +1084,24 @@ enum SPEC_TYPES_OFFSETS { /* Instruction has non-speculative dependence. This bit represents the property of an instruction - not the one of a dependence. - Therefore, it can appear only in TODO_SPEC field of an instruction. */ + Therefore, it can appear only in the TODO_SPEC field of an instruction. */ #define HARD_DEP (DEP_CONTROL << 1) -/* Set in the TODO_SPEC field of an instruction for which new_ready - has decided not to schedule it speculatively. */ +/* Like HARD_DEP, but dependencies can perhaps be broken by modifying + the instructions. This is used for example to change: + + rn++ => rm=[rn + 4] + rm=[rn] rn++ + + For instructions that have this bit set, one of the dependencies of + the instructions will have a non-NULL REPLACE field in its DEP_T. + Just like HARD_DEP, this bit is only ever set in TODO_SPEC. */ #define DEP_POSTPONED (HARD_DEP << 1) +/* Set if a dependency is cancelled via speculation. */ #define DEP_CANCELLED (DEP_POSTPONED << 1) + /* This represents the results of calling sched-deps.c functions, which modify dependencies. */ enum DEPS_ADJUST_RESULT { @@ -1268,7 +1303,6 @@ extern void deps_analyze_insn (struct deps_desc *, rtx); extern void remove_from_deps (struct deps_desc *, rtx); extern void init_insn_reg_pressure_info (rtx); -extern dw_t get_dep_weak_1 (ds_t, ds_t); extern dw_t get_dep_weak (ds_t, ds_t); extern ds_t set_dep_weak (ds_t, ds_t, dw_t); extern dw_t estimate_dep_weak (rtx, rtx); |