aboutsummaryrefslogtreecommitdiff
path: root/gcc/rtl.h
AgeCommit message (Collapse)AuthorFilesLines
2017-09-19explow.c: Include "params.h".Jeff Law1-0/+1
2017-09-18 Jeff Law <law@redhat.com> * explow.c: Include "params.h". (anti_adjust_stack_and_probe_stack_clash): New function. (get_stack_check_protect): Likewise. (compute_stack_clash_protection_loop_data): Likewise. (emit_stack_clash_protection_loop_start): Likewise. (emit_stack_clash_protection_loop_end): Likewise. (allocate_dynamic_stack_space): Use get_stack_check_protect. Use anti_adjust_stack_and_probe_stack_clash. * explow.h (compute_stack_clash_protection_loop_data): Prototype. (emit_stack_clash_protection_loop_start): Likewise. (emit_stack_clash_protection_loop_end): Likewise. * rtl.h (get_stack_check_protect): Prototype. * target.def (stack_clash_protection_final_dynamic_probe): New hook. * targhooks.c (default_stack_clash_protection_final_dynamic_probe): New. * targhooks.h (default_stack_clash_protection_final_dynamic_probe): Prototype. * doc/tm.texi.in (TARGET_STACK_CLASH_PROTECTION_FINAL_DYNAMIC_PROBE): Add @hook. * doc/tm.texi: Rebuilt. * config/aarch64/aarch64.c (aarch64_expand_prologue): Use get_stack_check_protect. * config/alpha/alpha.c (alpha_expand_prologue): Likewise. * config/arm/arm.c (arm_expand_prologue): Likewise. (arm_frame_pointer_required): Likewise. * config/i386/i386.c (ix86_expand_prologue): Likewise. * config/ia64/ia64.c (ia64_expand_prologue): Likewise. * config/mips/mips.c (mips_expand_prologue): Likewise. * config/powerpcspe/powerpcspe.c (rs6000_emit_prologue): Likewise. * config/rs6000/rs6000.c (rs6000_emit_prologue): Likewise. * config/sparc/sparc.c (sparc_expand_prologue): Likewise. (sparc_flat_expand_prologue): Likewise. * gcc.dg/stack-check-3.c: New test. From-SVN: r252995
2017-09-12Turn HARD_REGNO_NREGS into a target hookRichard Sandiford1-1/+1
2017-09-12 Richard Sandiford <richard.sandiford@linaro.org> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> gcc/ * target.def (hard_regno_nregs): New hook. (class_max_nregs): Refer to it instead of HARD_REGNO_NREGS. * targhooks.h (default_hard_regno_nregs): Declare. * targhooks.c (default_hard_regno_nregs): New function. * doc/tm.texi.in (HARD_REGNO_NREGS): Replace with... (TARGET_HARD_REGNO_NREGS): ...this hook. (HARD_REGNO_NREGS_HAS_PADDING): Update accordingly. (CLASS_MAX_NREGS): Likewise. * doc/tm.texi: Regenerate. * reginfo.c (init_reg_modes_target): Use targetm.hard_regno_nregs instead of HARD_REGNO_NREGS. * rtl.h (REG_NREGS): Refer to TARGET_HARD_REGNO_NREGS rather than HARD_REGNO_NREGS in the comment. * config/aarch64/aarch64.h (HARD_REGNO_NREGS): Delete. * config/aarch64/aarch64-protos.h (aarch64_hard_regno_nregs): Delete. * config/aarch64/aarch64.c (aarch64_hard_regno_nregs): Make static. Return an unsigned int. (TARGET_HARD_REGNO_NREGS): Redefine. * config/alpha/alpha.h (HARD_REGNO_NREGS): Delete. * config/arc/arc.h (HARD_REGNO_NREGS): Delete. * config/arc/arc.c (TARGET_HARD_REGNO_NREGS): Redefine. (arc_hard_regno_nregs): New function. * config/arm/arm.h (HARD_REGNO_NREGS): Delete. * config/arm/arm.c (TARGET_HARD_REGNO_NREGS): Redefine. (arm_hard_regno_nregs): New function. * config/avr/avr.h (HARD_REGNO_NREGS): Delete. * config/bfin/bfin.h (HARD_REGNO_NREGS): Delete. * config/bfin/bfin.c (bfin_hard_regno_nregs): New function. (TARGET_HARD_REGNO_NREGS): Redefine. * config/c6x/c6x.h (HARD_REGNO_NREGS): Delete. * config/cr16/cr16.h (LONG_REG_P): Use targetm.hard_regno_nregs. (HARD_REGNO_NREGS): Delete. * config/cr16/cr16.c (TARGET_HARD_REGNO_NREGS): Redefine. (cr16_hard_regno_nregs): New function. (cr16_memory_move_cost): Use it instead of HARD_REGNO_NREGS. * config/cris/cris.h (HARD_REGNO_NREGS): Delete. * config/cris/cris.c (TARGET_HARD_REGNO_NREGS): Redefine. (cris_hard_regno_nregs): New function. * config/epiphany/epiphany.h (HARD_REGNO_NREGS): Delete. * config/fr30/fr30.h (HARD_REGNO_NREGS): Delete. (CLASS_MAX_NREGS): Use targetm.hard_regno_nregs. * config/frv/frv.h (HARD_REGNO_NREGS): Delete. (CLASS_MAX_NREGS): Remove outdated copy of documentation. * config/frv/frv-protos.h (frv_hard_regno_nregs): Delete. * config/frv/frv.c (TARGET_HARD_REGNO_NREGS): Redefine. (frv_hard_regno_nregs): Make static. Take and return an unsigned int. (frv_class_max_nregs): Remove outdated copy of documentation. * config/ft32/ft32.h (HARD_REGNO_NREGS): Delete. * config/h8300/h8300.h (HARD_REGNO_NREGS): Delete. * config/h8300/h8300-protos.h (h8300_hard_regno_nregs): Delete. * config/h8300/h8300.c (h8300_hard_regno_nregs): Delete. * config/i386/i386.h (HARD_REGNO_NREGS): Delete. * config/i386/i386.c (ix86_hard_regno_nregs): New function. (TARGET_HARD_REGNO_NREGS): Redefine. * config/ia64/ia64.h (HARD_REGNO_NREGS): Delete. (CLASS_MAX_NREGS): Update comment. * config/ia64/ia64.c (TARGET_HARD_REGNO_NREGS): Redefine. (ia64_hard_regno_nregs): New function. * config/iq2000/iq2000.h (HARD_REGNO_NREGS): Delete. * config/lm32/lm32.h (HARD_REGNO_NREGS): Delete. * config/m32c/m32c.h (HARD_REGNO_NREGS): Delete. * config/m32c/m32c-protos.h (m32c_hard_regno_nregs): Delete. * config/m32c/m32c.c (m32c_hard_regno_nregs_1): Take and return an unsigned int. (m32c_hard_regno_nregs): Likewise. Make static. (TARGET_HARD_REGNO_NREGS): Redefine. * config/m32r/m32r.h (HARD_REGNO_NREGS): Delete. * config/m68k/m68k.h (HARD_REGNO_NREGS): Delete. * config/m68k/m68k.c (TARGET_HARD_REGNO_NREGS): Redefine. (m68k_hard_regno_nregs): New function. * config/mcore/mcore.h (HARD_REGNO_NREGS): Delete. * config/microblaze/microblaze.h (HARD_REGNO_NREGS): Delete. * config/mips/mips.h (HARD_REGNO_NREGS): Delete. * config/mips/mips-protos.h (mips_hard_regno_nregs): Delete. * config/mips/mips.c (mips_hard_regno_nregs): Make static. Take and return an unsigned int. (TARGET_HARD_REGNO_NREGS): Redefine. * config/mmix/mmix.h (HARD_REGNO_NREGS): Delete. (CLASS_MAX_NREGS): Use targetm.hard_regno_nregs. * config/mn10300/mn10300.h (HARD_REGNO_NREGS): Delete. * config/moxie/moxie.h (HARD_REGNO_NREGS): Delete. * config/msp430/msp430.h (HARD_REGNO_NREGS): Delete. * config/msp430/msp430-protos.h (msp430_hard_regno_nregs): Delete. * config/msp430/msp430.c (TARGET_HARD_REGNO_NREGS): Redefine. (msp430_hard_regno_nregs): Make static. Take and return an unsigned int. * config/nds32/nds32.h (HARD_REGNO_NREGS): Delete. * config/nds32/nds32-protos.h (nds32_hard_regno_nregs): Delete. * config/nds32/nds32.c (nds32_hard_regno_nregs): Delete. (nds32_hard_regno_mode_ok): Use targetm.hard_regno_nregs. * config/nios2/nios2.h (HARD_REGNO_NREGS): Delete. * config/nvptx/nvptx.h (HARD_REGNO_NREGS): Delete. * config/nvptx/nvptx.c (nvptx_hard_regno_nregs): New function. (TARGET_HARD_REGNO_NREGS): Redefine. * config/pa/pa32-regs.h (HARD_REGNO_NREGS): Rename to... (PA_HARD_REGNO_NREGS): ...this. * config/pa/pa64-regs.h (HARD_REGNO_NREGS): Rename to... (PA_HARD_REGNO_NREGS): ...this. * config/pa/pa.c (TARGET_HARD_REGNO_NREGS): Redefine. (pa_hard_regno_nregs): New function. * config/pdp11/pdp11.h (HARD_REGNO_NREGS): Delete. * config/pdp11/pdp11.c (TARGET_HARD_REGNO_NREGS): Redefine. (pdp11_hard_regno_nregs): New function. * config/powerpcspe/powerpcspe.h (HARD_REGNO_NREGS): Delete. * config/powerpcspe/powerpcspe.c (TARGET_HARD_REGNO_NREGS): Redefine. (rs6000_hard_regno_nregs_hook): New function. * config/riscv/riscv.h (HARD_REGNO_NREGS): Delete. * config/riscv/riscv-protos.h (riscv_hard_regno_nregs): Delete. * config/riscv/riscv.c (riscv_hard_regno_nregs): Make static. Take and return an unsigned int. Move earlier in file. (TARGET_HARD_REGNO_NREGS): Redefine. * config/rl78/rl78.h (HARD_REGNO_NREGS): Delete. * config/rl78/rl78-protos.h (rl78_hard_regno_nregs): Delete. * config/rl78/rl78.c (TARGET_HARD_REGNO_NREGS): Reefine. (rl78_hard_regno_nregs): Make static. Take and return an unsigned int. * config/rs6000/rs6000.h (HARD_REGNO_NREGS): Delete. * config/rs6000/rs6000.c (TARGET_HARD_REGNO_NREGS): Redefine. (rs6000_hard_regno_nregs_hook): New function. * config/rx/rx.h (HARD_REGNO_NREGS): Delete. * config/rx/rx.c (rx_hard_regno_nregs): New function. (TARGET_HARD_REGNO_NREGS): Redefine. * config/s390/s390.h (HARD_REGNO_NREGS): Delete. * config/s390/s390.c (REGNO_PAIR_OK): Use s390_hard_regno_nregs instead of HARD_REGNO_NREGS. (s390_hard_regno_nregs): New function. (s390_hard_regno_mode_ok): Add comment from s390.h. (TARGET_HARD_REGNO_NREGS): Redefine. * config/sh/sh.h (HARD_REGNO_NREGS): Delete. * config/sh/sh.c (TARGET_HARD_REGNO_NREGS): Redefine. (sh_hard_regno_nregs): New function. (sh_pass_in_reg_p): Use it. * config/sparc/sparc.h (HARD_REGNO_NREGS): Delete. * config/sparc/sparc.c (TARGET_HARD_REGNO_NREGS): Redefine. (sparc_hard_regno_nregs): New function. * config/spu/spu.h (HARD_REGNO_NREGS): Delete. * config/spu/spu.c (spu_hard_regno_nregs): New function. (spu_function_arg_advance): Use it, supplying a valid register number. (TARGET_HARD_REGNO_NREGS): Redefine. * config/stormy16/stormy16.h (HARD_REGNO_NREGS): Delete. * config/tilegx/tilegx.h (HARD_REGNO_NREGS): Delete. * config/tilepro/tilepro.h (HARD_REGNO_NREGS): Delete. * config/v850/v850.h (HARD_REGNO_NREGS): Delete. * config/vax/vax.h (HARD_REGNO_NREGS): Delete. * config/visium/visium.h (HARD_REGNO_NREGS): Delete. (CLASS_MAX_NREGS): Remove copy of old documentation. * config/visium/visium.c (TARGET_HARD_REGNO_NREGS): Redefine. (visium_hard_regno_nregs): New function. (visium_hard_regno_mode_ok): Use it instead of HARD_REGNO_NREGS. * config/xtensa/xtensa.h (HARD_REGNO_NREGS): Delete. * config/xtensa/xtensa.c (TARGET_HARD_REGNO_NREGS): Redefine. xtensa_hard_regno_nregs): New function. * system.h (HARD_REGNO_NREGS): Poison. Co-Authored-By: Alan Hayward <alan.hayward@arm.com> Co-Authored-By: David Sherwood <david.sherwood@arm.com> From-SVN: r252016
2017-09-04Add subreg_memory_offset helper functionsRichard Sandiford1-0/+2
This patch adds routines for converting a SUBREG_BYTE offset into a memory address offset. The two only differ for paradoxical subregs, where SUBREG_BYTE is always 0 but the memory address offset can be negative. 2017-09-04 Richard Sandiford <richard.sandiford@linaro.org> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> gcc/ * rtl.h (subreg_memory_offset): Declare. * emit-rtl.c (subreg_memory_offset): New function. * expmed.c (store_bit_field_1): Use it. * expr.c (undefined_operand_subword_p): Likewise. * simplify-rtx.c (simplify_subreg): Likewise. Co-Authored-By: Alan Hayward <alan.hayward@arm.com> Co-Authored-By: David Sherwood <david.sherwood@arm.com> From-SVN: r251644
2017-09-04PR82045: Avoid passing machine modes through "..."Richard Sandiford1-4/+132
PR82045 is about a bootstrap failure on sparc-sun-solaris2.11. The problem was that we were passing the new machine_mode wrapper classes through "..." to emit_library_call(_value), which then read them back as ints instead. The simplest fix seemed to be replace "..." with an array of rtx_mode_ts, then provide wrappers for the common cases. This bulks out rtl.h a bit, but it does make things a bit more typesafe. 2017-09-04 Richard Sandiford <richard.sandiford@linaro.org> gcc/ PR bootstrap/82045 * rtl.h (emit_library_call_value_1): Declare. (emit_library_call): Replace declaration with a series of overloads. Remove the parameter count argument. (emit_library_call_value): Likewise. * calls.c (emit_library_call_value_1): Make global. Replace varargs with an "rtx_mode_t *". (emit_library_call_value): Delete. (emit_library_call): Likewise. * asan.c (asan_emit_stack_protection): Update calls accordingly. (asan_emit_allocas_unpoison): Likewise. * builtins.c (expand_builtin_powi): Likewise. (expand_asan_emit_allocas_unpoison): Likewise. * cfgexpand.c (expand_main_function): Likewise. * config/aarch64/aarch64.c (aarch64_trampoline_init): Likewise. * config/aarch64/aarch64.h (PROFILE_HOOK): Likewise. * config/alpha/alpha.c (alpha_trampoline_init): Likewise. * config/arm/arm.c (arm_trampoline_init): Likewise. (arm_call_tls_get_addr): Likewise. (arm_expand_divmod_libfunc): Likewise. * config/bfin/bfin.md (umulsi3_highpart): Likewise. (smulsi3_highpart): Likewise. * config/c6x/c6x.c (c6x_initialize_trampoline): Likewise. (c6x_expand_compare): Likewise. (c6x_expand_movmem): Likewise. * config/frv/frv.c (frv_trampoline_init): Likewise. * config/i386/i386.c (ix86_trampoline_init): Likewise. (ix86_expand_divmod_libfunc): Likewise. * config/ia64/ia64.c (ia64_expand_tls_address): Likewise. (ia64_expand_compare): Likewise. (ia64_profile_hook): Likewise. * config/ia64/ia64.md (save_stack_nonlocal): Likewise. (nonlocal_goto): Likewise. (restore_stack_nonlocal): Likewise. * config/m32r/m32r.c (block_move_call): Likewise. (m32r_trampoline_init): Likewise. * config/m68k/linux.h (FINALIZE_TRAMPOLINE): Likewise. * config/m68k/m68k.c (m68k_call_tls_get_addr): Likewise. (m68k_call_m68k_read_tp): Likewise. * config/microblaze/microblaze.c (microblaze_call_tls_get_addr) (microblaze_expand_divide): Likewise. * config/mips/mips.h (mips_args): Likewise. * config/mips/sdemtk.h (mips_sync_icache): Likewise. (MIPS_ICACHE_SYNC): Likewise. * config/nios2/nios2.c (nios2_emit_expensive_div): Likewise. (nios2_trampoline_init): Likewise. * config/pa/pa.c (hppa_tls_call): Likewise. (pa_trampoline_init): Likewise. * config/pa/pa.md (canonicalize_funcptr_for_compare): Likewise. * config/powerpcspe/powerpcspe.c (rs6000_legitimize_tls_address) (expand_strn_compare): Likewise. (rs6000_generate_compare): Likewise. (rs6000_expand_float128_convert): Likewise. (output_profile_hook): Likewise. (rs6000_trampoline_init): Likewise. * config/powerpcspe/powerpcspe.md (neg<mode>2): Likewise. * config/riscv/riscv.h (PROFILE_HOOK): Likewise. * config/rs6000/rs6000-string.c (expand_strn_compare): Likewise. * config/rs6000/rs6000.c (rs6000_legitimize_tls_address): Likewise. (rs6000_generate_compare): Likewise. (rs6000_expand_float128_convert): Likewise. (output_profile_hook): Likewise. (rs6000_trampoline_init): Likewise. * config/rs6000/rs6000.md (neg<mode>2): Likewise. * config/sh/sh.c (sh_trampoline_init): Likewise. * config/sparc/sparc.c (emit_soft_tfmode_libcall): Likewise. (sparc_emit_float_lib_cmp): Likewise. (sparc32_initialize_trampoline): Likewise. (sparc64_initialize_trampoline): Likewise. (sparc_profile_hook): Likewise. * config/spu/spu.c (ea_load_store): Likewise. * config/spu/spu.md (floatunssidf2): Likewise. * config/tilegx/tilegx.c (tilegx_trampoline_init): Likewise. * config/tilepro/tilepro.c (tilepro_trampoline_init): Likewise. * config/visium/visium.c (expand_block_move_4): Likewise. (expand_block_move_2): Likewise. (expand_block_move_1): Likewise. (expand_block_set_4): Likewise. (expand_block_set_2): Likewise. (expand_block_set_1): Likewise. (visium_trampoline_init): Likewise. (visium_profile_hook): Likewise. * config/xtensa/xtensa.c (xtensa_expand_nonlocal_goto): Likewise. (xtensa_setup_frame_addresses): Likewise. (xtensa_trampoline_init): Likewise. * except.c (sjlj_emit_function_enter): Likewise. (sjlj_emit_function_exit): Likewise. * explow.c (allocate_dynamic_stack_space): Likewise. (probe_stack_range): Likewise. * expr.c (convert_mode_scalar): Likewise. * optabs.c (expand_binop): Likewise. (expand_twoval_binop_libfunc): Likewise. (expand_unop): Likewise. (prepare_cmp_insn): Likewise. (prepare_float_lib_cmp): Likewise. (expand_float): Likewise. (expand_fix): Likewise. (expand_fixed_convert): Likewise. (maybe_emit_sync_lock_test_and_set): Likewise. (expand_atomic_compare_and_swap): Likewise. (expand_mem_thread_fence): Likewise. (expand_atomic_fetch_op): Likewise. From-SVN: r251637
2017-08-30Drop df_ from df_read_modify_subreg_pRichard Sandiford1-1/+2
...it's really a general RTL predicate, rather than something that depends on the DF state. Thanks to Segher for the suggestion. 2017-08-30 Richard Sandiford <richard.sandiford@linaro.org> gcc/ * df.h (df_read_modify_subreg_p): Remove in favor of... * rtl.h (read_modify_subreg_p): ...this new function. Take a const_rtx instead of an rtx. * cprop.c (local_cprop_find_used_regs): Update accordingly. * df-problems.c (df_word_lr_mark_ref): Likewise. * ira-lives.c (mark_pseudo_reg_live): Likewise. (mark_pseudo_reg_dead): Likewise. (mark_ref_dead): Likewise. * reginfo.c (init_subregs_of_mode): Likewise. * sched-deps.c (sched_analyze_1): Likewise. * df-scan.c (df_def_record_1): Likewise. (df_uses_record): Likewise. (df_read_modify_subreg_p): Remove in favor of... * rtlanal.c (read_modify_subreg_p): ...this new function. Take a const_rtx instead of an rtx. From-SVN: r251537
2017-08-30Add a partial_subreg_p predicateRichard Sandiford1-0/+24
This patch adds a partial_subreg_p predicate to go alongside paradoxical_subreg_p. Like the paradoxical_subreg_p patch, this one replaces some tests that were based on GET_MODE_SIZE rather than GET_MODE_PRECISION. In each case the change should be a no-op or an improvement. The regcprop.c patch prevents some replacements of the 82-bit RFmode with the 80-bit XFmode on ia64. I don't understand the target details here particularly well, but from the way the modes are described in ia64-modes.def, it isn't valid to assume that an XFmode can carry an RFmode payload. A comparison of the testsuite assembly output for one target per CPU showed no other differences. Some of the places changed here are tracking the widest access mode found for a register. The series tries to standardise on: if (partial_subreg_p (widest_seen, new_mode)) widest_seen = new_mode; rather than: if (paradoxical_subreg_p (new_mode, widest_seen)) widest_seen = new_mode; Either would have been OK. 2017-08-30 Richard Sandiford <richard.sandiford@linaro.org> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> gcc/ * rtl.h (partial_subreg_p): New function. * caller-save.c (save_call_clobbered_regs): Use it. * calls.c (expand_call): Likewise. * combine.c (combinable_i3pat): Likewise. (simplify_set): Likewise. (make_extraction): Likewise. (make_compound_operation_int): Likewise. (gen_lowpart_or_truncate): Likewise. (force_to_mode): Likewise. (make_field_assignment): Likewise. (reg_truncated_to_mode): Likewise. (record_truncated_value): Likewise. (move_deaths): Likewise. * cse.c (record_jump_cond): Likewise. (cse_insn): Likewise. * cselib.c (cselib_lookup_1): Likewise. * expmed.c (extract_bit_field_using_extv): Likewise. * function.c (assign_parm_setup_reg): Likewise. * ifcvt.c (noce_convert_multiple_sets): Likewise. * ira-build.c (create_insn_allocnos): Likewise. * lra-coalesce.c (merge_pseudos): Likewise. * lra-constraints.c (match_reload): Likewise. (simplify_operand_subreg): Likewise. (curr_insn_transform): Likewise. * lra-lives.c (process_bb_lives): Likewise. * lra.c (new_insn_reg): Likewise. (lra_substitute_pseudo): Likewise. * regcprop.c (mode_change_ok): Likewise. (maybe_mode_change): Likewise. (copyprop_hardreg_forward_1): Likewise. * reload.c (push_reload): Likewise. (find_reloads): Likewise. (find_reloads_subreg_address): Likewise. * reload1.c (alter_reg): Likewise. (eliminate_regs_1): Likewise. * simplify-rtx.c (simplify_unary_operation_1): Likewise. Co-Authored-By: Alan Hayward <alan.hayward@arm.com> Co-Authored-By: David Sherwood <david.sherwood@arm.com> From-SVN: r251536
2017-08-30[66/77] Use scalar_mode for constant integersRichard Sandiford1-5/+4
This patch treats the mode associated with an integer constant as a scalar_mode. We can't use the more natural-sounding scalar_int_mode because we also use (const_int 0) for bounds-checking modes. (It might be worth adding a bounds-specific code instead, but that's for another day.) This exposes a latent bug in simplify_immed_subreg, which for vectors of CONST_WIDE_INTs would pass the vector mode rather than the element mode to rtx_mode_t. I think the: /* We can get a 0 for an error mark. */ || GET_MODE_CLASS (mode) == MODE_VECTOR_INT || GET_MODE_CLASS (mode) == MODE_VECTOR_FLOAT in immed_double_const is dead. trunc_int_mode (via gen_int_mode) would go on to ICE if the mode fitted in a HWI, and surely plenty of other code would be confused to see a const_int be interpreted as a vector. We should instead be using CONST0_RTX (mode) if we need a safe constant for a particular mode. We didn't try to make these functions take scalar_mode arguments because in many cases that would be too invasive at this stage. Maybe it would become feasible in future. Also, the long-term direction should probably be to add modes to constant integers rather than have then as VOIDmode odd-ones-out. That would remove the need for rtx_mode_t and thus remove the question whether they should use scalar_int_mode, scalar_mode or machine_mode. The patch also uses scalar_mode for the CONST_DOUBLE handling in loc_descriptor. In that case the mode can legitimately be either floating-point or integral. 2017-08-30 Richard Sandiford <richard.sandiford@linaro.org> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> gcc/ * emit-rtl.c (immed_double_const): Use is_a <scalar_mode> instead of separate mode class checks. Do not allow vector modes here. (immed_wide_int_const): Use as_a <scalar_mode>. * explow.c (trunc_int_for_mode): Likewise. * rtl.h (wi::int_traits<rtx_mode_t>::get_precision): Likewise. (wi::shwi): Likewise. (wi::min_value): Likewise. (wi::max_value): Likewise. * dwarf2out.c (loc_descriptor): Likewise. * simplify-rtx.c (simplify_immed_subreg): Fix rtx_mode_t argument for CONST_WIDE_INT. Co-Authored-By: Alan Hayward <alan.hayward@arm.com> Co-Authored-By: David Sherwood <david.sherwood@arm.com> From-SVN: r251517
2017-08-30[62/77] Big machine_mode to scalar_int_mode replacementRichard Sandiford1-5/+5
This patch changes the types of various things from machine_mode to scalar_int_mode, in cases where (after previous patches) simply changing the type is enough on its own. The patch does nothing other than that. 2017-08-30 Richard Sandiford <richard.sandiford@linaro.org> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> gcc/ * builtins.h (builtin_strncpy_read_str): Take a scalar_int_mode instead of a machine_mode. (builtin_memset_read_str): Likewise. * builtins.c (c_readstr): Likewise. (builtin_memcpy_read_str): Likewise. (builtin_strncpy_read_str): Likewise. (builtin_memset_read_str): Likewise. (builtin_memset_gen_str): Likewise. (expand_builtin_signbit): Use scalar_int_mode for local variables. * cfgexpand.c (convert_debug_memory_address): Take a scalar_int_mode instead of a machine_mode. * combine.c (simplify_if_then_else): Use scalar_int_mode for local variables. (make_extraction): Likewise. (try_widen_shift_mode): Take and return scalar_int_modes instead of machine_modes. * config/aarch64/aarch64.c (aarch64_libgcc_cmp_return_mode): Return a scalar_int_mode instead of a machine_mode. * config/avr/avr.c (avr_addr_space_address_mode): Likewise. (avr_addr_space_pointer_mode): Likewise. * config/cr16/cr16.c (cr16_unwind_word_mode): Likewise. * config/msp430/msp430.c (msp430_addr_space_pointer_mode): Likewise. (msp430_unwind_word_mode): Likewise. * config/spu/spu.c (spu_unwind_word_mode): Likewise. (spu_addr_space_pointer_mode): Likewise. (spu_addr_space_address_mode): Likewise. (spu_libgcc_cmp_return_mode): Likewise. (spu_libgcc_shift_count_mode): Likewise. * config/rl78/rl78.c (rl78_addr_space_address_mode): Likewise. (rl78_addr_space_pointer_mode): Likewise. (fl78_unwind_word_mode): Likewise. (rl78_valid_pointer_mode): Take a scalar_int_mode instead of a machine_mode. * config/alpha/alpha.c (vms_valid_pointer_mode): Likewise. * config/ia64/ia64.c (ia64_vms_valid_pointer_mode): Likewise. * config/mips/mips.c (mips_mode_rep_extended): Likewise. (mips_valid_pointer_mode): Likewise. * config/tilegx/tilegx.c (tilegx_mode_rep_extended): Likewise. * config/ft32/ft32.c (ft32_valid_pointer_mode): Likewise. (ft32_addr_space_pointer_mode): Return a scalar_int_mode instead of a machine_mode. (ft32_addr_space_address_mode): Likewise. * config/m32c/m32c.c (m32c_valid_pointer_mode): Take a scalar_int_mode instead of a machine_mode. (m32c_addr_space_pointer_mode): Return a scalar_int_mode instead of a machine_mode. (m32c_addr_space_address_mode): Likewise. * config/powerpcspe/powerpcspe.c (rs6000_abi_word_mode): Likewise. (rs6000_eh_return_filter_mode): Likewise. * config/rs6000/rs6000.c (rs6000_abi_word_mode): Likewise. (rs6000_eh_return_filter_mode): Likewise. * config/s390/s390.c (s390_libgcc_cmp_return_mode): Likewise. (s390_libgcc_shift_count_mode): Likewise. (s390_unwind_word_mode): Likewise. (s390_valid_pointer_mode): Take a scalar_int_mode rather than a machine_mode. * target.def (mode_rep_extended): Likewise. (valid_pointer_mode): Likewise. (addr_space.valid_pointer_mode): Likewise. (eh_return_filter_mode): Return a scalar_int_mode rather than a machine_mode. (libgcc_cmp_return_mode): Likewise. (libgcc_shift_count_mode): Likewise. (unwind_word_mode): Likewise. (addr_space.pointer_mode): Likewise. (addr_space.address_mode): Likewise. * doc/tm.texi: Regenerate. * dojump.c (prefer_and_bit_test): Take a scalar_int_mode rather than a machine_mode. (do_jump): Use scalar_int_mode for local variables. * dwarf2cfi.c (init_return_column_size): Take a scalar_int_mode rather than a machine_mode. * dwarf2out.c (convert_descriptor_to_mode): Likewise. (scompare_loc_descriptor_wide): Likewise. (scompare_loc_descriptor_narrow): Likewise. * emit-rtl.c (adjust_address_1): Use scalar_int_mode for local variables. * except.c (sjlj_emit_dispatch_table): Likewise. (expand_builtin_eh_copy_values): Likewise. * explow.c (convert_memory_address_addr_space_1): Likewise. Take a scalar_int_mode rather than a machine_mode. (convert_memory_address_addr_space): Take a scalar_int_mode rather than a machine_mode. (memory_address_addr_space): Use scalar_int_mode for local variables. * expmed.h (expand_mult_highpart_adjust): Take a scalar_int_mode rather than a machine_mode. * expmed.c (mask_rtx): Likewise. (init_expmed_one_conv): Likewise. (expand_mult_highpart_adjust): Likewise. (extract_high_half): Likewise. (expmed_mult_highpart_optab): Likewise. (expmed_mult_highpart): Likewise. (expand_smod_pow2): Likewise. (expand_sdiv_pow2): Likewise. (emit_store_flag_int): Likewise. (adjust_bit_field_mem_for_reg): Use scalar_int_mode for local variables. (extract_low_bits): Likewise. * expr.h (by_pieces_constfn): Take a scalar_int_mode rather than a machine_mode. * expr.c (pieces_addr::adjust): Likewise. (can_store_by_pieces): Likewise. (store_by_pieces): Likewise. (clear_by_pieces_1): Likewise. (expand_expr_addr_expr_1): Likewise. (expand_expr_addr_expr): Use scalar_int_mode for local variables. (expand_expr_real_1): Likewise. (try_casesi): Likewise. * final.c (shorten_branches): Likewise. * fold-const.c (fold_convert_const_int_from_fixed): Change the type of "mode" to machine_mode. * internal-fn.c (expand_arith_overflow_result_store): Take a scalar_int_mode rather than a machine_mode. (expand_mul_overflow): Use scalar_int_mode for local variables. * loop-doloop.c (doloop_modify): Likewise. (doloop_optimize): Likewise. * optabs.c (expand_subword_shift): Take a scalar_int_mode rather than a machine_mode. (expand_doubleword_shift_condmove): Likewise. (expand_doubleword_shift): Likewise. (expand_doubleword_clz): Likewise. (expand_doubleword_popcount): Likewise. (expand_doubleword_parity): Likewise. (expand_absneg_bit): Use scalar_int_mode for local variables. (prepare_float_lib_cmp): Likewise. * rtl.h (convert_memory_address_addr_space_1): Take a scalar_int_mode rather than a machine_mode. (convert_memory_address_addr_space): Likewise. (get_mode_bounds): Likewise. (get_address_mode): Return a scalar_int_mode rather than a machine_mode. * rtlanal.c (get_address_mode): Likewise. * stor-layout.c (get_mode_bounds): Take a scalar_int_mode rather than a machine_mode. * targhooks.c (default_mode_rep_extended): Likewise. (default_valid_pointer_mode): Likewise. (default_addr_space_valid_pointer_mode): Likewise. (default_eh_return_filter_mode): Return a scalar_int_mode rather than a machine_mode. (default_libgcc_cmp_return_mode): Likewise. (default_libgcc_shift_count_mode): Likewise. (default_unwind_word_mode): Likewise. (default_addr_space_pointer_mode): Likewise. (default_addr_space_address_mode): Likewise. * targhooks.h (default_eh_return_filter_mode): Likewise. (default_libgcc_cmp_return_mode): Likewise. (default_libgcc_shift_count_mode): Likewise. (default_unwind_word_mode): Likewise. (default_addr_space_pointer_mode): Likewise. (default_addr_space_address_mode): Likewise. (default_mode_rep_extended): Take a scalar_int_mode rather than a machine_mode. (default_valid_pointer_mode): Likewise. (default_addr_space_valid_pointer_mode): Likewise. * tree-ssa-address.c (addr_for_mem_ref): Use scalar_int_mode for local variables. * tree-ssa-loop-ivopts.c (get_shiftadd_cost): Take a scalar_int_mode rather than a machine_mode. * tree-switch-conversion.c (array_value_type): Use scalar_int_mode for local variables. * tree-vrp.c (simplify_float_conversion_using_ranges): Likewise. * var-tracking.c (use_narrower_mode): Take a scalar_int_mode rather than a machine_mode. Co-Authored-By: Alan Hayward <alan.hayward@arm.com> Co-Authored-By: David Sherwood <david.sherwood@arm.com> From-SVN: r251513
2017-08-30[59/77] Add a rtx_jump_table_data::get_data_mode helperRichard Sandiford1-0/+19
This patch adds a helper function to get the mode of the addresses or offsets in a jump table. It also changes the final.c code to use rtx_jump_table_data over rtx or rtx_insn in cases where it needed to use the new helper. This in turn meant adding a safe_dyn_cast equivalent of safe_as_a, to cope with null NEXT_INSNs. 2017-08-30 Richard Sandiford <richard.sandiford@linaro.org> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> gcc/ * is-a.h (safe_dyn_cast): New function. * rtl.h (rtx_jump_table_data::get_data_mode): New function. (jump_table_for_label): Likewise. * final.c (final_addr_vec_align): Take an rtx_jump_table_data * instead of an rtx_insn *. (shorten_branches): Use dyn_cast instead of LABEL_P and JUMP_TABLE_DATA_P. Use jump_table_for_label and rtx_jump_table_data::get_data_mode. (final_scan_insn): Likewise. Co-Authored-By: Alan Hayward <alan.hayward@arm.com> Co-Authored-By: David Sherwood <david.sherwood@arm.com> From-SVN: r251511
2017-08-30[50/77] Add helper routines for SUBREG_PROMOTED_VAR_P subregsRichard Sandiford1-0/+18
When subregs contain promoted values, as indicated by SUBREG_PROMOTED_VAR_P, both the unpromoted (outer) and promoted (inner) values are known to be scalar integers. This patch adds helper routines that get the modes as scalar_int_modes. 2017-08-30 Richard Sandiford <richard.sandiford@linaro.org> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> gcc/ * rtl.h (subreg_unpromoted_mode, subreg_promoted_mode): New functions. * expr.c (convert_move): Use them. (convert_modes): Likewise. (store_expr_with_bounds): Likewise. Co-Authored-By: Alan Hayward <alan.hayward@arm.com> Co-Authored-By: David Sherwood <david.sherwood@arm.com> From-SVN: r251502
2017-08-30[49/77] Simplify nonzero/num_sign_bits hooksRichard Sandiford1-4/+4
The two implementations of the reg_nonzero_bits and reg_num_sign_bits hooks ignored the "known_x", "known_mode" and "known_ret" arguments, so this patch removes them. It adds a new scalar_int_mode parameter that specifies the mode of "x". (This mode might be different from "mode", which is the mode in which "x" is used.) 2017-08-30 Richard Sandiford <richard.sandiford@linaro.org> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> gcc/ * rtl.h (rtl_hooks::reg_nonzero_bits): Add a scalar_int_mode parameter for the mode of "x". Remove the "known_x", "known_mode" and "known_ret" arguments. Change the type of the mode argument to scalar_int_mode. (rtl_hooks:reg_num_sign_bit_copies): Likewise. * combine.c (reg_nonzero_bits_for_combine): Update accordingly. (reg_num_sign_bit_copies_for_combine): Likewise. * rtlanal.c (nonzero_bits1): Likewise. (num_sign_bit_copies1): Likewise. * rtlhooks-def.h (reg_nonzero_bits_general): Likewise. (reg_num_sign_bit_copies_general): Likewise. * rtlhooks.c (reg_num_sign_bit_copies_general): Likewise. (reg_nonzero_bits_general): Likewise. Co-Authored-By: Alan Hayward <alan.hayward@arm.com> Co-Authored-By: David Sherwood <david.sherwood@arm.com> From-SVN: r251501
2017-08-30[21/77] Replace SCALAR_INT_MODE_P checks with is_a <scalar_int_mode>Richard Sandiford1-3/+4
This patch replaces checks of "SCALAR_INT_MODE_P (...)" with "is_a <scalar_int_mode> (..., &var)" in cases where it becomes useful to refer to the mode as a scalar_int_mode. It also replaces some checks for the two constituent classes (MODE_INT and MODE_PARTIAL_INT). The patch also introduces is_a <scalar_int_mode> checks for some uses of HWI_COMPUTABLE_MODE_P, which is a subcondition of SCALAR_INT_MODE_P. 2017-08-30 Richard Sandiford <richard.sandiford@linaro.org> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> gcc/ * wide-int.h (int_traits<unsigned char>) New class. (int_traits<unsigned short>) Likewise. * cfgexpand.c (expand_debug_expr): Use is_a <scalar_int_mode>. Use GET_MODE_UNIT_PRECISION and remove redundant test for SCALAR_INT_MODE_P. * combine.c (set_nonzero_bits_and_sign_copies): Use is_a <scalar_int_mode>. (find_split_point): Likewise. (combine_simplify_rtx): Likewise. (simplify_logical): Likewise. (expand_compound_operation): Likewise. (expand_field_assignment): Likewise. (make_compound_operation): Likewise. (extended_count): Likewise. (change_zero_ext): Likewise. (simplify_comparison): Likewise. * dwarf2out.c (scompare_loc_descriptor): Likewise. (ucompare_loc_descriptor): Likewise. (minmax_loc_descriptor): Likewise. (mem_loc_descriptor): Likewise. (loc_descriptor): Likewise. * expmed.c (init_expmed_one_mode): Likewise. * lra-constraints.c (lra_constraint_offset): Likewise. * optabs.c (prepare_libcall_arg): Likewise. * postreload.c (move2add_note_store): Likewise. * reload.c (operands_match_p): Likewise. * rtl.h (load_extend_op): Likewise. * rtlhooks.c (gen_lowpart_general): Likewise. * simplify-rtx.c (simplify_truncation): Likewise. (simplify_unary_operation_1): Likewise. (simplify_binary_operation_1): Likewise. (simplify_const_binary_operation): Likewise. (simplify_const_relational_operation): Likewise. (simplify_subreg): Likewise. * stor-layout.c (bitwise_mode_for_mode): Likewise. * var-tracking.c (adjust_mems): Likewise. (prepare_call_arguments): Likewise. gcc/ada/ * gcc-interface/decl.c (check_ok_for_atomic_type): Use is_a <scalar_int_mode>. * gcc-interface/trans.c (Pragma_to_gnu): Likewise. * gcc-interface/utils.c (gnat_type_for_mode): Likewise. gcc/fortran/ * trans-types.c (gfc_type_for_mode): Use is_a <scalar_int_mode>. Co-Authored-By: Alan Hayward <alan.hayward@arm.com> Co-Authored-By: David Sherwood <david.sherwood@arm.com> From-SVN: r251473
2017-08-22Make more use of paradoxical_subreg_pRichard Sandiford1-1/+19
This patch makes more use of the existing paradoxical_subreg_p predicate and also adds a version that operates on outer and inner modes. Some of the affected tests were based on GET_MODE_SIZE rather than GET_MODE_PRECISION and so the patch could change the result for modes that have the same size but different precisions. I think in each case the change should be a no-op or more correct, since a mode with precision N bits can't be expected to hold all of a mode with precision M>N bits. The patch changes the branch taken in simplify_subreg for modes with equal precision, but the new form matches the commentary more closely. Both branches should be equally good in that situation. 2017-08-22 Richard Sandiford <richard.sandiford@linaro.org> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> gcc/ * rtl.h (paradoxical_subreg_p): Define inline, and add a version that takes the outer and inner modes. * doc/rtl.texi: Use paradoxical_subreg_p instead of a GET_MODE_SIZE comparison as the canonical test for a paradoxical subreg. * combine.c (simplify_set): Use paradoxical_subreg_p. (make_extraction): Likewise. (force_to_mode): Likewise. (rtx_equal_for_field_assignment_p): Likewise. (gen_lowpart_for_combine): Likewise. (simplify_comparison): Likewise. * cse.c (equiv_constant): Likewise. * expmed.c (store_bit_field_1): Likewise. * final.c (alter_subreg): Likewise. * fwprop.c (propagate_rtx): Likewise. (forward_propagate_subreg): Likewise. * ira-conflicts.c (ira_build_conflicts): Likewise. * lower-subreg.c (simplify_gen_subreg_concatn): Likewise. * lra-constraints.c (curr_insn_transform): Likewise. (split_reg): Likewise. * lra-eliminations.c (move_plus_up): Likewise. (lra_eliminate_regs_1): Likewise. * recog.c (general_operand): Likewise. * ree.c (combine_reaching_defs): Likewise. * reload.c (push_reload): Likewise. (find_reloads): Likewise. * reload1.c (elimination_effects): Likewise. (compute_reload_subreg_offset): Likewise. (choose_reload_regs): Likewise. * rtlanal.c (subreg_lsb_1): Likewise. * simplify-rtx.c (simplify_unary_operation_1): Likewise. (simplify_subreg): Likewise. * var-tracking.c (track_loc_p): Likewise. * emit-rtl.c (byte_lowpart_offset): Likewise. (paradoxical_subreg_p): Delete out-of-line definition. Co-Authored-By: Alan Hayward <alan.hayward@arm.com> Co-Authored-By: David Sherwood <david.sherwood@arm.com> From-SVN: r251282
2017-07-29replace shallow_copy_rtx_stat with c++Trevor Saunders1-2/+1
gcc/ChangeLog: 2017-07-28 Trevor Saunders <tbsaunde+gcc@tbsaunde.org> * rtl.c (shallow_copy_rtx_stat): Remove _stat from name. * rtl.h (shallow_copy_rtx): Remove macro. From-SVN: r250708
2017-07-29replace rtx_alloc_stat with c++Trevor Saunders1-2/+1
gcc/ChangeLog: 2017-07-28 Trevor Saunders <tbsaunde+gcc@tbsaunde.org> * emit-rtl.c (gen_raw_REG): Adjust. * gengenrtl.c (gendef): Likewise. * rtl.c (rtx_alloc_stat): Remove _stat from name. * rtl.h (rtx_alloc): Remove macro. From-SVN: r250707
2017-07-16profile-count.h (profile_probability::from_reg_br_prob_note, [...]): New ↵Jan Hubicka1-1/+0
functions. * profile-count.h (profile_probability::from_reg_br_prob_note, profile_probability::to_reg_br_prob_note): New functions. * doc/rtl.texi (REG_BR_PROB_NOTE): Update documentation. * reg-notes.h (REG_BR_PROB, REG_BR_PRED): Update docs. * predict.c (probability_reliable_p): Update. (edge_probability_reliable_p): Update. (br_prob_note_reliable_p): Update. (invert_br_probabilities): Update. (add_reg_br_prob_note): New function. (combine_predictions_for_insn): Update. * asan.c (asan_clear_shadow): Update. * cfgbuild.c (compute_outgoing_frequencies): Update. * cfgrtl.c (force_nonfallthru_and_redirect): Update. (update_br_prob_note): Update. (rtl_verify_edges): Update. (purge_dead_edges): Update. (fixup_reorder_chain): Update. * emit-rtl.c (try_split): Update. * ifcvt.c (cond_exec_process_insns): Update. (cond_exec_process_if_block): Update. (dead_or_predicable): Update. * internal-fn.c (expand_addsub_overflow): Update. (expand_neg_overflow): Update. (expand_mul_overflow): Update. * loop-doloop.c (doloop_modify): Update. * loop-unroll.c (compare_and_jump_seq): Update. * optabs.c (emit_cmp_and_jump_insn_1): Update. * predict.h: Update. * reorg.c (mostly_true_jump): Update. * rtl.h: Update. * config/aarch64/aarch64.c (aarch64_emit_unlikely_jump): Update. * config/alpha/alpha.c (emit_unlikely_jump): Update. * config/arc/arc.c: (emit_unlikely_jump): Update. * config/arm/arm.c: (emit_unlikely_jump): Update. * config/bfin/bfin.c (cbranch_predicted_taken_p): Update. * config/frv/frv.c (frv_print_operand_jump_hint): Update. * config/i386/i386.c (ix86_expand_split_stack_prologue): Update. (ix86_print_operand): Update. (ix86_split_fp_branch): Update. (predict_jump): Update. * config/ia64/ia64.c (ia64_print_operand): Update. * config/mmix/mmix.c (mmix_print_operand): Update. * config/powerpcspe/powerpcspe.c (output_cbranch): Update. (rs6000_expand_split_stack_prologue): Update. * config/rs6000/rs6000.c: Update. * config/s390/s390.c (s390_expand_vec_strlen): Update. (s390_expand_vec_movstr): Update. (s390_expand_cs_tdsi): Update. (s390_expand_split_stack_prologue): Update. * config/sh/sh.c (sh_print_operand): Update. (expand_cbranchsi4): Update. (expand_cbranchdi4): Update. * config/sparc/sparc.c (output_v9branch): Update. * config/spu/spu.c (get_branch_target): Update. (ea_load_store_inline): Update. * config/tilegx/tilegx.c (cbranch_predicted_p): Update. * config/tilepro/tilepro.c: Update. * gcc.dg/predict-8.c: Update. From-SVN: r250239
2017-07-02Reorganise machmode.h headersRichard Sandiford1-4/+0
This patch splits the auto-generated inline functions out of insn-modes.h and puts them in a new header file, insn-modes-inline.h. It also makes coretypes.h include these files directly, rather than indirectly via machmode.h. This in turn allows insn-modes-inline.h and machmode.h to come later in the include list, after wide-int.h. This is useful for later patches. insn-modes.h itself still needs to come first, since it provides configuration information like MAX_BITSIZE_MODE_ANY_INT, which is used to control the size of a wide_int. The patch also makes the generator files include machmode.h via coretypes.h. Previously they did it by more indirect means. Finally, the patch makes wide-int-print.h available via coretypes.h too. There didn't seem to be any reason to force only the print routines to be included directly, and it would be painful to extend that approach to the SVE patches. [Based on the code ARM contributed in branches/ARM/sve-branch@242100] 2017-07-02 Richard Sandiford <richard.sandiford@linaro.org> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> contrib/header-tools/ * graph-header-logs (ignore): Update coretypes.h header list. gcc/ * Makefile.in (MACHMODE_H): Remove insn-modes.h (CORETYPES_H): New define. (MOSTLYCLEANFILES): Add insn-modes-inline.h. (insn-modes-inline.h, s-modes-inline-h): New rules. (generated_files): Add insn-modes-inline.h. (RTL_BASE_H, TREE_CORE_H): Use CORETYPES_H instead of coretypes.h. (build/gensupport.o, build/ggc-none.o, build/print-rtl.o): Likewise. (build/read-md.o, build/read-rtl.o, build/rtl.o): Likewise. (build/vec.o, build/hash-table.o, build/inchash.o): Likewise. (build/gencondmd.o, build/genattr.o, build/genattr-common.o): Likewise. (build/genattrtab.o, build/genautomata.o, build/gencheck.o): Likewise. (build/gencodes.o, build/genconditions.o): Likewise. (build/genconfig.o, build/genconstants.o, build/genemit.o): Likewise. (build/genenums.o, build/genextract.o, build/genflags.o): Likewise. (build/gentarget-def.o, build/genmddeps.o, build/genopinit.o) (build/genoutput.o, build/genpeep.o, build/genpreds.o): Likewise. (build/genrecog.o, build/genmddump.o, build/genmatch.o): Likewise. (build/gencfn-macros.o, build/gcov-iov.o): Likewise. * coretypes.h: Include everything up to real.h for generators. Include insn-modes.h first. Include wide-int-print.h after wide-int.h. Include insn-modes-inline.h and then machmode.h. * machmode.h: Don't include insn-modes.h here. * function-tests.c: Remove includes of signop.h, machmode.h, double-int.h and wide-int.h. * rtl.h: Likewise. * gcc-rich-location.c: Remove includes of machmode.h, double-int.h and wide-int.h. * optc-save-gen.awk: Likewise. * gencheck.c (BITS_PER_UNIT): Delete dummy definition. * godump.c: Remove include of wide-int-print.h. * pretty-print.h: Likewise. * wide-int-print.cc: Likewise. * wide-int.cc: Likewise. * hash-map-tests.c: Remove include of signop.h. * hash-set-tests.c: Likewise. * rtl-tests.c: Likewise. * mkconfig.sh: Remove include of machmode.h. * genmodes.c (emit_insn_modes_h): Split emission of inline functions into... (emit_insn_modes_inline_h): ...this new function. Emit the code into an insn-modes-inline.h header file, adding appropriate include guards and end comments. (emit_insn_modes_c_header): Remove include of machmode.h. (emit_min_insn_modes_c_header): Include coretypes.h rather than machmode.h. (main): Handle -i flag and call emit_insn_modes_inline_h when it is passed. Co-Authored-By: Alan Hayward <alan.hayward@arm.com> Co-Authored-By: David Sherwood <david.sherwood@arm.com> From-SVN: r249881
2017-06-08system.h (fancy_abort): Annotate by ATTRIBUTE_COLD.Jan Hubicka1-12/+12
* system.h (fancy_abort): Annotate by ATTRIBUTE_COLD. * rtl.h (rtl_check_failed_bounds, rtl_check_failed_type1, rtl_check_failed_type2, rtl_check_failed_code1, rtl_check_failed_code2, rtl_check_failed_code_mode, rtl_check_failed_block_symbol, cwi_check_failed_bounds, rtvec_check_failed_bounds, rtl_check_failed_flag, _fatal_insn_not_found, _fatal_insn): Likewise. * tree.h (tree_contains_struct_check_failed, tree_check_failed, tree_not_check_failed, tree_class_check_failed, tree_range_check_failed, tree_not_class_check_failed, tree_int_cst_elt_check_failed, tree_vec_elt_check_failed, phi_node_elt_check_failed, tree_operand_check_failed, omp_clause_check_failed, omp_clause_operand_check_failed, omp_clause_range_check_failed): Likewise. * cp-tree.h (lang_check_failed): Annotate by ATTRIBUTE_COLD. From-SVN: r249022
2017-03-14alias.c (struct alias_set_entry): Pack properly.Richard Biener1-3/+3
2017-03-14 Richard Biener <rguenther@suse.de> * alias.c (struct alias_set_entry): Pack properly. * cfgloop.h (struct loop): Likewise. * cse.c (struct set): Likewise. * ipa-utils.c (struct searchc_env): Likewise. * loop-invariant.c (struct invariant): Likewise. * lra-remat.c (struct cand): Likewise. * recog.c (struct change_t): Likewise. * rtl.h (struct address_info): Likewise. * symbol-summary.h (function_summary): Likewise. * tree-loop-distribution.c (struct partition): Likewise. * tree-object-size.c (struct object_size_info): Likewise. * tree-ssa-loop-ivopts.c (struct cost_pair): Likewise. * tree-ssa-threadupdate.c (struct ssa_local_info_t): Likewise. * tree-vect-data-refs.c (struct _vect_peel_info): Likewise. * tree-vect-slp.c (struct _slp_oprnd_info): Likewise. * tree-vect-stmts.c (struct simd_call_arg_info): Likewise. * tree-vectorizer.h (struct _loop_vec_info): Likewise. (struct _stmt_vec_info): Likewise. From-SVN: r246121
2017-01-05Introduce RTL function readerDavid Malcolm1-0/+2
This is the combination of these patches: - [8a/9] Introduce class function_reader (v8) - Add ASSERT_RTX_PTR_EQ - [8b/9] Add target-independent selftests of RTL function reader (v2) - [8c/9] Add aarch64-specific selftests for RTL function reader (v2) - [8d/9] Add x86_64-specific selftests for RTL function reader (v2) gcc/ChangeLog: * Makefile.in (OBJS): Add read-md.o, read-rtl.o, read-rtl-function.o, and selftest-rtl.o. * config/aarch64/aarch64.c: Include selftest.h and selftest-rtl.h. (selftest::aarch64_test_loading_full_dump): New function. (selftest::aarch64_run_selftests): New function. (TARGET_RUN_TARGET_SELFTESTS): Wire it up to selftest::aarch64_run_selftests. * config/i386/i386.c (selftest::ix86_test_loading_dump_fragment_1): New function. (selftest::ix86_test_loading_call_insn): New function. (selftest::ix86_test_loading_full_dump): New function. (selftest::ix86_test_loading_unspec): New function. (selftest::ix86_run_selftests): Call the new functions. * emit-rtl.c (maybe_set_max_label_num): New function. * emit-rtl.h (maybe_set_max_label_num): New decl. * function.c (instantiate_decls): Guard call to instantiate_decls_1 with if (DECL_INITIAL (fndecl)). * function-tests.c (selftest::verify_three_block_rtl_cfg): Remove "static". * gensupport.c (gen_reader::gen_reader): Pass "false" for new "compact" param of rtx_reader. * print-rtl.c (rtx_writer::print_rtx_operand): Print "(nil)" rather than an empty string for NULL strings. * read-md.c: Potentially include config.h rather than bconfig.h. Wrap include of errors.h with #ifdef GENERATOR_FILE. (have_error): New global, copied from errors.c. (md_reader::read_name): Rename to... (md_reader::read_name_1): ...this, adding "out_loc" param, and converting "missing name or number" to returning false, rather than failing. (md_reader::read_name): Reimplement in terms of read_name_1. (md_reader::read_name_or_nil): New function. (md_reader::read_string): Handle "(nil)" by returning NULL. (md_reader::md_reader): Add new param "compact". (md_reader::read_md_files): Wrap with #ifdef GENERATOR_FILE. (md_reader::read_file): New method. * read-md.h (md_reader::md_reader): Add new param "compact". (md_reader::read_file): New method. (md_reader::is_compact): New accessor. (md_reader::read_name): Convert return type from void to file_location. (md_reader::read_name_or_nil): New decl. (md_reader::read_name_1): New decl. (md_reader::m_compact): New field. (noop_reader::noop_reader): Pass "false" for new "compact" param of rtx_reader. (rtx_reader::rtx_reader): Add new "compact" param. (rtx_reader::read_rtx_operand): Make virtual and convert return type from void to rtx. (rtx_reader::read_until): New decl. (rtx_reader::handle_any_trailing_information): New virtual function. (rtx_reader::postprocess): New virtual function. (rtx_reader::finalize_string): New virtual function. (rtx_reader::m_in_call_function_usage): New field. (rtx_reader::m_reuse_rtx_by_id): New field. * read-rtl-function.c: New file. * selftest-rtl.c (selftest::assert_rtx_ptr_eq_at): New function. * selftest-rtl.h (ASSERT_RTX_PTR_EQ): New macro. (selftest::verify_three_block_rtl_cfg): New decl. * read-rtl-function.h: New file. * read-rtl.c: Potentially include config.h rather than bconfig.h. For host, include function.h, memmodel.h, and emit-rtl.h. (one_time_initialization): New function. (struct compact_insn_name): New struct. (compact_insn_names): New array. (find_code): Handle insn codes in compact dumps. (apply_subst_iterator): Wrap with #ifdef GENERATOR_FILE. (bind_subst_iter_and_attr): Likewise. (add_condition_to_string): Likewise. (add_condition_to_rtx): Likewise. (apply_attribute_uses): Likewise. (add_current_iterators): Likewise. (apply_iterators): Likewise. (initialize_iterators): Guard usage of apply_subst_iterator with #ifdef GENERATOR_FILE. (read_conditions): Wrap with #ifdef GENERATOR_FILE. (md_reader::read_mapping): Likewise. (add_define_attr_for_define_subst): Likewise. (add_define_subst_attr): Likewise. (read_subst_mapping): Likewise. (check_code_iterator): Likewise. (rtx_reader::read_rtx): Likewise. Move one-time initialization logic to... (one_time_initialization): New function. (rtx_reader::read_until): New method. (read_flags): New function. (parse_reg_note_name): New function. (rtx_reader::read_rtx_code): Initialize "iterator" to NULL. Handle reuse_rtx ids. Wrap iterator lookup within #ifdef GENERATOR_FILE. Add parsing support for RTL dumps, mirroring the special-cases in print_rtx, by calling read_flags, reading REG_NOTE names, INSN_UID values, and calling handle_any_trailing_information. (rtx_reader::read_rtx_operand): Convert return type from void to rtx, returning return_rtx. Handle case 'e'. Call finalize_string on XSTR and XTMPL fields. (rtx_reader::read_nested_rtx): Handle dumps in which trailing "(nil)" values were omitted. Call the postprocess vfunc on the return_rtx. (rtx_reader::rtx_reader): Add new "compact" param and pass to base class ctor. Initialize m_in_call_function_usage. Call one_time_initialization. * rtl-tests.c (selftest::test_uncond_jump): Call set_new_first_and_last_insn. * rtl.h (read_rtx): Wrap decl with #ifdef GENERATOR_FILE. * selftest-rtl.c: New file. * selftest-rtl.h (class selftest::rtl_dump_test): New class. (selftest::get_insn_by_uid): New decl. * selftest-run-tests.c (selftest::run_tests): Call read_rtl_function_c_tests. * selftest.h (selftest::read_rtl_function_c_tests): New decl. * tree-dfa.c (ssa_default_def): Return NULL_TREE for rtl function dumps. gcc/testsuite/ChangeLog: * selftests/asr_div1.rtl: New file. * selftests/aarch64: New subdirectory. * selftests/aarch64/times-two.rtl: New file. * selftests/bb-index.rtl: New file. * selftests/cfg-test.rtl: New file. * selftests/const-int.rtl: New file. * selftests/example-labels.rtl: New file. * selftests/insn-with-mode.rtl: New file. * selftests/jump-to-label-ref.rtl: New file. * selftests/jump-to-return.rtl: New file. * selftests/jump-to-simple-return.rtl: New file. * selftests/mem.rtl: New file. * selftests/note-insn-deleted.rtl: New file. * selftests/note_insn_basic_block.rtl: New file. * selftests/simple-cse.rtl: New file. * selftests/symbol-ref.rtl: New file. * selftests/x86_64: New subdirectory. * selftests/x86_64/call-insn.rtl: New file. * selftests/x86_64/copy-hard-reg-into-frame.rtl: New file. * selftests/x86_64/times-two.rtl: New file. * selftests/x86_64/unspec.rtl: New file. From-SVN: r244110
2017-01-05re PR rtl-optimization/78812 (Wrong code generation due to hoisting memory ↵Jeff Law1-0/+1
load across function call) PR tree-optimizatin/78812 * rtl.h (contains_mem_rtx_p): Prototype. * ifcvt.c (containts_mem_rtx_p): Move from here to... * rtlanal.c (contains_mem_rtx_p): Here and remvoe static linkage. * gcse.c (prune_expressions): Use contains_mem_rtx_p to discover and prune MEMs that are not at the toplevel of a SET_SRC rtx. Look through ZERO_EXTEND and SIGN_EXTEND when trying to avoid pruning MEMs. PR tree-optimization/78812 * g++.dg/torture/pr78812.C: New test. From-SVN: r244093
2017-01-01Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r243994
2016-12-09Prevent use of MEM_* attr accessor macros as lvaluesDavid Malcolm1-1/+1
gcc/ChangeLog: * rtl.h (get_mem_attrs): Add "const" qualifier to returned pointer. From-SVN: r243487
2016-12-02PR target/77822: Add helper macro EXTRACT_ARGS_IN_RANGE to system.h.Dominik Vogt1-0/+10
The macro can be used to validate the arguments of zero_extract and sign_extract to fix this problem: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77822 gcc/ChangeLog: 2016-12-02 Dominik Vogt <vogt@linux.vnet.ibm.com> PR target/77822 * rtl.h (EXTRACT_ARGS_IN_RANGE): New. From-SVN: r243159
2016-11-28re PR middle-end/78540 (ICE: in df_refs_verify, at df-scan.c:4062 with -O ↵Jakub Jelinek1-1/+1
-march=core2) PR middle-end/78540 * rtl.h (remove_reg_equal_equiv_notes): Return bool instead of void. * rtlanal.c (remove_reg_equal_equiv_notes): Return true if any note has been removed. * postreload.c (reload_combine_recognize_pattern): If remove_reg_equal_equiv_notes returns true, call df_notes_rescan. * gcc.dg/pr78540.c: New test. From-SVN: r242937
2016-11-23Add more subreg offset helpersRichard Sandiford1-4/+40
Provide versions of subreg_lowpart_offset and subreg_highpart_offset that work on mode sizes rather than modes. Also provide a routine that converts an lsb position to a subreg offset. The intent (in combination with later patches) is to move the handling of the BYTES_BIG_ENDIAN != WORDS_BIG_ENDIAN case into just two places, so that for other combinations we don't have to split offsets into words and subwords. gcc/ 2016-11-15 Richard Sandiford <richard.sandiford@arm.com> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> * rtl.h (subreg_size_offset_from_lsb): Declare. (subreg_offset_from_lsb): New function. (subreg_size_lowpart_offset): Declare. (subreg_lowpart_offset): Turn into an inline function. (subreg_size_highpart_offset): Declare. (subreg_highpart_offset): Turn into an inline function. * emit-rtl.c (subreg_size_lowpart_offset): New function. (subreg_size_highpart_offset): Likewise * rtlanal.c (subreg_size_offset_from_lsb): Likewise. Co-Authored-By: Alan Hayward <alan.hayward@arm.com> Co-Authored-By: David Sherwood <david.sherwood@arm.com> From-SVN: r242755
2016-11-21make dead_or_set_{,regno_}p take rtx_insn *Trevor Saunders1-2/+2
gcc/ChangeLog: 2016-11-21 Trevor Saunders <tbsaunde+gcc@tbsaunde.org> * rtl.h: Adjust prototype. * rtlanal.c (dead_or_set_p): Change argument type to rtx_insn *. (dead_or_set_regno_p): Likewise. From-SVN: r242657
2016-11-21make add_int_reg_note take rtx_insn *Trevor Saunders1-1/+1
gcc/ChangeLog: 2016-11-21 Trevor Saunders <tbsaunde+gcc@tbsaunde.org> * rtl.h: Adjust prototype. * rtlanal.c (add_int_reg_note): Change argument type to rtx_insn *. From-SVN: r242656
2016-11-21make replace_label_in_insn take labels as rtx_insn *Trevor Saunders1-1/+1
gcc/ChangeLog: 2016-11-21 Trevor Saunders <tbsaunde+gcc@tbsaunde.org> * rtl.h: Adjust prototype. * rtlanal.c (replace_label_in_insn): Change argument type to rtx_insn *. From-SVN: r242652
2016-11-18Make load_extend_op an inline functionRichard Sandiford1-1/+13
gcc/ * rtlanal.c (load_extend_op): Move to... * rtl.h: ...here and make inline. From-SVN: r242601
2016-11-16* rtl.h: Declare gt_ggc_mx and gt_pch_nx.Jason Merrill1-0/+4
From-SVN: r242522
2016-11-15Add a load_extend_op wrapperRichard Sandiford1-0/+1
LOAD_EXTEND_OP only applies to scalar integer modes that are narrower than a word. However, callers weren't consistent about which of these checks they made beforehand, and also weren't consistent about whether "smaller" was based on (bit)size or precision (IMO it's the latter). This patch adds a wrapper to try to make the macro easier to use. LOAD_EXTEND_OP is often used to disable transformations that aren't beneficial when extends from memory are free, so being stricter about the check accidentally exposed more optimisation opportunities. "SUBREG_BYTE (...) == 0" and subreg_lowpart_p are implied by paradoxical_subreg_p, so the patch also removes some redundant tests. The patch doesn't change reload, since different checks could have unforeseen consequences. gcc/ 2016-11-15 Richard Sandiford <richard.sandiford@arm.com> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> * rtl.h (load_extend_op): Declare. * rtlanal.c (load_extend_op): New function. (nonzero_bits1): Use it. (num_sign_bit_copies1): Likewise. * cse.c (cse_insn): Likewise. * fold-const.c (fold_single_bit_test): Likewise. (fold_unary_loc): Likewise. * fwprop.c (free_load_extend): Likewise. * postreload.c (reload_cse_simplify_set): Likewise. (reload_cse_simplify_operands): Likewise. * combine.c (try_combine): Likewise. (simplify_set): Likewise. Remove redundant SUBREG_BYTE and subreg_lowpart_p checks. Co-Authored-By: Alan Hayward <alan.hayward@arm.com> Co-Authored-By: David Sherwood <david.sherwood@arm.com> From-SVN: r242444
2016-11-07emit-rtl.c (emit_copy_of_insn_after): Duplicate notes in order.Bernd Schmidt1-0/+1
* emit-rtl.c (emit_copy_of_insn_after): Duplicate notes in order. * sel-sched-ir.c (create_copy_of_insn_rtx): Likewise. * rtl.h (duplicate_reg_notes): Declare. * rtlanal.c (duplicate_reg_note): New function. From-SVN: r241913
2016-11-02remove cast from prev_nonnote_insn_bbTrevor Saunders1-1/+1
gcc/ChangeLog: 2016-11-01 Trevor Saunders <tbsaunde+gcc@tbsaunde.org> * emit-rtl.c (prev_nonnote_insn_bb): Change argument type to rtx_insn *. * rtl.h (prev_nonnote_insn_bb): Adjust prototype. From-SVN: r241773
2016-11-02remove cast to rtx_insn * in remove_noteTrevor Saunders1-1/+1
gcc/ChangeLog: 2016-11-01 Trevor Saunders <tbsaunde+gcc@tbsaunde.org> * config/rl78/rl78.c (gen-and_emit_move): Change argument type to rtx_insn *. (transcode_memory_rtx): Likewise. (move_to_acc): Likewise. (move_from_acc): Likewise. (move_acc_to_reg): Likewise. (move_to_x): Likewise. (move_to_hl): Likewise. (move_to_de): Likewise. * config/rs6000/rs6000.c (emit_frame_save): Likewise. (rs6000_emit_savres_rtx): Likewise. (rs6000_emit_prologue): Likewise. * reorg.c (update_reg_unused_notes): Likewise. * rtl.h (remove_note): Adjust prototype. * rtlanal.c (remove_note): Make argument type rtx_insn *. From-SVN: r241771
2016-10-21make tablejump_p return the label as a rtx_insn *Trevor Saunders1-1/+1
gcc/ChangeLog: 2016-10-21 Trevor Saunders <tbsaunde+gcc@tbsaunde.org> * cfgcleanup.c (merge_blocks_move_successor_nojumps): Adjust. (outgoing_edges_match): Likewise. (try_crossjump_to_edge): Likewise. * cfgrtl.c (try_redirect_by_replacing_jump): Likewise. (rtl_tidy_fallthru_edge): Likewise. * rtl.h (tablejump_p): Adjust prototype. * rtlanal.c (tablejump_p): Return the label as a rtx_insn *. From-SVN: r241402
2016-10-21make LABEL_REF_LABEL a rtx_insn *Trevor Saunders1-1/+12
While changing LABEL_REF_LABEL it might as well become an inline function, so that its clearer what types are involved. Unfortunately because it is still possible to use XEXP and related macros on a LABEL_REF rtx you can still set the field to be a non insn rtx. The other unfortunate thing is that the generators actually create LABEL_REF rtx that refer to MATCH_x rtx, so there we actually need to use XEXP to bypass the checking this patch adds. gcc/ChangeLog: 2016-10-21 Trevor Saunders <tbsaunde+gcc@tbsaunde.org> * rtl.h (label_ref_label): New function. (set_label_ref_label): New function. (LABEL_REF_LABEL): Delete. * alias.c (rtx_equal_for_memref_p): Adjust. * cfgbuild.c (make_edges): Likewise. (purge_dead_tablejump_edges): Likewise. * cfgexpand.c (convert_debug_memory_address): Likewise. * cfgrtl.c (patch_jump_insn): Likewise. * combine.c (distribute_notes): Likewise. * cse.c (hash_rtx_cb): Likewise. (exp_equiv_p): Likewise. (fold_rtx): Likewise. (check_for_label_ref): Likewise. * cselib.c (rtx_equal_for_cselib_1): Likewise. (cselib_hash_rtx): Likewise. * emit-rtl.c (mark_label_nuses): Likewise. * explow.c (convert_memory_address_addr_space_1): Likewise. * final.c (output_asm_label): Likewise. (output_addr_const): Likewise. * gcse.c (add_label_notes): Likewise. * genconfig.c (walk_insn_part): Likewise. * genrecog.c (validate_pattern): Likewise. * ifcvt.c (cond_exec_get_condition): Likewise. (noce_emit_store_flag): Likewise. (noce_get_alt_condition): Likewise. (noce_get_condition): Likewise. * jump.c (maybe_propagate_label_ref): Likewise. (mark_jump_label_1): Likewise. (redirect_exp_1): Likewise. (rtx_renumbered_equal_p): Likewise. * lra-constraints.c (operands_match_p): Likewise. * print-rtl.c (print_value): Likewise. * reload.c (find_reloads): Likewise. * reload1.c (set_label_offsets): Likewise. * reorg.c (get_branch_condition): Likewise. * rtl-tests.c (test_uncond_jump): Likewise. * rtl.c (rtx_equal_p_cb): Likewise. (rtx_equal_p): Likewise. * rtlanal.c (reg_mentioned_p): Likewise. (rtx_referenced_p): Likewise. (get_condition): Likewise. * varasm.c (const_hash_1): Likewise. (compare_constant): Likewise. (const_rtx_hash_1): Likewise. (output_constant_pool_1): Likewise. From-SVN: r241401
2016-10-16re PR ada/37139 (DEP prevents using Ada tasking)Eric Botcazou1-0/+5
PR ada/37139 PR ada/67205 * common.opt (-ftrampolines): New option. * doc/invoke.texi (Code Gen Options): Document it. * doc/tm.texi.in (Trampolines): Add TARGET_CUSTOM_FUNCTION_DESCRIPTORS. * doc/tm.texi: Regenerate. * builtins.def: Add init_descriptor and adjust_descriptor. * builtins.c (expand_builtin_init_trampoline): Do not issue a warning on platforms with descriptors. (expand_builtin_init_descriptor): New function. (expand_builtin_adjust_descriptor): Likewise. (expand_builtin) <BUILT_IN_INIT_DESCRIPTOR>: New case. <BUILT_IN_ADJUST_DESCRIPTOR>: Likewise. * calls.c (prepare_call_address): Remove SIBCALLP parameter and add FLAGS parameter. Deal with indirect calls by descriptor and adjust. Set STATIC_CHAIN_REG_P on the static chain register, if any. (call_expr_flags): Set ECF_BY_DESCRIPTOR for calls by descriptor. (expand_call): Likewise. Move around call to prepare_call_address and pass all flags to it. * cfgexpand.c (expand_call_stmt): Reinstate CALL_EXPR_BY_DESCRIPTOR. * gimple.h (enum gf_mask): New GF_CALL_BY_DESCRIPTOR value. (gimple_call_set_by_descriptor): New setter. (gimple_call_by_descriptor_p): New getter. * gimple.c (gimple_build_call_from_tree): SetCALL_EXPR_BY_DESCRIPTOR. (gimple_call_flags): Deal with GF_CALL_BY_DESCRIPTOR. * langhooks.h (struct lang_hooks): Add custom_function_descriptors. * langhooks-def.h (LANG_HOOKS_CUSTOM_FUNCTION_DESCRIPTORS): Define. (LANG_HOOKS_INITIALIZER): Add LANG_HOOKS_CUSTOM_FUNCTION_DESCRIPTORS. * rtl.h (STATIC_CHAIN_REG_P): New macro. * rtlanal.c (find_first_parameter_load): Skip static chain registers. * target.def (custom_function_descriptors): New POD hook. * tree.h (FUNC_ADDR_BY_DESCRIPTOR): New flag on ADDR_EXPR. (CALL_EXPR_BY_DESCRIPTOR): New flag on CALL_EXPR. * tree-core.h (ECF_BY_DESCRIPTOR): New mask. Document FUNC_ADDR_BY_DESCRIPTOR and CALL_EXPR_BY_DESCRIPTOR. * tree.c (make_node_stat) <tcc_declaration>: Use FUNCTION_ALIGNMENT. (build_common_builtin_nodes): Initialize init_descriptor and adjust_descriptor. * tree-nested.c: Include target.h. (struct nesting_info): Add 'any_descr_created' field. (get_descriptor_type): New function. (lookup_element_for_decl): New function extracted from... (create_field_for_decl): Likewise. (lookup_tramp_for_decl): ...here. Adjust. (lookup_descr_for_decl): New function. (convert_tramp_reference_op): Deal with descriptors. (build_init_call_stmt): New function extracted from... (finalize_nesting_tree_1): ...here. Adjust and deal withdescriptors. * defaults.h (FUNCTION_ALIGNMENT): Define. (TRAMPOLINE_ALIGNMENT): Set to above instead of FUNCTION_BOUNDARY. * config/i386/i386.h (TARGET_CUSTOM_FUNCTION_DESCRIPTORS): Define. * config/ia64/ia64.h (TARGET_CUSTOM_FUNCTION_DESCRIPTORS): Likewise. * config/rs6000/rs6000.h (TARGET_CUSTOM_FUNCTION_DESCRIPTORS):Likewise. * config/sparc/sparc.h (TARGET_CUSTOM_FUNCTION_DESCRIPTORS): Likewise. ada/ * gcc-interface/misc.c (LANG_HOOKS_CUSTOM_FUNCTION_DESCRIPTORS):Define. * gcc-interface/trans.c (Attribute_to_gnu) <Attr_Access>: Deal with a zero TARGET_CUSTOM_FUNCTION_DESCRIPTORS specially for Code_Address. Otherwise, if TARGET_CUSTOM_FUNCTION_DESCRIPTORS is positive, set FUNC_ADDR_BY_DESCRIPTOR for 'Access/'Unrestricted_Access of nested subprograms if the type can use an internal representation. (call_to_gnu): Likewise, but set CALL_EXPR_BY_DESCRIPTOR on indirect calls if the type can use an internal representation. From-SVN: r241222
2016-10-12rtl.h (struct rtx_def): Comment how RTX_FLAGS will be dumped in RTL dumps.Georg-Johann Lay1-9/+16
* rtl.h (struct rtx_def): Comment how RTX_FLAGS will be dumped in RTL dumps. From-SVN: r241037
2016-09-22make next_cc0_user take rtx_insn *Trevor Saunders1-1/+1
gcc/ChangeLog: 2016-09-22 Trevor Saunders <tbsaunde+gcc@tbsaunde.org> * emit-rtl.c (next_cc0_user): Make argument type rtx_insn *. * rtl.h: Adjust prototype. From-SVN: r240362
2016-09-22make next/prev active_insn and active_insn_p take rtx_insn *Trevor Saunders1-3/+3
gcc/ChangeLog: 2016-09-22 Trevor Saunders <tbsaunde+gcc@tbsaunde.org> * emit-rtl.c (next_active_insn): Change argument type to rtx_insn *. (prev_active_insn): Likewise. (active_insn_p): Likewise. * rtl.h: Adjust prototypes. * cfgcleanup.c (merge_blocks_move_successor_nojumps): Adjust. * config/arc/arc.md: Likewise. * config/pa/pa.c (branch_to_delay_slot_p): Likewise. (branch_needs_nop_p): Likewise. (use_skip_p): Likewise. * config/sh/sh.c (gen_block_redirect): Likewise. (split_branches): Likewise. * reorg.c (optimize_skip): Likewise. (fill_simple_delay_slots): Likewise. (fill_slots_from_thread): Likewise. (relax_delay_slots): Likewise. * resource.c (mark_target_live_regs): Likewise. From-SVN: r240361
2016-09-22make next/prev nonnote_nondebug_insn take rtx_insn *Trevor Saunders1-2/+2
gcc/ChangeLog: 2016-09-22 Trevor Saunders <tbsaunde+gcc@tbsaunde.org> * config/cris/cris.c (cris_asm_output_case_end): Change argument type to rtx_insn *. * emit-rtl.c (next_nonnote_nondebug_insn): Likewise. (prev_nonnote_nondebug_insn): Likewise. * config/cris/cris-protos.h: Adjust prototype. * rtl.h: Likewise. * jump.c (rtx_renumbered_equal_p): Adjust. From-SVN: r240360
2016-09-22make prev_real_insn take rtx_insn *Trevor Saunders1-1/+1
gcc/ChangeLog: 2016-09-22 Trevor Saunders <tbsaunde+gcc@tbsaunde.org> * emit-rtl.c (prev_real_insn): Change argument type to rtx_insn *. * rtl.h: Adjust prototype. * config/sh/sh.md: Adjust. * dwarf2out.c (add_var_loc_to_decl): Likewise. From-SVN: r240359
2016-09-22make next/prev nondebug_insn take rtx_insn *Trevor Saunders1-2/+2
gcc/ChangeLog: 2016-09-22 Trevor Saunders <tbsaunde+gcc@tbsaunde.org> * emit-rtl.c (next_nondebug_insn): Change argument type to rtx_insn *. (prev_nondebug_insn): Likewise. * loop-doloop.c (doloop_condition_get): Likewise. * rtl.h: Adjust prototype. * cfgloop.h: Likewise. From-SVN: r240358
2016-09-22make next/prev _nonnote_insn take rtx_insn *Trevor Saunders1-4/+4
gcc/ChangeLog: 2016-09-22 Trevor Saunders <tbsaunde+gcc@tbsaunde.org> * emit-rtl.c (next_nonnote_insn): Change argument type to rtx_insn *. (prev_nonnote_insn): Likewise. * jump.c (reversed_comparison_code_parts): Likewise. (reversed_comparison): Likewise. * rtl.h: Adjust prototypes. * config/arc/arc.md: Adjust. * cse.c (find_comparison_args): Likewise. * reorg.c (redundant_insn): Change return type to rtx_insn *. (fix_reg_dead_note): Change argument type to rtx_insn *. (delete_prior_computation): Likewise. (delete_computation): Likewise. (fill_slots_from_thread): Adjust. (relax_delay_slots): Likewise. * simplify-rtx.c (simplify_unary_operation_1): Likewise. (simplify_relational_operation_1): Likewise. (simplify_ternary_operation): Likewise. From-SVN: r240357
2016-04-27maybe_set_first_label_num can take an rtx_code_label *David Malcolm1-1/+1
The function maybe_set_first_label_num acts on a CODE_LABEL; we can capture that in the type system. gcc/ChangeLog: * emit-rtl.c (maybe_set_first_label_num): Strengthen param from rtx to rtx_code_label *. * rtl.h (maybe_set_first_label_num): Likewise. From-SVN: r235525
2016-04-13re PR debug/70628 (ICE in get_reg_rtx, at emit-rtl.c:1025)Jakub Jelinek1-0/+2
PR debug/70628 * rtl.h (convert_memory_address_addr_space_1): New prototype. * explow.c (convert_memory_address_addr_space_1): No longer static, add NO_EMIT argument and don't call convert_modes if true, pass it down recursively, remove break after return. (convert_memory_address_addr_space): Adjust caller. * simplify-rtx.c (simplify_unary_operation_1): Call convert_memory_address_addr_space_1 instead of convert_memory_address, if it returns NULL, don't simplify. * gcc.dg/torture/pr70628.c: New test. From-SVN: r234933
2016-04-04re PR rtl-optimization/70484 (Wrong optimization with aliasing and access ↵Richard Biener1-0/+2
via char) 2016-04-04 Richard Biener <rguenther@suse.de> PR rtl-optimization/70484 * rtl.h (canon_output_dependence): Declare. * alias.c (canon_output_dependence): New function. * dse.c (record_store): Use canon_output_dependence rather than canon_true_dependence. * gcc.dg/torture/pr70484.c: New testcase. From-SVN: r234709
2016-03-17re PR middle-end/70245 (Miscompilation of ICU on i386 with atom tuning ↵Jakub Jelinek1-1/+1
starting with r227382) PR target/70245 * rtl.h (replace_rtx): Add ALL_REGS argument. * rtlanal.c (replace_rtx): Likewise. If true, use REGNO equality and assert mode is the same, instead of just rtx pointer equality. * config/i386/i386.md (mov + arithmetics with load peephole): Pass true as ALL_REGS argument to replace_rtx. From-SVN: r234285
2016-02-24[gcse] PR rtl-optimization/69886: Check target mode in ↵Kyrylo Tkachov1-1/+1
can_assign_to_reg_without_clobbers_p PR rtl-optimization/69886 * gcse.c (can_assign_to_reg_without_clobbers_p): Accept mode argument. Use it when checking validity of set instructions. (want_to_gcse_p): Pass mode to can_assign_to_reg_without_clobbers_p. (compute_ld_motion_mems): Update can_assign_to_reg_without_clobbers_p callsite. * rtl.h (can_assign_to_reg_without_clobbers_p): Update prototype. * store-motion.c (find_moveable_store): Update can_assign_to_reg_without_clobbers_p callsite. * gcc.dg/torture/pr69886.c: New test. From-SVN: r233662