tree-ssanames.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. /* SSA name expresssons routines
  2. Copyright (C) 2013-2015 Free Software Foundation, Inc.
  3. This file is part of GCC.
  4. GCC is free software; you can redistribute it and/or modify it under
  5. the terms of the GNU General Public License as published by the Free
  6. Software Foundation; either version 3, or (at your option) any later
  7. version.
  8. GCC is distributed in the hope that it will be useful, but WITHOUT ANY
  9. WARRANTY; without even the implied warranty of MERCHANTABILITY or
  10. FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  11. for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with GCC; see the file COPYING3. If not see
  14. <http://www.gnu.org/licenses/>. */
  15. #ifndef GCC_TREE_SSANAMES_H
  16. #define GCC_TREE_SSANAMES_H
  17. /* Aliasing information for SSA_NAMEs representing pointer variables. */
  18. struct GTY(()) ptr_info_def
  19. {
  20. /* The points-to solution. */
  21. struct pt_solution pt;
  22. /* Alignment and misalignment of the pointer in bytes. Together
  23. align and misalign specify low known bits of the pointer.
  24. ptr & (align - 1) == misalign. */
  25. /* When known, this is the power-of-two byte alignment of the object this
  26. pointer points into. This is usually DECL_ALIGN_UNIT for decls and
  27. MALLOC_ABI_ALIGNMENT for allocated storage. When the alignment is not
  28. known, it is zero. Do not access directly but use functions
  29. get_ptr_info_alignment, set_ptr_info_alignment,
  30. mark_ptr_info_alignment_unknown and similar. */
  31. unsigned int align;
  32. /* When alignment is known, the byte offset this pointer differs from the
  33. above alignment. Access only through the same helper functions as align
  34. above. */
  35. unsigned int misalign;
  36. };
  37. /* Value range information for SSA_NAMEs representing non-pointer variables. */
  38. struct GTY ((variable_size)) range_info_def {
  39. /* Minimum, maximum and nonzero bits. */
  40. TRAILING_WIDE_INT_ACCESSOR (min, ints, 0)
  41. TRAILING_WIDE_INT_ACCESSOR (max, ints, 1)
  42. TRAILING_WIDE_INT_ACCESSOR (nonzero_bits, ints, 2)
  43. trailing_wide_ints <3> ints;
  44. };
  45. #define SSANAMES(fun) (fun)->gimple_df->ssa_names
  46. #define DEFAULT_DEFS(fun) (fun)->gimple_df->default_defs
  47. #define num_ssa_names (vec_safe_length (cfun->gimple_df->ssa_names))
  48. #define ssa_name(i) ((*cfun->gimple_df->ssa_names)[(i)])
  49. /* Type of value ranges. See value_range_d In tree-vrp.c for a
  50. description of these types. */
  51. enum value_range_type { VR_UNDEFINED, VR_RANGE, VR_ANTI_RANGE, VR_VARYING };
  52. /* Sets the value range to SSA. */
  53. extern void set_range_info (tree, enum value_range_type, const wide_int_ref &,
  54. const wide_int_ref &);
  55. /* Gets the value range from SSA. */
  56. extern enum value_range_type get_range_info (const_tree, wide_int *,
  57. wide_int *);
  58. extern void set_nonzero_bits (tree, const wide_int_ref &);
  59. extern wide_int get_nonzero_bits (const_tree);
  60. extern void init_ssanames (struct function *, int);
  61. extern void fini_ssanames (void);
  62. extern void ssanames_print_statistics (void);
  63. extern tree make_ssa_name_fn (struct function *, tree, gimple);
  64. extern void release_ssa_name_fn (struct function *, tree);
  65. extern bool get_ptr_info_alignment (struct ptr_info_def *, unsigned int *,
  66. unsigned int *);
  67. extern void mark_ptr_info_alignment_unknown (struct ptr_info_def *);
  68. extern void set_ptr_info_alignment (struct ptr_info_def *, unsigned int,
  69. unsigned int);
  70. extern void adjust_ptr_info_misalignment (struct ptr_info_def *,
  71. unsigned int);
  72. extern struct ptr_info_def *get_ptr_info (tree);
  73. extern tree copy_ssa_name_fn (struct function *, tree, gimple);
  74. extern void duplicate_ssa_name_ptr_info (tree, struct ptr_info_def *);
  75. extern tree duplicate_ssa_name_fn (struct function *, tree, gimple);
  76. extern void duplicate_ssa_name_range_info (tree, enum value_range_type,
  77. struct range_info_def *);
  78. extern void reset_flow_sensitive_info (tree);
  79. extern void reset_flow_sensitive_info_in_bb (basic_block);
  80. extern void release_defs (gimple);
  81. extern void replace_ssa_name_symbol (tree, tree);
  82. /* Return an SSA_NAME node for variable VAR defined in statement STMT
  83. in function cfun. */
  84. static inline tree
  85. make_ssa_name (tree var, gimple stmt = NULL)
  86. {
  87. return make_ssa_name_fn (cfun, var, stmt);
  88. }
  89. /* Return an SSA_NAME node using the template SSA name NAME defined in
  90. statement STMT in function cfun. */
  91. static inline tree
  92. copy_ssa_name (tree var, gimple stmt = NULL)
  93. {
  94. return copy_ssa_name_fn (cfun, var, stmt);
  95. }
  96. /* Creates a duplicate of a SSA name NAME tobe defined by statement STMT
  97. in function cfun. */
  98. static inline tree
  99. duplicate_ssa_name (tree var, gimple stmt)
  100. {
  101. return duplicate_ssa_name_fn (cfun, var, stmt);
  102. }
  103. /* Release the SSA name NAME used in function cfun. */
  104. static inline void
  105. release_ssa_name (tree name)
  106. {
  107. release_ssa_name_fn (cfun, name);
  108. }
  109. /* Return an anonymous SSA_NAME node for type TYPE defined in statement STMT
  110. in function cfun. Arrange so that it uses NAME in dumps. */
  111. static inline tree
  112. make_temp_ssa_name (tree type, gimple stmt, const char *name)
  113. {
  114. tree ssa_name;
  115. gcc_checking_assert (TYPE_P (type));
  116. ssa_name = make_ssa_name_fn (cfun, type, stmt);
  117. SET_SSA_NAME_VAR_OR_IDENTIFIER (ssa_name, get_identifier (name));
  118. return ssa_name;
  119. }
  120. #endif /* GCC_TREE_SSANAMES_H */