/* SSA operand management for trees.
- Copyright (C) 2003, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005, 2006, 2007 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
-Software Foundation; either version 2, or (at your option) any later
+Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
for more details.
You should have received a copy of the GNU General Public License
-along with GCC; see the file COPYING. If not, write to the Free
-Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301, USA. */
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
#ifndef GCC_TREE_SSA_OPERANDS_H
#define GCC_TREE_SSA_OPERANDS_H
typedef struct vuse_vec_d
{
- int num_vuse;
+ unsigned int num_vuse;
vuse_element_t uses[1];
} vuse_vec_t;
typedef struct vuse_vec_d *vuse_vec_p;
#ifdef ENABLE_CHECKING
#define VUSE_VECT_ELEMENT(V,X) \
- (gcc_assert ((X) >= 0 && (X) < VUSE_VECT_NUM_ELEM (V)), \
+ (gcc_assert (((unsigned int) (X)) < VUSE_VECT_NUM_ELEM (V)), \
VUSE_VECT_ELEMENT_NC (V,X))
#define VUSE_ELEMENT_PTR(V,X) \
- (gcc_assert ((X) >= 0 && (X) < VUSE_VECT_NUM_ELEM (V)), \
+ (gcc_assert (((unsigned int) (X)) < VUSE_VECT_NUM_ELEM (V)), \
VUSE_ELEMENT_PTR_NC (V, X))
#define SET_VUSE_VECT_ELEMENT(V,X,N) \
- (gcc_assert ((X) >= 0 && (X) < VUSE_VECT_NUM_ELEM (V)), \
+ (gcc_assert (((unsigned int) (X)) < VUSE_VECT_NUM_ELEM (V)), \
VUSE_VECT_ELEMENT_NC (V,X) = (N))
#define SET_VUSE_ELEMENT_VAR(V,X,N) \
- (gcc_assert ((X) >= 0 && (X) < VUSE_VECT_NUM_ELEM (V)), \
+ (gcc_assert (((unsigned int) (X)) < VUSE_VECT_NUM_ELEM (V)), \
VUSE_VECT_ELEMENT_NC ((V),(X)).use_var = (N))
#define SET_VUSE_ELEMENT_PTR(V,X,N) \
- (gcc_assert ((X) >= 0 && (X) < VUSE_VECT_NUM_ELEM (V)), \
+ (gcc_assert (((unsigned int) (X)) < VUSE_VECT_NUM_ELEM (V)), \
VUSE_ELEMENT_PTR_NC (V, X) = (N))
#else
#define VUSE_VECT_ELEMENT(V,X) VUSE_VECT_ELEMENT_NC(V,X)
#define VUSE_ELEMENT_VAR(V,X) (VUSE_VECT_ELEMENT ((V),(X)).use_var)
-/* This represents the VDEFS for a stmt. */
-struct vdef_optype_d
+/* This represents the virtual ops of a stmt. */
+struct voptype_d
{
- struct vdef_optype_d *next;
+ struct voptype_d *next;
tree def_var;
vuse_vec_t usev;
};
-typedef struct vdef_optype_d *vdef_optype_p;
+typedef struct voptype_d *voptype_p;
-/* This represents the VUSEs for a stmt. */
-struct vuse_optype_d
-{
- struct vuse_optype_d *next;
- vuse_vec_t usev;
-};
-typedef struct vuse_optype_d *vuse_optype_p;
-
-
-#define SSA_OPERAND_MEMORY_SIZE (2048 - sizeof (void *))
-
+/* This structure represents a variable sized buffer which is allocated by the
+ operand memory manager. Operands are suballocated out of this block. The
+ MEM array varies in size. */
+
struct ssa_operand_memory_d GTY((chain_next("%h.next")))
{
struct ssa_operand_memory_d *next;
- char mem[SSA_OPERAND_MEMORY_SIZE];
+ char mem[1];
};
+/* Number of different size free buckets for virtual operands. */
+#define NUM_VOP_FREE_BUCKETS 29
+
/* Per-function operand caches. */
struct ssa_operands GTY(()) {
struct ssa_operand_memory_d *operand_memory;
unsigned operand_memory_index;
+ /* Current size of the operand memory buffer. */
+ unsigned int ssa_operand_mem_size;
bool ops_active;
struct def_optype_d * GTY ((skip (""))) free_defs;
struct use_optype_d * GTY ((skip (""))) free_uses;
- struct vuse_optype_d * GTY ((skip (""))) free_vuses;
- struct vdef_optype_d * GTY ((skip (""))) free_vdefs;
+ struct voptype_d * GTY ((skip (""))) vop_free_buckets[NUM_VOP_FREE_BUCKETS];
VEC(tree,heap) * GTY ((skip (""))) mpt_table;
};
struct use_optype_d * use_ops;
/* Virtual operands (VDEF, VUSE). */
- struct vdef_optype_d * vdef_ops;
- struct vuse_optype_d * vuse_ops;
+ struct voptype_d * vdef_ops;
+ struct voptype_d * vuse_ops;
/* Sets of memory symbols loaded and stored. */
bitmap stores;
#define PHI_ARG_INDEX_FROM_USE(USE) phi_arg_index_from_use (USE)
-extern struct vdef_optype_d *realloc_vdef (struct vdef_optype_d *, int);
-extern struct vuse_optype_d *realloc_vuse (struct vuse_optype_d *, int);
-
extern void init_ssa_operands (void);
extern void fini_ssa_operands (void);
extern void free_ssa_operands (stmt_operands_p);
extern void update_stmt_operands (tree);
+extern void free_stmt_operands (tree);
extern bool verify_imm_links (FILE *f, tree var);
extern void copy_virtual_operands (tree, tree);
{
def_optype_p defs;
use_optype_p uses;
- vuse_optype_p vuses;
- vdef_optype_p vdefs;
- vdef_optype_p mayuses;
+ voptype_p vuses;
+ voptype_p vdefs;
+ voptype_p mayuses;
enum ssa_op_iter_type iter_type;
int phi_i;
int num_phi;
tree phi_stmt;
bool done;
- int vuse_index;
- int mayuse_index;
+ unsigned int vuse_index;
+ unsigned int mayuse_index;
} ssa_op_iter;
/* These flags are used to determine which operands are returned during
DEFVAR = op_iter_next_def (&(ITER)))
/* This macro executes a loop over the VDEF operands of STMT. The def
- and use for each VDEF is returned in DEFVAR and USEVAR.
+ and use vector for each VDEF is returned in DEFVAR and USEVECT.
ITER is an ssa_op_iter structure used to control the loop. */
-#define FOR_EACH_SSA_VDEF_OPERAND(DEFVAR, USEVAR, STMT, ITER) \
- for (op_iter_init_vdef (&(ITER), STMT, &(USEVAR), &(DEFVAR)); \
+#define FOR_EACH_SSA_VDEF_OPERAND(DEFVAR, USEVECT, STMT, ITER) \
+ for (op_iter_init_vdef (&(ITER), STMT, &(USEVECT), &(DEFVAR)); \
!op_iter_done (&(ITER)); \
- op_iter_next_vdef (&(USEVAR), &(DEFVAR), &(ITER)))
+ op_iter_next_vdef (&(USEVECT), &(DEFVAR), &(ITER)))
/* This macro will execute a loop over all the arguments of a PHI which
match FLAGS. A use_operand_p is always returned via USEVAR. FLAGS
/* This macro counts the number of operands in STMT matching FLAGS. */
#define NUM_SSA_OPERANDS(STMT, FLAGS) num_ssa_operands (STMT, FLAGS)
-extern tree get_mpt_for (tree);
-extern void dump_memory_partitions (FILE *);
-extern void debug_memory_partitions (void);
-
#endif /* GCC_TREE_SSA_OPERANDS_H */