comparison gcc/valtrack.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 /* Infrastructure for tracking user variable locations and values 1 /* Infrastructure for tracking user variable locations and values
2 throughout compilation. 2 throughout compilation.
3 Copyright (C) 2010-2017 Free Software Foundation, Inc. 3 Copyright (C) 2010-2018 Free Software Foundation, Inc.
4 Contributed by Alexandre Oliva <aoliva@redhat.com>. 4 Contributed by Alexandre Oliva <aoliva@redhat.com>.
5 5
6 This file is part of GCC. 6 This file is part of GCC.
7 7
8 GCC is free software; you can redistribute it and/or modify it under 8 GCC is free software; you can redistribute it and/or modify it under
92 mem_mode = GET_MODE (x); 92 mem_mode = GET_MODE (x);
93 break; 93 break;
94 94
95 case PRE_INC: 95 case PRE_INC:
96 case PRE_DEC: 96 case PRE_DEC:
97 gcc_assert (mem_mode != VOIDmode && mem_mode != BLKmode); 97 {
98 return gen_rtx_PLUS (GET_MODE (x), 98 gcc_assert (mem_mode != VOIDmode && mem_mode != BLKmode);
99 cleanup_auto_inc_dec (XEXP (x, 0), mem_mode), 99 poly_int64 offset = GET_MODE_SIZE (mem_mode);
100 gen_int_mode (code == PRE_INC 100 if (code == PRE_DEC)
101 ? GET_MODE_SIZE (mem_mode) 101 offset = -offset;
102 : -GET_MODE_SIZE (mem_mode), 102 return gen_rtx_PLUS (GET_MODE (x),
103 GET_MODE (x))); 103 cleanup_auto_inc_dec (XEXP (x, 0), mem_mode),
104 gen_int_mode (offset, GET_MODE (x)));
105 }
104 106
105 case POST_INC: 107 case POST_INC:
106 case POST_DEC: 108 case POST_DEC:
107 case PRE_MODIFY: 109 case PRE_MODIFY:
108 case POST_MODIFY: 110 case POST_MODIFY:
169 subrtx_iterator::array_type array; 171 subrtx_iterator::array_type array;
170 FOR_EACH_SUBRTX (iter, array, pair->to, ALL) 172 FOR_EACH_SUBRTX (iter, array, pair->to, ALL)
171 if (REG_P (*iter) && ++cnt > 1) 173 if (REG_P (*iter) && ++cnt > 1)
172 { 174 {
173 rtx dval = make_debug_expr_from_rtl (old_rtx); 175 rtx dval = make_debug_expr_from_rtl (old_rtx);
176 rtx to = pair->to;
177 if (volatile_insn_p (to))
178 to = gen_rtx_UNKNOWN_VAR_LOC ();
174 /* Emit a debug bind insn. */ 179 /* Emit a debug bind insn. */
175 rtx bind 180 rtx bind
176 = gen_rtx_VAR_LOCATION (GET_MODE (old_rtx), 181 = gen_rtx_VAR_LOCATION (GET_MODE (old_rtx),
177 DEBUG_EXPR_TREE_DECL (dval), pair->to, 182 DEBUG_EXPR_TREE_DECL (dval), to,
178 VAR_INIT_STATUS_INITIALIZED); 183 VAR_INIT_STATUS_INITIALIZED);
179 rtx_insn *bind_insn = emit_debug_insn_before (bind, pair->insn); 184 rtx_insn *bind_insn = emit_debug_insn_before (bind, pair->insn);
180 df_insn_rescan (bind_insn); 185 df_insn_rescan (bind_insn);
181 pair->to = dval; 186 pair->to = dval;
182 break; 187 break;
209 rtl_hooks.gen_lowpart_no_emit = gen_lowpart_for_debug; 214 rtl_hooks.gen_lowpart_no_emit = gen_lowpart_for_debug;
210 while (next != last && next != end) 215 while (next != last && next != end)
211 { 216 {
212 insn = next; 217 insn = next;
213 next = NEXT_INSN (insn); 218 next = NEXT_INSN (insn);
214 if (DEBUG_INSN_P (insn)) 219 if (DEBUG_BIND_INSN_P (insn))
215 { 220 {
216 loc = simplify_replace_fn_rtx (INSN_VAR_LOCATION_LOC (insn), 221 loc = simplify_replace_fn_rtx (INSN_VAR_LOCATION_LOC (insn),
217 dest, propagate_for_debug_subst, &p); 222 dest, propagate_for_debug_subst, &p);
218 if (loc == INSN_VAR_LOCATION_LOC (insn)) 223 if (loc == INSN_VAR_LOCATION_LOC (insn))
219 continue; 224 continue;
225 if (volatile_insn_p (loc))
226 loc = gen_rtx_UNKNOWN_VAR_LOC ();
220 INSN_VAR_LOCATION_LOC (insn) = loc; 227 INSN_VAR_LOCATION_LOC (insn) = loc;
221 df_insn_rescan (insn); 228 df_insn_rescan (insn);
222 } 229 }
223 } 230 }
224 rtl_hooks.gen_lowpart_no_emit = saved_rtl_hook_no_emit; 231 rtl_hooks.gen_lowpart_no_emit = saved_rtl_hook_no_emit;
548 debug_lowpart_subreg (machine_mode outer_mode, rtx expr, 555 debug_lowpart_subreg (machine_mode outer_mode, rtx expr,
549 machine_mode inner_mode) 556 machine_mode inner_mode)
550 { 557 {
551 if (inner_mode == VOIDmode) 558 if (inner_mode == VOIDmode)
552 inner_mode = GET_MODE (expr); 559 inner_mode = GET_MODE (expr);
553 int offset = subreg_lowpart_offset (outer_mode, inner_mode); 560 poly_int64 offset = subreg_lowpart_offset (outer_mode, inner_mode);
554 rtx ret = simplify_gen_subreg (outer_mode, expr, inner_mode, offset); 561 rtx ret = simplify_gen_subreg (outer_mode, expr, inner_mode, offset);
555 if (ret) 562 if (ret)
556 return ret; 563 return ret;
557 return gen_rtx_raw_SUBREG (outer_mode, expr, offset); 564 return gen_rtx_raw_SUBREG (outer_mode, expr, offset);
558 } 565 }
604 } 611 }
605 *usesp = cur; 612 *usesp = cur;
606 usesp = &cur->next; 613 usesp = &cur->next;
607 *tailp = cur->next; 614 *tailp = cur->next;
608 cur->next = NULL; 615 cur->next = NULL;
616 /* "may" rather than "must" because we want (for example)
617 N V4SFs to win over plain V4SF even though N might be 1. */
618 rtx candidate = *DF_REF_REAL_LOC (cur->use);
609 if (!reg 619 if (!reg
610 || (GET_MODE_BITSIZE (GET_MODE (reg)) 620 || maybe_lt (GET_MODE_BITSIZE (GET_MODE (reg)),
611 < GET_MODE_BITSIZE (GET_MODE (*DF_REF_REAL_LOC (cur->use))))) 621 GET_MODE_BITSIZE (GET_MODE (candidate))))
612 reg = *DF_REF_REAL_LOC (cur->use); 622 reg = candidate;
613 } 623 }
614 else 624 else
615 tailp = &(*tailp)->next; 625 tailp = &(*tailp)->next;
616 } 626 }
617 627
658 XDELETE (uses); 668 XDELETE (uses);
659 uses = cur; 669 uses = cur;
660 } 670 }
661 return 0; 671 return 0;
662 } 672 }
673 /* Asm in DEBUG_INSN is never useful, we can't emit debug info for
674 that. And for volatile_insn_p, it is actually harmful
675 - DEBUG_INSNs shouldn't have any side-effects. */
676 else if (GET_CODE (src) == ASM_OPERANDS
677 || volatile_insn_p (src))
678 set = NULL_RTX;
663 } 679 }
664 680
665 /* ??? Should we try to extract it from a PARALLEL? */ 681 /* ??? Should we try to extract it from a PARALLEL? */
666 if (!set) 682 if (!set)
667 breg = NULL; 683 breg = NULL;