annotate gcc/tree-phinodes.h @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 1830386684a0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* Header file for PHI node routines
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2 Copyright (C) 2013-2020 Free Software Foundation, Inc.
111
kono
parents:
diff changeset
3
kono
parents:
diff changeset
4 This file is part of GCC.
kono
parents:
diff changeset
5
kono
parents:
diff changeset
6 GCC is free software; you can redistribute it and/or modify it under
kono
parents:
diff changeset
7 the terms of the GNU General Public License as published by the Free
kono
parents:
diff changeset
8 Software Foundation; either version 3, or (at your option) any later
kono
parents:
diff changeset
9 version.
kono
parents:
diff changeset
10
kono
parents:
diff changeset
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
kono
parents:
diff changeset
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
kono
parents:
diff changeset
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
kono
parents:
diff changeset
14 for more details.
kono
parents:
diff changeset
15
kono
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
kono
parents:
diff changeset
17 along with GCC; see the file COPYING3. If not see
kono
parents:
diff changeset
18 <http://www.gnu.org/licenses/>. */
kono
parents:
diff changeset
19
kono
parents:
diff changeset
20 #ifndef GCC_TREE_PHINODES_H
kono
parents:
diff changeset
21 #define GCC_TREE_PHINODES_H
kono
parents:
diff changeset
22
kono
parents:
diff changeset
23 extern void phinodes_print_statistics (void);
kono
parents:
diff changeset
24 extern void reserve_phi_args_for_new_edge (basic_block);
kono
parents:
diff changeset
25 extern void add_phi_node_to_bb (gphi *phi, basic_block bb);
kono
parents:
diff changeset
26 extern gphi *create_phi_node (tree, basic_block);
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
27 extern void add_phi_arg (gphi *, tree, edge, location_t);
111
kono
parents:
diff changeset
28 extern void remove_phi_args (edge);
kono
parents:
diff changeset
29 extern void remove_phi_node (gimple_stmt_iterator *, bool);
kono
parents:
diff changeset
30 extern void remove_phi_nodes (basic_block);
kono
parents:
diff changeset
31 extern tree degenerate_phi_result (gphi *);
kono
parents:
diff changeset
32 extern void set_phi_nodes (basic_block, gimple_seq);
kono
parents:
diff changeset
33
kono
parents:
diff changeset
34 static inline use_operand_p
kono
parents:
diff changeset
35 gimple_phi_arg_imm_use_ptr (gimple *gs, int i)
kono
parents:
diff changeset
36 {
kono
parents:
diff changeset
37 return &gimple_phi_arg (gs, i)->imm_use;
kono
parents:
diff changeset
38 }
kono
parents:
diff changeset
39
kono
parents:
diff changeset
40 /* Return the phi argument which contains the specified use. */
kono
parents:
diff changeset
41
kono
parents:
diff changeset
42 static inline int
kono
parents:
diff changeset
43 phi_arg_index_from_use (use_operand_p use)
kono
parents:
diff changeset
44 {
kono
parents:
diff changeset
45 struct phi_arg_d *element, *root;
kono
parents:
diff changeset
46 size_t index;
kono
parents:
diff changeset
47 gimple *phi;
kono
parents:
diff changeset
48
kono
parents:
diff changeset
49 /* Since the use is the first thing in a PHI argument element, we can
kono
parents:
diff changeset
50 calculate its index based on casting it to an argument, and performing
kono
parents:
diff changeset
51 pointer arithmetic. */
kono
parents:
diff changeset
52
kono
parents:
diff changeset
53 phi = USE_STMT (use);
kono
parents:
diff changeset
54
kono
parents:
diff changeset
55 element = (struct phi_arg_d *)use;
kono
parents:
diff changeset
56 root = gimple_phi_arg (phi, 0);
kono
parents:
diff changeset
57 index = element - root;
kono
parents:
diff changeset
58
kono
parents:
diff changeset
59 /* Make sure the calculation doesn't have any leftover bytes. If it does,
kono
parents:
diff changeset
60 then imm_use is likely not the first element in phi_arg_d. */
kono
parents:
diff changeset
61 gcc_checking_assert ((((char *)element - (char *)root)
kono
parents:
diff changeset
62 % sizeof (struct phi_arg_d)) == 0
kono
parents:
diff changeset
63 && index < gimple_phi_capacity (phi));
kono
parents:
diff changeset
64
kono
parents:
diff changeset
65 return index;
kono
parents:
diff changeset
66 }
kono
parents:
diff changeset
67
kono
parents:
diff changeset
68 #endif /* GCC_TREE_PHINODES_H */