comparison gcc/df-scan.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
comparison
equal deleted inserted replaced
111:04ced10e8804 131:84e7813d76e9
1 /* Scanning of rtl for dataflow analysis. 1 /* Scanning of rtl for dataflow analysis.
2 Copyright (C) 1999-2017 Free Software Foundation, Inc. 2 Copyright (C) 1999-2018 Free Software Foundation, Inc.
3 Originally contributed by Michael P. Hayes 3 Originally contributed by Michael P. Hayes
4 (m.hayes@elec.canterbury.ac.nz, mhayes@redhat.com) 4 (m.hayes@elec.canterbury.ac.nz, mhayes@redhat.com)
5 Major rewrite contributed by Danny Berlin (dberlin@dberlin.org) 5 Major rewrite contributed by Danny Berlin (dberlin@dberlin.org)
6 and Kenneth Zadeck (zadeck@naturalbridge.com). 6 and Kenneth Zadeck (zadeck@naturalbridge.com).
7 7
32 #include "memmodel.h" 32 #include "memmodel.h"
33 #include "tm_p.h" 33 #include "tm_p.h"
34 #include "regs.h" 34 #include "regs.h"
35 #include "emit-rtl.h" /* FIXME: Can go away once crtl is moved to rtl.h. */ 35 #include "emit-rtl.h" /* FIXME: Can go away once crtl is moved to rtl.h. */
36 #include "dumpfile.h" 36 #include "dumpfile.h"
37 #include "calls.h"
37 38
38 39
39 /* The set of hard registers in eliminables[i].from. */ 40 /* The set of hard registers in eliminables[i].from. */
40 41
41 static HARD_REG_SET elim_reg_set; 42 static HARD_REG_SET elim_reg_set;
2775 case SET: 2776 case SET:
2776 df_find_hard_reg_defs_1 (SET_DEST (x), defs); 2777 df_find_hard_reg_defs_1 (SET_DEST (x), defs);
2777 break; 2778 break;
2778 2779
2779 case CLOBBER: 2780 case CLOBBER:
2781 case CLOBBER_HIGH:
2780 df_find_hard_reg_defs_1 (XEXP (x, 0), defs); 2782 df_find_hard_reg_defs_1 (XEXP (x, 0), defs);
2781 break; 2783 break;
2782 2784
2783 case COND_EXEC: 2785 case COND_EXEC:
2784 df_find_hard_reg_defs (COND_EXEC_CODE (x), defs); 2786 df_find_hard_reg_defs (COND_EXEC_CODE (x), defs);
2832 DF_REF_REG_MEM_STORE, 2834 DF_REF_REG_MEM_STORE,
2833 bb, insn_info, 2835 bb, insn_info,
2834 flags); 2836 flags);
2835 2837
2836 /* If we're clobbering a REG then we have a def so ignore. */ 2838 /* If we're clobbering a REG then we have a def so ignore. */
2839 return;
2840
2841 case CLOBBER_HIGH:
2842 gcc_assert (REG_P (XEXP (x, 0)));
2837 return; 2843 return;
2838 2844
2839 case MEM: 2845 case MEM:
2840 df_uses_record (collection_rec, 2846 df_uses_record (collection_rec,
2841 &XEXP (x, 0), DF_REF_REG_MEM_LOAD, 2847 &XEXP (x, 0), DF_REF_REG_MEM_LOAD,
3130 /* Record the registers used to pass arguments, and explicitly 3136 /* Record the registers used to pass arguments, and explicitly
3131 noted as clobbered. */ 3137 noted as clobbered. */
3132 for (note = CALL_INSN_FUNCTION_USAGE (insn_info->insn); note; 3138 for (note = CALL_INSN_FUNCTION_USAGE (insn_info->insn); note;
3133 note = XEXP (note, 1)) 3139 note = XEXP (note, 1))
3134 { 3140 {
3141 gcc_assert (GET_CODE (XEXP (note, 0)) != CLOBBER_HIGH);
3135 if (GET_CODE (XEXP (note, 0)) == USE) 3142 if (GET_CODE (XEXP (note, 0)) == USE)
3136 df_uses_record (collection_rec, &XEXP (XEXP (note, 0), 0), 3143 df_uses_record (collection_rec, &XEXP (XEXP (note, 0), 0),
3137 DF_REF_REG_USE, bb, insn_info, flags); 3144 DF_REF_REG_USE, bb, insn_info, flags);
3138 else if (GET_CODE (XEXP (note, 0)) == CLOBBER) 3145 else if (GET_CODE (XEXP (note, 0)) == CLOBBER)
3139 { 3146 {
3204 /* For CALL_INSNs, first record DF_REF_BASE register defs, as well as 3211 /* For CALL_INSNs, first record DF_REF_BASE register defs, as well as
3205 uses from CALL_INSN_FUNCTION_USAGE. */ 3212 uses from CALL_INSN_FUNCTION_USAGE. */
3206 if (CALL_P (insn_info->insn)) 3213 if (CALL_P (insn_info->insn))
3207 df_get_call_refs (collection_rec, bb, insn_info, flags); 3214 df_get_call_refs (collection_rec, bb, insn_info, flags);
3208 3215
3209 if (asm_noperands (PATTERN (insn_info->insn)) >= 0)
3210 for (unsigned i = 0; i < FIRST_PSEUDO_REGISTER; i++)
3211 if (global_regs[i])
3212 {
3213 /* As with calls, asm statements reference all global regs. */
3214 df_ref_record (DF_REF_BASE, collection_rec, regno_reg_rtx[i],
3215 NULL, bb, insn_info, DF_REF_REG_USE, flags);
3216 df_ref_record (DF_REF_BASE, collection_rec, regno_reg_rtx[i],
3217 NULL, bb, insn_info, DF_REF_REG_DEF, flags);
3218 }
3219
3220 /* Record other defs. These should be mostly for DF_REF_REGULAR, so 3216 /* Record other defs. These should be mostly for DF_REF_REGULAR, so
3221 that a qsort on the defs is unnecessary in most cases. */ 3217 that a qsort on the defs is unnecessary in most cases. */
3222 df_defs_record (collection_rec, 3218 df_defs_record (collection_rec,
3223 PATTERN (insn_info->insn), bb, insn_info, 0); 3219 PATTERN (insn_info->insn), bb, insn_info, 0);
3224 3220
3516 if (r && REG_P (r)) 3512 if (r && REG_P (r))
3517 bitmap_set_bit (entry_block_defs, REGNO (r)); 3513 bitmap_set_bit (entry_block_defs, REGNO (r));
3518 3514
3519 /* If the function has an incoming STATIC_CHAIN, it has to show up 3515 /* If the function has an incoming STATIC_CHAIN, it has to show up
3520 in the entry def set. */ 3516 in the entry def set. */
3521 r = targetm.calls.static_chain (current_function_decl, true); 3517 r = rtx_for_static_chain (current_function_decl, true);
3522 if (r && REG_P (r)) 3518 if (r && REG_P (r))
3523 bitmap_set_bit (entry_block_defs, REGNO (r)); 3519 bitmap_set_bit (entry_block_defs, REGNO (r));
3524 3520
3525 if ((!reload_completed) || frame_pointer_needed) 3521 if ((!reload_completed) || frame_pointer_needed)
3526 { 3522 {