summaryrefslogtreecommitdiff
path: root/gcc/expr.c
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2004-12-09 10:54:50 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2004-12-09 10:54:50 +0000
commit08f2586c92554b92c43ae5becc531807c927f75b (patch)
tree0ebc77b705976f6aa26d0801d2f77bd111850b5f /gcc/expr.c
parent61fcaeec1e95fdaf23a7c41222f895dafe84af7f (diff)
downloadgcc-08f2586c92554b92c43ae5becc531807c927f75b.tar.gz
tree.def (SET_TYPE): Remove.
* tree.def (SET_TYPE): Remove. (CONSTRUCTOR): Update description. * builtins.c (type_to_class) Remove SET_TYPE case. * dbxout.c (dbxout_type): Likewise. * dwarf2out.c (is_base_type): Likewise. (gen_set_type_die): Remove. (gen_type_die): Remove SET_TYPE case. * expr.c (count_type_elements): Likewise. (mostly_zeroes_p): Likewise. (store_constructor): Likewise. * print_tree.c (print_node): Likewise. * stor-layout.c (layout_type): Likewise. * tree-browser.c (browse_tree): Likewise. * tree-inline.c (remap_type): Likewise. * tree-pretty-print.c (dump_generic_node): Likewise. * tree.c (type_contains_plaeholder_1, type_hash_eq, variably_modified_type_p, initializer_zerop): Likewise. * tree.h (SET_OR_ARRAY_CHECK): Remove. (AGGREGATE_TYPE_P): Remove SET_TYPE check. (TYPE_DOMAIN): Use ARRAY_TYPE_CHECK. * typeclass.h (enum type_class): Remove set_type_class. * varasm.c (const_hash_1): Remove SET_TYPE case. (compare_constant, copy_constant, output_constant): Likewise. * config/i386/i386.c (classify_argument): Likewise. * config/ia64/ia64.c (hfa_element_mode): Likewise. * config/sparc/sparc.c (sparc_type_code): Likewise. * ada/decl.c (gnat_substitute_in_type): Remove SET_TYPE case. From-SVN: r91931
Diffstat (limited to 'gcc/expr.c')
-rw-r--r--gcc/expr.c184
1 files changed, 1 insertions, 183 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index d594671658e..1f4d140332f 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -4371,7 +4371,6 @@ count_type_elements (tree type)
case VOID_TYPE:
case METHOD_TYPE:
case FILE_TYPE:
- case SET_TYPE:
case FUNCTION_TYPE:
case LANG_TYPE:
default:
@@ -4389,10 +4388,6 @@ mostly_zeros_p (tree exp)
{
HOST_WIDE_INT nz_elts, nc_elts, elts;
- /* If there are no ranges of true bits, it is all zero. */
- if (TREE_TYPE (exp) && TREE_CODE (TREE_TYPE (exp)) == SET_TYPE)
- return CONSTRUCTOR_ELTS (exp) == NULL_TREE;
-
categorize_ctor_elements (exp, &nz_elts, &nc_elts);
elts = count_type_elements (TREE_TYPE (exp));
@@ -5011,184 +5006,7 @@ store_constructor (tree exp, rtx target, int cleared, HOST_WIDE_INT size)
gen_rtvec_v (n_elts, vector))));
break;
}
-
- /* Set constructor assignments. */
- case SET_TYPE:
- {
- tree elt = CONSTRUCTOR_ELTS (exp);
- unsigned HOST_WIDE_INT nbytes = int_size_in_bytes (type), nbits;
- tree domain = TYPE_DOMAIN (type);
- tree domain_min, domain_max, bitlength;
-
- /* The default implementation strategy is to extract the
- constant parts of the constructor, use that to initialize
- the target, and then "or" in whatever non-constant ranges
- we need in addition.
-
- If a large set is all zero or all ones, it is probably
- better to set it using memset. Also, if a large set has
- just a single range, it may also be better to first clear
- all the first clear the set (using memset), and set the
- bits we want. */
-
- /* Check for all zeros. */
- if (elt == NULL_TREE && size > 0)
- {
- if (!cleared)
- clear_storage (target, GEN_INT (size));
- return;
- }
-
- domain_min = convert (sizetype, TYPE_MIN_VALUE (domain));
- domain_max = convert (sizetype, TYPE_MAX_VALUE (domain));
- bitlength = size_binop (PLUS_EXPR,
- size_diffop (domain_max, domain_min),
- ssize_int (1));
-
- nbits = tree_low_cst (bitlength, 1);
-
- /* For "small" sets, or "medium-sized" (up to 32 bytes) sets
- that are "complicated" (more than one range), initialize
- (the constant parts) by copying from a constant. */
- if (GET_MODE (target) != BLKmode || nbits <= 2 * BITS_PER_WORD
- || (nbytes <= 32 && TREE_CHAIN (elt) != NULL_TREE))
- {
- unsigned int set_word_size = TYPE_ALIGN (TREE_TYPE (exp));
- enum machine_mode mode = mode_for_size (set_word_size, MODE_INT, 1);
- char *bit_buffer = alloca (nbits);
- HOST_WIDE_INT word = 0;
- unsigned int bit_pos = 0;
- unsigned int ibit = 0;
- unsigned int offset = 0; /* In bytes from beginning of set. */
-
- elt = get_set_constructor_bits (exp, bit_buffer, nbits);
- for (;;)
- {
- if (bit_buffer[ibit])
- {
- if (BYTES_BIG_ENDIAN)
- word |= (1 << (set_word_size - 1 - bit_pos));
- else
- word |= 1 << bit_pos;
- }
-
- bit_pos++; ibit++;
- if (bit_pos >= set_word_size || ibit == nbits)
- {
- if (word != 0 || ! cleared)
- {
- rtx datum = gen_int_mode (word, mode);
- rtx to_rtx;
-
- /* The assumption here is that it is safe to
- use XEXP if the set is multi-word, but not
- if it's single-word. */
- if (MEM_P (target))
- to_rtx = adjust_address (target, mode, offset);
- else
- {
- gcc_assert (!offset);
- to_rtx = target;
- }
- emit_move_insn (to_rtx, datum);
- }
-
- if (ibit == nbits)
- break;
- word = 0;
- bit_pos = 0;
- offset += set_word_size / BITS_PER_UNIT;
- }
- }
- }
- else if (!cleared)
- /* Don't bother clearing storage if the set is all ones. */
- if (TREE_CHAIN (elt) != NULL_TREE
- || (TREE_PURPOSE (elt) == NULL_TREE
- ? nbits != 1
- : ( ! host_integerp (TREE_VALUE (elt), 0)
- || ! host_integerp (TREE_PURPOSE (elt), 0)
- || (tree_low_cst (TREE_VALUE (elt), 0)
- - tree_low_cst (TREE_PURPOSE (elt), 0) + 1
- != (HOST_WIDE_INT) nbits))))
- clear_storage (target, expr_size (exp));
-
- for (; elt != NULL_TREE; elt = TREE_CHAIN (elt))
- {
- /* Start of range of element or NULL. */
- tree startbit = TREE_PURPOSE (elt);
- /* End of range of element, or element value. */
- tree endbit = TREE_VALUE (elt);
- HOST_WIDE_INT startb, endb;
- rtx bitlength_rtx, startbit_rtx, endbit_rtx, targetx;
-
- bitlength_rtx = expand_expr (bitlength,
- NULL_RTX, MEM, EXPAND_CONST_ADDRESS);
-
- /* Handle non-range tuple element like [ expr ]. */
- if (startbit == NULL_TREE)
- {
- startbit = save_expr (endbit);
- endbit = startbit;
- }
-
- startbit = convert (sizetype, startbit);
- endbit = convert (sizetype, endbit);
- if (! integer_zerop (domain_min))
- {
- startbit = size_binop (MINUS_EXPR, startbit, domain_min);
- endbit = size_binop (MINUS_EXPR, endbit, domain_min);
- }
- startbit_rtx = expand_expr (startbit, NULL_RTX, MEM,
- EXPAND_CONST_ADDRESS);
- endbit_rtx = expand_expr (endbit, NULL_RTX, MEM,
- EXPAND_CONST_ADDRESS);
-
- if (REG_P (target))
- {
- targetx
- = assign_temp
- ((build_qualified_type (lang_hooks.types.type_for_mode
- (GET_MODE (target), 0),
- TYPE_QUAL_CONST)),
- 0, 1, 1);
- emit_move_insn (targetx, target);
- }
-
- else
- {
- gcc_assert (MEM_P (target));
- targetx = target;
- }
-
- /* Optimization: If startbit and endbit are constants divisible
- by BITS_PER_UNIT, call memset instead. */
- if (TREE_CODE (startbit) == INTEGER_CST
- && TREE_CODE (endbit) == INTEGER_CST
- && (startb = TREE_INT_CST_LOW (startbit)) % BITS_PER_UNIT == 0
- && (endb = TREE_INT_CST_LOW (endbit) + 1) % BITS_PER_UNIT == 0)
- {
- emit_library_call (memset_libfunc, LCT_NORMAL,
- VOIDmode, 3,
- plus_constant (XEXP (targetx, 0),
- startb / BITS_PER_UNIT),
- Pmode,
- constm1_rtx, TYPE_MODE (integer_type_node),
- GEN_INT ((endb - startb) / BITS_PER_UNIT),
- TYPE_MODE (sizetype));
- }
- else
- emit_library_call (setbits_libfunc, LCT_NORMAL,
- VOIDmode, 4, XEXP (targetx, 0),
- Pmode, bitlength_rtx, TYPE_MODE (sizetype),
- startbit_rtx, TYPE_MODE (sizetype),
- endbit_rtx, TYPE_MODE (sizetype));
-
- if (REG_P (target))
- emit_move_insn (target, targetx);
- }
- break;
- }
+
default:
gcc_unreachable ();
}