aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
AgeCommit message (Collapse)AuthorFilesLines
2005-01-23alias.c, [...]: Fix comment typos.Kazu Hirata1-1/+1
* alias.c, c-common.h, c-incpath.c, c-incpath.h, expr.c, fold-const.c, gimplify.c, params.h, tree-data-ref.c, tree-if-conv.c, tree-nested.c, tree-outof-ssa.c, tree-ssa-dom.c, tree-vectorizer.c, tree.def, config/darwin.c, config/freebsd-spec.h, config/arm/arm.h, config/h8300/h8300.md, config/i386/i386.md, config/i386/predicates.md, config/i386/sse.md, config/ia64/ia64.c, config/ip2k/ip2k.c, config/s390/s390.c, config/vax/vax.md: Fix comment typos. Follow spelling conventions. From-SVN: r94112
2005-01-21re PR rtl-optimization/576 (gcc performs invalid optimization with float ↵Roger Sayle1-14/+19
operations when different rounding mode.) PR rtl-optimization/576 * real.c (real_arithmetic): Change return type from void to bool to return an indication that the result may be inexact. * real.h (real_arithmeric): Update prototype. * fold-const.c (const_binop): Don't constant fold floating point expressions when the user specifies -frounding-math and the result may depend upon the run-time rounding mode. (fold_convert_const_real_from_real): Clean-up. (fold_initializer): Ignore flag_rounding_math for initializers. * simplify-rtx.c (simplify_binary_operation): Likewise, don't constant fold FP operations with flag_rounding_math if the result may depend upon the run-time rounding mode. From-SVN: r94020
2005-01-18calls.c (expand_call): Check DECL_BUILT_IN_CLASS before accessing ↵Eric Botcazou1-5/+2
DECL_FUNCTION_CODE. * calls.c (expand_call): Check DECL_BUILT_IN_CLASS before accessing DECL_FUNCTION_CODE. * dojump.c (do_jump): Likewise. * gimplify.c (gimplify_call_expr): Likewise. * predict.c (expr_expected_value): Likewise. (strip_builtin_expect): Likewise. * tree-inline.c (estimate_num_insns_1): Likewise. * tree-ssa-loop-im.c (stmt_cost): Likewise * fold-const.c (fold): Test for BUILT_IN_NORMAL. (tree_expr_nonnegative_p): Likewise. From-SVN: r93864
2005-01-18basic-block.h, [...]: Update copyright.Kazu Hirata1-1/+1
* basic-block.h, c-common.c, c-cppbuiltin.c, c-lang.c, c-tree.h, cfgbuild.c, cgraph.c, cgraph.h, collect2.c, combine.c, config.gcc, coverage.h, cse.c, cselib.c, defaults.h, df.c, dwarf2asm.c, dwarf2out.c, explow.c, expr.c, flow.c, fold-const.c, gcse.c, ggc-page.c, gimple-low.c, gimplify.c, ifcvt.c, langhooks-def.h, lcm.c, optabs.h, output.h, postreload-gcse.c, postreload.c, recog.c, resource.c, rtl.def, rtlanal.c, sched-deps.c, sched-rgn.c, targhooks.h, toplev.c, tree-data-ref.c, tree-eh.c, tree-flow.h, tree-loop-linear.c, tree-mudflap.h, tree-nrv.c, tree-optimize.c, tree-outof-ssa.c, tree-pass.h, tree-scalar-evolution.c, tree-ssa-copy.c, tree-ssa-dce.c, tree-ssa-dse.c, tree-ssa-loop-ivopts.c, tree-ssa-operands.c, tree-ssa-pre.c, tree-ssa.c, tree-vectorizer.c, tree.def, unwind-dw2-fde-darwin.c, var-tracking.c: Update copyright. From-SVN: r93827
2005-01-15re PR tree-optimization/19060 (Miscompiling of if and "long long")Jakub Jelinek1-20/+52
PR tree-optimization/19060 * tree-ssa-dom.c (extract_range_from_cond) <case LT_EXPR, GT_EXPR>: Return 0 if op1 <= TYPE_MIN_VALUE () resp. op1 >= TYPE_MAX_VALUE (). (simplify_cond_and_lookup_avail_expr): Add assert for dummy == 0 and handle extract_range_from_cond returning false. * fold-const.c (fold): Optimize comparisons with min/max even for width > HOST_BITS_PER_WIDE_INT. * gcc.c-torture/execute/20050104-1.c: New test. From-SVN: r93692
2005-01-09fold-const.c (fold): Also handle EXACT_DIV_EXPR when folding X/C1 cmpop C2.Falk Hueffner1-1/+2
* fold-const.c (fold): Also handle EXACT_DIV_EXPR when folding X/C1 cmpop C2. From-SVN: r93121
2005-01-07re PR tree-optimization/19283 (Bad code generated in final_cleanup)Jakub Jelinek1-1/+4
PR tree-optimization/19283 * fold-const.c (fold_widened_comparison): Return NULL if shorter_type is not shorter than the original type. * gcc.c-torture/execute/20050106-1.c: New test. From-SVN: r93043
2005-01-04fold-const.c (fold_single_bit_test): Delete unreachable handling of ↵Roger Sayle1-22/+1
TRUTH_NOT_EXPR. * fold-const.c (fold_single_bit_test): Delete unreachable handling of TRUTH_NOT_EXPR. (fold): Don't call fold_single_bit_test with a TRUTH_NOT_EXPR, as all the cases handled by it are inverted by invert_truthvalue. From-SVN: r92909
2005-01-04fold-const.c (force_fit_type): Cope with types larger than 2 HWI.Richard Henderson1-131/+149
* fold-const.c (force_fit_type): Cope with types larger than 2 HWI. (fold_convert_const_int_from_int, fold_convert_const_int_from_real, fold_convert_const_real_from_real): Split out from ... (fold_convert_const): ... here. From-SVN: r92890
2004-12-28fold-const.c (fold_build_cleanup_point_expr): For a RETURN_EXPR...Andrew Pinski1-0/+15
2004-12-28 Andrew Pinski <pinskia@physics.uc.edu> * fold-const.c (fold_build_cleanup_point_expr): For a RETURN_EXPR, we only need a cleanup point expression when the expression on the left hand side of the MODIFIY_EXPR inside the return has side effects. From-SVN: r92672
2004-12-23re PR middle-end/17746 (ICE when building the Ada RTS)Eric Botcazou1-4/+5
PR middle-end/17746 * expr.c (get_inner_reference): Add 'keep_aligning' parameter. Break on aligning VIEW_CONVERT_EXPR nodes on STRICT_ALIGNMENT platforms only if keep_aligning is true. (expand_assignment): Adjust call to get_inner_reference. (expand_expr_addr_expr_1): Likewise. (expand_expr_real_1): Likewise. * dojump.c (do_jump): Likewise. * dwarf2out.c (loc_descriptor_from_tree_1): Likewise. * fold-const.c (optimize_bit_field_compare): Likewise. (decode_field_reference): Likewise. (split_address_to_core_and_offset): Likewise. * tree-ssa-loop-ivopts.c (split_address_cost): Likewise. * expr.h (get_inner_reference): Adjust prototype. ada/ * trans.c (Attribute_to_gnu): Adjust call to get_inner_reference. * utils2.c (build_unary_op): Likewise. From-SVN: r92549
2004-12-18fold-const.c (multiple_of_p): Handle BIT_AND_EXPR when BOTTOM is a power of two.Richard Henderson1-0/+7
* fold-const.c (multiple_of_p): Handle BIT_AND_EXPR when BOTTOM is a power of two. From-SVN: r92358
2004-12-14fold-const.c (fold_single_bit_test): If flag_syntax_only, pretend ↵Jakub Jelinek1-5/+8
LOAD_EXTEND_OP is not defined. * fold-const.c (fold_single_bit_test): If flag_syntax_only, pretend LOAD_EXTEND_OP is not defined. (fold): Likewise. If flag_syntax_only, don't depend on BITS_PER_WORD. From-SVN: r92150
2004-12-11re PR middle-end/18921 (wrong code with operator "?")Roger Sayle1-6/+6
PR middle-end/18921 * fold-const.c (fold_unwidened_comparison): Use omit_one_operand instead of constant_boolean_node as arg0 may have side-effects. * gcc.dg/pr18921-1.c: New test case. From-SVN: r92030
2004-12-07c-common.c, [...]: Replace uses of first_rtl_op with TREE_CODE_LENGTH.Kazu Hirata1-3/+3
gcc/ * c-common.c, expr.c, fold-const.c, print-tree.c, tree-gimple.c, tree-inline.c, tree-pretty-print.c, tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c: Replace uses of first_rtl_op with TREE_CODE_LENGTH. * tree.c (first_rtl_op): Remove. Replace uses of first_rtl_op with TREE_CODE_LENGTH. * tree.h: Remove the prototype for first_rtl_op. gcc/cp/ * pt.c: Replace a use of first_rtl_op with TREE_CODE_LENGTH. From-SVN: r91818
2004-11-30fold-const.c (fold_widened_comparison): Make sure that we're passing an ↵Eric Christopher1-3/+3
INTEGER_TYPE to int_fits_type_p. 2004-11-30 Eric Christopher <echristo@redhat.com> * fold-const.c (fold_widened_comparison): Make sure that we're passing an INTEGER_TYPE to int_fits_type_p. (fold): Clean up comment. From-SVN: r91539
2004-11-29expr.c (get_inner_reference): Handle REAL/IMAGPART_EXPR.Richard Henderson1-3/+1
* expr.c (get_inner_reference): Handle REAL/IMAGPART_EXPR. (handled_component_p): Likewise. * alias.c (can_address_p): Reformat and simplify. Handle REAL/IMAGPART_EXPR. Do not disable addressability based on alias set zero. * fold-const.c (build_fold_addr_expr_with_type): Remove duplicate check for REAL/IMAGPART_EXPR. * gimplify.c (gimplify_compound_lval): Likewise. * tree-cfg.c (verify_expr): Likewise. * tree-gimple.c (is_gimple_addressable, get_base_address): Likewise. * tree-nested.c (build_addr, convert_nonlocal_reference): Likewise. (convert_local_reference): Likewise. * tree-ssa-loop-ivopts.c (prepare_decl_rtl): Likewise. From-SVN: r91511
2004-11-27* fold-const.c: Fix a comment typo.Kazu Hirata1-1/+1
From-SVN: r91393
2004-11-27fold-const.c (extract_muldiv_1): If ctype is unsigned and type signed...Jakub Jelinek1-1/+15
* fold-const.c (extract_muldiv_1) <case ABS_EXPR>: If ctype is unsigned and type signed, build ABS_EXPR with signed_type (ctype) and only afterwards convert to ctype. * gcc.c-torture/execute/20041126-1.c: New test. From-SVN: r91373
2004-11-24fold-const.c (operand_equal_p): Remove kludge allowing ARG0 and ARG1 to be ↵Richard Kenner1-54/+37
null... * fold-const.c (operand_equal_p): Remove kludge allowing ARG0 and ARG1 to be null; instead define OP_SAME and OP_SAME_NULL and use them. From-SVN: r91170
2004-11-23fold-const.c (nondestructive_fold_binary_to_constant): Rename to ↵Roger Sayle1-9/+6
fold_binary_to_constant. * fold-const.c (nondestructive_fold_binary_to_constant): Rename to fold_binary_to_constant. (nondestructive_fold_unary_to_constant): Likewise, rename to fold_unary_to_constant. (fold_relational_hi_lo): Update call to fold_binary_to_constant. * tree.h (nondestructive_fold_binary_to_constant): Update prototype. (nondestructive_fold_unary_to_constant): Likewise. * tree-ssa-ccp.c (ccp_fold): Update calls to fold_unary_to_constant and fold_binary_to_constant. * tree-ssa-loop-niter.c (EXEC_BINARY, EXEC_UNARY): Delete macros. (inverse, number_of_iterations_cond): Replace uses of EXEC_BINARY and EXEC_UNARY with calls to fold_*nary_to_constant. * tree-ssa-loop-ivopts.c (EXEC_BINARY, EXEC_UNARY): Delete macros. (idx_find_step): Replace uses of EXEC_BINARY with calls to fold_binary_to_constant. From-SVN: r91063
2004-11-22re PR tree-optimization/18529 (When the lower bound of a loop is ↵Zdenek Dvorak1-5/+63
non-constant we cannot find the number of iterations) PR tree-optimization/18529 * fold-const.c (fold_to_nonsharp_ineq_using_bound): New function. (simple_operand_p): Use STRIP_NOPS. Consider SSA names simple. (fold): Call fold_to_nonsharp_ineq_using_bound. * tree-ssa-loop-niter.c (simplify_replace_tree): New function. (number_of_iterations_cond): Fold the expressions before futher processing. (tree_simplify_using_condition): Handle case when cond or expr is an EQ_EXPR specially. From-SVN: r91031
2004-11-18re PR rtl-optimization/17107 (Opportunity to improve code generated for ↵Nathan Sidwell1-4/+5
complex logical expression) PR target/17107 * fold-const.c (RANGE_TEST_NON_SHORT_CIRCUIT): Rename to ... (LOGICAL_OP_NON_SHORT_CIRCUIT): ... here. (fold_range_test): Adjust. (fold_truthop): Use it. * config/rs6000/rs6000.h (RANGE_TEST_NON_SHORT_CIRCUIT): Rename to ... (LOGICAL_OP_NON_SHORT_CIRCUIT): ... here. From-SVN: r90857
2004-11-15re PR tree-optimization/18431 (Code for arrays and pointers are not the same)Zdenek Dvorak1-15/+143
PR tree-optimization/18431 * fold-const.c (associate_trees): Do not produce x + 0. (fold_widened_comparison, fold_sign_changed_comparison): New functions. (fold): Use them. * tree-ssa-loop-niter.c (upper_bound_in_type, lower_bound_in_type): Moved ... * tree.c (upper_bound_in_type, lower_bound_in_type): Here. * tree.h (upper_bound_in_type, lower_bound_in_type): Declare. * testsuite/gcc.c-torture/execute/20041114-1.c: New test. From-SVN: r90646
2004-11-10tree-ssa-loop-ivopts.c (get_address_cost): Add address elements in right order.Zdenek Dvorak1-13/+37
* tree-ssa-loop-ivopts.c (get_address_cost): Add address elements in right order. (force_var_cost): Determine cost of addition and multiplication more precisely. (get_computation_cost_at): Add cost for computing address elements to the final cost. * fold-const.c (fold): Attempt to use ptr_difference_const whenever one of the arguments of MINUS_EXPR is an address. (split_address_to_core_and_offset): New function. (ptr_difference_const): Handle case when one of the operands is a pointer. * tree-ssa-loop-ivopts.c (determine_base_object): Fold &*addr. (ptr_difference_cost): Pass addresses instead of objects to ptr_difference_const. From-SVN: r90451
2004-11-09fold-const.c (pedantic_non_lvalue): Make it static.Kazu Hirata1-1/+1
* fold-const.c (pedantic_non_lvalue): Make it static. * tree.h: Remove the corresponding prototype. From-SVN: r90352
2004-11-06fold-const.c (non_lvalue): Don't construct NON_LVALUE_EXPR if we are in GIMPLE.Kazu Hirata1-0/+5
* fold-const.c (non_lvalue): Don't construct NON_LVALUE_EXPR if we are in GIMPLE. From-SVN: r90187
2004-11-02fold-const.c (fold): Reassociate also (x - mult) + mult and (mult - x) + mult.Zdenek Dvorak1-10/+16
* fold-const.c (fold): Reassociate also (x - mult) + mult and (mult - x) + mult. Cast operands of expression after applying distributive law to the correct types. Apply distributive law to a * c - b * c for all non-float types. From-SVN: r90000
2004-10-27re PR tree-optimization/18048 (mgrid loop performance regression with ivopts ↵Zdenek Dvorak1-0/+107
(register pressure)) PR tree-optimization/18048 * fold-const.c (try_move_mult_to_index): New function. (fold): Use try_move_mult_to_index. * tree-ssa-loop-ivopts.c (try_add_cand_for): Prefer common candidates. * tree-ssa-loop-niter.c (number_of_iterations_cond): Produce an all-ones unsigned constant without extra bits. * tree.c (build_low_bits_mask): New function. * tree.h (build_low_bits_mask): Declare. From-SVN: r89708
2004-10-10re PR c++/17554 (crashes in on kopete build (KDE's kdenetwork))Andrew Pinski1-0/+15
2004-10-10 Andrew Pinski <pinskia@physics.uc.edu> PR c++/17554 part of c++/17657 middle-end/17703 * semantics.c (maybe_cleanup_point_expr): Call fold_build_cleanup_point_expr. (maybe_cleanup_point_expr_void): New function. (add_decl_expr): Call maybe_cleanup_point_expr_void. (finish_expr_stmt): Likewise. (finish_return_stmt): Likewise. (finish_for_expr): Likewise. (finish_asm_stmt): Likewise. * typeck.c (condition_conversion): Call fold_build_cleanup_point_expr. 2004-10-10 Andrew Pinski <pinskia@physics.uc.edu> PR middle-end/17703 part of PR c++/17657 * fold-const.c (fold_build_cleanup_point_expr): New function. * tree.h (fold_build_cleanup_point_expr): Prototype. 2004-10-10 Andrew Pinski <pinskia@physics.uc.edu> PR c++/17554 * g++.dg/init/for3.C: New test. PR c++/17657 * g++.dg/opt/switch2.C: New test. PR middle-end/17703 * g++.dg/warn/Wreturn-2.C: New test. From-SVN: r88869
2004-10-09re PR middle-end/17894 (div/compare folding incorrect)Roger Sayle1-0/+3
PR middle-end/17894 * fold-const.c (fold_div_compare): When optimizing X/C1 op C2, the relational comparison operator op needs to be swapped/reversed when C1 is negative. i.e. X/-10 < 1 becomes X >= -9, not X < -9. * gcc.c-torture/execute/divcmp-4.c: New test case. From-SVN: r88818
2004-10-03fold-const.c (fold): When seeing if D & ~C != 0 to fold (A & C) == D into 0, ↵Kazu Hirata1-9/+8
fold ~C. * fold-const.c (fold) [EQ_EXPR]: When seeing if D & ~C != 0 to fold (A & C) == D into 0, fold ~C. Similarly, for the case where | is used instead of &. * testsuite/gcc.dg/tree-ssa/20041002-1.c: New. From-SVN: r88449
2004-09-29fold-const.c (tree_swap_operands_p): Remove duplicated code.Eric Christopher1-35/+26
2004-09-29 Eric Christopher <echristo@redhat.com> * fold-const.c (tree_swap_operands_p): Remove duplicated code. From-SVN: r88299
2004-09-25c-typeck.c, [...]: Fix comment formatting.Kazu Hirata1-3/+3
* c-typeck.c, defaults.h, dwarf.h, dwarf2out.c, fold-const.c, gthr-dce.h, gthr-posix.h, gthr-solaris.h, gthr-win32.h, lambda-code.c, lambda-mat.c, libgcc2.c, stmt.c, tree-ssa-pre.c, tree-vn.c, tree.h: Fix comment formatting. From-SVN: r88102
2004-09-23tree.def (ALIGN_INDIRECT_REF, [...]): New tree-codes.Dorit Naishlos1-1/+7
2004-09-23 Dorit Naishlos <dorit@il.ibm.com> * tree.def (ALIGN_INDIRECT_REF, MISALIGNED_INDIRECT_REF): New tree-codes. * tree.h (REF_ORIGINAL): Consider ALIGN_INDIRECT_REF and MISALIGNED_INDIRECT_REF. * alias.c (get_alias_set, nonoverlapping_memrefs_p): Likewise. * emit-rtl.c (mem_expr_equal_p, set_mem_attributes_minus_bitpos): Likewise. * expr.c (safe_from_p, expand_expr_real_1, rewrite_address_base) (find_interesting_uses_address): Likewise. * fold-const.c (non_lvalue, operand_equal_p): Likewise. (build_fold_addr_expr_with_type): Likewise. * gimplify.c (gimplify_addr_expr, gimplify_expr): Likewise. * print-rtl.c (print_mem_expr): Likewise. * tree-dump.c (dequeue_and_dump): Likewise. * tree-eh.c (tree_could_trap_p): Likewise. * tree-gimple.c (is_gimple_addressable, get_base_address): Likewise. * tree-pretty-print.c (op_prio, op_symbol, dump_generic_node): Likewise. * tree-ssa-alias.c (find_ptr_dereference, ptr_is_dereferenced_by): Likewise. * tree-ssa-dce.c (mark_stmt_if_obviously_necessary): Likewise. * tree-ssa-dom.c (record_equivalences_from_stmt): Likewise. * tree-ssa-loop-im.c (for_each_index, is_call_clobbered_ref): Likewise. * tree-ssa-loop-ivopts.c (find_interesting_uses_address): Likewise. (add_address_candidates, rewrite_address_base): Likewise. * tree-ssa-operands.c (get_expr_operands, get_indirect_ref_operands): Likewise. * tree.c (staticp, build1_stat): Likewise. * tree.def (REALIGN_LOAD_EXPR, REALIGN_STORE_EXPR): New tree-codes. * tree-pretty-print.c (dump_generic_node): Consider REALIGN_LOAD_EXPR. * tree-ssa-operands.c (get_expr_operands): Likewise. * expr.c (expand_expr_real_1): Likewise. * optabs.h (vec_realign_store_optab, vec_realign_load_optab): New optabs. (OTI_vec_realign_store, OTI_vec_realign_load): New optab_index values for the new optabs. (expand_ternary_op): New function. * genopinit.c (optabs): Handle the new optabs. * optabs.c (optab_for_tree_code): Add cases for the new tree-codes. (init_optabs): Initialize vec_realign_load_optab. (expand_ternary_op): New functions. * target-def.h (TARGET_VECTORIZE): New member for struct gcc_target. (TARGET_VECTORIZE_MISALIGNED_MEM_OK): New member for targetm.vectorize. (TARGET_VECTORIZE_BUILTIN_MASK_FOR_LOAD): Likewise. (TARGET_VECTORIZE_BUILTIN_MASK_FOR_STORE): Likewise. * target.h (struct vectorize): New member for struct gcc_target. (misaligned_mem_ok): New member for targetm.vectorize. (builtin_mask_for_load): Likewise. (builtin_mask_for_store): Likewise. * targethooks.c (default_vect_misaligned_mem_ok): New function. * targethooks.h (default_vect_misaligned_mem_ok): New function. * config/rs6000/altivec.md (build_vector_mask_for_load): New define_expand. (vec_realign_load_v4si, vec_realign_load_v4sf, vec_realign_load_v8hi) (vec_realign_load_v16qi): New define_insn. * config/rs6000/rs6000.h (ALTIVEC_BUILTIN_MASK_FOR_LOAD): (ALTIVEC_BUILTIN_MASK_FOR_STORE): New target builtins. * config/rs6000/rs6000.c (altivec_builtin_mask_for_load): (altivec_builtin_mask_for_store): New variables. (rs6000_builtin_mask_for_load): New function. Implements TARGET_VECTORIZE_BUILTIN_MASK_FOR_LOAD. (rs6000_builtin_mask_for_store): New function. Implements TARGET_VECTORIZE_BUILTIN_MASK_FOR_STORE. (rs6000_expand_builtin): Expand the target builtins builtin_mask_for_load and builtin_mask_for_store. (altivec_init_builtins): Initialize the new target builtins. * config/i386/i386.c (ix86_misaligned_mem_ok): New function. Implements the target hook TARGET_VECTORIZE_MISALIGNED_MEM_OK. * tree-vectorizer.c (vect_create_data_ref): Renamed to vect_create_data_ref_ptr. Returns a pointer instead of an array-ref. (vect_create_addr_base_for_vector_ref): Additional argument (offset). (vectorizable_store): Call vect_create_data_ref_ptr with additional arguments, and create an indirect_ref with its return value data_ref. Check aligned_access_p. (vectorizable_load): Handle misaligned loads, using software-pipelined scheme with REALIGN_LOAD_EXPR and ALIGN_INDIRECT_REF if vec_realign_load_optab is supported, or using a scheme without software-pipelining with MISALIGNED_INDIRECT_REF if the target hook misaligned_mem_ok is supported. (vect_finish_stmt_generation): Typo. (vect_enhance_data_refs_alignment): Rename loop_vinfo to loop_info. (vect_analyze_data_refs_alignment): Don't fail vectorization in the presence of misaligned loads. (vect_analyze_data_ref_access): Add check for constant init. (vect_get_symbl_and_dr): Remove duplicate line. * tree-vectorizer.h (DR_MISALIGNMENT): Add comment. From-SVN: r87948
2004-09-22fold-const.c (fold): Avoid non INTEGER_TYPEs when widening operands in an ↵Diego Novillo1-0/+1
integer comparison. * fold-const.c (fold): Avoid non INTEGER_TYPEs when widening operands in an integer comparison. * tree-cfg.c (find_taken_edge): Call fold() to determine whether the predicate is known. From-SVN: r87855
2004-09-17alias.c (find_base_decl): Remove unreachable case '3' block.Jeffrey D. Oldham1-83/+84
2004-09-17 Jeffrey D. Oldham <oldham@codesourcery.com> Zack Weinberg <zack@codesourcery.com> * alias.c (find_base_decl): Remove unreachable case '3' block. * expr.c (safe_from_p): Abort if passed a type. * tree-gimple.c (recalculate_side_effects): Abort if passed anything other than an expression. * tree-ssa-pre.c (phi_translate): Return expr immediately if is_gimple_min_invariant is true for it. Reorder cases for clarity. Abort on un-handled tree classes. (valid_in_set): Likewise. * tree.c (tree_code_class_strings): New static data. * tree.h (enum tree_code_class): New. (tree_code_class_strings): Declare. (TREE_CODE_CLASS_STRING, EXCEPTIONAL_CLASS_P, CONSTANT_CLASS_P) (REFERENCE_CLASS_P, COMPARISON_CLASS_P, UNARY_CLASS_P, BINARY_CLASS_P) (STATEMENT_CLASS_P, EXPRESSION_CLASS_P, IS_TYPE_OR_DECL_P): New macros. (TYPE_P, DECL_P, IS_NON_TYPE_CODE_CLASS, IS_EXPR_CODE_CLASS) (checking macros, EXPR_LOCATION, SET_EXPR_LOCATION, EXPR_LOCUS): Update. * tree.def, c-common.def, objc/objc-tree.def: Use tree_code_class enumeration constants instead of code letters. * alias.c, builtins.c, c-common.c, c-format.c, c-lang.c, c-pragma.c * c-typeck.c, cgraphunit.c, convert.c, dbxout.c, dwarf2out.c * emit-rtl.c expr.c, fold-const.c, gimplify.c, lambda-code.c * langhooks.c, langhooks.h, predict.c, print-tree.c, reload1.c, stmt.c * tree-browser.c, tree-cfg.c, tree-chrec.c, tree-complex.c, tree-dfa.c * tree-dump.c, tree-eh.c, tree-gimple.c, tree-inline.c, tree-nested.c * tree-outof-ssa.c, tree-pretty-print.c, tree-sra.c, tree-ssa-ccp.c * tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-forwprop.c, tree-ssa-live.c * tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c, tree-ssa-operands.c * tree-ssa-phiopt.c, tree-ssa-pre.c, tree-ssa-propagate.c * tree-ssa.c, tree-ssanames.c, tree-tailcall.c, tree.c, varasm.c * config/sol2-c.c, config/arm/arm.c, config/i386/winnt.c * config/pa/pa.c, config/pa/pa.h, config/sh/sh.c, objc/objc-lang.c Update to match. * LANGUAGES: Add note about change. ada: * ada-tree.def: Use tree_code_class enumeration constants instead of code letters. * ada-tree.h, decl.c, misc.c, trans.c, utils.c, utils2.c: Update for new tree-class enumeration constants. cp: * cp-tree.def: Use tree_code_class enumeration constants instead of code letters. * call.c, class.c, cp-gimplify.c, cp-lang.c, cxx-pretty-print.c * mangle.c, pt.c, semantics.c, tree.c, typeck.c: Update for new tree-class enumeration constants. fortran: * f95-lang.c, trans-expr.c, trans.c: Update for new tree-class enumeration constants. java: * java-tree.def: Use tree_code_class enumeration constants instead of code letters. * java-gimplify.c, jcf-write.c, lang.c, parse.y: Update for new tree-class enumeration constants. treelang: * treetree.c: Update for new tree-class enumeration constants. From-SVN: r87675
2004-09-16fold-const.c (fold): Fold difference of addresses.Zdenek Dvorak1-0/+60
* fold-const.c (fold): Fold difference of addresses. (ptr_difference_const): Moved from tree-ssa-loop-ivopts, based on get_inner_reference. * tree-ssa-loop-ivopts.c (peel_address): Removed. (ptr_difference_const): Moved to fold-const.c. (split_address_cost): Use get_inner_reference instead of peel_address. (ptr_difference_cost): Change type of diff to HOST_WIDE_INT. * tree.h (ptr_difference_const): Export. * tree-ssa-loop-ivopts.c (dump_iv, dump_use, dump_cand): Add induction variable type to the dump. Fix indentation. (idx_find_step): Handle nonconstant array_ref_element_size and array_ref_low_bound. (idx_record_use): Handle array_ref_element_size and array_ref_low_bound. (find_interesting_uses_stmt): Handle memory = nontrivial_expression statements correctly. (get_computation_at, iv_value): Do not unshare expressions here. (rewrite_use_outer): Unshare the expression before it is emitted to code. * tree-ssa-loop-niter.c (unsigned_type_for, signed_type_for): Moved to tree.c. * tree.c (unsigned_type_for, signed_type_for): Moved from tree-ssa-loop-niter.c. Use langhooks. * tree.h (signed_type_for): Export. From-SVN: r87601
2004-09-15attribs.c, [...]: Use %<, %> and %q for quoting in diagnostics going through ↵Joseph Myers1-2/+2
pretty-print.c. gcc: * attribs.c, builtins.c, c-format.c, c-pch.c, coverage.c, except.c, fold-const.c, function.c, langhooks.c, params.c, reload.c, reload1.c, stmt.c, stor-layout.c, toplev.c, tree-cfg.c, tree-dump.c, tree-mudflap.c, tree.c, varasm.c: Use %<, %> and %q for quoting in diagnostics going through pretty-print.c. Use '' for quoting in other diagnostic text. * langhooks.c: Include intl.h. Mark text locating diagnostics for translation. * Makefile.in (langhooks.o): Update dependencies. * pretty-print.h (pp_printf): Mark as accepting GCC diagnostic formats. gcc/testsuite: * g++.dg/ext/member-attr.C, g++.dg/warn/deprecated.C, gcc.dg/deprecated.c, gcc.dg/noreturn-1.c, gcc.dg/noreturn-4.c: Update expected messages. libmudflap: * testsuite/libmudflap.c/pass35-frag.c: Update expected message. From-SVN: r87563
2004-09-14cgraph.h, [...]: Fix comment typos.Kazu Hirata1-2/+2
* cgraph.h, cgraphunit.c, fold-const.c, lambda-mat.c, lambda.h, profile.c, tree-optimize.c, tree-sra.c, vec.h: Fix comment typos. Follow spelling conventions. From-SVN: r87490
2004-09-13fold-const.c (fold_checksum_tree): Ignore TYPE_CACHED_VALUES.Daniel Jacobowitz1-3/+9
* fold-const.c (fold_checksum_tree): Ignore TYPE_CACHED_VALUES. Only use TYPE_BINFO for aggregates. From-SVN: r87457
2004-09-12re PR c++/16254 (ICE in lower_stmt, at gimple-low.c:205)Richard Henderson1-43/+0
PR c++/16254 * fold-const.c (fold) <case CLEANUP_POINT_EXPR>: Remove. * tree.c, tree.h (has_cleanups): Remove. cp/ * semantics.c (maybe_cleanup_point_expr): Don't call fold. * typeck.c (condition_conversion): Likewise. From-SVN: r87407
2004-09-11re PR c++/17412 (tree check failure in fold-const)Steven Bosscher1-7/+9
PR c++/17412 * fold-const.c (fold): Do not try to fold the operand of a CLEANUP_POINT_EXPR if that operand does itself not have any operands. testsuite/ * g++.dg/parse/break-in-for.C: New test. PR middle-end/17417 * langhooks.c (lhd_decl_printable_name): Make sure that this function is called with is a decl node that has an identifier. * tree-pretty-print.c (dump_function_name): New function to wrap PRINT_FUNCTION_NAME and dump_decl_name. (print_call_name): Use it. From-SVN: r87363
2004-09-11re PR middle-end/17024 (ICE in fold_cond_expr_with_comparison, at ↵Roger Sayle1-13/+33
fold-const.c:4324) PR middle-end/17024 * fold-const.c (fold_cond_expr_with_comparison): Handle unordered floating point comparison operators. Change aborts to gcc_asserts. * gcc.dg/pr17024-1.c: New test case. From-SVN: r87339
2004-09-10re PR middle-end/17055 (ICE while folding int/float vectors)Roger Sayle1-0/+20
PR middle-end/17055 * fold-const.c (build_zero_vector): New function to construct a vector (either floating point or integer) of zeros. (fold_convert): Internally, enable conversions of integer zero to arbitrary vector types, using the new build_zero_vector. * gcc.dg/pr17055-1.c: New test case. From-SVN: r87272
2004-09-08final.c (shorten_branches, [...]): Use gcc_assert and gcc_unreachable.Nathan Sidwell1-133/+140
* final.c (shorten_branches, final, get_insn_template, output_alternate_entry_point, final_scan_insn, alter_subreg, alter_cond, output_operand, asm_fprintf, final_forward_branch_p, leaf_renumber_regs_insn): Use gcc_assert and gcc_unreachable. * fix-header.c (lookup_std_proto): Likewise. * flow.c (first_insn_after_basic_block_note, verify_wide_reg, verify_local_live_at_start, update_life_info, mark_reg, calculate_global_regs_live, allocate_reg_life_data, init_propagate_block_info, mark_set_regs, flush_reg_cond_reg_1, ior_reg_cond, not_reg_cond, and_reg_cond, elim_reg_cond, attempt_auto_inc, mark_used_reg, mark_used_regs): Likewise. * fold-const.c (force_fit_type, div_and_round_double, may_negate_without_overflow_p, int_const_binop, const_binop, size_binop, size_diffop, fold_convert_const, fold_convert, invert_tree_comparison, swap_tree_comparison, comparison_to_compcode, compcode_to_comparison, invert_truthvalue, range_binop, make_range, fold_cond_expr_with_comparison, fold_div_compare, fold, fold_checksum_tree, fold_negate_const, fold_abs_const, fold_not_const, fold_relational_const, round_up, round_down): Likewise. * function.c (find_function_data, assign_stack_temp_for_type, instantiate_virtual_regs_lossage, aggregate_value_p, assign_parm_find_entry_rtl, assign_parm_setup_block, expand_function_start, expand_function_end, keep_stack_depressed, handle_epilogue_set, thread_prologue_and_epilogue_insns): Likewise. From-SVN: r87192
2004-09-05c-common.c, [...]: Fix comment formatting.Kazu Hirata1-2/+2
* c-common.c, c-decl.c, combine.c, defaults.h, fold-const.c, gimplify.c, gthr-nks.h, hooks.c, lambda-code.c, lambda-mat.c, stor-layout.c, target.h, tree-cfg.c, tree-chrec.c, tree-if-conv.c, tree-inline.c, tree-into-ssa.c, tree-mudflap.c, tree-optimize.c, tree-scalar-evolution.c, tree-ssa-alias.c, tree-ssa-ccp.c, tree-ssa-dce.c, tree-ssa-pre.c, tree-vectorizer.c, tree-vectorizer.h, tree.h, vec.h: Fix comment formatting. From-SVN: r87105
2004-09-04revert: fold-const.c (operand_equal_p): Remove code to allow null ARG0/1.Richard Kenner1-36/+54
Revert: * fold-const.c (operand_equal_p): Remove code to allow null ARG0/1. Define locals macros OP_SAME and OP_SAME_WITH_NULL and use throughout. From-SVN: r87089
2004-09-04fold-const.c (operand_equal_p): Remove code to allow null ARG0/1.Richard Kenner1-54/+36
* fold-const.c (operand_equal_p): Remove code to allow null ARG0/1. Define locals macros OP_SAME and OP_SAME_WITH_NULL and use throughout. From-SVN: r87082
2004-09-01re PR middle-end/17258 (gcc.c-torture/compile/20030224-1.c:16: internal ↵Richard Henderson1-0/+4
compiler error: in expand_expr_addr_expr, at expr.c:6157) PR middle-end/17258 * calls.c (initialize_argument_information): Tighten pass-through conditions for pass-by-reference. Remove dead TARGET_EXPR code. Use build_fold_addr_expr. (emit_library_call_value_1): Use build_fold_addr_expr. Remove code that assumes ADDR_EXPR allocates stack space. * fold-const.c (build_fold_addr_expr_with_type): Look through WITH_SIZE_EXPR. From-SVN: r86957