Commit 79f99d42 by Andrew MacLeod Committed by Andrew Macleod

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.

From-SVN: r120009
parent 85bf4c61
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.
2006-12-18 Nathan Sidwell <nathan@codesourcery.com>
* config/rs6000/rs6000.md (*movdf_hardfloat32): Use %X format to
......
......@@ -2692,8 +2692,8 @@ newline_and_indent (pretty_printer *buffer, int spc)
static void
dump_vops (pretty_printer *buffer, tree stmt, int spc, int flags)
{
struct vdef_optype_d *vdefs;
struct vuse_optype_d *vuses;
struct voptype_d *vdefs;
struct voptype_d *vuses;
int i, n;
if (!ssa_operands_active () || !stmt_references_memory_p (stmt))
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment