]>
Commit | Line | Data |
---|---|---|
6de9cd9a DN |
1 | /* SSA operand management for trees. |
2 | Copyright (C) 2003 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 2, 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 COPYING. If not, write to the Free | |
18 | Software Foundation, 59 Temple Place - Suite 330, Boston, MA | |
19 | 02111-1307, USA. */ | |
20 | ||
21 | #ifndef GCC_TREE_SSA_OPERANDS_H | |
22 | #define GCC_TREE_SSA_OPERANDS_H | |
23 | ||
24 | /* Interface to SSA operands. */ | |
25 | ||
d00ad49b AM |
26 | |
27 | /* This represents a pointer to a DEF operand. */ | |
28 | typedef struct def_operand_ptr GTY(()) | |
29 | { | |
30 | tree * GTY((skip(""))) def; | |
31 | } def_operand_p; | |
32 | ||
33 | /* This represents a pointer to a USE operand. */ | |
34 | typedef struct use_operand_ptr GTY(()) | |
35 | { | |
36 | tree * GTY((skip(""))) use; | |
37 | } use_operand_p; | |
38 | ||
39 | ||
40 | /* This represents the DEF operands of a stmt. */ | |
6de9cd9a DN |
41 | typedef struct def_optype_d GTY(()) |
42 | { | |
43 | unsigned num_defs; | |
d00ad49b | 44 | struct def_operand_ptr GTY((length("%h.num_defs"))) defs[1]; |
6de9cd9a DN |
45 | } def_optype_t; |
46 | ||
47 | typedef def_optype_t *def_optype; | |
48 | ||
d00ad49b | 49 | /* This represents the USE operands of a stmt. */ |
6de9cd9a DN |
50 | typedef struct use_optype_d GTY(()) |
51 | { | |
52 | unsigned num_uses; | |
d00ad49b | 53 | struct use_operand_ptr GTY((length("%h.num_uses"))) uses[1]; |
6de9cd9a DN |
54 | } use_optype_t; |
55 | ||
56 | typedef use_optype_t *use_optype; | |
57 | ||
d00ad49b | 58 | /* This represents the MAY_DEFS for a stmt. */ |
a32b97a2 | 59 | typedef struct v_may_def_optype_d GTY(()) |
6de9cd9a | 60 | { |
a32b97a2 BB |
61 | unsigned num_v_may_defs; |
62 | tree GTY((length ("%h.num_v_may_defs * 2"))) v_may_defs[1]; | |
63 | } v_may_def_optype_t; | |
6de9cd9a | 64 | |
a32b97a2 | 65 | typedef v_may_def_optype_t *v_may_def_optype; |
6de9cd9a | 66 | |
d00ad49b | 67 | /* This represents the VUSEs for a stmt. */ |
6de9cd9a DN |
68 | typedef struct vuse_optype_d GTY(()) |
69 | { | |
70 | unsigned num_vuses; | |
71 | tree GTY((length ("%h.num_vuses"))) vuses[1]; | |
72 | } vuse_optype_t; | |
73 | ||
74 | typedef vuse_optype_t *vuse_optype; | |
75 | ||
d00ad49b | 76 | /* This represents the V_MUST_DEFS for a stmt. */ |
a32b97a2 BB |
77 | typedef struct v_must_def_optype_d GTY(()) |
78 | { | |
79 | unsigned num_v_must_defs; | |
80 | tree GTY((length("%h.num_v_must_defs"))) v_must_defs[1]; | |
81 | } v_must_def_optype_t; | |
82 | ||
83 | typedef v_must_def_optype_t *v_must_def_optype; | |
84 | ||
d00ad49b AM |
85 | #define USE_FROM_PTR(OP) get_use_from_ptr (OP) |
86 | #define DEF_FROM_PTR(OP) get_def_from_ptr (OP) | |
87 | #define SET_USE(OP, V) ((*((OP).use)) = (V)) | |
88 | #define SET_DEF(OP, V) ((*((OP).def)) = (V)) | |
89 | ||
90 | ||
6de9cd9a DN |
91 | #define USE_OPS(ANN) get_use_ops (ANN) |
92 | #define STMT_USE_OPS(STMT) get_use_ops (stmt_ann (STMT)) | |
93 | #define NUM_USES(OPS) ((OPS) ? (OPS)->num_uses : 0) | |
94 | #define USE_OP_PTR(OPS, I) get_use_op_ptr ((OPS), (I)) | |
d00ad49b AM |
95 | #define USE_OP(OPS, I) (USE_FROM_PTR (USE_OP_PTR ((OPS), (I)))) |
96 | #define SET_USE_OP(OPS, I, V) (SET_USE (USE_OP_PTR ((OPS), (I)), (V))) | |
97 | ||
6de9cd9a DN |
98 | |
99 | ||
100 | #define DEF_OPS(ANN) get_def_ops (ANN) | |
101 | #define STMT_DEF_OPS(STMT) get_def_ops (stmt_ann (STMT)) | |
102 | #define NUM_DEFS(OPS) ((OPS) ? (OPS)->num_defs : 0) | |
103 | #define DEF_OP_PTR(OPS, I) get_def_op_ptr ((OPS), (I)) | |
d00ad49b AM |
104 | #define DEF_OP(OPS, I) (DEF_FROM_PTR (DEF_OP_PTR ((OPS), (I)))) |
105 | #define SET_DEF_OP(OPS, I, V) (SET_DEF (DEF_OP_PTR ((OPS), (I)), (V))) | |
106 | ||
6de9cd9a DN |
107 | |
108 | ||
a32b97a2 BB |
109 | #define V_MAY_DEF_OPS(ANN) get_v_may_def_ops (ANN) |
110 | #define STMT_V_MAY_DEF_OPS(STMT) get_v_may_def_ops (stmt_ann(STMT)) | |
111 | #define NUM_V_MAY_DEFS(OPS) ((OPS) ? (OPS)->num_v_may_defs : 0) | |
112 | #define V_MAY_DEF_RESULT_PTR(OPS, I) get_v_may_def_result_ptr ((OPS), (I)) | |
d00ad49b AM |
113 | #define V_MAY_DEF_RESULT(OPS, I) \ |
114 | (DEF_FROM_PTR (V_MAY_DEF_RESULT_PTR ((OPS), (I)))) | |
115 | #define SET_V_MAY_DEF_RESULT(OPS, I, V) \ | |
116 | (SET_DEF (V_MAY_DEF_RESULT_PTR ((OPS), (I)), (V))) | |
a32b97a2 | 117 | #define V_MAY_DEF_OP_PTR(OPS, I) get_v_may_def_op_ptr ((OPS), (I)) |
d00ad49b AM |
118 | #define V_MAY_DEF_OP(OPS, I) \ |
119 | (USE_FROM_PTR (V_MAY_DEF_OP_PTR ((OPS), (I)))) | |
120 | #define SET_V_MAY_DEF_OP(OPS, I, V) \ | |
121 | (SET_USE (V_MAY_DEF_OP_PTR ((OPS), (I)), (V))) | |
6de9cd9a DN |
122 | |
123 | ||
124 | #define VUSE_OPS(ANN) get_vuse_ops (ANN) | |
125 | #define STMT_VUSE_OPS(STMT) get_vuse_ops (stmt_ann(STMT)) | |
126 | #define NUM_VUSES(OPS) ((OPS) ? (OPS)->num_vuses : 0) | |
127 | #define VUSE_OP_PTR(OPS, I) get_vuse_op_ptr ((OPS), (I)) | |
d00ad49b AM |
128 | #define VUSE_OP(OPS, I) (USE_FROM_PTR (VUSE_OP_PTR ((OPS), (I)))) |
129 | #define SET_VUSE_OP(OPS, I, V) (SET_USE (VUSE_OP_PTR ((OPS), (I)), (V))) | |
6de9cd9a DN |
130 | |
131 | ||
a32b97a2 BB |
132 | #define V_MUST_DEF_OPS(ANN) get_v_must_def_ops (ANN) |
133 | #define STMT_V_MUST_DEF_OPS(STMT) get_v_must_def_ops (stmt_ann (STMT)) | |
134 | #define NUM_V_MUST_DEFS(OPS) ((OPS) ? (OPS)->num_v_must_defs : 0) | |
135 | #define V_MUST_DEF_OP_PTR(OPS, I) get_v_must_def_op_ptr ((OPS), (I)) | |
d00ad49b AM |
136 | #define V_MUST_DEF_OP(OPS, I) \ |
137 | (DEF_FROM_PTR (V_MUST_DEF_OP_PTR ((OPS), (I)))) | |
138 | #define SET_V_MUST_DEF_OP(OPS, I, V) \ | |
139 | (SET_DEF (V_MUST_DEF_OP_PTR ((OPS), (I)), (V))) | |
140 | ||
141 | ||
142 | #define PHI_RESULT_PTR(PHI) get_phi_result_ptr (PHI) | |
143 | #define PHI_RESULT(PHI) DEF_FROM_PTR (PHI_RESULT_PTR (PHI)) | |
144 | #define SET_PHI_RESULT(PHI, V) SET_DEF (PHI_RESULT_PTR (PHI), (V)) | |
145 | ||
146 | #define PHI_ARG_DEF_PTR(PHI, I) get_phi_arg_def_ptr ((PHI), (I)) | |
147 | #define PHI_ARG_DEF(PHI, I) USE_FROM_PTR (PHI_ARG_DEF_PTR ((PHI), (I))) | |
148 | #define SET_PHI_ARG_DEF(PHI, I, V) \ | |
149 | SET_USE (PHI_ARG_DEF_PTR ((PHI), (I)), (V)) | |
150 | #define PHI_ARG_DEF_FROM_EDGE(PHI, E) \ | |
151 | PHI_ARG_DEF ((PHI), \ | |
152 | phi_arg_from_edge ((PHI),(E))) | |
153 | #define PHI_ARG_DEF_PTR_FROM_EDGE(PHI, E) \ | |
154 | PHI_ARG_DEF_PTR ((PHI), \ | |
155 | phi_arg_from_edge ((PHI),(E))) | |
156 | ||
a32b97a2 | 157 | |
6de9cd9a DN |
158 | extern void init_ssa_operands (void); |
159 | extern void fini_ssa_operands (void); | |
160 | extern void verify_start_operands (tree); | |
161 | extern void finalize_ssa_stmt_operands (tree); | |
162 | void add_vuse (tree, tree); | |
163 | extern void get_stmt_operands (tree); | |
164 | extern void remove_vuses (tree); | |
a32b97a2 BB |
165 | extern void remove_v_may_defs (tree); |
166 | extern void remove_v_must_defs (tree); | |
6de9cd9a DN |
167 | |
168 | #endif /* GCC_TREE_SSA_OPERANDS_H */ |