New target hook to calculate MII
Co-Authored-By: Revital Eres <eres@il.ibm.com> From-SVN: r128343
This commit is contained in:
parent
77340500f2
commit
67186a97fe
@ -1,3 +1,16 @@
|
||||
2007-09-10 Trevor Smigiel <trevor_smigiel@playstation.sony.com>
|
||||
Revital Eres <eres@il.ibm.com>
|
||||
|
||||
* target.h (struct gcc_target.sched): New field: sms_res_mii.
|
||||
(struct ddg): Define.
|
||||
* target-def.h (TARGET_SCHED_SMS_RES_MII): Define.
|
||||
(TARGET_SCHED): Add TARGET_SCHED_SMS_RES_MII.
|
||||
* config/spu/spu.c: Include ddg.h.
|
||||
(TARGET_SCHED_SMS_RES_MII): Define.
|
||||
(spu_sms_res_mii): New function to calculate mii.
|
||||
* modulo-sched (res_MII): Use it.
|
||||
* doc/tm.texi: Document TARGET_SCHED_SMS_RES_MII.
|
||||
|
||||
2007-09-10 Andreas Krebbel <krebbel1@de.ibm.com>
|
||||
|
||||
* config/s390/s390.c (s390_dump_pool): Create copy of constant
|
||||
|
@ -53,6 +53,7 @@
|
||||
#include "tree-gimple.h"
|
||||
#include "tm-constrs.h"
|
||||
#include "spu-builtins.h"
|
||||
#include "ddg.h"
|
||||
|
||||
/* Builtin types, data and prototypes. */
|
||||
struct spu_builtin_range
|
||||
@ -136,6 +137,7 @@ static tree spu_builtin_mul_widen_odd (tree);
|
||||
static tree spu_builtin_mask_for_load (void);
|
||||
static int spu_builtin_vectorization_cost (bool);
|
||||
static bool spu_vector_alignment_reachable (const_tree, bool);
|
||||
static int spu_sms_res_mii (struct ddg *g);
|
||||
|
||||
extern const char *reg_names[];
|
||||
rtx spu_compare_op0, spu_compare_op1;
|
||||
@ -287,6 +289,9 @@ const struct attribute_spec spu_attribute_table[];
|
||||
#undef TARGET_LIBGCC_SHIFT_COUNT_MODE
|
||||
#define TARGET_LIBGCC_SHIFT_COUNT_MODE spu_libgcc_shift_count_mode
|
||||
|
||||
#undef TARGET_SCHED_SMS_RES_MII
|
||||
#define TARGET_SCHED_SMS_RES_MII spu_sms_res_mii
|
||||
|
||||
struct gcc_target targetm = TARGET_INITIALIZER;
|
||||
|
||||
void
|
||||
@ -5506,6 +5511,38 @@ spu_vector_alignment_reachable (const_tree type ATTRIBUTE_UNUSED, bool is_packed
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Count the total number of instructions in each pipe and return the
|
||||
maximum, which is used as the Minimum Iteration Interval (MII)
|
||||
in the modulo scheduler. get_pipe() will return -2, -1, 0, or 1.
|
||||
-2 are instructions that can go in pipe0 or pipe1. */
|
||||
static int
|
||||
spu_sms_res_mii (struct ddg *g)
|
||||
{
|
||||
int i;
|
||||
unsigned t[4] = {0, 0, 0, 0};
|
||||
|
||||
for (i = 0; i < g->num_nodes; i++)
|
||||
{
|
||||
rtx insn = g->nodes[i].insn;
|
||||
int p = get_pipe (insn) + 2;
|
||||
|
||||
assert (p >= 0);
|
||||
assert (p < 4);
|
||||
|
||||
t[p]++;
|
||||
if (dump_file && INSN_P (insn))
|
||||
fprintf (dump_file, "i%d %s %d %d\n",
|
||||
INSN_UID (insn),
|
||||
insn_data[INSN_CODE(insn)].name,
|
||||
p, t[p]);
|
||||
}
|
||||
if (dump_file)
|
||||
fprintf (dump_file, "%d %d %d %d\n", t[0], t[1], t[2], t[3]);
|
||||
|
||||
return MAX ((t[0] + t[2] + t[3] + 1) / 2, MAX (t[2], t[3]));
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
spu_init_expanders (void)
|
||||
{
|
||||
|
@ -6342,6 +6342,15 @@ an additional structure @var{spec_info} should be filled by the target.
|
||||
The structure describes speculation types that can be used in the scheduler.
|
||||
@end deftypefn
|
||||
|
||||
@deftypefn {Target Hook} int TARGET_SCHED_SMS_RES_MII (struct ddg *@var{g})
|
||||
This hook is called by the swing modulo scheduler to calculate a
|
||||
resource-based lower bound which is based on the resources available in
|
||||
the machine and the resources required by each instruction. The target
|
||||
backend can use @var{g} to calculate such bound. A very simple lower
|
||||
bound will be used in case this hook is not implemented: the total number
|
||||
of instructions divided by the issue rate.
|
||||
@end deftypefn
|
||||
|
||||
@node Sections
|
||||
@section Dividing the Output into Sections (Texts, Data, @dots{})
|
||||
@c the above section title is WAY too long. maybe cut the part between
|
||||
|
@ -374,6 +374,9 @@ const_iteration_count (rtx count_reg, basic_block pre_header,
|
||||
static int
|
||||
res_MII (ddg_ptr g)
|
||||
{
|
||||
if (targetm.sched.sms_res_mii)
|
||||
return targetm.sched.sms_res_mii (g);
|
||||
|
||||
return (g->num_nodes / issue_rate);
|
||||
}
|
||||
|
||||
|
@ -322,7 +322,7 @@
|
||||
#define TARGET_SCHED_GEN_CHECK 0
|
||||
#define TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DFA_LOOKAHEAD_GUARD_SPEC 0
|
||||
#define TARGET_SCHED_SET_SCHED_FLAGS 0
|
||||
|
||||
#define TARGET_SCHED_SMS_RES_MII 0
|
||||
|
||||
#define TARGET_SCHED \
|
||||
{TARGET_SCHED_ADJUST_COST, \
|
||||
@ -351,7 +351,8 @@
|
||||
TARGET_SCHED_NEEDS_BLOCK_P, \
|
||||
TARGET_SCHED_GEN_CHECK, \
|
||||
TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DFA_LOOKAHEAD_GUARD_SPEC, \
|
||||
TARGET_SCHED_SET_SCHED_FLAGS}
|
||||
TARGET_SCHED_SET_SCHED_FLAGS, \
|
||||
TARGET_SCHED_SMS_RES_MII}
|
||||
|
||||
#define TARGET_VECTORIZE_BUILTIN_MASK_FOR_LOAD 0
|
||||
#define TARGET_VECTORIZE_BUILTIN_VECTORIZED_FUNCTION \
|
||||
|
@ -88,6 +88,9 @@ typedef struct secondary_reload_info
|
||||
/* This is defined in sched-int.h . */
|
||||
struct _dep;
|
||||
|
||||
/* This is defined in ddg.h . */
|
||||
struct ddg;
|
||||
|
||||
struct gcc_target
|
||||
{
|
||||
/* Functions that output assembler for the target. */
|
||||
@ -397,6 +400,12 @@ struct gcc_target
|
||||
information about the speculation capabilities of the target.
|
||||
The parameter is a pointer to spec_info variable. */
|
||||
void (* set_sched_flags) (struct spec_info_def *);
|
||||
|
||||
/* The following member value is a pointer to a function that provides
|
||||
information about the target resource-based lower bound which is
|
||||
used by the swing modulo scheduler. The parameter is a pointer
|
||||
to ddg variable. */
|
||||
int (* sms_res_mii) (struct ddg *);
|
||||
} sched;
|
||||
|
||||
/* Functions relating to vectorization. */
|
||||
|
Loading…
Reference in New Issue
Block a user