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