您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

159 行
5.5KB

  1. /* SSA name expresssons routines
  2. Copyright (C) 2013-2020 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. #define FOR_EACH_SSA_NAME(I, VAR, FN) \
  50. for (I = 1; SSANAMES (FN)->iterate (I, &VAR); ++I) \
  51. if (VAR)
  52. /* Sets the value range to SSA. */
  53. extern void set_range_info (tree, enum value_range_kind, const wide_int_ref &,
  54. const wide_int_ref &);
  55. extern void set_range_info (tree, const value_range &);
  56. /* Gets the value range from SSA. */
  57. extern enum value_range_kind get_range_info (const_tree, wide_int *,
  58. wide_int *);
  59. extern enum value_range_kind get_range_info (const_tree, value_range &);
  60. extern void set_nonzero_bits (tree, const wide_int_ref &);
  61. extern wide_int get_nonzero_bits (const_tree);
  62. extern bool ssa_name_has_boolean_range (tree);
  63. extern void init_ssanames (struct function *, int);
  64. extern void fini_ssanames (struct function *);
  65. extern void ssanames_print_statistics (void);
  66. extern tree make_ssa_name_fn (struct function *, tree, gimple *,
  67. unsigned int version = 0);
  68. extern void init_ssa_name_imm_use (tree);
  69. extern void release_ssa_name_fn (struct function *, tree);
  70. extern bool get_ptr_info_alignment (struct ptr_info_def *, unsigned int *,
  71. unsigned int *);
  72. extern void mark_ptr_info_alignment_unknown (struct ptr_info_def *);
  73. extern void set_ptr_info_alignment (struct ptr_info_def *, unsigned int,
  74. unsigned int);
  75. extern void adjust_ptr_info_misalignment (struct ptr_info_def *, poly_uint64);
  76. extern struct ptr_info_def *get_ptr_info (tree);
  77. extern void set_ptr_nonnull (tree);
  78. extern bool get_ptr_nonnull (const_tree);
  79. extern tree copy_ssa_name_fn (struct function *, tree, gimple *);
  80. extern void duplicate_ssa_name_ptr_info (tree, struct ptr_info_def *);
  81. extern tree duplicate_ssa_name_fn (struct function *, tree, gimple *);
  82. extern void duplicate_ssa_name_range_info (tree, enum value_range_kind,
  83. struct range_info_def *);
  84. extern void reset_flow_sensitive_info (tree);
  85. extern void reset_flow_sensitive_info_in_bb (basic_block);
  86. extern void release_defs (gimple *);
  87. extern void replace_ssa_name_symbol (tree, tree);
  88. extern void flush_ssaname_freelist (void);
  89. /* Return an SSA_NAME node for variable VAR defined in statement STMT
  90. in function cfun. */
  91. static inline tree
  92. make_ssa_name (tree var, gimple *stmt = NULL)
  93. {
  94. return make_ssa_name_fn (cfun, var, stmt);
  95. }
  96. /* Return an SSA_NAME node using the template SSA name NAME defined in
  97. statement STMT in function cfun. */
  98. static inline tree
  99. copy_ssa_name (tree var, gimple *stmt = NULL)
  100. {
  101. return copy_ssa_name_fn (cfun, var, stmt);
  102. }
  103. /* Creates a duplicate of a SSA name NAME tobe defined by statement STMT
  104. in function cfun. */
  105. static inline tree
  106. duplicate_ssa_name (tree var, gimple *stmt)
  107. {
  108. return duplicate_ssa_name_fn (cfun, var, stmt);
  109. }
  110. /* Release the SSA name NAME used in function cfun. */
  111. static inline void
  112. release_ssa_name (tree name)
  113. {
  114. release_ssa_name_fn (cfun, name);
  115. }
  116. /* Return an anonymous SSA_NAME node for type TYPE defined in statement STMT
  117. in function cfun. Arrange so that it uses NAME in dumps. */
  118. static inline tree
  119. make_temp_ssa_name (tree type, gimple *stmt, const char *name)
  120. {
  121. tree ssa_name;
  122. gcc_checking_assert (TYPE_P (type));
  123. ssa_name = make_ssa_name_fn (cfun, type, stmt);
  124. SET_SSA_NAME_VAR_OR_IDENTIFIER (ssa_name, get_identifier (name));
  125. return ssa_name;
  126. }
  127. #endif /* GCC_TREE_SSANAMES_H */