diff options
author | Lawrence Crowl <crowl@google.com> | 2012-09-07 00:06:35 +0000 |
---|---|---|
committer | Lawrence Crowl <crowl@gcc.gnu.org> | 2012-09-07 00:06:35 +0000 |
commit | 27bcd47cfab04b1b1e6d2712e34b9b289c7a2dd7 (patch) | |
tree | 82231821d6793cd33f15d6b9792a8b82f2ec15d1 /gcc/tree.c | |
parent | 316b938ed79ef024177ab82057a061a7a4b5af67 (diff) | |
download | gcc-27bcd47cfab04b1b1e6d2712e34b9b289c7a2dd7.zip gcc-27bcd47cfab04b1b1e6d2712e34b9b289c7a2dd7.tar.gz gcc-27bcd47cfab04b1b1e6d2712e34b9b289c7a2dd7.tar.bz2 |
Modify gcc/*.[hc] double_int call sites to use the new interface.
This change entailed adding a few new methods to double_int.
The change results in a 0.163% time improvement with a 70% confidence.
Tested on x86_64.
Index: gcc/ChangeLog
2012-09-06 Lawrence Crowl <crowl@google.com>
* double-int.h (double_int::operator &=): New.
(double_int::operator ^=): New.
(double_int::operator |=): New.
(double_int::mul_with_sign): Modify overflow parameter to bool*.
(double_int::add_with_sign): New.
(double_int::ule): New.
(double_int::sle): New.
(binary double_int::operator *): Remove parameter name.
(binary double_int::operator +): Likewise.
(binary double_int::operator -): Likewise.
(binary double_int::operator &): Likewise.
(double_int::operator |): Likewise.
(double_int::operator ^): Likewise.
(double_int::and_not): Likewise.
(double_int::from_shwi): Tidy formatting.
(double_int::from_uhwi): Likewise.
(double_int::from_uhwi): Likewise.
* double-int.c (double_int::mul_with_sign): Modify overflow parameter
to bool*.
(double_int::add_with_sign): New.
(double_int::ule): New.
(double_int::sle): New.
* builtins.c: Modify to use the new double_int interface.
* cgraph.c: Likewise.
* combine.c: Likewise.
* dwarf2out.c: Likewise.
* emit-rtl.c: Likewise.
* expmed.c: Likewise.
* expr.c: Likewise.
* fixed-value.c: Likewise.
* fold-const.c: Likewise.
* gimple-fold.c: Likewise.
* gimple-ssa-strength-reduction.c: Likewise.
* gimplify-rtx.c: Likewise.
* ipa-prop.c: Likewise.
* loop-iv.c: Likewise.
* optabs.c: Likewise.
* stor-layout.c: Likewise.
* tree-affine.c: Likewise.
* tree-cfg.c: Likewise.
* tree-dfa.c: Likewise.
* tree-flow-inline.h: Likewise.
* tree-object-size.c: Likewise.
* tree-predcom.c: Likewise.
* tree-pretty-print.c: Likewise.
* tree-sra.c: Likewise.
* tree-ssa-address.c: Likewise.
* tree-ssa-alias.c: Likewise.
* tree-ssa-ccp.c: Likewise.
* tree-ssa-forwprop.c: Likewise.
* tree-ssa-loop-ivopts.c: Likewise.
* tree-ssa-loop-niter.c: Likewise.
* tree-ssa-phiopt.c: Likewise.
* tree-ssa-pre.c: Likewise.
* tree-ssa-sccvn: Likewise.
* tree-ssa-structalias.c: Likewise.
* tree-ssa.c: Likewise.
* tree-switch-conversion.c: Likewise.
* tree-vect-loop-manip.c: Likewise.
* tree-vrp.c: Likewise.
* tree.h: Likewise.
* tree.c: Likewise.
* varasm.c: Likewise.
From-SVN: r191047
Diffstat (limited to 'gcc/tree.c')
-rw-r--r-- | gcc/tree.c | 48 |
1 files changed, 23 insertions, 25 deletions
@@ -1041,7 +1041,7 @@ build_int_cst (tree type, HOST_WIDE_INT low) if (!type) type = integer_type_node; - return double_int_to_tree (type, shwi_to_double_int (low)); + return double_int_to_tree (type, double_int::from_shwi (low)); } /* Create an INT_CST node with a LOW value sign extended to TYPE. */ @@ -1051,7 +1051,7 @@ build_int_cst_type (tree type, HOST_WIDE_INT low) { gcc_assert (type); - return double_int_to_tree (type, shwi_to_double_int (low)); + return double_int_to_tree (type, double_int::from_shwi (low)); } /* Constructs tree in type TYPE from with value given by CST. Signedness @@ -1062,7 +1062,7 @@ double_int_to_tree (tree type, double_int cst) { bool sign_extended_type = !TYPE_UNSIGNED (type); - cst = double_int_ext (cst, TYPE_PRECISION (type), !sign_extended_type); + cst = cst.ext (TYPE_PRECISION (type), !sign_extended_type); return build_int_cst_wide (type, cst.low, cst.high); } @@ -1077,9 +1077,9 @@ double_int_fits_to_tree_p (const_tree type, double_int cst) bool sign_extended_type = !TYPE_UNSIGNED (type); double_int ext - = double_int_ext (cst, TYPE_PRECISION (type), !sign_extended_type); + = cst.ext (TYPE_PRECISION (type), !sign_extended_type); - return double_int_equal_p (cst, ext); + return cst == ext; } /* We force the double_int CST to the range of the type TYPE by sign or @@ -1114,7 +1114,7 @@ force_fit_type_double (tree type, double_int cst, int overflowable, || (overflowable > 0 && sign_extended_type)) { tree t = make_node (INTEGER_CST); - TREE_INT_CST (t) = double_int_ext (cst, TYPE_PRECISION (type), + TREE_INT_CST (t) = cst.ext (TYPE_PRECISION (type), !sign_extended_type); TREE_TYPE (t) = type; TREE_OVERFLOW (t) = 1; @@ -1285,7 +1285,7 @@ build_low_bits_mask (tree type, unsigned bits) /* Sign extended all-ones mask. */ mask = double_int_minus_one; else - mask = double_int_mask (bits); + mask = double_int::mask (bits); return build_int_cst_wide (type, mask.low, mask.high); } @@ -1910,7 +1910,7 @@ int fixed_zerop (const_tree expr) { return (TREE_CODE (expr) == FIXED_CST - && double_int_zero_p (TREE_FIXED_CST (expr).data)); + && TREE_FIXED_CST (expr).data.is_zero ()); } /* Return the power of two represented by a tree node known to be a @@ -3998,8 +3998,7 @@ double_int mem_ref_offset (const_tree t) { tree toff = TREE_OPERAND (t, 1); - return double_int_sext (tree_to_double_int (toff), - TYPE_PRECISION (TREE_TYPE (toff))); + return tree_to_double_int (toff).sext (TYPE_PRECISION (TREE_TYPE (toff))); } /* Return the pointer-type relevant for TBAA purposes from the @@ -6557,7 +6556,7 @@ HOST_WIDE_INT size_low_cst (const_tree t) { double_int d = tree_to_double_int (t); - return double_int_sext (d, TYPE_PRECISION (TREE_TYPE (t))).low; + return d.sext (TYPE_PRECISION (TREE_TYPE (t))).low; } /* Return the most significant (sign) bit of T. */ @@ -8295,15 +8294,15 @@ retry: dd = tree_to_double_int (type_low_bound); if (unsc != TYPE_UNSIGNED (TREE_TYPE (type_low_bound))) { - int c_neg = (!unsc && double_int_negative_p (dc)); - int t_neg = (unsc && double_int_negative_p (dd)); + int c_neg = (!unsc && dc.is_negative ()); + int t_neg = (unsc && dd.is_negative ()); if (c_neg && !t_neg) return false; - if ((c_neg || !t_neg) && double_int_ucmp (dc, dd) < 0) + if ((c_neg || !t_neg) && dc.ult (dd)) return false; } - else if (double_int_cmp (dc, dd, unsc) < 0) + else if (dc.cmp (dd, unsc) < 0) return false; ok_for_low_bound = true; } @@ -8316,15 +8315,15 @@ retry: dd = tree_to_double_int (type_high_bound); if (unsc != TYPE_UNSIGNED (TREE_TYPE (type_high_bound))) { - int c_neg = (!unsc && double_int_negative_p (dc)); - int t_neg = (unsc && double_int_negative_p (dd)); + int c_neg = (!unsc && dc.is_negative ()); + int t_neg = (unsc && dd.is_negative ()); if (t_neg && !c_neg) return false; - if ((t_neg || !c_neg) && double_int_ucmp (dc, dd) > 0) + if ((t_neg || !c_neg) && dc.ugt (dd)) return false; } - else if (double_int_cmp (dc, dd, unsc) > 0) + else if (dc.cmp (dd, unsc) > 0) return false; ok_for_high_bound = true; } @@ -8338,7 +8337,7 @@ retry: /* Perform some generic filtering which may allow making a decision even if the bounds are not constant. First, negative integers never fit in unsigned types, */ - if (TYPE_UNSIGNED (type) && !unsc && double_int_negative_p (dc)) + if (TYPE_UNSIGNED (type) && !unsc && dc.is_negative ()) return false; /* Second, narrower types always fit in wider ones. */ @@ -8393,9 +8392,8 @@ get_type_static_bounds (const_tree type, mpz_t min, mpz_t max) else { double_int mn; - mn = double_int_mask (TYPE_PRECISION (type) - 1); - mn = double_int_sext (double_int_add (mn, double_int_one), - TYPE_PRECISION (type)); + mn = double_int::mask (TYPE_PRECISION (type) - 1); + mn = (mn + double_int_one).sext (TYPE_PRECISION (type)); mpz_set_double_int (min, mn, false); } } @@ -8407,10 +8405,10 @@ get_type_static_bounds (const_tree type, mpz_t min, mpz_t max) else { if (TYPE_UNSIGNED (type)) - mpz_set_double_int (max, double_int_mask (TYPE_PRECISION (type)), + mpz_set_double_int (max, double_int::mask (TYPE_PRECISION (type)), true); else - mpz_set_double_int (max, double_int_mask (TYPE_PRECISION (type) - 1), + mpz_set_double_int (max, double_int::mask (TYPE_PRECISION (type) - 1), true); } } |