summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-operands.h
diff options
context:
space:
mode:
authoramacleod <amacleod@138bc75d-0d04-0410-961f-82ee72b054a4>2006-12-18 16:21:08 +0000
committeramacleod <amacleod@138bc75d-0d04-0410-961f-82ee72b054a4>2006-12-18 16:21:08 +0000
commitdadb7503551583adb76c5115920d7d2e8b13481e (patch)
tree84b63c6bdefa887d08218dba3084880c6484eaaf /gcc/tree-ssa-operands.h
parentd872f90cc4807e8130a3f412885a67904f61fe22 (diff)
downloadgcc-dadb7503551583adb76c5115920d7d2e8b13481e.tar.gz
Add memory reuse to virtual operands in the operand scanner.
2006-12-18 Andrew MacLeod <amacleod@redhat.com> * tree-ssa-operands.h (struct vdef_optype_d): Rename to voptype_d. (struct vuse_optype_d): Delete. (SSA_OPERAND_MEMORY_SIZE): Delete. (struct ssa_operand_memory_d): Change mem array to size one. (NUM_VOP_FREE_BUCKETS): Define. (free_vuses, free_vdefs): Replace with vop_free_buckets array. (vdef_ops, vuse_ops, struct ssa_operand_iterator_d): Use voptype_d type. * tree-pretty-print.c (dump_vops): Use voptype_d type. * tree-ssa-operands.c (vop_free_bucket_size): New. Number of operands which fit into a chunk of memory from a specific bucket. (vop_free_bucket_index): New. Find correct size memory bucket. (init_vop_buckets): New. Initialize VOP free memory buckets. (add_vop_to_freelist): New. Add a VOP to the correct free list. (ssa_operand_mem_size): New. Current size of an operand memory chunk. (init_ssa_operands): Initialize operand memory and free lists. (fini_ssa_operands): Remove references to free_vuses and free_vdefs. (ssa_operand_alloc): Use graduated size memory allocation. (APPEND_OP_AFTER, MOVE_HEAD_AFTER, MOVE_HEAD_TO_FREELIST, INITIALIZE_USE): Remove. (alloc_vop): New. Allocate a virtual operand. (alloc_vdef, alloc_vuse): Delete. (add_def_op, add_use_op): Directly setup pointers. (add_vop): New. Add a virtual operand. (add_vuse_op, add_vdef_op): Call add_vop. (realloc_vop): New. Reallocate a virtual operand. (realloc_vdef, realloc_vuse): Call realloc_vop. (finalize_ssa_def_ops): Delete. Move content to finalize_ssa_defs. (finalize_ssa_defs): Optimize for common case, remove code based on sorted pointers which was a waste of time. (finalize_ssa_use_ops): Delete. Move content to finalize_ssa_uses. (finalize_ssa_uses): Update last pointer. (finalize_ssa_vdef_ops): Delete. Move content to finalize_ssa_vdefs. (finalize_ssa_vdefs, finalize_ssa_vuse_ops): Use voptype_d and directly manipulate pointers. (copy_virtual_operands): Use voptype_d, and no need to update pointers. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@120009 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-operands.h')
-rw-r--r--gcc/tree-ssa-operands.h45
1 files changed, 20 insertions, 25 deletions
diff --git a/gcc/tree-ssa-operands.h b/gcc/tree-ssa-operands.h
index 1bcbe952e69..10fd1459996 100644
--- a/gcc/tree-ssa-operands.h
+++ b/gcc/tree-ssa-operands.h
@@ -98,32 +98,28 @@ typedef struct vuse_vec_d *vuse_vec_p;
#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 (511 * sizeof (struct vuse_optype_d))
-
+/* This structure represents a variable sized buffer which is allocated by the
+ operand memory manager. Operands are subalocated 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;
@@ -133,8 +129,7 @@ struct ssa_operands GTY(()) {
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;
};
@@ -146,8 +141,8 @@ struct stmt_operands_d
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;
@@ -206,8 +201,8 @@ typedef struct stmt_operands_d *stmt_operands_p;
#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 struct voptype_d *realloc_vdef (struct voptype_d *, int);
+extern struct voptype_d *realloc_vuse (struct voptype_d *, int);
extern void init_ssa_operands (void);
extern void fini_ssa_operands (void);
@@ -249,9 +244,9 @@ typedef struct ssa_operand_iterator_d
{
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;