-static void
-verify_flow_insensitive_alias_info (void)
-{
- tree var;
- referenced_var_iterator rvi;
-
- FOR_EACH_REFERENCED_VAR (var, rvi)
- {
- unsigned int j;
- bitmap aliases;
- tree alias;
- bitmap_iterator bi;
-
- if (!MTAG_P (var) || !MTAG_ALIASES (var))
- continue;
-
- aliases = MTAG_ALIASES (var);
-
- EXECUTE_IF_SET_IN_BITMAP (aliases, 0, j, bi)
- {
- alias = referenced_var (j);
-
- if (TREE_CODE (alias) != MEMORY_PARTITION_TAG
- && !may_be_aliased (alias))
- {
- error ("non-addressable variable inside an alias set");
- debug_variable (alias);
- goto err;
- }
- }
- }
-
- return;
-
-err:
- debug_variable (var);
- internal_error ("verify_flow_insensitive_alias_info failed");
-}
-
-
-static void
-verify_flow_sensitive_alias_info (void)
-{
- size_t i;
- tree ptr;
-
- for (i = 1; i < num_ssa_names; i++)
- {
- tree var;
- var_ann_t ann;
- struct ptr_info_def *pi;
-
-
- ptr = ssa_name (i);
- if (!ptr)
- continue;
-
- /* We only care for pointers that are actually referenced in the
- program. */
- if (!POINTER_TYPE_P (TREE_TYPE (ptr)) || !TREE_VISITED (ptr))
- continue;
-
- /* RESULT_DECL is special. If it's a GIMPLE register, then it
- is only written-to only once in the return statement.
- Otherwise, aggregate RESULT_DECLs may be written-to more than
- once in virtual operands. */
- var = SSA_NAME_VAR (ptr);
- if (TREE_CODE (var) == RESULT_DECL
- && is_gimple_reg (ptr))
- continue;
-
- pi = SSA_NAME_PTR_INFO (ptr);
- if (pi == NULL)
- continue;
-
- ann = var_ann (var);
- if (pi->is_dereferenced && !pi->name_mem_tag && !ann->symbol_mem_tag)
- {
- error ("dereferenced pointers should have a name or a symbol tag");
- goto err;
- }
-
- if (pi->name_mem_tag
- && (pi->pt_vars == NULL || bitmap_empty_p (pi->pt_vars)))
- {
- error ("pointers with a memory tag, should have points-to sets");
- goto err;
- }
-
- if (pi->value_escapes_p && pi->name_mem_tag)
- {
- tree t = memory_partition (pi->name_mem_tag);
- if (t == NULL_TREE)
- t = pi->name_mem_tag;
-
- if (!is_call_clobbered (t))
- {
- error ("pointer escapes but its name tag is not call-clobbered");
- goto err;
- }
- }
- }
-
- return;
-
-err:
- debug_variable (ptr);
- internal_error ("verify_flow_sensitive_alias_info failed");
-}
-
-
-/* Verify the consistency of call clobbering information. */
-
-static void
-verify_call_clobbering (void)
-{
- unsigned int i;
- bitmap_iterator bi;
- tree var;
- referenced_var_iterator rvi;
-
- /* At all times, the result of the call_clobbered flag should
- match the result of the call_clobbered_vars bitmap. Verify both
- that everything in call_clobbered_vars is marked
- call_clobbered, and that everything marked
- call_clobbered is in call_clobbered_vars. */
- EXECUTE_IF_SET_IN_BITMAP (gimple_call_clobbered_vars (cfun), 0, i, bi)
- {
- var = referenced_var (i);
-
- if (memory_partition (var))
- var = memory_partition (var);
-
- if (!MTAG_P (var) && !var_ann (var)->call_clobbered)
- {
- error ("variable in call_clobbered_vars but not marked "
- "call_clobbered");
- debug_variable (var);
- goto err;
- }
- }
-
- FOR_EACH_REFERENCED_VAR (var, rvi)
- {
- if (is_gimple_reg (var))
- continue;
-
- if (memory_partition (var))
- var = memory_partition (var);
-
- if (!MTAG_P (var)
- && var_ann (var)->call_clobbered
- && !bitmap_bit_p (gimple_call_clobbered_vars (cfun), DECL_UID (var)))
- {
- error ("variable marked call_clobbered but not in "
- "call_clobbered_vars bitmap.");
- debug_variable (var);
- goto err;
- }
- }
-
- return;
-
- err:
- internal_error ("verify_call_clobbering failed");
-}
-
-
-/* Verify invariants in memory partitions. */
-
-static void
-verify_memory_partitions (void)
-{
- unsigned i;
- tree mpt;
- VEC(tree,heap) *mpt_table = gimple_ssa_operands (cfun)->mpt_table;
- struct pointer_set_t *partitioned_syms = pointer_set_create ();
-
- for (i = 0; VEC_iterate (tree, mpt_table, i, mpt); i++)
- {
- unsigned j;
- bitmap_iterator bj;
-
- if (MPT_SYMBOLS (mpt) == NULL)
- {
- error ("Memory partitions should have at least one symbol");
- debug_variable (mpt);
- goto err;
- }
-
- EXECUTE_IF_SET_IN_BITMAP (MPT_SYMBOLS (mpt), 0, j, bj)
- {
- tree var = referenced_var (j);
- if (pointer_set_insert (partitioned_syms, var))
- {
- error ("Partitioned symbols should belong to exactly one "
- "partition");
- debug_variable (var);
- goto err;
- }
- }
- }
-
- pointer_set_destroy (partitioned_syms);
-
- return;
-
-err:
- internal_error ("verify_memory_partitions failed");
-}
-
-
-/* Verify the consistency of aliasing information. */
-
-static void
-verify_alias_info (void)
-{
- verify_flow_sensitive_alias_info ();
- verify_call_clobbering ();
- verify_flow_insensitive_alias_info ();
- verify_memory_partitions ();
-}
-
-