diff options
author | rsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-11-19 07:42:09 +0000 |
---|---|---|
committer | rsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-11-19 07:42:09 +0000 |
commit | f9ae6f95055fe8521d46b1f2d87f7062d9977104 (patch) | |
tree | ae798e9ef20864aa44736ca475453536bd92e00f | |
parent | dd76621fd65db1958572949115035a8c3646d846 (diff) | |
download | gcc-f9ae6f95055fe8521d46b1f2d87f7062d9977104.tar.gz |
Remove tree_to_hwi.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/wide-int@205007 138bc75d-0d04-0410-961f-82ee72b054a4
79 files changed, 249 insertions, 254 deletions
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index ea580e72cbb..fd81ef070b8 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -4538,7 +4538,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) NULL_TREE)) { unsigned int size - = tree_to_hwi (TYPE_SIZE (gnu_return_type)); + = TREE_INT_CST_LOW (TYPE_SIZE (gnu_return_type)); unsigned int i = BITS_PER_UNIT; enum machine_mode mode; diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index 1f837faf83e..f699fd85d18 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/gcc/ada/gcc-interface/trans.c @@ -4247,7 +4247,7 @@ Call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target, gnu_actual = unchecked_convert (DECL_ARG_TYPE (gnu_formal), convert (gnat_type_for_size - (tree_to_hwi (gnu_size), 1), + (TREE_INT_CST_LOW (gnu_size), 1), integer_zero_node), false); else diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c index 0a65f369464..eef41275b5d 100644 --- a/gcc/ada/gcc-interface/utils.c +++ b/gcc/ada/gcc-interface/utils.c @@ -2570,7 +2570,7 @@ scale_by_factor_of (tree expr, unsigned int value) if (TREE_CODE (expr) == BIT_AND_EXPR && TREE_CODE (TREE_OPERAND (expr, 1)) == INTEGER_CST) { - unsigned HOST_WIDE_INT mask = tree_to_hwi (TREE_OPERAND (expr, 1)); + unsigned HOST_WIDE_INT mask = TREE_INT_CST_LOW (TREE_OPERAND (expr, 1)); unsigned int i = 0; while ((mask & 1) == 0 && i < HOST_BITS_PER_WIDE_INT) @@ -3869,7 +3869,7 @@ convert_vms_descriptor64 (tree gnu_type, tree gnu_expr, Entity_Id gnat_subprog) tree max_field = DECL_CHAIN (TYPE_FIELDS (template_type)); tree template_tree, template_addr, aflags, dimct, t, u; /* See the head comment of build_vms_descriptor. */ - int iklass = tree_to_hwi (DECL_INITIAL (klass)); + int iklass = TREE_INT_CST_LOW (DECL_INITIAL (klass)); tree lfield, ufield; vec<constructor_elt, va_gc> *v; @@ -4023,7 +4023,7 @@ convert_vms_descriptor32 (tree gnu_type, tree gnu_expr, Entity_Id gnat_subprog) tree max_field = DECL_CHAIN (TYPE_FIELDS (template_type)); tree template_tree, template_addr, aflags, dimct, t, u; /* See the head comment of build_vms_descriptor. */ - int iklass = tree_to_hwi (DECL_INITIAL (klass)); + int iklass = TREE_INT_CST_LOW (DECL_INITIAL (klass)); vec<constructor_elt, va_gc> *v; /* Convert POINTER to the pointer-to-array type. */ @@ -5307,7 +5307,7 @@ unchecked_convert (tree type, tree expr, bool notrunc_p) GET_MODE_BITSIZE (TYPE_MODE (type)))) { tree rec_type = make_node (RECORD_TYPE); - unsigned HOST_WIDE_INT prec = tree_to_hwi (TYPE_RM_SIZE (type)); + unsigned HOST_WIDE_INT prec = TREE_INT_CST_LOW (TYPE_RM_SIZE (type)); tree field_type, field; if (TYPE_UNSIGNED (type)) @@ -5336,7 +5336,7 @@ unchecked_convert (tree type, tree expr, bool notrunc_p) GET_MODE_BITSIZE (TYPE_MODE (etype)))) { tree rec_type = make_node (RECORD_TYPE); - unsigned HOST_WIDE_INT prec = tree_to_hwi (TYPE_RM_SIZE (etype)); + unsigned HOST_WIDE_INT prec = TREE_INT_CST_LOW (TYPE_RM_SIZE (etype)); vec<constructor_elt, va_gc> *v; vec_alloc (v, 1); tree field_type, field; @@ -6064,7 +6064,7 @@ get_nonnull_operand (tree arg_num_expr, unsigned HOST_WIDE_INT *valp) if (!cst_fits_uhwi_p (arg_num_expr)) return false; - *valp = tree_to_hwi (arg_num_expr); + *valp = TREE_INT_CST_LOW (arg_num_expr); return true; } diff --git a/gcc/ada/gcc-interface/utils2.c b/gcc/ada/gcc-interface/utils2.c index 0e97c178113..c45f1c3fc63 100644 --- a/gcc/ada/gcc-interface/utils2.c +++ b/gcc/ada/gcc-interface/utils2.c @@ -119,7 +119,7 @@ known_alignment (tree exp) case INTEGER_CST: { - unsigned HOST_WIDE_INT c = tree_to_hwi (exp); + unsigned HOST_WIDE_INT c = TREE_INT_CST_LOW (exp); /* The first part of this represents the lowest bit in the constant, but it is originally in bytes, not bits. */ this_alignment = MIN (BITS_PER_UNIT * (c & -c), BIGGEST_ALIGNMENT); diff --git a/gcc/builtins.c b/gcc/builtins.c index 07189fa8628..28d975586d8 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -366,8 +366,8 @@ get_object_alignment_2 (tree exp, unsigned int *alignp, if (TREE_CODE (addr) == BIT_AND_EXPR && TREE_CODE (TREE_OPERAND (addr, 1)) == INTEGER_CST) { - align = (tree_to_hwi (TREE_OPERAND (addr, 1)) - & -tree_to_hwi (TREE_OPERAND (addr, 1))); + align = (TREE_INT_CST_LOW (TREE_OPERAND (addr, 1)) + & -TREE_INT_CST_LOW (TREE_OPERAND (addr, 1))); align *= BITS_PER_UNIT; addr = TREE_OPERAND (addr, 0); } @@ -384,7 +384,7 @@ get_object_alignment_2 (tree exp, unsigned int *alignp, { unsigned HOST_WIDE_INT step = 1; if (TMR_STEP (exp)) - step = tree_to_hwi (TMR_STEP (exp)); + step = TREE_INT_CST_LOW (TMR_STEP (exp)); align = MIN (align, (step & -step) * BITS_PER_UNIT); } if (TMR_INDEX2 (exp)) @@ -508,7 +508,7 @@ get_pointer_alignment_1 (tree exp, unsigned int *alignp, else if (TREE_CODE (exp) == INTEGER_CST) { *alignp = BIGGEST_ALIGNMENT; - *bitposp = ((tree_to_hwi (exp) * BITS_PER_UNIT) + *bitposp = ((TREE_INT_CST_LOW (exp) * BITS_PER_UNIT) & (BIGGEST_ALIGNMENT - 1)); return true; } @@ -716,7 +716,7 @@ target_char_cast (tree cst, char *p) return 1; /* Do not care if it fits or not right here. */ - val = tree_to_hwi (cst); + val = TREE_INT_CST_LOW (cst); if (CHAR_TYPE_SIZE < HOST_BITS_PER_WIDE_INT) val &= (((unsigned HOST_WIDE_INT) 1) << CHAR_TYPE_SIZE) - 1; @@ -4462,7 +4462,7 @@ expand_builtin_alloca (tree exp, bool cannot_accumulate) /* Compute the alignment. */ align = (alloca_with_align - ? tree_to_hwi (CALL_EXPR_ARG (exp, 1)) + ? TREE_INT_CST_LOW (CALL_EXPR_ARG (exp, 1)) : BIGGEST_ALIGNMENT); /* Allocate the desired space. */ @@ -8610,7 +8610,7 @@ fold_builtin_memset (location_t loc, tree dest, tree c, tree len, if (CHAR_BIT != 8 || BITS_PER_UNIT != 8 || HOST_BITS_PER_WIDE_INT > 64) return NULL_TREE; - cval = tree_to_hwi (c); + cval = TREE_INT_CST_LOW (c); cval &= 0xff; cval |= cval << 8; cval |= cval << 16; diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index b8db750b60a..1a39a9d771c 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -861,7 +861,7 @@ finish_fname_decls (void) for (saved = TREE_PURPOSE (stack); saved; saved = TREE_CHAIN (saved)) { tree decl = TREE_PURPOSE (saved); - unsigned ix = tree_to_hwi (TREE_VALUE (saved)); + unsigned ix = TREE_INT_CST_LOW (TREE_VALUE (saved)); *fname_vars[ix].decl = decl; } @@ -4780,7 +4780,7 @@ c_type_hash (const void *p) if (TREE_CODE (TYPE_SIZE (t)) != INTEGER_CST) size = 0; else - size = tree_to_hwi (TYPE_SIZE (t)); + size = TREE_INT_CST_LOW (TYPE_SIZE (t)); return ((size << 24) | (n_elements << shift)); } @@ -8676,7 +8676,7 @@ check_function_sentinel (const_tree fntype, int nargs, tree *argarray) if (TREE_VALUE (attr)) { tree p = TREE_VALUE (TREE_VALUE (attr)); - pos = tree_to_hwi (p); + pos = TREE_INT_CST_LOW (p); } /* The sentinel must be one of the varargs, i.e. @@ -8752,7 +8752,7 @@ get_nonnull_operand (tree arg_num_expr, unsigned HOST_WIDE_INT *valp) /* Verify the arg number is a small constant. */ if (cst_fits_uhwi_p (arg_num_expr)) { - *valp = tree_to_hwi (arg_num_expr); + *valp = TREE_INT_CST_LOW (arg_num_expr); return true; } else @@ -8954,7 +8954,7 @@ parse_optimize_options (tree args, bool attr_p) if (TREE_CODE (value) == INTEGER_CST) { char buffer[20]; - sprintf (buffer, "-O%ld", (long) tree_to_hwi (value)); + sprintf (buffer, "-O%ld", (long) TREE_INT_CST_LOW (value)); vec_safe_push (optimize_args, ggc_strdup (buffer)); } @@ -9450,7 +9450,7 @@ c_parse_error (const char *gmsgid, enum cpp_ttype token_type, || token_type == CPP_CHAR16 || token_type == CPP_CHAR32) { - unsigned int val = tree_to_hwi (value); + unsigned int val = TREE_INT_CST_LOW (value); const char *prefix; switch (token_type) diff --git a/gcc/c-family/c-format.c b/gcc/c-family/c-format.c index 491ef71e42d..ed2cf89eaf2 100644 --- a/gcc/c-family/c-format.c +++ b/gcc/c-family/c-format.c @@ -232,7 +232,7 @@ get_constant (tree expr, unsigned HOST_WIDE_INT *value, int validated_p) return false; } - *value = tree_to_hwi (expr); + *value = TREE_INT_CST_LOW (expr); return true; } diff --git a/gcc/c-family/c-pragma.c b/gcc/c-family/c-pragma.c index 6e6ad5844e1..029ab1e33ac 100644 --- a/gcc/c-family/c-pragma.c +++ b/gcc/c-family/c-pragma.c @@ -151,7 +151,7 @@ handle_pragma_pack (cpp_reader * ARG_UNUSED (dummy)) { if (TREE_CODE (x) != INTEGER_CST) GCC_BAD ("invalid constant in %<#pragma pack%> - ignored"); - align = tree_to_hwi (x); + align = TREE_INT_CST_LOW (x); action = set; if (pragma_lex (&x) != CPP_CLOSE_PAREN) GCC_BAD ("malformed %<#pragma pack%> - ignored"); @@ -183,7 +183,7 @@ handle_pragma_pack (cpp_reader * ARG_UNUSED (dummy)) { if (TREE_CODE (x) != INTEGER_CST) GCC_BAD ("invalid constant in %<#pragma pack%> - ignored"); - align = tree_to_hwi (x); + align = TREE_INT_CST_LOW (x); if (align == -1) action = set; } diff --git a/gcc/c-family/c-pretty-print.c b/gcc/c-family/c-pretty-print.c index 70381a0efae..1fe8c51e2f9 100644 --- a/gcc/c-family/c-pretty-print.c +++ b/gcc/c-family/c-pretty-print.c @@ -950,7 +950,7 @@ static void pp_c_character_constant (c_pretty_printer *pp, tree c) { pp_quote (pp); - pp_c_char (pp, (unsigned) tree_to_hwi (c)); + pp_c_char (pp, (unsigned) TREE_INT_CST_LOW (c)); pp_quote (pp); } diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c index 96810eac334..74eb13a3f7e 100644 --- a/gcc/c/c-parser.c +++ b/gcc/c/c-parser.c @@ -383,7 +383,7 @@ c_lex_one_token (c_parser *parser, c_token *token) break; case CPP_PRAGMA: /* We smuggled the cpp_token->u.pragma value in an INTEGER_CST. */ - token->pragma_kind = (enum pragma_kind) tree_to_hwi (token->value); + token->pragma_kind = (enum pragma_kind) TREE_INT_CST_LOW (token->value); token->value = NULL; break; default: @@ -13375,7 +13375,7 @@ c_parser_cilk_clause_vectorlength (c_parser *parser, tree clauses) || !TREE_CONSTANT (expr) || !INTEGRAL_TYPE_P (TREE_TYPE (expr))) error_at (loc, "vectorlength must be an integer constant"); - else if (exact_log2 (tree_to_hwi (expr)) == -1) + else if (exact_log2 (TREE_INT_CST_LOW (expr)) == -1) error_at (loc, "vectorlength must be a power of 2"); else { diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c index 09f52650909..cbc1177aaff 100644 --- a/gcc/c/c-typeck.c +++ b/gcc/c/c-typeck.c @@ -9563,7 +9563,7 @@ c_finish_bc_stmt (location_t loc, tree *label_p, bool is_break) } else if (TREE_CODE (label) == LABEL_DECL) ; - else switch (tree_to_hwi (label)) + else switch (TREE_INT_CST_LOW (label)) { case 0: if (is_break) diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c index c811520062e..4a351180ae5 100644 --- a/gcc/cgraphunit.c +++ b/gcc/cgraphunit.c @@ -1777,7 +1777,7 @@ expand_function (struct cgraph_node *node) larger_than_size)) { unsigned int size_as_int - = tree_to_hwi (TYPE_SIZE_UNIT (ret_type)); + = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (ret_type)); if (compare_tree_int (TYPE_SIZE_UNIT (ret_type), size_as_int) == 0) warning (OPT_Wlarger_than_, "size of return value of %q+D is %u bytes", diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c index e83624087b2..f0383a7b314 100644 --- a/gcc/config/avr/avr.c +++ b/gcc/config/avr/avr.c @@ -12072,7 +12072,7 @@ avr_expand_builtin (tree exp, rtx target, if (TREE_CODE (CALL_EXPR_ARG (exp, 1)) != INTEGER_CST) break; - int rbit = (int) tree_to_hwi (CALL_EXPR_ARG (exp, 1)); + int rbit = (int) TREE_INT_CST_LOW (CALL_EXPR_ARG (exp, 1)); if (rbit >= (int) GET_MODE_FBIT (mode)) { @@ -12256,7 +12256,7 @@ avr_fold_builtin (tree fndecl, int n_args ATTRIBUTE_UNUSED, tree *arg, /* Inserting bits known at compile time is easy and can be performed by AND and OR with appropriate masks. */ - int bits = tree_to_hwi (tbits); + int bits = TREE_INT_CST_LOW (tbits); int mask_ior = 0, mask_and = 0xff; for (i = 0; i < 8; i++) diff --git a/gcc/config/epiphany/epiphany.c b/gcc/config/epiphany/epiphany.c index f07f15e888c..c3200250c06 100644 --- a/gcc/config/epiphany/epiphany.c +++ b/gcc/config/epiphany/epiphany.c @@ -2762,7 +2762,7 @@ epiphany_special_round_type_align (tree type, unsigned computed, || tree_to_uhwi (offset) >= try_align || tree_to_uhwi (size) >= try_align) return try_align; - total = tree_to_hwi (offset) + tree_to_hwi (size); + total = TREE_INT_CST_LOW (offset) + TREE_INT_CST_LOW (size); if (total > max) max = total; } diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 113367c8607..d332b5bc80e 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -5475,7 +5475,7 @@ ix86_function_regparm (const_tree type, const_tree decl) attr = lookup_attribute ("regparm", TYPE_ATTRIBUTES (type)); if (attr) { - regparm = tree_to_hwi (TREE_VALUE (TREE_VALUE (attr))); + regparm = TREE_INT_CST_LOW (TREE_VALUE (TREE_VALUE (attr))); return regparm; } } @@ -5602,7 +5602,7 @@ ix86_keep_aggregate_return_pointer (tree fntype) attr = lookup_attribute ("callee_pop_aggregate_return", TYPE_ATTRIBUTES (fntype)); if (attr) - return (tree_to_hwi (TREE_VALUE (TREE_VALUE (attr))) == 0); + return (TREE_INT_CST_LOW (TREE_VALUE (TREE_VALUE (attr))) == 0); /* For 32-bit MS-ABI the default is to keep aggregate return pointer. */ diff --git a/gcc/config/m32c/m32c.c b/gcc/config/m32c/m32c.c index f78037446fd..deac40c228f 100644 --- a/gcc/config/m32c/m32c.c +++ b/gcc/config/m32c/m32c.c @@ -2935,8 +2935,8 @@ function_vector_handler (tree * node ATTRIBUTE_UNUSED, name); *no_add_attrs = true; } - else if (tree_to_hwi (TREE_VALUE (args)) < 18 - || tree_to_hwi (TREE_VALUE (args)) > 255) + else if (TREE_INT_CST_LOW (TREE_VALUE (args)) < 18 + || TREE_INT_CST_LOW (TREE_VALUE (args)) > 255) { /* The argument value must be between 18 to 255. */ warning (OPT_Wattributes, @@ -2968,7 +2968,7 @@ current_function_special_page_vector (rtx x) { if (is_attribute_p ("function_vector", TREE_PURPOSE (list))) { - num = tree_to_hwi (TREE_VALUE (TREE_VALUE (list))); + num = TREE_INT_CST_LOW (TREE_VALUE (TREE_VALUE (list))); return num; } diff --git a/gcc/config/mep/mep.c b/gcc/config/mep/mep.c index 4f986ed8b5e..489bef9c2d3 100644 --- a/gcc/config/mep/mep.c +++ b/gcc/config/mep/mep.c @@ -4210,7 +4210,7 @@ mep_attrlist_to_encoding (tree list, tree decl) && TREE_VALUE (TREE_VALUE (list)) && TREE_CODE (TREE_VALUE (TREE_VALUE (list))) == INTEGER_CST) { - int location = tree_to_hwi (TREE_VALUE (TREE_VALUE(list))); + int location = TREE_INT_CST_LOW (TREE_VALUE (TREE_VALUE(list))); if (location >= 0 && location <= 0x1000000) return 'i'; @@ -4299,7 +4299,7 @@ mep_insert_attributes (tree decl, tree *attributes) && TREE_VALUE (attr) && TREE_VALUE (TREE_VALUE(attr))) { - int location = tree_to_hwi (TREE_VALUE (TREE_VALUE(attr))); + int location = TREE_INT_CST_LOW (TREE_VALUE (TREE_VALUE(attr))); static tree previous_value = 0; static int previous_location = 0; static tree previous_name = 0; @@ -4715,7 +4715,7 @@ mep_output_aligned_common (FILE *stream, tree decl, const char *name, if (attr && TREE_VALUE (attr) && TREE_VALUE (TREE_VALUE(attr))) - location = tree_to_hwi (TREE_VALUE (TREE_VALUE(attr))); + location = TREE_INT_CST_LOW (TREE_VALUE (TREE_VALUE(attr))); if (location == -1) return; if (global) diff --git a/gcc/config/msp430/msp430.c b/gcc/config/msp430/msp430.c index 6648cacb68c..8721f3a8229 100644 --- a/gcc/config/msp430/msp430.c +++ b/gcc/config/msp430/msp430.c @@ -1157,7 +1157,7 @@ msp430_start_function (FILE *file, const char *name, tree decl) TREE_STRING_POINTER (intr_vector)); else /* TREE_CODE (intr_vector) == INTEGER_CST */ sprintf (buf, "__interrupt_vector_%u", - (unsigned int) tree_to_hwi (intr_vector)); + (unsigned int) TREE_INT_CST_LOW (intr_vector)); switch_to_section (get_section (buf, SECTION_CODE, decl)); fputs ("\t.word\t", file); diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index feab5e25eb1..c530ccde536 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -4036,7 +4036,7 @@ rs6000_builtin_support_vector_misalignment (enum machine_mode mode, it's word aligned. */ if (rs6000_vector_alignment_reachable (type, is_packed)) { - int element_size = tree_to_hwi (TYPE_SIZE (type)); + int element_size = TREE_INT_CST_LOW (TYPE_SIZE (type)); if (element_size == 64 || element_size == 32) return true; @@ -11553,7 +11553,7 @@ rs6000_expand_binop_builtin (enum insn_code icode, tree exp, rtx target) /* Only allow 5-bit unsigned literals. */ STRIP_NOPS (arg1); if (TREE_CODE (arg1) != INTEGER_CST - || tree_to_hwi (arg1) & ~0x1f) + || TREE_INT_CST_LOW (arg1) & ~0x1f) { error ("argument 2 must be a 5-bit unsigned literal"); return const0_rtx; @@ -11598,7 +11598,7 @@ altivec_expand_predicate_builtin (enum insn_code icode, tree exp, rtx target) return const0_rtx; } else - cr6_form_int = tree_to_hwi (cr6_form); + cr6_form_int = TREE_INT_CST_LOW (cr6_form); gcc_assert (mode0 == mode1); @@ -12089,7 +12089,7 @@ rs6000_expand_ternop_builtin (enum insn_code icode, tree exp, rtx target) /* Only allow 4-bit unsigned literals. */ STRIP_NOPS (arg2); if (TREE_CODE (arg2) != INTEGER_CST - || tree_to_hwi (arg2) & ~0xf) + || TREE_INT_CST_LOW (arg2) & ~0xf) { error ("argument 3 must be a 4-bit unsigned literal"); return const0_rtx; @@ -12107,7 +12107,7 @@ rs6000_expand_ternop_builtin (enum insn_code icode, tree exp, rtx target) /* Only allow 2-bit unsigned literals. */ STRIP_NOPS (arg2); if (TREE_CODE (arg2) != INTEGER_CST - || tree_to_hwi (arg2) & ~0x3) + || TREE_INT_CST_LOW (arg2) & ~0x3) { error ("argument 3 must be a 2-bit unsigned literal"); return const0_rtx; @@ -12119,7 +12119,7 @@ rs6000_expand_ternop_builtin (enum insn_code icode, tree exp, rtx target) /* Only allow 1-bit unsigned literals. */ STRIP_NOPS (arg2); if (TREE_CODE (arg2) != INTEGER_CST - || tree_to_hwi (arg2) & ~0x1) + || TREE_INT_CST_LOW (arg2) & ~0x1) { error ("argument 3 must be a 1-bit unsigned literal"); return const0_rtx; @@ -12323,7 +12323,7 @@ altivec_expand_dst_builtin (tree exp, rtx target ATTRIBUTE_UNUSED, *expandedp = true; STRIP_NOPS (arg2); if (TREE_CODE (arg2) != INTEGER_CST - || tree_to_hwi (arg2) & ~0x3) + || TREE_INT_CST_LOW (arg2) & ~0x3) { error ("argument to %qs must be a 2-bit unsigned literal", d->name); return const0_rtx; @@ -12570,7 +12570,7 @@ altivec_expand_builtin (tree exp, rtx target, bool *expandedp) return const0_rtx; if (TREE_CODE (arg0) != INTEGER_CST - || tree_to_hwi (arg0) & ~0x3) + || TREE_INT_CST_LOW (arg0) & ~0x3) { error ("argument to dss must be a 2-bit unsigned literal"); return const0_rtx; @@ -12779,7 +12779,7 @@ spe_expand_builtin (tree exp, rtx target, bool *expandedp) case SPE_BUILTIN_EVSTWWO: arg1 = CALL_EXPR_ARG (exp, 2); if (TREE_CODE (arg1) != INTEGER_CST - || tree_to_hwi (arg1) & ~0x1f) + || TREE_INT_CST_LOW (arg1) & ~0x1f) { error ("argument 2 must be a 5-bit unsigned literal"); return const0_rtx; @@ -12905,7 +12905,7 @@ paired_expand_predicate_builtin (enum insn_code icode, tree exp, rtx target) return const0_rtx; } else - form_int = tree_to_hwi (form); + form_int = TREE_INT_CST_LOW (form); gcc_assert (mode0 == mode1); @@ -12977,7 +12977,7 @@ spe_expand_predicate_builtin (enum insn_code icode, tree exp, rtx target) return const0_rtx; } else - form_int = tree_to_hwi (form); + form_int = TREE_INT_CST_LOW (form); gcc_assert (mode0 == mode1); diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c index 0be07b86dab..088ef396313 100644 --- a/gcc/config/sh/sh.c +++ b/gcc/config/sh/sh.c @@ -1161,7 +1161,7 @@ sh_print_operand (FILE *stream, rtx x, int code) DECL_ATTRIBUTES (current_function_decl)); if (trapa_attr) fprintf (stream, "trapa #%ld", - (long) tree_to_hwi (TREE_VALUE (TREE_VALUE (trapa_attr)))); + (long) TREE_INT_CST_LOW (TREE_VALUE (TREE_VALUE (trapa_attr)))); else if (sh_cfun_interrupt_handler_p ()) { if (sh_cfun_resbank_handler_p ()) @@ -9505,7 +9505,7 @@ sh2a_handle_function_vector_handler_attribute (tree * node, tree name, name); *no_add_attrs = true; } - else if (tree_to_hwi (TREE_VALUE (args)) > 255) + else if (TREE_INT_CST_LOW (TREE_VALUE (args)) > 255) { /* The argument value must be between 0 to 255. */ warning (OPT_Wattributes, @@ -9554,7 +9554,7 @@ sh2a_get_function_vector_number (rtx x) { if (is_attribute_p ("function_vector", TREE_PURPOSE (list))) { - num = tree_to_hwi (TREE_VALUE (TREE_VALUE (list))); + num = TREE_INT_CST_LOW (TREE_VALUE (TREE_VALUE (list))); return num; } diff --git a/gcc/config/sol2-c.c b/gcc/config/sol2-c.c index 86a8d907521..0accac40020 100644 --- a/gcc/config/sol2-c.c +++ b/gcc/config/sol2-c.c @@ -93,7 +93,7 @@ solaris_pragma_align (cpp_reader *pfile ATTRIBUTE_UNUSED) return; } - low = tree_to_hwi (x); + low = TREE_INT_CST_LOW (x); if (!cst_fits_uhwi_p (x) || (low != 1 && low != 2 && low != 4 && low != 8 && low != 16 && low != 32 && low != 64 && low != 128)) diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c index f4508021de3..ab8f501e4fa 100644 --- a/gcc/config/sparc/sparc.c +++ b/gcc/config/sparc/sparc.c @@ -7148,10 +7148,10 @@ sparc_struct_value_rtx (tree fndecl, int incoming) /* Calculate the return object size */ tree size = TYPE_SIZE_UNIT (TREE_TYPE (fndecl)); - rtx size_rtx = GEN_INT (tree_to_hwi (size) & 0xfff); + rtx size_rtx = GEN_INT (TREE_INT_CST_LOW (size) & 0xfff); /* Construct a temporary return value */ rtx temp_val - = assign_stack_local (Pmode, tree_to_hwi (size), 0); + = assign_stack_local (Pmode, TREE_INT_CST_LOW (size), 0); /* Implement SPARC 32-bit psABI callee return struct checking: @@ -10500,31 +10500,31 @@ sparc_handle_vis_mul8x16 (tree *n_elts, int fncode, tree inner_type, for (i = 0; i < num; ++i) { int val - = sparc_vis_mul8x16 (tree_to_hwi (VECTOR_CST_ELT (cst0, i)), - tree_to_hwi (VECTOR_CST_ELT (cst1, i))); + = sparc_vis_mul8x16 (TREE_INT_CST_LOW (VECTOR_CST_ELT (cst0, i)), + TREE_INT_CST_LOW (VECTOR_CST_ELT (cst1, i))); n_elts[i] = build_int_cst (inner_type, val); } break; case CODE_FOR_fmul8x16au_vis: - scale = tree_to_hwi (VECTOR_CST_ELT (cst1, 0)); + scale = TREE_INT_CST_LOW (VECTOR_CST_ELT (cst1, 0)); for (i = 0; i < num; ++i) { int val - = sparc_vis_mul8x16 (tree_to_hwi (VECTOR_CST_ELT (cst0, i)), + = sparc_vis_mul8x16 (TREE_INT_CST_LOW (VECTOR_CST_ELT (cst0, i)), scale); n_elts[i] = build_int_cst (inner_type, val); } break; case CODE_FOR_fmul8x16al_vis: - scale = tree_to_hwi (VECTOR_CST_ELT (cst1, 1)); + scale = TREE_INT_CST_LOW (VECTOR_CST_ELT (cst1, 1)); for (i = 0; i < num; ++i) { int val - = sparc_vis_mul8x16 (tree_to_hwi (VECTOR_CST_ELT (cst0, i)), + = sparc_vis_mul8x16 (TREE_INT_CST_LOW (VECTOR_CST_ELT (cst0, i)), scale); n_elts[i] = build_int_cst (inner_type, val); } @@ -10584,7 +10584,7 @@ sparc_fold_builtin (tree fndecl, int n_args ATTRIBUTE_UNUSED, n_elts = XALLOCAVEC (tree, VECTOR_CST_NELTS (arg0)); for (i = 0; i < VECTOR_CST_NELTS (arg0); ++i) n_elts[i] = build_int_cst (inner_type, - tree_to_hwi + TREE_INT_CST_LOW (VECTOR_CST_ELT (arg0, i)) << 4); return build_vector (rtype, n_elts); } diff --git a/gcc/config/vms/vms-c.c b/gcc/config/vms/vms-c.c index 5e4ed7cca65..d56ac1b8a70 100644 --- a/gcc/config/vms/vms-c.c +++ b/gcc/config/vms/vms-c.c @@ -316,7 +316,7 @@ handle_pragma_pointer_size (const char *pragma_name) int val; if (TREE_CODE (x) == INTEGER_CST) - val = tree_to_hwi (x); + val = TREE_INT_CST_LOW (x); else val = -1; diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index cb782516ee7..4e26bd501b4 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -2805,7 +2805,7 @@ extern void decl_shadowed_for_var_insert (tree, tree); /* The number of levels of template parameters given by NODE. */ #define TMPL_PARMS_DEPTH(NODE) \ - ((HOST_WIDE_INT) tree_to_hwi (TREE_PURPOSE (NODE))) + ((HOST_WIDE_INT) TREE_INT_CST_LOW (TREE_PURPOSE (NODE))) /* The TEMPLATE_DECL instantiated or specialized by NODE. This TEMPLATE_DECL will be the immediate parent, not the most general @@ -3689,7 +3689,7 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter) /* Accessor macros for C++ template decl nodes. */ /* The DECL_TEMPLATE_PARMS are a list. The TREE_PURPOSE of each node - is a INT_CST whose tree_to_hwi indicates the level of the + is a INT_CST whose TREE_INT_CST_LOW indicates the level of the template parameters, with 1 being the outermost set of template parameters. The TREE_VALUE is a vector, whose elements are the template parameters at each level. Each element in the vector is a diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c index 803a0d50dd5..69b1e312b7e 100644 --- a/gcc/cp/mangle.c +++ b/gcc/cp/mangle.c @@ -1545,7 +1545,7 @@ write_integer_cst (const tree cst) done = integer_zerop (d); tmp = fold_build2_loc (input_location, MINUS_EXPR, type, n, tmp); - c = hwint_to_ascii (tree_to_hwi (tmp), 10, ptr, + c = hwint_to_ascii (TREE_INT_CST_LOW (tmp), 10, ptr, done ? 1 : chunk_digits); ptr -= c; count += c; @@ -1557,7 +1557,7 @@ write_integer_cst (const tree cst) else { /* A small num. */ - unsigned HOST_WIDE_INT low = tree_to_hwi (cst); + unsigned HOST_WIDE_INT low = TREE_INT_CST_LOW (cst); if (sign < 0) { diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 2944a310c70..ec8350d37a2 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -823,7 +823,7 @@ cp_lexer_get_preprocessor_token (cp_lexer *lexer, cp_token *token) { /* We smuggled the cpp_token->u.pragma value in an INTEGER_CST. */ token->pragma_kind = ((enum pragma_kind) - tree_to_hwi (token->u.value)); + TREE_INT_CST_LOW (token->u.value)); token->u.value = NULL_TREE; } } @@ -3936,7 +3936,7 @@ cp_parser_userdef_string_literal (cp_token *token) tree name = cp_literal_operator_id (IDENTIFIER_POINTER (suffix_id)); tree value = USERDEF_LITERAL_VALUE (literal); int len = TREE_STRING_LENGTH (value) - / tree_to_hwi (TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (value)))) - 1; + / TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (value)))) - 1; tree decl, result; vec<tree, va_gc> *args; @@ -31277,7 +31277,7 @@ cp_parser_cilk_simd_vectorlength (cp_parser *parser, tree clauses) expr = maybe_constant_value (expr); if (TREE_CONSTANT (expr) - && exact_log2 (tree_to_hwi (expr)) == -1) + && exact_log2 (TREE_INT_CST_LOW (expr)) == -1) error_at (loc, "vectorlength must be a power of 2"); else if (expr != error_mark_node) { diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 9a102b98214..4a0169c9b3f 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -1694,7 +1694,7 @@ debug_binfo (tree elem) fprintf (stderr, "type \"%s\", offset = " HOST_WIDE_INT_PRINT_DEC "\nvtable type:\n", TYPE_NAME_STRING (BINFO_TYPE (elem)), - tree_to_hwi (BINFO_OFFSET (elem))); + TREE_INT_CST_LOW (BINFO_OFFSET (elem))); debug_tree (BINFO_TYPE (elem)); if (BINFO_VTABLE (elem)) fprintf (stderr, "vtable decl \"%s\"\n", @@ -1710,7 +1710,7 @@ debug_binfo (tree elem) tree fndecl = TREE_VALUE (virtuals); fprintf (stderr, "%s [%ld =? %ld]\n", IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (fndecl)), - (long) n, (long) tree_to_hwi (DECL_VINDEX (fndecl))); + (long) n, (long) TREE_INT_CST_LOW (DECL_VINDEX (fndecl))); ++n; virtuals = TREE_CHAIN (virtuals); } @@ -3241,7 +3241,7 @@ handle_init_priority_attribute (tree* node, return NULL_TREE; } - pri = tree_to_hwi (initp_expr); + pri = TREE_INT_CST_LOW (initp_expr); type = strip_array_types (type); diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index 484805da5dd..a6276744b2e 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -982,7 +982,7 @@ digest_init_r (tree type, tree init, bool nested, int flags, } if (TYPE_DOMAIN (type) != 0 && TREE_CONSTANT (TYPE_SIZE (type))) { - int size = tree_to_hwi (TYPE_SIZE (type)); + int size = TREE_INT_CST_LOW (TYPE_SIZE (type)); size = (size + BITS_PER_UNIT - 1) / BITS_PER_UNIT; /* In C it is ok to subtract 1 from the length of the string because it's ok to ignore the terminating null char that is diff --git a/gcc/dbxout.c b/gcc/dbxout.c index d110a9475f6..1ef63f32c85 100644 --- a/gcc/dbxout.c +++ b/gcc/dbxout.c @@ -2251,7 +2251,7 @@ dbxout_type (tree type, int full) value = DECL_INITIAL (value); if (cst_fits_shwi_p (value)) - stabstr_D (tree_to_hwi (value)); + stabstr_D (TREE_INT_CST_LOW (value)); else stabstr_O (value); @@ -2872,7 +2872,7 @@ dbxout_symbol (tree decl, int local ATTRIBUTE_UNUSED) if (TREE_CODE (TREE_TYPE (decl)) == INTEGER_TYPE || TREE_CODE (TREE_TYPE (decl)) == ENUMERAL_TYPE) { - HOST_WIDE_INT ival = tree_to_hwi (DECL_INITIAL (decl)); + HOST_WIDE_INT ival = TREE_INT_CST_LOW (DECL_INITIAL (decl)); dbxout_begin_complex_stabs (); dbxout_symbol_name (decl, NULL, 'c'); diff --git a/gcc/dojump.c b/gcc/dojump.c index b7b78050217..c3cff7dc082 100644 --- a/gcc/dojump.c +++ b/gcc/dojump.c @@ -541,10 +541,10 @@ do_jump (tree exp, rtx if_false_label, rtx if_true_label, int prob) && compare_tree_int (shift, 0) >= 0 && compare_tree_int (shift, HOST_BITS_PER_WIDE_INT) < 0 && prefer_and_bit_test (TYPE_MODE (argtype), - tree_to_hwi (shift))) + TREE_INT_CST_LOW (shift))) { unsigned HOST_WIDE_INT mask - = (unsigned HOST_WIDE_INT) 1 << tree_to_hwi (shift); + = (unsigned HOST_WIDE_INT) 1 << TREE_INT_CST_LOW (shift); do_jump (build2 (BIT_AND_EXPR, argtype, arg, build_int_cstu (argtype, mask)), clr_label, set_label, setclr_prob); diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index a5493e58259..62b2a676107 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -16348,12 +16348,15 @@ add_bound_info (dw_die_ref subrange_die, enum dwarf_attribute bound_attr, tree b type will be necessary to re-interpret it unambiguously. */ else if (prec < HOST_BITS_PER_WIDE_INT) { + unsigned HOST_WIDE_INT mask + = ((unsigned HOST_WIDE_INT) 1 << prec) - 1; add_AT_unsigned (subrange_die, bound_attr, - zext_hwi (tree_to_hwi (bound), prec)); + TREE_INT_CST_LOW (bound) & mask); } - else if (prec == HOST_BITS_PER_WIDE_INT + else if (prec == HOST_BITS_PER_WIDE_INT || (cst_fits_uhwi_p (bound) && wi::ges_p (bound, 0))) - add_AT_unsigned (subrange_die, bound_attr, tree_to_hwi (bound)); + add_AT_unsigned (subrange_die, bound_attr, + TREE_INT_CST_LOW (bound)); else add_AT_wide (subrange_die, bound_attr, bound); } @@ -17508,7 +17511,7 @@ gen_enumeration_type_die (tree type, dw_die_ref context_die) This should be re-worked to use correct signed/unsigned int/double tags for all cases, instead of always treating as signed. */ - add_AT_int (enum_die, DW_AT_const_value, tree_to_hwi (value)); + add_AT_int (enum_die, DW_AT_const_value, TREE_INT_CST_LOW (value)); else /* Enumeration constants may be wider than HOST_WIDE_INT. Handle that here. */ diff --git a/gcc/except.c b/gcc/except.c index 937935f03b6..6043ef293e6 100644 --- a/gcc/except.c +++ b/gcc/except.c @@ -2381,7 +2381,7 @@ collect_one_action_chain (action_hash_type ar_hash, eh_region region) { /* Retrieve the filter from the head of the filter list where we have stored it (see assign_filter_values). */ - int filter = tree_to_hwi (TREE_VALUE (c->filter_list)); + int filter = TREE_INT_CST_LOW (TREE_VALUE (c->filter_list)); next = add_action_record (ar_hash, filter, 0); } else @@ -2408,7 +2408,7 @@ collect_one_action_chain (action_hash_type ar_hash, eh_region region) flt_node = c->filter_list; for (; flt_node; flt_node = TREE_CHAIN (flt_node)) { - int filter = tree_to_hwi (TREE_VALUE (flt_node)); + int filter = TREE_INT_CST_LOW (TREE_VALUE (flt_node)); next = add_action_record (ar_hash, filter, next); } } diff --git a/gcc/expr.c b/gcc/expr.c index f48a88d24e5..a7ad8561e10 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -8197,7 +8197,7 @@ expand_expr_real_2 (sepops ops, rtx target, enum machine_mode tmode, truncated according to the mode of OP1, then sign extended to a HOST_WIDE_INT. Using the constant directly can result in non-canonical RTL in a 64x32 cross compile. */ - wc = tree_to_hwi (treeop0); + wc = TREE_INT_CST_LOW (treeop0); constant_part = immed_wide_int_const (wi::shwi (wc, wmode), wmode); op1 = plus_constant (mode, op1, INTVAL (constant_part)); @@ -8231,7 +8231,7 @@ expand_expr_real_2 (sepops ops, rtx target, enum machine_mode tmode, truncated according to the mode of OP1, then sign extended to a HOST_WIDE_INT. Using the constant directly can result in non-canonical RTL in a 64x32 cross compile. */ - wc = tree_to_hwi (treeop1); + wc = TREE_INT_CST_LOW (treeop1); constant_part = immed_wide_int_const (wi::shwi (wc, wmode), wmode); op0 = plus_constant (mode, op0, INTVAL (constant_part)); @@ -9803,7 +9803,7 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode, if (GET_MODE_CLASS (mode) == MODE_INT && GET_MODE_SIZE (mode) == 1) return gen_int_mode (TREE_STRING_POINTER (init) - [tree_to_hwi (index1)], + [TREE_INT_CST_LOW (index1)], mode); } } @@ -9840,7 +9840,7 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode, op0 = expand_expr (value, target, tmode, modifier); if (DECL_BIT_FIELD (field)) { - HOST_WIDE_INT bitsize = tree_to_hwi (DECL_SIZE (field)); + HOST_WIDE_INT bitsize = TREE_INT_CST_LOW (DECL_SIZE (field)); enum machine_mode imode = TYPE_MODE (TREE_TYPE (field)); if (TYPE_UNSIGNED (TREE_TYPE (field))) diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 615c71406c8..306606e95f3 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -6580,7 +6580,7 @@ fold_single_bit_test (location_t loc, enum tree_code code, && wi::ltu_p (wi::to_widest (TREE_OPERAND (inner, 1)) + bitnum, TYPE_PRECISION (type))) { - bitnum += tree_to_hwi (TREE_OPERAND (inner, 1)); + bitnum += TREE_INT_CST_LOW (TREE_OPERAND (inner, 1)); inner = TREE_OPERAND (inner, 0); } @@ -9693,7 +9693,7 @@ get_pointer_modulus_and_residue (tree expr, unsigned HOST_WIDE_INT *residue, inner_code = TREE_CODE (op1); if (inner_code == INTEGER_CST) { - *residue += tree_to_hwi (op1); + *residue += TREE_INT_CST_LOW (op1); return modulus; } else if (inner_code == MULT_EXPR) @@ -9704,7 +9704,7 @@ get_pointer_modulus_and_residue (tree expr, unsigned HOST_WIDE_INT *residue, unsigned HOST_WIDE_INT align; /* Compute the greatest power-of-2 divisor of op1. */ - align = tree_to_hwi (op1); + align = TREE_INT_CST_LOW (op1); align &= -align; /* If align is non-zero and less than *modulus, replace @@ -11952,7 +11952,7 @@ fold_binary_loc (location_t loc, < TYPE_PRECISION (TREE_TYPE (arg0)))) { unsigned int shiftc = tree_to_uhwi (TREE_OPERAND (arg0, 1)); - unsigned HOST_WIDE_INT mask = tree_to_hwi (arg1); + unsigned HOST_WIDE_INT mask = TREE_INT_CST_LOW (arg1); unsigned HOST_WIDE_INT newmask, zerobits = 0; tree shift_type = TREE_TYPE (arg0); @@ -15672,7 +15672,7 @@ tree_call_nonnegative_warnv_p (tree type, tree fndecl, /* True if the 1st argument is nonnegative or the second argument is an even integer. */ if (TREE_CODE (arg1) == INTEGER_CST - && (tree_to_hwi (arg1) & 1) == 0) + && (TREE_INT_CST_LOW (arg1) & 1) == 0) return true; return tree_expr_nonnegative_warnv_p (arg0, strict_overflow_p); diff --git a/gcc/fortran/target-memory.c b/gcc/fortran/target-memory.c index da8c7bf1165..86bbb5de51d 100644 --- a/gcc/fortran/target-memory.c +++ b/gcc/fortran/target-memory.c @@ -254,8 +254,8 @@ encode_derived (gfc_expr *source, unsigned char *buffer, size_t buffer_size) gcc_assert (cmp); if (!c->expr) continue; - ptr = tree_to_hwi (DECL_FIELD_OFFSET(cmp->backend_decl)) - + tree_to_hwi (DECL_FIELD_BIT_OFFSET(cmp->backend_decl))/8; + ptr = TREE_INT_CST_LOW(DECL_FIELD_OFFSET(cmp->backend_decl)) + + TREE_INT_CST_LOW(DECL_FIELD_BIT_OFFSET(cmp->backend_decl))/8; if (c->expr->expr_type == EXPR_NULL) { @@ -548,9 +548,9 @@ gfc_interpret_derived (unsigned char *buffer, size_t buffer_size, gfc_expr *resu i.e. there are, e.g., no bit fields. */ gcc_assert (cmp->backend_decl); - ptr = tree_to_hwi (DECL_FIELD_BIT_OFFSET (cmp->backend_decl)); + ptr = TREE_INT_CST_LOW (DECL_FIELD_BIT_OFFSET (cmp->backend_decl)); gcc_assert (ptr % 8 == 0); - ptr = ptr/8 + tree_to_hwi (DECL_FIELD_OFFSET (cmp->backend_decl)); + ptr = ptr/8 + TREE_INT_CST_LOW (DECL_FIELD_OFFSET (cmp->backend_decl)); gfc_target_interpret_expr (&buffer[ptr], buffer_size - ptr, e, true); } @@ -662,8 +662,8 @@ expr_to_char (gfc_expr *e, unsigned char *data, unsigned char *chk, size_t len) gcc_assert (cmp && cmp->backend_decl); if (!c->expr) continue; - ptr = tree_to_hwi (DECL_FIELD_OFFSET(cmp->backend_decl)) - + tree_to_hwi (DECL_FIELD_BIT_OFFSET(cmp->backend_decl))/8; + ptr = TREE_INT_CST_LOW(DECL_FIELD_OFFSET(cmp->backend_decl)) + + TREE_INT_CST_LOW(DECL_FIELD_BIT_OFFSET(cmp->backend_decl))/8; expr_to_char (c->expr, &data[ptr], &chk[ptr], len); } return len; diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index 5aef944c880..5b3cd1f6eb1 100644 --- a/gcc/fortran/trans-array.c +++ b/gcc/fortran/trans-array.c @@ -1685,7 +1685,7 @@ gfc_trans_array_constructor_value (stmtblock_t * pblock, tree type, tmp = gfc_build_addr_expr (NULL_TREE, tmp); init = gfc_build_addr_expr (NULL_TREE, init); - size = tree_to_hwi (TYPE_SIZE_UNIT (type)); + size = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (type)); bound = build_int_cst (size_type_node, n * size); tmp = build_call_expr_loc (input_location, builtin_decl_explicit (BUILT_IN_MEMCPY), diff --git a/gcc/fortran/trans-const.c b/gcc/fortran/trans-const.c index 1ff33e5c92a..ad2b4d23b39 100644 --- a/gcc/fortran/trans-const.c +++ b/gcc/fortran/trans-const.c @@ -147,7 +147,7 @@ gfc_conv_string_init (tree length, gfc_expr * expr) gcc_assert (expr->ts.type == BT_CHARACTER); gcc_assert (cst_fits_uhwi_p (length)); - len = tree_to_hwi (length); + len = TREE_INT_CST_LOW (length); slen = expr->value.character.length; if (len > slen) diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index 7ee947c1204..fa83a765338 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -408,7 +408,7 @@ gfc_can_put_var_on_stack (tree size) if (!cst_fits_uhwi_p (size)) return 0; - low = tree_to_hwi (size); + low = TREE_INT_CST_LOW (size); if (low > (unsigned HOST_WIDE_INT) gfc_option.flag_max_stack_var_size) return 0; diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index a1afbf26a0b..92be1e8e0b4 100644 --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -2632,7 +2632,7 @@ gfc_string_to_single_character (tree len, tree str, int kind) || !POINTER_TYPE_P (TREE_TYPE (str))) return NULL_TREE; - if (tree_to_hwi (len) == 1) + if (TREE_INT_CST_LOW (len) == 1) { str = fold_convert (gfc_get_pchar_type (kind), str); return build_fold_indirect_ref_loc (input_location, str); diff --git a/gcc/fortran/trans-io.c b/gcc/fortran/trans-io.c index 1b500b51d31..5fa1cdc091e 100644 --- a/gcc/fortran/trans-io.c +++ b/gcc/fortran/trans-io.c @@ -292,8 +292,8 @@ gfc_build_io_library_fndecls (void) = build_pointer_type (gfc_intio_type_node); types[IOPARM_type_parray] = pchar_type_node; types[IOPARM_type_pchar] = pchar_type_node; - pad_size = 16 * tree_to_hwi (TYPE_SIZE_UNIT (pchar_type_node)); - pad_size += 32 * tree_to_hwi (TYPE_SIZE_UNIT (integer_type_node)); + pad_size = 16 * TREE_INT_CST_LOW (TYPE_SIZE_UNIT (pchar_type_node)); + pad_size += 32 * TREE_INT_CST_LOW (TYPE_SIZE_UNIT (integer_type_node)); pad_idx = build_index_type (size_int (pad_size - 1)); types[IOPARM_type_pad] = build_array_type (char_type_node, pad_idx); diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c index 03ceea7417b..07a3ac276f8 100644 --- a/gcc/fortran/trans-types.c +++ b/gcc/fortran/trans-types.c @@ -1450,7 +1450,7 @@ gfc_get_dtype (tree type) if (tree_int_cst_lt (gfc_max_array_element_size, size)) gfc_fatal_error ("Array element size too big at %C"); - i += tree_to_hwi (size) << GFC_DTYPE_SIZE_SHIFT; + i += TREE_INT_CST_LOW (size) << GFC_DTYPE_SIZE_SHIFT; } dtype = build_int_cst (gfc_array_index_type, i); diff --git a/gcc/function.c b/gcc/function.c index 7fdf67639a4..41382310e04 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -3848,7 +3848,7 @@ locate_and_pad_parm (enum machine_mode passed_mode, tree type, int in_regs, #ifdef PUSH_ROUNDING if (passed_mode != BLKmode) - sizetree = size_int (PUSH_ROUNDING (tree_to_hwi (sizetree))); + sizetree = size_int (PUSH_ROUNDING (TREE_INT_CST_LOW (sizetree))); #endif /* Pad_below needs the pre-rounded size to know how much to pad below @@ -3950,7 +3950,7 @@ pad_below (struct args_size *offset_ptr, enum machine_mode passed_mode, tree siz else { if (TREE_CODE (sizetree) != INTEGER_CST - || (tree_to_hwi (sizetree) * BITS_PER_UNIT) % PARM_BOUNDARY) + || (TREE_INT_CST_LOW (sizetree) * BITS_PER_UNIT) % PARM_BOUNDARY) { /* Round the size up to multiple of PARM_BOUNDARY bits. */ tree s2 = round_up (sizetree, PARM_BOUNDARY / BITS_PER_UNIT); diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c index ffaa765aa5e..80c23be230d 100644 --- a/gcc/gimple-fold.c +++ b/gcc/gimple-fold.c @@ -1153,7 +1153,7 @@ gimple_fold_call (gimple_stmt_iterator *gsi, bool inplace) if (binfo) { HOST_WIDE_INT token - = tree_to_hwi (OBJ_TYPE_REF_TOKEN (callee)); + = TREE_INT_CST_LOW (OBJ_TYPE_REF_TOKEN (callee)); tree fndecl = gimple_get_virt_method_for_binfo (token, binfo); if (fndecl) { @@ -3064,7 +3064,7 @@ fold_const_aggregate_ref_1 (tree t, tree (*valueize) (tree)) offset = woffset.to_shwi (); /* TODO: This code seems wrong, multiply then check to see if it fits. */ - offset *= tree_to_hwi (unit_size); + offset *= TREE_INT_CST_LOW (unit_size); offset *= BITS_PER_UNIT; base = TREE_OPERAND (t, 0); @@ -3298,7 +3298,7 @@ gimple_val_nonnegative_real_p (tree val) arg1 = gimple_call_arg (def_stmt, 1); if (TREE_CODE (arg1) == INTEGER_CST - && (tree_to_hwi (arg1) & 1) == 0) + && (TREE_INT_CST_LOW (arg1) & 1) == 0) return true; break; diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c index 8bf90f23aa2..928426c2462 100644 --- a/gcc/gimple-pretty-print.c +++ b/gcc/gimple-pretty-print.c @@ -734,7 +734,7 @@ dump_gimple_call (pretty_printer *buffer, gimple gs, int spc, int flags) pp_string (buffer, " [ "); /* Get the transaction code properties. */ - props = tree_to_hwi (t); + props = TREE_INT_CST_LOW (t); if (props & PR_INSTRUMENTEDCODE) pp_string (buffer, "instrumentedCode "); diff --git a/gcc/gimple.c b/gcc/gimple.c index 692adf5253d..b316c84c5d5 100644 --- a/gcc/gimple.c +++ b/gcc/gimple.c @@ -2103,11 +2103,11 @@ gimple_compare_field_offset (tree f1, tree f2) { unsigned HOST_WIDE_INT byte_offset1, byte_offset2; unsigned HOST_WIDE_INT bit_offset1, bit_offset2; - bit_offset1 = tree_to_hwi (DECL_FIELD_BIT_OFFSET (f1)); - byte_offset1 = (tree_to_hwi (DECL_FIELD_OFFSET (f1)) + bit_offset1 = TREE_INT_CST_LOW (DECL_FIELD_BIT_OFFSET (f1)); + byte_offset1 = (TREE_INT_CST_LOW (DECL_FIELD_OFFSET (f1)) + bit_offset1 / BITS_PER_UNIT); - bit_offset2 = tree_to_hwi (DECL_FIELD_BIT_OFFSET (f2)); - byte_offset2 = (tree_to_hwi (DECL_FIELD_OFFSET (f2)) + bit_offset2 = TREE_INT_CST_LOW (DECL_FIELD_BIT_OFFSET (f2)); + byte_offset2 = (TREE_INT_CST_LOW (DECL_FIELD_OFFSET (f2)) + bit_offset2 / BITS_PER_UNIT); if (byte_offset1 != byte_offset2) return false; @@ -2578,7 +2578,7 @@ infer_nonnull_range (gimple stmt, tree op) /* Now see if op appears in the nonnull list. */ for (tree t = TREE_VALUE (attrs); t; t = TREE_CHAIN (t)) { - int idx = tree_to_hwi (TREE_VALUE (t)) - 1; + int idx = TREE_INT_CST_LOW (TREE_VALUE (t)) - 1; tree arg = gimple_call_arg (stmt, idx); if (operand_equal_p (op, arg, 0)) return true; diff --git a/gcc/go/go-gcc.cc b/gcc/go/go-gcc.cc index f543644a7ac..d70e4f120e0 100644 --- a/gcc/go/go-gcc.cc +++ b/gcc/go/go-gcc.cc @@ -828,7 +828,7 @@ Gcc_backend::type_size(Btype* btype) return 1; t = TYPE_SIZE_UNIT(t); gcc_assert(cst_fits_uhwi_p (t)); - unsigned HOST_WIDE_INT val_wide = tree_to_hwi (t); + unsigned HOST_WIDE_INT val_wide = TREE_INT_CST_LOW (t); size_t ret = static_cast<size_t>(val_wide); gcc_assert(ret == val_wide); return ret; diff --git a/gcc/java/boehm.c b/gcc/java/boehm.c index 14d228a7e2f..d8ed23964b7 100644 --- a/gcc/java/boehm.c +++ b/gcc/java/boehm.c @@ -233,5 +233,5 @@ uses_jv_markobj_p (tree dtable) point in asserting unless we hit the bad case. */ gcc_assert (!flag_reduced_reflection || TARGET_VTABLE_USES_DESCRIPTORS == 0); v = (*CONSTRUCTOR_ELTS (dtable))[3].value; - return (PROCEDURE_OBJECT_DESCRIPTOR == tree_to_hwi (v)); + return (PROCEDURE_OBJECT_DESCRIPTOR == TREE_INT_CST_LOW (v)); } diff --git a/gcc/java/expr.c b/gcc/java/expr.c index 2e7ee9dde3f..983822dadcb 100644 --- a/gcc/java/expr.c +++ b/gcc/java/expr.c @@ -2673,7 +2673,7 @@ build_jni_stub (tree method) special way, we would do that here. */ for (tem = method_args; tem != NULL_TREE; tem = DECL_CHAIN (tem)) { - int arg_bits = tree_to_hwi (TYPE_SIZE (TREE_TYPE (tem))); + int arg_bits = TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (tem))); #ifdef PARM_BOUNDARY arg_bits = (((arg_bits + PARM_BOUNDARY - 1) / PARM_BOUNDARY) * PARM_BOUNDARY); diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c index dabf47f3cb7..4400095cd6f 100644 --- a/gcc/lto-streamer-out.c +++ b/gcc/lto-streamer-out.c @@ -2282,7 +2282,7 @@ write_symbol (struct streamer_tree_cache_d *cache, if (kind == GCCPK_COMMON && DECL_SIZE_UNIT (t) && TREE_CODE (DECL_SIZE_UNIT (t)) == INTEGER_CST) - size = tree_to_hwi (DECL_SIZE_UNIT (t)); + size = TREE_INT_CST_LOW (DECL_SIZE_UNIT (t)); else size = 0; diff --git a/gcc/lto/lto-lang.c b/gcc/lto/lto-lang.c index 55bf1787a3f..b087cc81b04 100644 --- a/gcc/lto/lto-lang.c +++ b/gcc/lto/lto-lang.c @@ -319,7 +319,7 @@ get_nonnull_operand (tree arg_num_expr, unsigned HOST_WIDE_INT *valp) if (!cst_fits_uhwi_p (arg_num_expr)) return false; - *valp = tree_to_hwi (arg_num_expr); + *valp = TREE_INT_CST_LOW (arg_num_expr); return true; } diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c index 0b1b304e126..05f7ebaca8d 100644 --- a/gcc/objc/objc-act.c +++ b/gcc/objc/objc-act.c @@ -3023,8 +3023,8 @@ check_string_class_template (void) #define AT_LEAST_AS_LARGE_AS(F, T) \ (F && TREE_CODE (F) == FIELD_DECL \ - && (tree_to_hwi (TYPE_SIZE (TREE_TYPE (F))) \ - >= tree_to_hwi (TYPE_SIZE (T)))) + && (TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (F))) \ + >= TREE_INT_CST_LOW (TYPE_SIZE (T)))) if (!AT_LEAST_AS_LARGE_AS (field_decl, ptr_type_node)) return 0; @@ -8880,7 +8880,7 @@ gen_declaration (tree decl) if (DECL_INITIAL (decl) && TREE_CODE (DECL_INITIAL (decl)) == INTEGER_CST) sprintf (errbuf + strlen (errbuf), ": " HOST_WIDE_INT_PRINT_DEC, - tree_to_hwi (DECL_INITIAL (decl))); + TREE_INT_CST_LOW (DECL_INITIAL (decl))); } return errbuf; @@ -8920,7 +8920,7 @@ gen_type_name_0 (tree type) char sz[20]; sprintf (sz, HOST_WIDE_INT_PRINT_DEC, - (tree_to_hwi + (TREE_INT_CST_LOW (TYPE_MAX_VALUE (TYPE_DOMAIN (type))) + 1)); strcat (errbuf, sz); } diff --git a/gcc/objc/objc-encoding.c b/gcc/objc/objc-encoding.c index 1c7ba105fa8..532725114a2 100644 --- a/gcc/objc/objc-encoding.c +++ b/gcc/objc/objc-encoding.c @@ -393,12 +393,12 @@ encode_array (tree type, int curtype, int format) array. */ sprintf (buffer, "[" HOST_WIDE_INT_PRINT_DEC, (HOST_WIDE_INT)0); } - else if (tree_to_hwi (TYPE_SIZE (array_of)) == 0) + else if (TREE_INT_CST_LOW (TYPE_SIZE (array_of)) == 0) sprintf (buffer, "[" HOST_WIDE_INT_PRINT_DEC, (HOST_WIDE_INT)0); else sprintf (buffer, "[" HOST_WIDE_INT_PRINT_DEC, - tree_to_hwi (an_int_cst) - / tree_to_hwi (TYPE_SIZE (array_of))); + TREE_INT_CST_LOW (an_int_cst) + / TREE_INT_CST_LOW (TYPE_SIZE (array_of))); obstack_grow (&util_obstack, buffer, strlen (buffer)); encode_type (array_of, curtype, format); @@ -425,7 +425,7 @@ encode_vector (tree type, int curtype, int format) sprintf (buffer, "![" HOST_WIDE_INT_PRINT_DEC ",%d", /* We want to compute the equivalent of sizeof (<vector>). Code inspired by c_sizeof_or_alignof_type. */ - ((tree_to_hwi (TYPE_SIZE_UNIT (type)) + ((TREE_INT_CST_LOW (TYPE_SIZE_UNIT (type)) / (TYPE_PRECISION (char_type_node) / BITS_PER_UNIT))), /* We want to compute the equivalent of __alignof__ (<vector>). Code inspired by diff --git a/gcc/objc/objc-next-runtime-abi-01.c b/gcc/objc/objc-next-runtime-abi-01.c index 5e896eebc19..000256d8311 100644 --- a/gcc/objc/objc-next-runtime-abi-01.c +++ b/gcc/objc/objc-next-runtime-abi-01.c @@ -1199,7 +1199,7 @@ generate_v1_objc_protocol_extension (tree proto_interface, build_v1_objc_protocol_extension_template (); /* uint32_t size */ - size = tree_to_hwi (TYPE_SIZE_UNIT (objc_protocol_extension_template)); + size = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (objc_protocol_extension_template)); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, build_int_cst (NULL_TREE, size)); /* Try for meaningful diagnostics. */ @@ -1343,7 +1343,7 @@ generate_v1_property_table (tree context, tree klass_ctxt) is_proto ? context : klass_ctxt); - init_val = tree_to_hwi (TYPE_SIZE_UNIT (objc_v1_property_template)); + init_val = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (objc_v1_property_template)); if (is_proto) snprintf (buf, BUFSIZE, "_OBJC_ProtocolPropList_%s", IDENTIFIER_POINTER (PROTOCOL_NAME (context))); @@ -1723,7 +1723,7 @@ build_v1_category_initializer (tree type, tree cat_name, tree class_name, if (flag_objc_abi >= 1) { - int val = tree_to_hwi (TYPE_SIZE_UNIT (objc_category_template)); + int val = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (objc_category_template)); expr = build_int_cst (NULL_TREE, val); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, expr); ltyp = objc_prop_list_ptr; @@ -1825,7 +1825,7 @@ generate_objc_class_ext (tree property_list, tree context) build_objc_class_ext_template (); /* uint32_t size */ - size = tree_to_hwi (TYPE_SIZE_UNIT (objc_class_ext_template)); + size = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (objc_class_ext_template)); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, build_int_cst (NULL_TREE, size)); ltyp = const_string_type_node; diff --git a/gcc/objc/objc-next-runtime-abi-02.c b/gcc/objc/objc-next-runtime-abi-02.c index 0f158e13f0b..885047705d4 100644 --- a/gcc/objc/objc-next-runtime-abi-02.c +++ b/gcc/objc/objc-next-runtime-abi-02.c @@ -2318,7 +2318,7 @@ generate_v2_meth_descriptor_table (tree chain, tree protocol, decl = start_var_decl (method_list_template, buf); - entsize = tree_to_hwi (TYPE_SIZE_UNIT (objc_method_template)); + entsize = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (objc_method_template)); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, build_int_cst (NULL_TREE, entsize)); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, build_int_cst (NULL_TREE, size)); initlist = @@ -2432,7 +2432,7 @@ generate_v2_property_table (tree context, tree klass_ctxt) is_proto ? context : klass_ctxt); - init_val = tree_to_hwi (TYPE_SIZE_UNIT (objc_v2_property_template)); + init_val = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (objc_v2_property_template)); if (is_proto) snprintf (buf, BUFSIZE, "_OBJC_ProtocolPropList_%s", IDENTIFIER_POINTER (PROTOCOL_NAME (context))); @@ -2507,7 +2507,7 @@ build_v2_protocol_initializer (tree type, tree protocol_name, tree protocol_list /* const uint32_t size; = sizeof(struct protocol_t) */ expr = build_int_cst (integer_type_node, - tree_to_hwi (TYPE_SIZE_UNIT (objc_v2_protocol_template))); + TREE_INT_CST_LOW (TYPE_SIZE_UNIT (objc_v2_protocol_template))); CONSTRUCTOR_APPEND_ELT (inits, NULL_TREE, expr); /* const uint32_t flags; = 0 */ CONSTRUCTOR_APPEND_ELT (inits, NULL_TREE, integer_zero_node); @@ -2621,7 +2621,7 @@ generate_v2_dispatch_table (tree chain, const char *name, tree attr) decl = start_var_decl (method_list_template, name); - init_val = tree_to_hwi (TYPE_SIZE_UNIT (objc_method_template)); + init_val = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (objc_method_template)); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, build_int_cst (integer_type_node, init_val)); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, @@ -2848,7 +2848,7 @@ build_v2_ivar_list_initializer (tree class_name, tree type, tree field_decl) build_int_cst (integer_type_node, val)); /* Set size. */ - val = tree_to_hwi (DECL_SIZE_UNIT (field_decl)); + val = TREE_INT_CST_LOW (DECL_SIZE_UNIT (field_decl)); CONSTRUCTOR_APPEND_ELT (ivar, NULL_TREE, build_int_cst (integer_type_node, val)); @@ -2917,7 +2917,7 @@ generate_v2_ivars_list (tree chain, const char *name, tree attr, tree templ) initlist = build_v2_ivar_list_initializer (CLASS_NAME (templ), objc_v2_ivar_template, chain); - ivar_t_size = tree_to_hwi (TYPE_SIZE_UNIT (objc_v2_ivar_template)); + ivar_t_size = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (objc_v2_ivar_template)); decl = start_var_decl (ivar_list_template, name); CONSTRUCTOR_APPEND_ELT (inits, NULL_TREE, @@ -3175,7 +3175,7 @@ generate_v2_class_structs (struct imp_entry *impent) buf, meta_clac_meth); } - instanceStart = tree_to_hwi (TYPE_SIZE_UNIT (objc_v2_class_template)); + instanceStart = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (objc_v2_class_template)); /* Currently there are no class ivars and generation of class variables for the root of the inheritance has been removed. It @@ -3185,7 +3185,7 @@ generate_v2_class_structs (struct imp_entry *impent) class_ivars = NULL_TREE; /* TODO: Add total size of class variables when implemented. */ - instanceSize = tree_to_hwi (TYPE_SIZE_UNIT (objc_v2_class_template)); + instanceSize = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (objc_v2_class_template)); /* So now build the META CLASS structs. */ /* static struct class_ro_t _OBJC_METACLASS_Foo = { ... }; */ diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c index bd608825331..f4598a6b1ab 100644 --- a/gcc/simplify-rtx.c +++ b/gcc/simplify-rtx.c @@ -321,7 +321,7 @@ delegitimize_mem_from_attrs (rtx x) { offset += bitpos / BITS_PER_UNIT; if (toffset) - offset += tree_to_hwi (toffset); + offset += TREE_INT_CST_LOW (toffset); } break; } diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index 4da2d4bc444..bb4b6d9b82b 100644 --- a/gcc/stor-layout.c +++ b/gcc/stor-layout.c @@ -688,7 +688,7 @@ layout_decl (tree decl, unsigned int known_align) if (size != 0 && TREE_CODE (size) == INTEGER_CST && compare_tree_int (size, larger_than_size) > 0) { - int size_as_int = tree_to_hwi (size); + int size_as_int = TREE_INT_CST_LOW (size); if (compare_tree_int (size, size_as_int) == 0) warning (OPT_Wlarger_than_, "size of %q+D is %d bytes", decl, size_as_int); diff --git a/gcc/trans-mem.c b/gcc/trans-mem.c index 31b4a0d190a..879f37b9177 100644 --- a/gcc/trans-mem.c +++ b/gcc/trans-mem.c @@ -3118,7 +3118,7 @@ expand_block_edges (struct tm_region *const region, basic_block bb) // TM_ABORT directly get what they deserve. tree arg = gimple_call_arg (stmt, 0); if (TREE_CODE (arg) == INTEGER_CST - && (tree_to_hwi (arg) & AR_OUTERABORT) != 0 + && (TREE_INT_CST_LOW (arg) & AR_OUTERABORT) != 0 && !decl_is_tm_clone (current_function_decl)) { // Find the GTMA_IS_OUTER transaction. diff --git a/gcc/tree-dfa.h b/gcc/tree-dfa.h index 66154d8af50..ab7dd19f09f 100644 --- a/gcc/tree-dfa.h +++ b/gcc/tree-dfa.h @@ -59,7 +59,7 @@ get_addr_base_and_unit_offset_1 (tree exp, HOST_WIDE_INT *poffset, { case BIT_FIELD_REF: { - HOST_WIDE_INT this_off = tree_to_hwi (TREE_OPERAND (exp, 2)); + HOST_WIDE_INT this_off = TREE_INT_CST_LOW (TREE_OPERAND (exp, 2)); if (this_off % BITS_PER_UNIT) return NULL_TREE; byte_offset += this_off / BITS_PER_UNIT; @@ -74,12 +74,12 @@ get_addr_base_and_unit_offset_1 (tree exp, HOST_WIDE_INT *poffset, if (!this_offset || TREE_CODE (this_offset) != INTEGER_CST - || (tree_to_hwi (DECL_FIELD_BIT_OFFSET (field)) + || (TREE_INT_CST_LOW (DECL_FIELD_BIT_OFFSET (field)) % BITS_PER_UNIT)) return NULL_TREE; - hthis_offset = tree_to_hwi (this_offset); - hthis_offset += (tree_to_hwi (DECL_FIELD_BIT_OFFSET (field)) + hthis_offset = TREE_INT_CST_LOW (this_offset); + hthis_offset += (TREE_INT_CST_LOW (DECL_FIELD_BIT_OFFSET (field)) / BITS_PER_UNIT); byte_offset += hthis_offset; } @@ -102,10 +102,10 @@ get_addr_base_and_unit_offset_1 (tree exp, HOST_WIDE_INT *poffset, && (unit_size = array_ref_element_size (exp), TREE_CODE (unit_size) == INTEGER_CST)) { - HOST_WIDE_INT hindex = tree_to_hwi (index); + HOST_WIDE_INT hindex = TREE_INT_CST_LOW (index); - hindex -= tree_to_hwi (low_bound); - hindex *= tree_to_hwi (unit_size); + hindex -= TREE_INT_CST_LOW (low_bound); + hindex *= TREE_INT_CST_LOW (unit_size); byte_offset += hindex; } else @@ -117,7 +117,7 @@ get_addr_base_and_unit_offset_1 (tree exp, HOST_WIDE_INT *poffset, break; case IMAGPART_EXPR: - byte_offset += tree_to_hwi (TYPE_SIZE_UNIT (TREE_TYPE (exp))); + byte_offset += TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (exp))); break; case VIEW_CONVERT_EXPR: diff --git a/gcc/tree-flow-inline.h b/gcc/tree-flow-inline.h index c2ede6abd62..a68b8a91b99 100644 --- a/gcc/tree-flow-inline.h +++ b/gcc/tree-flow-inline.h @@ -1183,7 +1183,7 @@ get_addr_base_and_unit_offset_1 (tree exp, HOST_WIDE_INT *poffset, { case BIT_FIELD_REF: { - HOST_WIDE_INT this_off = tree_to_hwi (TREE_OPERAND (exp, 2)); + HOST_WIDE_INT this_off = TREE_INT_CST_LOW (TREE_OPERAND (exp, 2)); if (this_off % BITS_PER_UNIT) return NULL_TREE; byte_offset += this_off / BITS_PER_UNIT; @@ -1198,12 +1198,12 @@ get_addr_base_and_unit_offset_1 (tree exp, HOST_WIDE_INT *poffset, if (!this_offset || TREE_CODE (this_offset) != INTEGER_CST - || (tree_to_hwi (DECL_FIELD_BIT_OFFSET (field)) + || (TREE_INT_CST_LOW (DECL_FIELD_BIT_OFFSET (field)) % BITS_PER_UNIT)) return NULL_TREE; - hthis_offset = tree_to_hwi (this_offset); - hthis_offset += (tree_to_hwi (DECL_FIELD_BIT_OFFSET (field)) + hthis_offset = TREE_INT_CST_LOW (this_offset); + hthis_offset += (TREE_INT_CST_LOW (DECL_FIELD_BIT_OFFSET (field)) / BITS_PER_UNIT); byte_offset += hthis_offset; } @@ -1226,10 +1226,10 @@ get_addr_base_and_unit_offset_1 (tree exp, HOST_WIDE_INT *poffset, && (unit_size = array_ref_element_size (exp), TREE_CODE (unit_size) == INTEGER_CST)) { - HOST_WIDE_INT hindex = tree_to_hwi (index); + HOST_WIDE_INT hindex = TREE_INT_CST_LOW (index); - hindex -= tree_to_hwi (low_bound); - hindex *= tree_to_hwi (unit_size); + hindex -= TREE_INT_CST_LOW (low_bound); + hindex *= TREE_INT_CST_LOW (unit_size); byte_offset += hindex; } else @@ -1241,7 +1241,7 @@ get_addr_base_and_unit_offset_1 (tree exp, HOST_WIDE_INT *poffset, break; case IMAGPART_EXPR: - byte_offset += tree_to_hwi (TYPE_SIZE_UNIT (TREE_TYPE (exp))); + byte_offset += TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (exp))); break; case VIEW_CONVERT_EXPR: diff --git a/gcc/tree-object-size.c b/gcc/tree-object-size.c index be07fd03992..4d5b83f9a92 100644 --- a/gcc/tree-object-size.c +++ b/gcc/tree-object-size.c @@ -400,9 +400,9 @@ alloc_object_size (const_gimple call, int object_size_type) { tree p = TREE_VALUE (alloc_size); - arg1 = tree_to_hwi (TREE_VALUE (p))-1; + arg1 = TREE_INT_CST_LOW (TREE_VALUE (p))-1; if (TREE_CHAIN (p)) - arg2 = tree_to_hwi (TREE_VALUE (TREE_CHAIN (p)))-1; + arg2 = TREE_INT_CST_LOW (TREE_VALUE (TREE_CHAIN (p)))-1; } if (DECL_BUILT_IN_CLASS (callee) == BUILT_IN_NORMAL) diff --git a/gcc/tree-pretty-print.c b/gcc/tree-pretty-print.c index 78db8e70f91..e1fb11bddf0 100644 --- a/gcc/tree-pretty-print.c +++ b/gcc/tree-pretty-print.c @@ -1232,9 +1232,9 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags, NB: Neither of the following divisors can be trivially used to recover the original literal: - tree_to_hwi (TYPE_SIZE_UNIT (TREE_TYPE (node))) + TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (node))) TYPE_PRECISION (TREE_TYPE (TREE_TYPE (node))) */ - pp_wide_integer (buffer, tree_to_hwi (node)); + pp_wide_integer (buffer, TREE_INT_CST_LOW (node)); pp_string (buffer, "B"); /* pseudo-unit */ } else if (tree_fits_shwi_p (node)) diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c index ce088a99f97..04579526e48 100644 --- a/gcc/tree-sra.c +++ b/gcc/tree-sra.c @@ -1370,11 +1370,11 @@ compare_access_positions (const void *a, const void *b) return TYPE_PRECISION (f2->type) - TYPE_PRECISION (f1->type); /* Put any integral type with non-full precision last. */ else if (INTEGRAL_TYPE_P (f1->type) - && (tree_to_hwi (TYPE_SIZE (f1->type)) + && (TREE_INT_CST_LOW (TYPE_SIZE (f1->type)) != TYPE_PRECISION (f1->type))) return 1; else if (INTEGRAL_TYPE_P (f2->type) - && (tree_to_hwi (TYPE_SIZE (f2->type)) + && (TREE_INT_CST_LOW (TYPE_SIZE (f2->type)) != TYPE_PRECISION (f2->type))) return -1; /* Stabilize the sort. */ @@ -1436,7 +1436,7 @@ make_fancy_name_1 (tree expr) index = TREE_OPERAND (expr, 1); if (TREE_CODE (index) != INTEGER_CST) break; - sprintf (buffer, HOST_WIDE_INT_PRINT_DEC, tree_to_hwi (index)); + sprintf (buffer, HOST_WIDE_INT_PRINT_DEC, TREE_INT_CST_LOW (index)); obstack_grow (&name_obstack, buffer, strlen (buffer)); break; @@ -1450,7 +1450,7 @@ make_fancy_name_1 (tree expr) { obstack_1grow (&name_obstack, '$'); sprintf (buffer, HOST_WIDE_INT_PRINT_DEC, - tree_to_hwi (TREE_OPERAND (expr, 1))); + TREE_INT_CST_LOW (TREE_OPERAND (expr, 1))); obstack_grow (&name_obstack, buffer, strlen (buffer)); } break; diff --git a/gcc/tree-ssa-address.c b/gcc/tree-ssa-address.c index 61579bc5ef5..5e2a1071073 100644 --- a/gcc/tree-ssa-address.c +++ b/gcc/tree-ssa-address.c @@ -880,7 +880,7 @@ copy_ref_info (tree new_ref, tree old_ref) && !(TREE_CODE (new_ref) == TARGET_MEM_REF && (TMR_INDEX2 (new_ref) || (TMR_STEP (new_ref) - && (tree_to_hwi (TMR_STEP (new_ref)) + && (TREE_INT_CST_LOW (TMR_STEP (new_ref)) < align))))) { unsigned int inc = (mem_ref_offset (old_ref).to_uhwi () diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index 96c646e96a7..aefc38e58fc 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -616,7 +616,7 @@ ao_ref_init_from_ptr_and_size (ao_ref *ref, tree ptr, tree size) if (size && tree_fits_shwi_p (size) && tree_to_shwi (size) * BITS_PER_UNIT / BITS_PER_UNIT - == tree_to_hwi (size)) + == tree_to_shwi (size)) ref->max_size = ref->size = tree_to_shwi (size) * BITS_PER_UNIT; else ref->max_size = ref->size = -1; diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c index 3648c2830fb..e20f4123d6d 100644 --- a/gcc/tree-ssa-ccp.c +++ b/gcc/tree-ssa-ccp.c @@ -887,7 +887,7 @@ ccp_finalize (void) align = (tem & -tem); if (align > 1) set_ptr_info_alignment (get_ptr_info (name), align, - (tree_to_hwi (val->value) + (TREE_INT_CST_LOW (val->value) & (align - 1))); } else @@ -1717,7 +1717,7 @@ evaluate_stmt (gimple stmt) case BUILT_IN_ALLOCA: case BUILT_IN_ALLOCA_WITH_ALIGN: align = (DECL_FUNCTION_CODE (fndecl) == BUILT_IN_ALLOCA_WITH_ALIGN - ? tree_to_hwi (gimple_call_arg (stmt, 1)) + ? TREE_INT_CST_LOW (gimple_call_arg (stmt, 1)) : BIGGEST_ALIGNMENT); val.lattice_val = CONSTANT; val.value = build_int_cst (TREE_TYPE (gimple_get_lhs (stmt)), 0); @@ -1924,7 +1924,7 @@ fold_builtin_alloca_with_align (gimple stmt) || !tree_fits_uhwi_p (arg)) return NULL_TREE; - size = tree_to_hwi (arg); + size = TREE_INT_CST_LOW (arg); /* Heuristic: don't fold large allocas. */ threshold = (unsigned HOST_WIDE_INT)PARAM_VALUE (PARAM_LARGE_STACK_FRAME); @@ -1942,7 +1942,7 @@ fold_builtin_alloca_with_align (gimple stmt) n_elem = size * 8 / BITS_PER_UNIT; array_type = build_array_type_nelts (elem_type, n_elem); var = create_tmp_var (array_type, NULL); - DECL_ALIGN (var) = tree_to_hwi (gimple_call_arg (stmt, 1)); + DECL_ALIGN (var) = TREE_INT_CST_LOW (gimple_call_arg (stmt, 1)); { struct ptr_info_def *pi = SSA_NAME_PTR_INFO (lhs); if (pi != NULL && !pi->pt.anything) diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c index cbbbbda8211..5dd8049582b 100644 --- a/gcc/tree-ssa-forwprop.c +++ b/gcc/tree-ssa-forwprop.c @@ -3037,11 +3037,11 @@ simplify_bitfield_ref (gimple_stmt_iterator *gsi) if (TREE_TYPE (op) != elem_type) return false; - size = tree_to_hwi (TYPE_SIZE (elem_type)); - n = tree_to_hwi (op1) / size; + size = TREE_INT_CST_LOW (TYPE_SIZE (elem_type)); + n = TREE_INT_CST_LOW (op1) / size; if (n != 1) return false; - idx = tree_to_hwi (op2) / size; + idx = TREE_INT_CST_LOW (op2) / size; if (code == VEC_PERM_EXPR) { @@ -3051,7 +3051,7 @@ simplify_bitfield_ref (gimple_stmt_iterator *gsi) if (TREE_CODE (m) != VECTOR_CST) return false; nelts = VECTOR_CST_NELTS (m); - idx = tree_to_hwi (VECTOR_CST_ELT (m, idx)); + idx = TREE_INT_CST_LOW (VECTOR_CST_ELT (m, idx)); idx %= 2 * nelts; if (idx < nelts) { @@ -3095,7 +3095,7 @@ is_combined_permutation_identity (tree mask1, tree mask2) { tree val = VECTOR_CST_ELT (mask, i); gcc_assert (TREE_CODE (val) == INTEGER_CST); - j = tree_to_hwi (val) & (2 * nelts - 1); + j = TREE_INT_CST_LOW (val) & (2 * nelts - 1); if (j == i) maybe_identity2 = false; else if (j == i + nelts) @@ -3240,7 +3240,7 @@ simplify_vector_constructor (gimple_stmt_iterator *gsi) nelts = TYPE_VECTOR_SUBPARTS (type); elem_type = TREE_TYPE (type); - elem_size = tree_to_hwi (TYPE_SIZE (elem_type)); + elem_size = TREE_INT_CST_LOW (TYPE_SIZE (elem_type)); sel = XALLOCAVEC (unsigned char, nelts); orig = NULL; @@ -3275,9 +3275,9 @@ simplify_vector_constructor (gimple_stmt_iterator *gsi) return false; orig = ref; } - if (tree_to_hwi (TREE_OPERAND (op1, 1)) != elem_size) + if (TREE_INT_CST_LOW (TREE_OPERAND (op1, 1)) != elem_size) return false; - sel[i] = tree_to_hwi (TREE_OPERAND (op1, 2)) / elem_size; + sel[i] = TREE_INT_CST_LOW (TREE_OPERAND (op1, 2)) / elem_size; if (sel[i] != i) maybe_ident = false; } if (i < nelts) diff --git a/gcc/tree-ssa-loop-prefetch.c b/gcc/tree-ssa-loop-prefetch.c index f5318887103..8046309f950 100644 --- a/gcc/tree-ssa-loop-prefetch.c +++ b/gcc/tree-ssa-loop-prefetch.c @@ -514,7 +514,7 @@ analyze_ref (struct loop *loop, tree *ref_p, tree *base, for (; TREE_CODE (ref) == COMPONENT_REF; ref = TREE_OPERAND (ref, 0)) { off = DECL_FIELD_BIT_OFFSET (TREE_OPERAND (ref, 1)); - bit_offset = tree_to_hwi (off); + bit_offset = TREE_INT_CST_LOW (off); gcc_assert (bit_offset % BITS_PER_UNIT == 0); *delta += bit_offset / BITS_PER_UNIT; diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c index 77900876930..0a91a6d90a3 100644 --- a/gcc/tree-ssa-math-opts.c +++ b/gcc/tree-ssa-math-opts.c @@ -1763,7 +1763,7 @@ find_bswap_1 (gimple stmt, struct symbolic_number *n, int limit) case RSHIFT_EXPR: case LROTATE_EXPR: case RROTATE_EXPR: - if (!do_shift_rotate (code, n, (int)tree_to_hwi (rhs2))) + if (!do_shift_rotate (code, n, (int)TREE_INT_CST_LOW (rhs2))) return NULL_TREE; break; CASE_CONVERT: @@ -1856,7 +1856,7 @@ find_bswap (gimple stmt) increase that number by three here in order to also cover signed -> unsigned converions of the src operand as can be seen in libgcc, and for initial shift/and operation of the src operand. */ - limit = tree_to_hwi (TYPE_SIZE_UNIT (gimple_expr_type (stmt))); + limit = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (gimple_expr_type (stmt))); limit += 1 + (int) ceil_log2 ((unsigned HOST_WIDE_INT) limit); source_expr = find_bswap_1 (stmt, &n, limit); diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c index d23eebd3cd6..4c3dca822f5 100644 --- a/gcc/tree-ssa-reassoc.c +++ b/gcc/tree-ssa-reassoc.c @@ -1054,7 +1054,7 @@ decrement_power (gimple stmt) CASE_FLT_FN (BUILT_IN_POWI): arg1 = gimple_call_arg (stmt, 1); - power = tree_to_hwi (arg1) - 1; + power = TREE_INT_CST_LOW (arg1) - 1; gimple_call_set_arg (stmt, 1, build_int_cst (TREE_TYPE (arg1), power)); return power; diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index 6fbb493fe76..ab983ecf3b6 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -658,11 +658,11 @@ vn_reference_eq (const_vn_reference_t const vr1, const_vn_reference_t const vr2) } else if (INTEGRAL_TYPE_P (vr1->type) && (TYPE_PRECISION (vr1->type) - != tree_to_hwi (TYPE_SIZE (vr1->type)))) + != TREE_INT_CST_LOW (TYPE_SIZE (vr1->type)))) return false; else if (INTEGRAL_TYPE_P (vr2->type) && (TYPE_PRECISION (vr2->type) - != tree_to_hwi (TYPE_SIZE (vr2->type)))) + != TREE_INT_CST_LOW (TYPE_SIZE (vr2->type)))) return false; i = 0; @@ -803,7 +803,7 @@ copy_reference_ops_from_ref (tree ref, vec<vn_reference_op_s> *result) && TREE_CODE (this_offset) == INTEGER_CST) { tree bit_offset = DECL_FIELD_BIT_OFFSET (TREE_OPERAND (ref, 1)); - if (tree_to_hwi (bit_offset) % BITS_PER_UNIT == 0) + if (TREE_INT_CST_LOW (bit_offset) % BITS_PER_UNIT == 0) { offset_int off = (wi::to_offset (this_offset) @@ -883,7 +883,7 @@ copy_reference_ops_from_ref (tree ref, vec<vn_reference_op_s> *result) break; case IMAGPART_EXPR: /* This is only interesting for its constant offset. */ - temp.off = tree_to_hwi (TYPE_SIZE_UNIT (TREE_TYPE (ref))); + temp.off = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (ref))); break; default: gcc_unreachable (); @@ -1012,7 +1012,7 @@ ao_ref_init_from_vn_reference (ao_ref *ref, { offset += (tree_to_uhwi (DECL_FIELD_OFFSET (field)) * BITS_PER_UNIT); - offset += tree_to_hwi (DECL_FIELD_BIT_OFFSET (field)); + offset += TREE_INT_CST_LOW (DECL_FIELD_BIT_OFFSET (field)); } break; } @@ -1300,7 +1300,7 @@ fully_constant_vn_reference_p (vn_reference_t ref) && compare_tree_int (op->op0, TREE_STRING_LENGTH (arg0->op0)) < 0) return build_int_cst_type (op->type, (TREE_STRING_POINTER (arg0->op0) - [tree_to_hwi (op->op0)])); + [TREE_INT_CST_LOW (op->op0)])); } return NULL_TREE; @@ -1696,7 +1696,7 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *vr_) { tree val = NULL_TREE; HOST_WIDE_INT elsz - = tree_to_hwi (TYPE_SIZE (TREE_TYPE (TREE_TYPE (rhs1)))); + = TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (TREE_TYPE (rhs1)))); if (gimple_assign_rhs_code (def_stmt2) == COMPLEX_EXPR) { if (off == 0) @@ -1900,7 +1900,7 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *vr_) && TREE_CODE (rhs) != ADDR_EXPR) return (void *)-1; - copy_size = tree_to_hwi (gimple_call_arg (def_stmt, 2)); + copy_size = TREE_INT_CST_LOW (gimple_call_arg (def_stmt, 2)); /* The bases of the destination and the references have to agree. */ if ((TREE_CODE (base) != MEM_REF @@ -1916,7 +1916,7 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *vr_) /* And the access has to be contained within the memcpy destination. */ at = offset / BITS_PER_UNIT; if (TREE_CODE (base) == MEM_REF) - at += tree_to_hwi (TREE_OPERAND (base, 1)); + at += TREE_INT_CST_LOW (TREE_OPERAND (base, 1)); if (lhs_offset > at || lhs_offset + copy_size < at + maxsize / BITS_PER_UNIT) return (void *)-1; diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index fe0ca3709b5..bcb617a1b95 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -5359,7 +5359,7 @@ push_fields_onto_fieldstack (tree type, vec<fieldoff_s> *fieldstack, && !pair->has_unknown_size && pair->offset + (HOST_WIDE_INT)pair->size == offset + foff) { - pair->size += tree_to_hwi (DECL_SIZE (field)); + pair->size += TREE_INT_CST_LOW (DECL_SIZE (field)); } else { @@ -5367,7 +5367,7 @@ push_fields_onto_fieldstack (tree type, vec<fieldoff_s> *fieldstack, e.offset = offset + foff; e.has_unknown_size = has_unknown_size; if (!has_unknown_size) - e.size = tree_to_hwi (DECL_SIZE (field)); + e.size = TREE_INT_CST_LOW (DECL_SIZE (field)); else e.size = -1; e.must_have_pointers = must_have_pointers_p; @@ -5684,7 +5684,7 @@ create_variable_info_for_1 (tree decl, const char *name) vi = new_var_info (decl, name); vi->offset = 0; vi->may_have_pointers = true; - vi->fullsize = tree_to_hwi (declsize); + vi->fullsize = TREE_INT_CST_LOW (declsize); vi->size = vi->fullsize; vi->is_full_var = true; fieldstack.release (); @@ -5692,7 +5692,7 @@ create_variable_info_for_1 (tree decl, const char *name) } vi = new_var_info (decl, name); - vi->fullsize = tree_to_hwi (declsize); + vi->fullsize = TREE_INT_CST_LOW (declsize); for (i = 0, newvi = vi; fieldstack.iterate (i, &fo); ++i, newvi = vi_next (newvi)) diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c index ab0aec58bac..7d5309c4a42 100644 --- a/gcc/tree-vect-data-refs.c +++ b/gcc/tree-vect-data-refs.c @@ -117,7 +117,7 @@ vect_get_smallest_scalar_type (gimple stmt, HOST_WIDE_INT *lhs_size_unit, tree scalar_type = gimple_expr_type (stmt); HOST_WIDE_INT lhs, rhs; - lhs = rhs = tree_to_hwi (TYPE_SIZE_UNIT (scalar_type)); + lhs = rhs = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (scalar_type)); if (is_gimple_assign (stmt) && (gimple_assign_cast_p (stmt) @@ -127,7 +127,7 @@ vect_get_smallest_scalar_type (gimple stmt, HOST_WIDE_INT *lhs_size_unit, { tree rhs_type = TREE_TYPE (gimple_assign_rhs1 (stmt)); - rhs = tree_to_hwi (TYPE_SIZE_UNIT (rhs_type)); + rhs = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (rhs_type)); if (rhs < lhs) scalar_type = rhs_type; } @@ -544,16 +544,16 @@ vect_slp_analyze_data_ref_dependence (struct data_dependence_relation *ddr) return true; /* Check the types. */ - type_size_a = tree_to_hwi (TYPE_SIZE_UNIT (TREE_TYPE (DR_REF (dra)))); - type_size_b = tree_to_hwi (TYPE_SIZE_UNIT (TREE_TYPE (DR_REF (drb)))); + type_size_a = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (DR_REF (dra)))); + type_size_b = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (DR_REF (drb)))); if (type_size_a != type_size_b || !types_compatible_p (TREE_TYPE (DR_REF (dra)), TREE_TYPE (DR_REF (drb)))) return true; - init_a = tree_to_hwi (DR_INIT (dra)); - init_b = tree_to_hwi (DR_INIT (drb)); + init_a = TREE_INT_CST_LOW (DR_INIT (dra)); + init_b = TREE_INT_CST_LOW (DR_INIT (drb)); /* Two different locations - no dependence. */ if (init_a != init_b) @@ -656,7 +656,7 @@ vect_compute_data_ref_alignment (struct data_reference *dr) if (loop && nested_in_vect_loop_p (loop, stmt)) { tree step = DR_STEP (dr); - HOST_WIDE_INT dr_step = tree_to_hwi (step); + HOST_WIDE_INT dr_step = TREE_INT_CST_LOW (step); if (dr_step % GET_MODE_SIZE (TYPE_MODE (vectype)) == 0) { @@ -684,7 +684,7 @@ vect_compute_data_ref_alignment (struct data_reference *dr) if (!loop) { tree step = DR_STEP (dr); - HOST_WIDE_INT dr_step = tree_to_hwi (step); + HOST_WIDE_INT dr_step = TREE_INT_CST_LOW (step); if (dr_step % GET_MODE_SIZE (TYPE_MODE (vectype)) != 0) { @@ -781,7 +781,7 @@ vect_compute_data_ref_alignment (struct data_reference *dr) return false; } - SET_DR_MISALIGNMENT (dr, tree_to_hwi (misalign)); + SET_DR_MISALIGNMENT (dr, TREE_INT_CST_LOW (misalign)); if (dump_enabled_p ()) { @@ -2005,12 +2005,12 @@ vect_analyze_group_access (struct data_reference *dr) { tree step = DR_STEP (dr); tree scalar_type = TREE_TYPE (DR_REF (dr)); - HOST_WIDE_INT type_size = tree_to_hwi (TYPE_SIZE_UNIT (scalar_type)); + HOST_WIDE_INT type_size = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (scalar_type)); gimple stmt = DR_STMT (dr); stmt_vec_info stmt_info = vinfo_for_stmt (stmt); loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_info); bb_vec_info bb_vinfo = STMT_VINFO_BB_VINFO (stmt_info); - HOST_WIDE_INT dr_step = tree_to_hwi (step); + HOST_WIDE_INT dr_step = TREE_INT_CST_LOW (step); HOST_WIDE_INT groupsize, last_accessed_element = 1; bool slp_impossible = false; struct loop *loop = NULL; @@ -2131,8 +2131,8 @@ vect_analyze_group_access (struct data_reference *dr) /* Check that the distance between two accesses is equal to the type size. Otherwise, we have gaps. */ - diff = (tree_to_hwi (DR_INIT (data_ref)) - - tree_to_hwi (prev_init)) / type_size; + diff = (TREE_INT_CST_LOW (DR_INIT (data_ref)) + - TREE_INT_CST_LOW (prev_init)) / type_size; if (diff != 1) { /* FORNOW: SLP of accesses with gaps is not supported. */ @@ -2322,7 +2322,7 @@ vect_analyze_data_ref_access (struct data_reference *dr) /* Consecutive? */ if (TREE_CODE (step) == INTEGER_CST) { - HOST_WIDE_INT dr_step = tree_to_hwi (step); + HOST_WIDE_INT dr_step = TREE_INT_CST_LOW (step); if (!tree_int_cst_compare (step, TYPE_SIZE_UNIT (scalar_type)) || (dr_step < 0 && !compare_tree_int (TYPE_SIZE_UNIT (scalar_type), -dr_step))) @@ -2563,19 +2563,19 @@ vect_analyze_data_ref_accesses (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo) break; /* Sorting has ensured that DR_INIT (dra) <= DR_INIT (drb). */ - HOST_WIDE_INT init_a = tree_to_hwi (DR_INIT (dra)); - HOST_WIDE_INT init_b = tree_to_hwi (DR_INIT (drb)); + HOST_WIDE_INT init_a = TREE_INT_CST_LOW (DR_INIT (dra)); + HOST_WIDE_INT init_b = TREE_INT_CST_LOW (DR_INIT (drb)); gcc_assert (init_a < init_b); /* If init_b == init_a + the size of the type * k, we have an interleaving, and DRA is accessed before DRB. */ - HOST_WIDE_INT type_size_a = tree_to_hwi (sza); + HOST_WIDE_INT type_size_a = TREE_INT_CST_LOW (sza); if ((init_b - init_a) % type_size_a != 0) break; /* The step (if not zero) is greater than the difference between data-refs' inits. This splits groups into suitable sizes. */ - HOST_WIDE_INT step = tree_to_hwi (DR_STEP (dra)); + HOST_WIDE_INT step = TREE_INT_CST_LOW (DR_STEP (dra)); if (step != 0 && step <= (init_b - init_a)) break; @@ -5137,7 +5137,7 @@ vect_supportable_dr_alignment (struct data_reference *dr, { tree vectype = STMT_VINFO_VECTYPE (stmt_info); if ((nested_in_vect_loop - && (tree_to_hwi (DR_STEP (dr)) + && (TREE_INT_CST_LOW (DR_STEP (dr)) != GET_MODE_SIZE (TYPE_MODE (vectype)))) || !loop_vinfo) return dr_explicit_realign; diff --git a/gcc/tree-vect-generic.c b/gcc/tree-vect-generic.c index 135716cd92f..5b867b09d99 100644 --- a/gcc/tree-vect-generic.c +++ b/gcc/tree-vect-generic.c @@ -449,7 +449,7 @@ expand_vector_divmod (gimple_stmt_iterator *gsi, tree type, tree op0, if (sign_p == UNSIGNED) { unsigned HOST_WIDE_INT mh; - unsigned HOST_WIDE_INT d = tree_to_hwi (cst) & mask; + unsigned HOST_WIDE_INT d = TREE_INT_CST_LOW (cst) & mask; if (d >= ((unsigned HOST_WIDE_INT) 1 << (prec - 1))) /* FIXME: Can transform this into op0 >= op1 ? 1 : 0. */ @@ -519,7 +519,7 @@ expand_vector_divmod (gimple_stmt_iterator *gsi, tree type, tree op0, } else { - HOST_WIDE_INT d = tree_to_hwi (cst); + HOST_WIDE_INT d = TREE_INT_CST_LOW (cst); unsigned HOST_WIDE_INT abs_d; if (d == -1) @@ -1049,7 +1049,7 @@ vector_element (gimple_stmt_iterator *gsi, tree vect, tree idx, tree *ptmpvec) /* Given that we're about to compute a binary modulus, we don't care about the high bits of the value. */ - index = tree_to_hwi (idx); + index = TREE_INT_CST_LOW (idx); if (!tree_fits_uhwi_p (idx) || index >= elements) { index &= elements - 1; @@ -1155,7 +1155,7 @@ lower_vec_perm (gimple_stmt_iterator *gsi) unsigned char *sel_int = XALLOCAVEC (unsigned char, elements); for (i = 0; i < elements; ++i) - sel_int[i] = (tree_to_hwi (VECTOR_CST_ELT (mask, i)) + sel_int[i] = (TREE_INT_CST_LOW (VECTOR_CST_ELT (mask, i)) & (2 * elements - 1)); if (can_vec_perm_p (TYPE_MODE (vect_type), false, sel_int)) @@ -1181,7 +1181,7 @@ lower_vec_perm (gimple_stmt_iterator *gsi) { unsigned HOST_WIDE_INT index; - index = tree_to_hwi (i_val); + index = TREE_INT_CST_LOW (i_val); if (!tree_fits_uhwi_p (i_val) || index >= elements) i_val = build_int_cst (mask_elt_type, index & (elements - 1)); diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index 934f14fffca..4a68157fee6 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -1272,7 +1272,7 @@ vect_analyze_loop_form (struct loop *loop) dump_printf (MSG_NOTE, "\n"); } } - else if (tree_to_hwi (number_of_iterations) == 0) + else if (TREE_INT_CST_LOW (number_of_iterations) == 0) { if (dump_enabled_p ()) dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, @@ -3614,7 +3614,7 @@ get_initial_def_for_reduction (gimple stmt, tree init_val, if (SCALAR_FLOAT_TYPE_P (scalar_type)) init_value = build_real (scalar_type, TREE_REAL_CST (init_val)); else - init_value = build_int_cst (scalar_type, tree_to_hwi (init_val)); + init_value = build_int_cst (scalar_type, TREE_INT_CST_LOW (init_val)); } else init_value = init_val; diff --git a/gcc/tree-vect-patterns.c b/gcc/tree-vect-patterns.c index d16673fccbc..068c90aa547 100644 --- a/gcc/tree-vect-patterns.c +++ b/gcc/tree-vect-patterns.c @@ -2077,8 +2077,8 @@ vect_recog_divmod_pattern (vec<gimple> *stmts, { unsigned HOST_WIDE_INT mh, ml; int pre_shift, post_shift; - unsigned HOST_WIDE_INT d = tree_to_hwi (oprnd1) - & GET_MODE_MASK (TYPE_MODE (itype)); + unsigned HOST_WIDE_INT d = (TREE_INT_CST_LOW (oprnd1) + & GET_MODE_MASK (TYPE_MODE (itype))); tree t1, t2, t3, t4; if (d >= ((unsigned HOST_WIDE_INT) 1 << (prec - 1))) @@ -2194,7 +2194,7 @@ vect_recog_divmod_pattern (vec<gimple> *stmts, { unsigned HOST_WIDE_INT ml; int post_shift; - HOST_WIDE_INT d = tree_to_hwi (oprnd1); + HOST_WIDE_INT d = TREE_INT_CST_LOW (oprnd1); unsigned HOST_WIDE_INT abs_d; bool add = false; tree t1, t2, t3, t4; diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index 292a7491b36..54d821af9c0 100644 --- a/gcc/tree-vect-stmts.c +++ b/gcc/tree-vect-stmts.c @@ -5014,7 +5014,7 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt, nested within an outer-loop that is being vectorized. */ if (nested_in_vect_loop - && (tree_to_hwi (DR_STEP (dr)) + && (TREE_INT_CST_LOW (DR_STEP (dr)) % GET_MODE_SIZE (TYPE_MODE (vectype)) != 0)) { gcc_assert (alignment_support_scheme != dr_explicit_realign_optimized); diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h index 579ae05eb01..1634d7fa7f5 100644 --- a/gcc/tree-vectorizer.h +++ b/gcc/tree-vectorizer.h @@ -365,7 +365,7 @@ typedef struct _loop_vec_info { #define LOOP_VINFO_LOOP_NEST(L) (L)->loop_nest #define LOOP_VINFO_DATAREFS(L) (L)->datarefs #define LOOP_VINFO_DDRS(L) (L)->ddrs -#define LOOP_VINFO_INT_NITERS(L) (tree_to_hwi ((L)->num_iters)) +#define LOOP_VINFO_INT_NITERS(L) (TREE_INT_CST_LOW ((L)->num_iters)) #define LOOP_PEELING_FOR_ALIGNMENT(L) (L)->peeling_for_alignment #define LOOP_VINFO_UNALIGNED_DR(L) (L)->unaligned_dr #define LOOP_VINFO_MAY_MISALIGN_STMTS(L) (L)->may_misalign_stmts diff --git a/gcc/tree.c b/gcc/tree.c index 162a5df2a74..d97904b8e2e 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -2664,7 +2664,7 @@ int_size_in_bytes (const_tree type) t = TYPE_SIZE_UNIT (type); if (t && cst_fits_uhwi_p (t)) - return tree_to_hwi (t); + return TREE_INT_CST_LOW (t); else return -1; } @@ -7231,9 +7231,9 @@ compare_tree_int (const_tree t, unsigned HOST_WIDE_INT u) return -1; else if (!cst_fits_uhwi_p (t)) return 1; - else if ((unsigned HOST_WIDE_INT) tree_to_hwi (t) == u) + else if (TREE_INT_CST_LOW (t) == u) return 0; - else if ((unsigned HOST_WIDE_INT) tree_to_hwi (t) < u) + else if (TREE_INT_CST_LOW (t) < u) return -1; else return 1; @@ -10123,10 +10123,10 @@ build_vector_type_for_mode (tree innertype, enum machine_mode mode) case MODE_INT: /* Check that there are no leftover bits. */ gcc_assert (GET_MODE_BITSIZE (mode) - % tree_to_hwi (TYPE_SIZE (innertype)) == 0); + % TREE_INT_CST_LOW (TYPE_SIZE (innertype)) == 0); nunits = GET_MODE_BITSIZE (mode) - / tree_to_hwi (TYPE_SIZE (innertype)); + / TREE_INT_CST_LOW (TYPE_SIZE (innertype)); break; default: @@ -10449,7 +10449,7 @@ HOST_WIDE_INT int_cst_value (const_tree x) { unsigned bits = TYPE_PRECISION (TREE_TYPE (x)); - unsigned HOST_WIDE_INT val = tree_to_hwi (x); + unsigned HOST_WIDE_INT val = TREE_INT_CST_LOW (x); /* Make sure the sign-extended value will fit in a HOST_WIDE_INT. */ gcc_assert (cst_fits_shwi_p (x)); @@ -10472,7 +10472,7 @@ HOST_WIDEST_INT widest_int_cst_value (const_tree x) { unsigned bits = TYPE_PRECISION (TREE_TYPE (x)); - unsigned HOST_WIDEST_INT val = tree_to_hwi (x); + unsigned HOST_WIDEST_INT val = TREE_INT_CST_LOW (x); #if HOST_BITS_PER_WIDEST_INT > HOST_BITS_PER_WIDE_INT gcc_assert (HOST_BITS_PER_WIDEST_INT >= HOST_BITS_PER_DOUBLE_INT); diff --git a/gcc/tree.h b/gcc/tree.h index 7045f10411c..cdc9ed43584 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -903,6 +903,8 @@ extern void omp_clause_range_check_failed (const_tree, const char *, int, #define TREE_INT_CST_EXT_NUNITS(NODE) \ (INTEGER_CST_CHECK (NODE)->base.u.int_length.extended) #define TREE_INT_CST_ELT(NODE, I) TREE_INT_CST_ELT_CHECK (NODE, I) +#define TREE_INT_CST_LOW(NODE) \ + ((unsigned HOST_WIDE_INT) TREE_INT_CST_ELT (NODE, 0)) #define INT_CST_LT(A, B) (wi::lts_p (wi::to_widest (A), wi::to_widest (B))) #define INT_CST_LE(A, B) (wi::les_p (wi::to_widest (A), wi::to_widest (B))) @@ -1023,7 +1025,7 @@ extern void omp_clause_range_check_failed (const_tree, const char *, int, Note that we have to bypass the use of TREE_OPERAND to access that field to avoid infinite recursion in expanding the macros. */ #define VL_EXP_OPERAND_LENGTH(NODE) \ - ((int)tree_to_hwi (VL_EXP_CHECK (NODE)->exp.operands[0])) + ((int)TREE_INT_CST_LOW (VL_EXP_CHECK (NODE)->exp.operands[0])) /* Nonzero if is_gimple_debug() may possibly hold. */ #define MAY_HAVE_DEBUG_STMTS (flag_var_tracking_assignments) @@ -1125,7 +1127,7 @@ extern void protected_set_expr_location (tree, location_t); #define CHREC_VAR(NODE) TREE_OPERAND (POLYNOMIAL_CHREC_CHECK (NODE), 0) #define CHREC_LEFT(NODE) TREE_OPERAND (POLYNOMIAL_CHREC_CHECK (NODE), 1) #define CHREC_RIGHT(NODE) TREE_OPERAND (POLYNOMIAL_CHREC_CHECK (NODE), 2) -#define CHREC_VARIABLE(NODE) tree_to_hwi (CHREC_VAR (NODE)) +#define CHREC_VARIABLE(NODE) TREE_INT_CST_LOW (CHREC_VAR (NODE)) /* LABEL_EXPR accessor. This gives access to the label associated with the given label expression. */ @@ -3174,16 +3176,6 @@ cst_fits_uhwi_p (const_tree x) return TREE_INT_CST_NUNITS (x) == 1 && TREE_INT_CST_ELT (x, 0) >= 0; } -/* Return the HOST_WIDE_INT least significant bits of CST. No - checking is done to assure that it fits. It is assumed that one of - tree_fits_uhwi_p or tree_fits_shwi_p was done before this call. */ - -static inline HOST_WIDE_INT -tree_to_hwi (const_tree cst) -{ - return TREE_INT_CST_ELT (cst, 0); -} - /* Compute the number of operands in an expression node NODE. For tcc_vl_exp nodes like CALL_EXPRs, this is stored in the node itself, otherwise it is looked up from the node's code. */ |