aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-dfa.c
diff options
context:
space:
mode:
authorLawrence Crowl <crowl@google.com>2012-09-07 00:06:35 +0000
committerLawrence Crowl <crowl@gcc.gnu.org>2012-09-07 00:06:35 +0000
commit27bcd47cfab04b1b1e6d2712e34b9b289c7a2dd7 (patch)
tree82231821d6793cd33f15d6b9792a8b82f2ec15d1 /gcc/tree-dfa.c
parent316b938ed79ef024177ab82057a061a7a4b5af67 (diff)
downloadgcc-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-dfa.c')
-rw-r--r--gcc/tree-dfa.c76
1 files changed, 32 insertions, 44 deletions
diff --git a/gcc/tree-dfa.c b/gcc/tree-dfa.c
index 5342f19..f8f10a4 100644
--- a/gcc/tree-dfa.c
+++ b/gcc/tree-dfa.c
@@ -423,9 +423,7 @@ get_ref_base_and_extent (tree exp, HOST_WIDE_INT *poffset,
switch (TREE_CODE (exp))
{
case BIT_FIELD_REF:
- bit_offset
- = double_int_add (bit_offset,
- tree_to_double_int (TREE_OPERAND (exp, 2)));
+ bit_offset += tree_to_double_int (TREE_OPERAND (exp, 2));
break;
case COMPONENT_REF:
@@ -436,14 +434,11 @@ get_ref_base_and_extent (tree exp, HOST_WIDE_INT *poffset,
if (this_offset && TREE_CODE (this_offset) == INTEGER_CST)
{
double_int doffset = tree_to_double_int (this_offset);
- doffset = double_int_lshift (doffset,
- BITS_PER_UNIT == 8
- ? 3 : exact_log2 (BITS_PER_UNIT),
- HOST_BITS_PER_DOUBLE_INT, true);
- doffset = double_int_add (doffset,
- tree_to_double_int
- (DECL_FIELD_BIT_OFFSET (field)));
- bit_offset = double_int_add (bit_offset, doffset);
+ doffset = doffset.alshift (BITS_PER_UNIT == 8
+ ? 3 : exact_log2 (BITS_PER_UNIT),
+ HOST_BITS_PER_DOUBLE_INT);
+ doffset += tree_to_double_int (DECL_FIELD_BIT_OFFSET (field));
+ bit_offset = bit_offset + doffset;
/* If we had seen a variable array ref already and we just
referenced the last field of a struct or a union member
@@ -462,11 +457,11 @@ get_ref_base_and_extent (tree exp, HOST_WIDE_INT *poffset,
tree ssize = TYPE_SIZE_UNIT (stype);
if (host_integerp (fsize, 0)
&& host_integerp (ssize, 0)
- && double_int_fits_in_shwi_p (doffset))
+ && doffset.fits_shwi ())
maxsize += ((TREE_INT_CST_LOW (ssize)
- TREE_INT_CST_LOW (fsize))
* BITS_PER_UNIT
- - double_int_to_shwi (doffset));
+ - doffset.to_shwi ());
else
maxsize = -1;
}
@@ -481,9 +476,9 @@ get_ref_base_and_extent (tree exp, HOST_WIDE_INT *poffset,
if (maxsize != -1
&& csize
&& host_integerp (csize, 1)
- && double_int_fits_in_shwi_p (bit_offset))
+ && bit_offset.fits_shwi ())
maxsize = TREE_INT_CST_LOW (csize)
- - double_int_to_shwi (bit_offset);
+ - bit_offset.to_shwi ();
else
maxsize = -1;
}
@@ -504,17 +499,13 @@ get_ref_base_and_extent (tree exp, HOST_WIDE_INT *poffset,
TREE_CODE (unit_size) == INTEGER_CST))
{
double_int doffset
- = double_int_sext
- (double_int_sub (TREE_INT_CST (index),
- TREE_INT_CST (low_bound)),
- TYPE_PRECISION (TREE_TYPE (index)));
- doffset = double_int_mul (doffset,
- tree_to_double_int (unit_size));
- doffset = double_int_lshift (doffset,
- BITS_PER_UNIT == 8
- ? 3 : exact_log2 (BITS_PER_UNIT),
- HOST_BITS_PER_DOUBLE_INT, true);
- bit_offset = double_int_add (bit_offset, doffset);
+ = (TREE_INT_CST (index) - TREE_INT_CST (low_bound))
+ .sext (TYPE_PRECISION (TREE_TYPE (index)));
+ doffset *= tree_to_double_int (unit_size);
+ doffset = doffset.alshift (BITS_PER_UNIT == 8
+ ? 3 : exact_log2 (BITS_PER_UNIT),
+ HOST_BITS_PER_DOUBLE_INT);
+ bit_offset = bit_offset + doffset;
/* An array ref with a constant index up in the structure
hierarchy will constrain the size of any variable array ref
@@ -530,9 +521,9 @@ get_ref_base_and_extent (tree exp, HOST_WIDE_INT *poffset,
if (maxsize != -1
&& asize
&& host_integerp (asize, 1)
- && double_int_fits_in_shwi_p (bit_offset))
+ && bit_offset.fits_shwi ())
maxsize = TREE_INT_CST_LOW (asize)
- - double_int_to_shwi (bit_offset);
+ - bit_offset.to_shwi ();
else
maxsize = -1;
@@ -547,8 +538,7 @@ get_ref_base_and_extent (tree exp, HOST_WIDE_INT *poffset,
break;
case IMAGPART_EXPR:
- bit_offset
- = double_int_add (bit_offset, uhwi_to_double_int (bitsize));
+ bit_offset += double_int::from_uhwi (bitsize);
break;
case VIEW_CONVERT_EXPR:
@@ -563,12 +553,11 @@ get_ref_base_and_extent (tree exp, HOST_WIDE_INT *poffset,
else
{
double_int off = mem_ref_offset (exp);
- off = double_int_lshift (off,
- BITS_PER_UNIT == 8
- ? 3 : exact_log2 (BITS_PER_UNIT),
- HOST_BITS_PER_DOUBLE_INT, true);
- off = double_int_add (off, bit_offset);
- if (double_int_fits_in_shwi_p (off))
+ off = off.alshift (BITS_PER_UNIT == 8
+ ? 3 : exact_log2 (BITS_PER_UNIT),
+ HOST_BITS_PER_DOUBLE_INT);
+ off = off + bit_offset;
+ if (off.fits_shwi ())
{
bit_offset = off;
exp = TREE_OPERAND (TREE_OPERAND (exp, 0), 0);
@@ -595,12 +584,11 @@ get_ref_base_and_extent (tree exp, HOST_WIDE_INT *poffset,
else
{
double_int off = mem_ref_offset (exp);
- off = double_int_lshift (off,
- BITS_PER_UNIT == 8
- ? 3 : exact_log2 (BITS_PER_UNIT),
- HOST_BITS_PER_DOUBLE_INT, true);
- off = double_int_add (off, bit_offset);
- if (double_int_fits_in_shwi_p (off))
+ off = off.alshift (BITS_PER_UNIT == 8
+ ? 3 : exact_log2 (BITS_PER_UNIT),
+ HOST_BITS_PER_DOUBLE_INT);
+ off += bit_offset;
+ if (off.fits_shwi ())
{
bit_offset = off;
exp = TREE_OPERAND (TMR_BASE (exp), 0);
@@ -617,7 +605,7 @@ get_ref_base_and_extent (tree exp, HOST_WIDE_INT *poffset,
}
done:
- if (!double_int_fits_in_shwi_p (bit_offset))
+ if (!bit_offset.fits_shwi ())
{
*poffset = 0;
*psize = bitsize;
@@ -626,7 +614,7 @@ get_ref_base_and_extent (tree exp, HOST_WIDE_INT *poffset,
return exp;
}
- hbit_offset = double_int_to_shwi (bit_offset);
+ hbit_offset = bit_offset.to_shwi ();
/* We need to deal with variable arrays ending structures such as
struct { int length; int a[1]; } x; x.a[d]