The type_for_size langhook should go (it does not handle non-mode
precision well, at least it handles it unexpectedly to most callers).
Instead callers that want to call a langhook should use type_for_mode.
The following patch makes some direct uses of the langhook from the
middle-end use something more suitable, for example [un]signed_type_for
for getting an integer type for a pointer type.
Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.
Jakub, are the OMP bits ok?
Thanks,
Richard.
2012-03-07 Richard Guenther rguent...@suse.de
* omp-low.c (extract_omp_for_data): Use signed_type_for.
(expand_omp_for_generic): Likewise.
(expand_omp_for_static_nochunk): Likewise.
(expand_omp_for_static_chunk): Likewise.
* tree-vect-stmts.c (vect_gen_perm_mask): Use type_for_mode.
* tree-vect-slp.c (vect_transform_slp_perm_load): Likewise.
* tree-vect-loop-manip.c (vect_gen_niters_for_prolog_loop):
Use unsigned_type_for.
(vect_create_cond_for_align_checks): Use signed_type_for.
Index: gcc/omp-low.c
===
*** gcc/omp-low.c (revision 185029)
--- gcc/omp-low.c (working copy)
*** extract_omp_for_data (gimple for_stmt, s
*** 407,414
tree itype = TREE_TYPE (loop-v);
if (POINTER_TYPE_P (itype))
! itype
! = lang_hooks.types.type_for_size (TYPE_PRECISION (itype), 0);
t = build_int_cst (itype, (loop-cond_code == LT_EXPR ? -1 : 1));
t = fold_build2_loc (loc,
PLUS_EXPR, itype,
--- 407,413
tree itype = TREE_TYPE (loop-v);
if (POINTER_TYPE_P (itype))
! itype = signed_type_for (itype);
t = build_int_cst (itype, (loop-cond_code == LT_EXPR ? -1 : 1));
t = fold_build2_loc (loc,
PLUS_EXPR, itype,
*** expand_omp_for_generic (struct omp_regio
*** 3772,3778
tree itype = TREE_TYPE (fd-loops[i].v);
if (POINTER_TYPE_P (itype))
! itype = lang_hooks.types.type_for_size (TYPE_PRECISION (itype), 0);
t = build_int_cst (itype, (fd-loops[i].cond_code == LT_EXPR
? -1 : 1));
t = fold_build2 (PLUS_EXPR, itype,
--- 3771,3777
tree itype = TREE_TYPE (fd-loops[i].v);
if (POINTER_TYPE_P (itype))
! itype = signed_type_for (itype);
t = build_int_cst (itype, (fd-loops[i].cond_code == LT_EXPR
? -1 : 1));
t = fold_build2 (PLUS_EXPR, itype,
*** expand_omp_for_generic (struct omp_regio
*** 3836,3843
TYPE_PRECISION (type) != TYPE_PRECISION (fd-iter_type))
{
/* Avoid casting pointers to integer of a different size. */
! tree itype
! = lang_hooks.types.type_for_size (TYPE_PRECISION (type), 0);
t1 = fold_convert (fd-iter_type, fold_convert (itype, fd-loop.n2));
t0 = fold_convert (fd-iter_type, fold_convert (itype, fd-loop.n1));
}
--- 3835,3841
TYPE_PRECISION (type) != TYPE_PRECISION (fd-iter_type))
{
/* Avoid casting pointers to integer of a different size. */
! tree itype = signed_type_for (type);
t1 = fold_convert (fd-iter_type, fold_convert (itype, fd-loop.n2));
t0 = fold_convert (fd-iter_type, fold_convert (itype, fd-loop.n1));
}
*** expand_omp_for_generic (struct omp_regio
*** 3904,3911
if (bias)
t = fold_build2 (MINUS_EXPR, fd-iter_type, t, bias);
if (POINTER_TYPE_P (type))
! t = fold_convert (lang_hooks.types.type_for_size (TYPE_PRECISION (type),
! 0), t);
t = fold_convert (type, t);
t = force_gimple_operand_gsi (gsi, t, false, NULL_TREE,
false, GSI_CONTINUE_LINKING);
--- 3902,3908
if (bias)
t = fold_build2 (MINUS_EXPR, fd-iter_type, t, bias);
if (POINTER_TYPE_P (type))
! t = fold_convert (signed_type_for (type), t);
t = fold_convert (type, t);
t = force_gimple_operand_gsi (gsi, t, false, NULL_TREE,
false, GSI_CONTINUE_LINKING);
*** expand_omp_for_generic (struct omp_regio
*** 3916,3923
if (bias)
t = fold_build2 (MINUS_EXPR, fd-iter_type, t, bias);
if (POINTER_TYPE_P (type))
! t = fold_convert (lang_hooks.types.type_for_size (TYPE_PRECISION (type),
! 0), t);
t = fold_convert (type, t);
iend = force_gimple_operand_gsi (gsi, t, true, NULL_TREE,
false, GSI_CONTINUE_LINKING);
--- 3913,3919
if (bias)
t = fold_build2 (MINUS_EXPR, fd-iter_type, t, bias);
if (POINTER_TYPE_P