1 /* SSA name expresssons routines
2 Copyright (C) 2013 Free Software Foundation, Inc.
4 This file is part of GCC.
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
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
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/>. */
20 #ifndef GCC_TREE_SSANAMES_H
21 #define GCC_TREE_SSANAMES_H
23 /* Aliasing information for SSA_NAMEs representing pointer variables. */
25 struct GTY(()) ptr_info_def
27 /* The points-to solution. */
28 struct pt_solution pt
;
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. */
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. */
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
45 unsigned int misalign
;
49 #define SSANAMES(fun) (fun)->gimple_df->ssa_names
50 #define MODIFIED_NORETURN_CALLS(fun) (fun)->gimple_df->modified_noreturn_calls
51 #define DEFAULT_DEFS(fun) (fun)->gimple_df->default_defs
53 #define num_ssa_names (vec_safe_length (cfun->gimple_df->ssa_names))
54 #define ssa_name(i) ((*cfun->gimple_df->ssa_names)[(i)])
57 extern void init_ssanames (struct function
*, int);
58 extern void fini_ssanames (void);
59 extern void ssanames_print_statistics (void);
60 extern tree
make_ssa_name_fn (struct function
*, tree
, gimple
);
61 extern void release_ssa_name (tree
);
62 extern bool get_ptr_info_alignment (struct ptr_info_def
*, unsigned int *,
64 extern void mark_ptr_info_alignment_unknown (struct ptr_info_def
*);
65 extern void set_ptr_info_alignment (struct ptr_info_def
*, unsigned int,
67 extern void adjust_ptr_info_misalignment (struct ptr_info_def
*,
69 extern struct ptr_info_def
*get_ptr_info (tree
);
71 extern tree
copy_ssa_name_fn (struct function
*, tree
, gimple
);
72 extern void duplicate_ssa_name_ptr_info (tree
, struct ptr_info_def
*);
73 extern tree
duplicate_ssa_name_fn (struct function
*, tree
, gimple
);
74 extern void release_defs (gimple
);
75 extern void replace_ssa_name_symbol (tree
, tree
);
78 /* Return an SSA_NAME node for variable VAR defined in statement STMT
82 make_ssa_name (tree var
, gimple stmt
)
84 return make_ssa_name_fn (cfun
, var
, stmt
);
87 /* Return an SSA_NAME node using the template SSA name NAME defined in
88 statement STMT in function cfun. */
91 copy_ssa_name (tree var
, gimple stmt
)
93 return copy_ssa_name_fn (cfun
, var
, stmt
);
96 /* Creates a duplicate of a SSA name NAME tobe defined by statement STMT
100 duplicate_ssa_name (tree var
, gimple stmt
)
102 return duplicate_ssa_name_fn (cfun
, var
, stmt
);
105 /* Return an anonymous SSA_NAME node for type TYPE defined in statement STMT
106 in function cfun. Arrange so that it uses NAME in dumps. */
109 make_temp_ssa_name (tree type
, gimple stmt
, const char *name
)
112 gcc_checking_assert (TYPE_P (type
));
113 ssa_name
= make_ssa_name_fn (cfun
, type
, stmt
);
114 SET_SSA_NAME_VAR_OR_IDENTIFIER (ssa_name
, get_identifier (name
));
119 #endif /* GCC_TREE_SSANAMES_H */