comparison gcc/tree-ssanames.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 /* Generic routines for manipulating SSA_NAME expressions 1 /* Generic routines for manipulating SSA_NAME expressions
2 Copyright (C) 2003-2017 Free Software Foundation, Inc. 2 Copyright (C) 2003-2018 Free Software Foundation, Inc.
3 3
4 This file is part of GCC. 4 This file is part of GCC.
5 5
6 GCC is free software; you can redistribute it and/or modify 6 GCC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by 7 it under the terms of the GNU General Public License as published by
27 #include "ssa.h" 27 #include "ssa.h"
28 #include "gimple-iterator.h" 28 #include "gimple-iterator.h"
29 #include "stor-layout.h" 29 #include "stor-layout.h"
30 #include "tree-into-ssa.h" 30 #include "tree-into-ssa.h"
31 #include "tree-ssa.h" 31 #include "tree-ssa.h"
32 #include "cfgloop.h"
33 #include "tree-scalar-evolution.h"
32 34
33 /* Rewriting a function into SSA form can create a huge number of SSA_NAMEs, 35 /* Rewriting a function into SSA form can create a huge number of SSA_NAMEs,
34 many of which may be thrown away shortly after their creation if jumps 36 many of which may be thrown away shortly after their creation if jumps
35 were threaded through PHI nodes. 37 were threaded through PHI nodes.
36 38
239 on the free list or in the queue. Anything else is an error. */ 241 on the free list or in the queue. Anything else is an error. */
240 242
241 void 243 void
242 flush_ssaname_freelist (void) 244 flush_ssaname_freelist (void)
243 { 245 {
246 /* If there were any SSA names released reset the SCEV cache. */
247 if (! vec_safe_is_empty (FREE_SSANAMES_QUEUE (cfun)))
248 scev_reset_htab ();
244 vec_safe_splice (FREE_SSANAMES (cfun), FREE_SSANAMES_QUEUE (cfun)); 249 vec_safe_splice (FREE_SSANAMES (cfun), FREE_SSANAMES_QUEUE (cfun));
245 vec_safe_truncate (FREE_SSANAMES_QUEUE (cfun), 0); 250 vec_safe_truncate (FREE_SSANAMES_QUEUE (cfun), 0);
246 } 251 }
247 252
248 /* Return an SSA_NAME node for variable VAR defined in statement STMT 253 /* Return an SSA_NAME node for variable VAR defined in statement STMT
324 329
325 Store range information RANGE_TYPE, MIN, and MAX to tree ssa_name 330 Store range information RANGE_TYPE, MIN, and MAX to tree ssa_name
326 NAME. */ 331 NAME. */
327 332
328 void 333 void
329 set_range_info_raw (tree name, enum value_range_type range_type, 334 set_range_info_raw (tree name, enum value_range_kind range_type,
330 const wide_int_ref &min, const wide_int_ref &max) 335 const wide_int_ref &min, const wide_int_ref &max)
331 { 336 {
332 gcc_assert (!POINTER_TYPE_P (TREE_TYPE (name))); 337 gcc_assert (!POINTER_TYPE_P (TREE_TYPE (name)));
333 gcc_assert (range_type == VR_RANGE || range_type == VR_ANTI_RANGE); 338 gcc_assert (range_type == VR_RANGE || range_type == VR_ANTI_RANGE);
334 range_info_def *ri = SSA_NAME_RANGE_INFO (name); 339 range_info_def *ri = SSA_NAME_RANGE_INFO (name);
365 370
366 /* Store range information RANGE_TYPE, MIN, and MAX to tree ssa_name 371 /* Store range information RANGE_TYPE, MIN, and MAX to tree ssa_name
367 NAME while making sure we don't store useless range info. */ 372 NAME while making sure we don't store useless range info. */
368 373
369 void 374 void
370 set_range_info (tree name, enum value_range_type range_type, 375 set_range_info (tree name, enum value_range_kind range_type,
371 const wide_int_ref &min, const wide_int_ref &max) 376 const wide_int_ref &min, const wide_int_ref &max)
372 { 377 {
373 gcc_assert (!POINTER_TYPE_P (TREE_TYPE (name))); 378 gcc_assert (!POINTER_TYPE_P (TREE_TYPE (name)));
374 379
375 /* A range of the entire domain is really no range at all. */ 380 /* A range of the entire domain is really no range at all. */
390 395
391 set_range_info_raw (name, range_type, min, max); 396 set_range_info_raw (name, range_type, min, max);
392 } 397 }
393 398
394 399
395 /* Gets range information MIN, MAX and returns enum value_range_type 400 /* Gets range information MIN, MAX and returns enum value_range_kind
396 corresponding to tree ssa_name NAME. enum value_range_type returned 401 corresponding to tree ssa_name NAME. enum value_range_kind returned
397 is used to determine if MIN and MAX are valid values. */ 402 is used to determine if MIN and MAX are valid values. */
398 403
399 enum value_range_type 404 enum value_range_kind
400 get_range_info (const_tree name, wide_int *min, wide_int *max) 405 get_range_info (const_tree name, wide_int *min, wide_int *max)
401 { 406 {
402 gcc_assert (!POINTER_TYPE_P (TREE_TYPE (name))); 407 gcc_assert (!POINTER_TYPE_P (TREE_TYPE (name)));
403 gcc_assert (min && max); 408 gcc_assert (min && max);
404 range_info_def *ri = SSA_NAME_RANGE_INFO (name); 409 range_info_def *ri = SSA_NAME_RANGE_INFO (name);
560 { 565 {
561 tree saved_ssa_name_var = SSA_NAME_VAR (var); 566 tree saved_ssa_name_var = SSA_NAME_VAR (var);
562 int saved_ssa_name_version = SSA_NAME_VERSION (var); 567 int saved_ssa_name_version = SSA_NAME_VERSION (var);
563 use_operand_p imm = &(SSA_NAME_IMM_USE_NODE (var)); 568 use_operand_p imm = &(SSA_NAME_IMM_USE_NODE (var));
564 569
565 if (MAY_HAVE_DEBUG_STMTS) 570 if (MAY_HAVE_DEBUG_BIND_STMTS)
566 insert_debug_temp_for_var_def (NULL, var); 571 insert_debug_temp_for_var_def (NULL, var);
567 572
568 if (flag_checking) 573 if (flag_checking)
569 verify_imm_links (stderr, var); 574 verify_imm_links (stderr, var);
570 while (imm->next != imm) 575 while (imm->next != imm)
641 646
642 /* If pointer described by PI has known alignment, increase its known 647 /* If pointer described by PI has known alignment, increase its known
643 misalignment by INCREMENT modulo its current alignment. */ 648 misalignment by INCREMENT modulo its current alignment. */
644 649
645 void 650 void
646 adjust_ptr_info_misalignment (struct ptr_info_def *pi, 651 adjust_ptr_info_misalignment (struct ptr_info_def *pi, poly_uint64 increment)
647 unsigned int increment)
648 { 652 {
649 if (pi->align != 0) 653 if (pi->align != 0)
650 { 654 {
651 pi->misalign += increment; 655 increment += pi->misalign;
652 pi->misalign &= (pi->align - 1); 656 if (!known_misalignment (increment, pi->align, &pi->misalign))
657 {
658 pi->align = known_alignment (increment);
659 pi->misalign = 0;
660 }
653 } 661 }
654 } 662 }
655 663
656 /* Return the alias information associated with pointer T. It creates a 664 /* Return the alias information associated with pointer T. It creates a
657 new instance if none existed. */ 665 new instance if none existed. */
717 } 725 }
718 726
719 /* Creates a duplicate of the range_info_def at RANGE_INFO of type 727 /* Creates a duplicate of the range_info_def at RANGE_INFO of type
720 RANGE_TYPE for use by the SSA name NAME. */ 728 RANGE_TYPE for use by the SSA name NAME. */
721 void 729 void
722 duplicate_ssa_name_range_info (tree name, enum value_range_type range_type, 730 duplicate_ssa_name_range_info (tree name, enum value_range_kind range_type,
723 struct range_info_def *range_info) 731 struct range_info_def *range_info)
724 { 732 {
725 struct range_info_def *new_range_info; 733 struct range_info_def *new_range_info;
726 734
727 gcc_assert (!POINTER_TYPE_P (TREE_TYPE (name))); 735 gcc_assert (!POINTER_TYPE_P (TREE_TYPE (name)));