diff options
author | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-08-12 04:01:04 +0000 |
---|---|---|
committer | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-08-12 04:01:04 +0000 |
commit | 59ff7b6e271e2d9b3cd5df791e039d9c12d178e0 (patch) | |
tree | fc30e6d27de3e811bf01d5d624f1b7c9f3a541d8 /gcc/stor-layout.c | |
parent | d38cff3040db5b167aec03750793417522d85f6c (diff) | |
download | gcc-59ff7b6e271e2d9b3cd5df791e039d9c12d178e0.tar.gz |
* stor-layout.c (round_up, round_down): Move ...
* fold-const.c (round_up, round_down): ... here. Use
multiple_of_p to avoid any arithmetic at all.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@85848 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/stor-layout.c')
-rw-r--r-- | gcc/stor-layout.c | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index 3a0acd70725..661cb8b3173 100644 --- a/gcc/stor-layout.c +++ b/gcc/stor-layout.c @@ -269,64 +269,6 @@ get_mode_alignment (enum machine_mode mode) return MIN (BIGGEST_ALIGNMENT, MAX (1, mode_base_align[mode]*BITS_PER_UNIT)); } -/* Return the value of VALUE, rounded up to a multiple of DIVISOR. - This can only be applied to objects of a sizetype. */ - -tree -round_up (tree value, int divisor) -{ - tree t; - - if (divisor == 0) - abort (); - if (divisor == 1) - return value; - - /* If divisor is a power of two, simplify this to bit manipulation. */ - if (divisor == (divisor & -divisor)) - { - t = size_int_type (divisor - 1, TREE_TYPE (value)); - value = size_binop (PLUS_EXPR, value, t); - t = size_int_type (-divisor, TREE_TYPE (value)); - value = size_binop (BIT_AND_EXPR, value, t); - } - else - { - t = size_int_type (divisor, TREE_TYPE (value)); - value = size_binop (CEIL_DIV_EXPR, value, t); - value = size_binop (MULT_EXPR, value, t); - } - - return value; -} - -/* Likewise, but round down. */ - -tree -round_down (tree value, int divisor) -{ - tree t; - - if (divisor == 0) - abort (); - if (divisor == 1) - return value; - - /* If divisor is a power of two, simplify this to bit manipulation. */ - if (divisor == (divisor & -divisor)) - { - t = size_int_type (-divisor, TREE_TYPE (value)); - value = size_binop (BIT_AND_EXPR, value, t); - } - else - { - t = size_int_type (divisor, TREE_TYPE (value)); - value = size_binop (FLOOR_DIV_EXPR, value, t); - value = size_binop (MULT_EXPR, value, t); - } - - return value; -} /* Subroutine of layout_decl: Force alignment required for the data type. But if the decl itself wants greater alignment, don't override that. */ |