comparison gcc/sched-deps.c @ 132:d34655255c78

update gcc-8.2
author mir3636
date Thu, 25 Oct 2018 10:21:07 +0900
parents 84e7813d76e9
children 1830386684a0
comparison
equal deleted inserted replaced
130:e108057fa461 132:d34655255c78
1 /* Instruction scheduling pass. This file computes dependencies between 1 /* Instruction scheduling pass. This file computes dependencies between
2 instructions. 2 instructions.
3 Copyright (C) 1992-2017 Free Software Foundation, Inc. 3 Copyright (C) 1992-2018 Free Software Foundation, Inc.
4 Contributed by Michael Tiemann (tiemann@cygnus.com) Enhanced by, 4 Contributed by Michael Tiemann (tiemann@cygnus.com) Enhanced by,
5 and currently maintained by, Jim Wilson (wilson@cygnus.com) 5 and currently maintained by, Jim Wilson (wilson@cygnus.com)
6 6
7 This file is part of GCC. 7 This file is part of GCC.
8 8
2317 else if (ref == USE) 2317 else if (ref == USE)
2318 { 2318 {
2319 while (--i >= 0) 2319 while (--i >= 0)
2320 note_reg_use (regno + i); 2320 note_reg_use (regno + i);
2321 } 2321 }
2322 else if (ref == CLOBBER_HIGH)
2323 {
2324 gcc_assert (i == 1);
2325 /* We don't know the current state of the register, so have to treat
2326 the clobber high as a full clobber. */
2327 note_reg_clobber (regno);
2328 }
2322 else 2329 else
2323 { 2330 {
2324 while (--i >= 0) 2331 while (--i >= 0)
2325 note_reg_clobber (regno + i); 2332 note_reg_clobber (regno + i);
2326 } 2333 }
2340 if (ref == SET) 2347 if (ref == SET)
2341 note_reg_set (regno); 2348 note_reg_set (regno);
2342 else if (ref == USE) 2349 else if (ref == USE)
2343 note_reg_use (regno); 2350 note_reg_use (regno);
2344 else 2351 else
2352 /* For CLOBBER_HIGH, we don't know the current state of the register,
2353 so have to treat it as a full clobber. */
2345 note_reg_clobber (regno); 2354 note_reg_clobber (regno);
2346 2355
2347 /* Pseudos that are REG_EQUIV to something may be replaced 2356 /* Pseudos that are REG_EQUIV to something may be replaced
2348 by that during reloading. We need only add dependencies for 2357 by that during reloading. We need only add dependencies for
2349 the address in the REG_EQUIV note. */ 2358 the address in the REG_EQUIV note. */
2832 2841
2833 static void 2842 static void
2834 sched_macro_fuse_insns (rtx_insn *insn) 2843 sched_macro_fuse_insns (rtx_insn *insn)
2835 { 2844 {
2836 rtx_insn *prev; 2845 rtx_insn *prev;
2846 /* No target hook would return true for debug insn as any of the
2847 hook operand, and with very large sequences of only debug insns
2848 where on each we call sched_macro_fuse_insns it has quadratic
2849 compile time complexity. */
2850 if (DEBUG_INSN_P (insn))
2851 return;
2837 prev = prev_nonnote_nondebug_insn (insn); 2852 prev = prev_nonnote_nondebug_insn (insn);
2838 if (!prev) 2853 if (!prev)
2839 return; 2854 return;
2840 2855
2841 if (any_condjump_p (insn)) 2856 if (any_condjump_p (insn))
2842 { 2857 {
2843 unsigned int condreg1, condreg2; 2858 unsigned int condreg1, condreg2;
2844 rtx cc_reg_1; 2859 rtx cc_reg_1;
2845 targetm.fixed_condition_code_regs (&condreg1, &condreg2); 2860 targetm.fixed_condition_code_regs (&condreg1, &condreg2);
2889 2904
2890 can_start_lhs_rhs_p = (NONJUMP_INSN_P (insn) 2905 can_start_lhs_rhs_p = (NONJUMP_INSN_P (insn)
2891 && code == SET); 2906 && code == SET);
2892 2907
2893 /* Group compare and branch insns for macro-fusion. */ 2908 /* Group compare and branch insns for macro-fusion. */
2894 if (targetm.sched.macro_fusion_p 2909 if (!deps->readonly
2910 && targetm.sched.macro_fusion_p
2895 && targetm.sched.macro_fusion_p ()) 2911 && targetm.sched.macro_fusion_p ())
2896 sched_macro_fuse_insns (insn); 2912 sched_macro_fuse_insns (insn);
2897 2913
2898 if (may_trap_p (x)) 2914 if (may_trap_p (x))
2899 /* Avoid moving trapping instructions across function calls that might 2915 /* Avoid moving trapping instructions across function calls that might
2914 /* Make sure prologue insn is scheduled before next jump. */ 2930 /* Make sure prologue insn is scheduled before next jump. */
2915 deps->sched_before_next_jump 2931 deps->sched_before_next_jump
2916 = alloc_INSN_LIST (insn, deps->sched_before_next_jump); 2932 = alloc_INSN_LIST (insn, deps->sched_before_next_jump);
2917 2933
2918 /* Make sure epilogue insn is scheduled after preceding jumps. */ 2934 /* Make sure epilogue insn is scheduled after preceding jumps. */
2935 add_dependence_list (insn, deps->last_pending_memory_flush, 1,
2936 REG_DEP_ANTI, true);
2919 add_dependence_list (insn, deps->pending_jump_insns, 1, REG_DEP_ANTI, 2937 add_dependence_list (insn, deps->pending_jump_insns, 1, REG_DEP_ANTI,
2920 true); 2938 true);
2921 } 2939 }
2922 2940
2923 if (code == COND_EXEC) 2941 if (code == COND_EXEC)
2951 { 2969 {
2952 sched_analyze_2 (deps, COND_EXEC_TEST (sub), insn); 2970 sched_analyze_2 (deps, COND_EXEC_TEST (sub), insn);
2953 sub = COND_EXEC_CODE (sub); 2971 sub = COND_EXEC_CODE (sub);
2954 code = GET_CODE (sub); 2972 code = GET_CODE (sub);
2955 } 2973 }
2956 if (code == SET || code == CLOBBER) 2974 else if (code == SET || code == CLOBBER || code == CLOBBER_HIGH)
2957 sched_analyze_1 (deps, sub, insn); 2975 sched_analyze_1 (deps, sub, insn);
2958 else 2976 else
2959 sched_analyze_2 (deps, sub, insn); 2977 sched_analyze_2 (deps, sub, insn);
2960 } 2978 }
2961 } 2979 }
2967 { 2985 {
2968 for (link = CALL_INSN_FUNCTION_USAGE (insn); link; link = XEXP (link, 1)) 2986 for (link = CALL_INSN_FUNCTION_USAGE (insn); link; link = XEXP (link, 1))
2969 { 2987 {
2970 if (GET_CODE (XEXP (link, 0)) == CLOBBER) 2988 if (GET_CODE (XEXP (link, 0)) == CLOBBER)
2971 sched_analyze_1 (deps, XEXP (link, 0), insn); 2989 sched_analyze_1 (deps, XEXP (link, 0), insn);
2990 else if (GET_CODE (XEXP (link, 0)) == CLOBBER_HIGH)
2991 /* We could support CLOBBER_HIGH and treat it in the same way as
2992 HARD_REGNO_CALL_PART_CLOBBERED, but no port needs that yet. */
2993 gcc_unreachable ();
2972 else if (GET_CODE (XEXP (link, 0)) != SET) 2994 else if (GET_CODE (XEXP (link, 0)) != SET)
2973 sched_analyze_2 (deps, XEXP (link, 0), insn); 2995 sched_analyze_2 (deps, XEXP (link, 0), insn);
2974 } 2996 }
2975 /* Don't schedule anything after a tail call, tail call needs 2997 /* Don't schedule anything after a tail call, tail call needs
2976 to use at least all call-saved registers. */ 2998 to use at least all call-saved registers. */