static void add_call_read_ops (tree, voperands_t);
static void add_stmt_operand (tree *, tree, int, voperands_t);
-
-struct freelist_d GTY((chain_next ("%h.next")))
-{
- struct freelist_d *next;
-};
-
-#define NUM_FREE 5
-static GTY ((length ("NUM_FREE"))) struct freelist_d optype_freelist[NUM_FREE] = { {0}, {0}, {0}, {0}, {0} };
-
-
-static inline void *
-check_optype_freelist (size_t num ATTRIBUTE_UNUSED)
-{
- return NULL;
-#if 0
- void *vec = NULL;
-
- if (num <= NUM_FREE && optype_freelist[num - 1].next)
- {
- vec = (void *)optype_freelist[num - 1].next;
- optype_freelist[num - 1].next = optype_freelist[num - 1].next->next;
- }
- return vec;
-#endif
-}
/* Return a vector of contiguous memory of a specified size. */
-
-static inline void
-add_optype_freelist (void *vec ATTRIBUTE_UNUSED, size_t size ATTRIBUTE_UNUSED)
-{
-#if 0
- struct freelist_d *ptr;
-#ifdef ENABLE_CHECKING
- if (size == 0)
- abort ();
-#endif
-
- /* if its bigger than one of our lists, simply let it go and let GC
- collect it. */
- if (size > NUM_FREE)
- return;
-
- ptr = vec;
- ptr->next = optype_freelist[size - 1].next;;
- optype_freelist[size - 1].next = ptr;
-#endif
-}
-
-
static inline def_optype
allocate_def_optype (unsigned num)
{
def_optype def_ops;
unsigned size;
size = sizeof (struct def_optype_d) + sizeof (tree *) * (num - 1);
- def_ops = check_optype_freelist (num);
- if (!def_ops)
- def_ops = ggc_alloc (size);
+ def_ops = ggc_alloc (size);
def_ops->num_defs = num;
return def_ops;
}
use_optype use_ops;
unsigned size;
size = sizeof (struct use_optype_d) + sizeof (tree *) * (num - 1);
- use_ops = check_optype_freelist (num);
- if (!use_ops)
- use_ops = ggc_alloc (size);
+ use_ops = ggc_alloc (size);
use_ops->num_uses = num;
return use_ops;
}
v_may_def_optype v_may_def_ops;
unsigned size;
size = sizeof (struct v_may_def_optype_d) + sizeof (tree) * ((num * 2) - 1);
- v_may_def_ops = check_optype_freelist (num * 2);
- if (!v_may_def_ops)
- v_may_def_ops = ggc_alloc (size);
+ v_may_def_ops = ggc_alloc (size);
v_may_def_ops->num_v_may_defs = num;
return v_may_def_ops;
}
vuse_optype vuse_ops;
unsigned size;
size = sizeof (struct vuse_optype_d) + sizeof (tree) * (num - 1);
- vuse_ops = check_optype_freelist (num);
- if (!vuse_ops)
- vuse_ops = ggc_alloc (size);
+ vuse_ops = ggc_alloc (size);
vuse_ops->num_vuses = num;
return vuse_ops;
}
v_must_def_optype v_must_def_ops;
unsigned size;
size = sizeof (struct v_must_def_optype_d) + sizeof (tree *) * (num - 1);
- v_must_def_ops = check_optype_freelist (num);
- if (!v_must_def_ops)
- v_must_def_ops = ggc_alloc (size);
+ v_must_def_ops = ggc_alloc (size);
v_must_def_ops->num_v_must_defs = num;
return v_must_def_ops;
}
if (*uses)
{
if (dealloc)
- add_optype_freelist (*uses, (*uses)->num_uses);
+ ggc_free (*uses);
*uses = NULL;
}
}
if (*defs)
{
if (dealloc)
- add_optype_freelist (*defs, (*defs)->num_defs);
+ ggc_free (*defs);
*defs = NULL;
}
}
if (*vuses)
{
if (dealloc)
- add_optype_freelist (*vuses, (*vuses)->num_vuses);
+ ggc_free (*vuses);
*vuses = NULL;
}
}
if (*v_may_defs)
{
if (dealloc)
- add_optype_freelist (*v_may_defs, (*v_may_defs)->num_v_may_defs);
+ ggc_free (*v_may_defs);
*v_may_defs = NULL;
}
}
if (*v_must_defs)
{
if (dealloc)
- add_optype_freelist (*v_must_defs, (*v_must_defs)->num_v_must_defs);
+ ggc_free (*v_must_defs);
*v_must_defs = NULL;
}
}
void
init_ssa_operands (void)
{
- int x;
-
VARRAY_TREE_PTR_INIT (build_defs, 5, "build defs");
VARRAY_TREE_PTR_INIT (build_uses, 10, "build uses");
VARRAY_TREE_INIT (build_v_may_defs, 10, "build v_may_defs");
VARRAY_TREE_INIT (build_vuses, 10, "build vuses");
VARRAY_TREE_INIT (build_v_must_defs, 10, "build v_must_defs");
-
- for (x = 0; x < NUM_FREE; x++)
- optype_freelist[x].next = NULL;
}
void
fini_ssa_operands (void)
{
- int x;
- for (x = 0; x < NUM_FREE; x++)
- optype_freelist[x].next = NULL;
}
static void
def_ops = allocate_def_optype (num);
for (x = 0; x < num ; x++)
- def_ops->defs[x] = VARRAY_TREE_PTR (build_defs, x);
+ def_ops->defs[x].def = VARRAY_TREE_PTR (build_defs, x);
VARRAY_POP_ALL (build_defs);
ann = stmt_ann (stmt);
use_ops = allocate_use_optype (num);
for (x = 0; x < num ; x++)
- use_ops->uses[x] = VARRAY_TREE_PTR (build_uses, x);
+ use_ops->uses[x].use = VARRAY_TREE_PTR (build_uses, x);
VARRAY_POP_ALL (build_uses);
ann = stmt_ann (stmt);
code = TREE_CODE (expr);
class = TREE_CODE_CLASS (code);
- /* Expressions that make no memory references. */
- if (class == 'c'
- || class == 't'
- || code == BLOCK
- || code == FUNCTION_DECL
- || code == EXC_PTR_EXPR
- || code == FILTER_EXPR
- || code == LABEL_DECL)
- return;
-
/* We could have the address of a component, array member, etc which
has interesting variable references. */
if (code == ADDR_EXPR)
{
- enum tree_code subcode = TREE_CODE (TREE_OPERAND (expr, 0));
-
/* Taking the address of a variable does not represent a
reference to it, but the fact that STMT takes its address will be
of interest to some passes (e.g. alias resolution). */
add_stmt_operand (expr_p, stmt, 0, NULL);
- /* If the address is invariant, there may be no interesting variable
- references inside. */
- if (is_gimple_min_invariant (expr))
+ /* If the address is constant (invariant is not sufficient), there will
+ be no interesting variable references inside. */
+ if (TREE_CONSTANT (expr))
return;
/* There should be no VUSEs created, since the referenced objects are
flags |= opf_no_vops;
/* Avoid recursion. */
- code = subcode;
- class = TREE_CODE_CLASS (code);
expr_p = &TREE_OPERAND (expr, 0);
expr = *expr_p;
+ code = TREE_CODE (expr);
+ class = TREE_CODE_CLASS (code);
}
+ /* Expressions that make no memory references. */
+ if (class == 'c'
+ || class == 't'
+ || code == BLOCK
+ || code == FUNCTION_DECL
+ || code == EXC_PTR_EXPR
+ || code == FILTER_EXPR
+ || code == LABEL_DECL)
+ return;
+
/* If we found a variable, add it to DEFS or USES depending on the
operand flags. */
if (SSA_VAR_P (expr))
/* Treat array references as references to the virtual variable
representing the array. The virtual variable for an ARRAY_REF
is the VAR_DECL for the array. */
- if (code == ARRAY_REF)
+ if (code == ARRAY_REF || code == ARRAY_RANGE_REF)
{
/* Add the virtual variable for the ARRAY_REF to VDEFS or VUSES
according to the value of IS_DEF. Recurse if the LHS of the
get_expr_operands (stmt, &TREE_OPERAND (expr, 0), flags, prev_vops);
get_expr_operands (stmt, &TREE_OPERAND (expr, 1), opf_none, prev_vops);
+ get_expr_operands (stmt, &TREE_OPERAND (expr, 2), opf_none, prev_vops);
+ get_expr_operands (stmt, &TREE_OPERAND (expr, 3), opf_none, prev_vops);
return;
}
else
get_expr_operands (stmt, &TREE_OPERAND (expr, 0), flags, prev_vops);
+ if (code == COMPONENT_REF)
+ get_expr_operands (stmt, &TREE_OPERAND (expr, 2), opf_none, prev_vops);
return;
}
|| code == TRUTH_AND_EXPR
|| code == TRUTH_OR_EXPR
|| code == TRUTH_XOR_EXPR
- || code == COMPOUND_EXPR)
+ || code == COMPOUND_EXPR
+ || code == OBJ_TYPE_REF)
{
tree op0 = TREE_OPERAND (expr, 0);
tree op1 = TREE_OPERAND (expr, 1);