1 /* SSA operand management for trees.
2 Copyright (C) 2003 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 2, 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 COPYING. If not, write to the Free
18 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
21 #ifndef GCC_TREE_SSA_OPERANDS_H
22 #define GCC_TREE_SSA_OPERANDS_H
24 /* Interface to SSA operands. */
27 /* This represents a pointer to a DEF operand. */
28 typedef struct def_operand_ptr
GTY(())
30 tree
* GTY((skip(""))) def
;
33 /* This represents a pointer to a USE operand. */
34 typedef struct use_operand_ptr
GTY(())
36 tree
* GTY((skip(""))) use
;
40 /* This represents the DEF operands of a stmt. */
41 typedef struct def_optype_d
GTY(())
44 struct def_operand_ptr
GTY((length("%h.num_defs"))) defs
[1];
47 typedef def_optype_t
*def_optype
;
49 /* This represents the USE operands of a stmt. */
50 typedef struct use_optype_d
GTY(())
53 struct use_operand_ptr
GTY((length("%h.num_uses"))) uses
[1];
56 typedef use_optype_t
*use_optype
;
58 /* Operand type which stores a def and a use tree. */
59 typedef struct v_may_def_operand_type
GTY(())
63 } v_may_def_operand_type_t
;
65 /* This represents the MAY_DEFS for a stmt. */
66 typedef struct v_may_def_optype_d
GTY(())
68 unsigned num_v_may_defs
;
69 struct v_may_def_operand_type
GTY((length ("%h.num_v_may_defs")))
73 typedef v_may_def_optype_t
*v_may_def_optype
;
75 /* This represents the VUSEs for a stmt. */
76 typedef struct vuse_optype_d
GTY(())
79 tree
GTY((length ("%h.num_vuses"))) vuses
[1];
82 typedef vuse_optype_t
*vuse_optype
;
84 /* This represents the V_MUST_DEFS for a stmt. */
85 typedef struct v_must_def_optype_d
GTY(())
87 unsigned num_v_must_defs
;
88 tree
GTY((length("%h.num_v_must_defs"))) v_must_defs
[1];
89 } v_must_def_optype_t
;
91 typedef v_must_def_optype_t
*v_must_def_optype
;
93 /* This represents the operand cache fora stmt. */
94 typedef struct stmt_operands_d
GTY(())
96 /* Statement operands. */
97 struct def_optype_d
* GTY (()) def_ops
;
98 struct use_optype_d
* GTY (()) use_ops
;
100 /* Virtual operands (V_MAY_DEF, VUSE, and V_MUST_DEF). */
101 struct v_may_def_optype_d
* GTY (()) v_may_def_ops
;
102 struct vuse_optype_d
* GTY (()) vuse_ops
;
103 struct v_must_def_optype_d
* GTY (()) v_must_def_ops
;
106 typedef stmt_operands_t
*stmt_operands_p
;
108 #define USE_FROM_PTR(OP) get_use_from_ptr (OP)
109 #define DEF_FROM_PTR(OP) get_def_from_ptr (OP)
110 #define SET_USE(OP, V) ((*((OP).use)) = (V))
111 #define SET_DEF(OP, V) ((*((OP).def)) = (V))
114 #define USE_OPS(ANN) get_use_ops (ANN)
115 #define STMT_USE_OPS(STMT) get_use_ops (stmt_ann (STMT))
116 #define NUM_USES(OPS) ((OPS) ? (OPS)->num_uses : 0)
117 #define USE_OP_PTR(OPS, I) get_use_op_ptr ((OPS), (I))
118 #define USE_OP(OPS, I) (USE_FROM_PTR (USE_OP_PTR ((OPS), (I))))
119 #define SET_USE_OP(OPS, I, V) (SET_USE (USE_OP_PTR ((OPS), (I)), (V)))
123 #define DEF_OPS(ANN) get_def_ops (ANN)
124 #define STMT_DEF_OPS(STMT) get_def_ops (stmt_ann (STMT))
125 #define NUM_DEFS(OPS) ((OPS) ? (OPS)->num_defs : 0)
126 #define DEF_OP_PTR(OPS, I) get_def_op_ptr ((OPS), (I))
127 #define DEF_OP(OPS, I) (DEF_FROM_PTR (DEF_OP_PTR ((OPS), (I))))
128 #define SET_DEF_OP(OPS, I, V) (SET_DEF (DEF_OP_PTR ((OPS), (I)), (V)))
132 #define V_MAY_DEF_OPS(ANN) get_v_may_def_ops (ANN)
133 #define STMT_V_MAY_DEF_OPS(STMT) get_v_may_def_ops (stmt_ann(STMT))
134 #define NUM_V_MAY_DEFS(OPS) ((OPS) ? (OPS)->num_v_may_defs : 0)
135 #define V_MAY_DEF_RESULT_PTR(OPS, I) get_v_may_def_result_ptr ((OPS), (I))
136 #define V_MAY_DEF_RESULT(OPS, I) \
137 (DEF_FROM_PTR (V_MAY_DEF_RESULT_PTR ((OPS), (I))))
138 #define SET_V_MAY_DEF_RESULT(OPS, I, V) \
139 (SET_DEF (V_MAY_DEF_RESULT_PTR ((OPS), (I)), (V)))
140 #define V_MAY_DEF_OP_PTR(OPS, I) get_v_may_def_op_ptr ((OPS), (I))
141 #define V_MAY_DEF_OP(OPS, I) \
142 (USE_FROM_PTR (V_MAY_DEF_OP_PTR ((OPS), (I))))
143 #define SET_V_MAY_DEF_OP(OPS, I, V) \
144 (SET_USE (V_MAY_DEF_OP_PTR ((OPS), (I)), (V)))
147 #define VUSE_OPS(ANN) get_vuse_ops (ANN)
148 #define STMT_VUSE_OPS(STMT) get_vuse_ops (stmt_ann(STMT))
149 #define NUM_VUSES(OPS) ((OPS) ? (OPS)->num_vuses : 0)
150 #define VUSE_OP_PTR(OPS, I) get_vuse_op_ptr ((OPS), (I))
151 #define VUSE_OP(OPS, I) (USE_FROM_PTR (VUSE_OP_PTR ((OPS), (I))))
152 #define SET_VUSE_OP(OPS, I, V) (SET_USE (VUSE_OP_PTR ((OPS), (I)), (V)))
155 #define V_MUST_DEF_OPS(ANN) get_v_must_def_ops (ANN)
156 #define STMT_V_MUST_DEF_OPS(STMT) get_v_must_def_ops (stmt_ann (STMT))
157 #define NUM_V_MUST_DEFS(OPS) ((OPS) ? (OPS)->num_v_must_defs : 0)
158 #define V_MUST_DEF_OP_PTR(OPS, I) get_v_must_def_op_ptr ((OPS), (I))
159 #define V_MUST_DEF_OP(OPS, I) \
160 (DEF_FROM_PTR (V_MUST_DEF_OP_PTR ((OPS), (I))))
161 #define SET_V_MUST_DEF_OP(OPS, I, V) \
162 (SET_DEF (V_MUST_DEF_OP_PTR ((OPS), (I)), (V)))
165 #define PHI_RESULT_PTR(PHI) get_phi_result_ptr (PHI)
166 #define PHI_RESULT(PHI) DEF_FROM_PTR (PHI_RESULT_PTR (PHI))
167 #define SET_PHI_RESULT(PHI, V) SET_DEF (PHI_RESULT_PTR (PHI), (V))
169 #define PHI_ARG_DEF_PTR(PHI, I) get_phi_arg_def_ptr ((PHI), (I))
170 #define PHI_ARG_DEF(PHI, I) USE_FROM_PTR (PHI_ARG_DEF_PTR ((PHI), (I)))
171 #define SET_PHI_ARG_DEF(PHI, I, V) \
172 SET_USE (PHI_ARG_DEF_PTR ((PHI), (I)), (V))
173 #define PHI_ARG_DEF_FROM_EDGE(PHI, E) \
174 PHI_ARG_DEF ((PHI), \
175 phi_arg_from_edge ((PHI),(E)))
176 #define PHI_ARG_DEF_PTR_FROM_EDGE(PHI, E) \
177 PHI_ARG_DEF_PTR ((PHI), \
178 phi_arg_from_edge ((PHI),(E)))
181 extern void init_ssa_operands (void);
182 extern void fini_ssa_operands (void);
183 extern void get_stmt_operands (tree
);
184 extern void copy_virtual_operands (tree
, tree
);
185 extern void create_ssa_artficial_load_stmt (stmt_operands_p
, tree
);
187 #endif /* GCC_TREE_SSA_OPERANDS_H */