Esempio n. 1
0
static void
pathCount(DUG * dug,
	  BLOCK * node,
	  int *counts)
{
    LIST *i;
    LIST *j;
    BRANCH *f;
    DU *def;
    BVPTR *v_list;

    /*
     * For each symbol defined at node
     * traverse graph down from node to find C-USEs and P-USEs.
     * uCount adds each node to v_list when it is visited. 
     */
    for (i = 0; (def = du_use(dug, node, &i)) != 0;) {
	if ((def->ref_type & VAR_DEF) == 0)
	    continue;
	v_list = BVALLOC(dug->count);
	if (node->branches)
	    for (j = 0; LIST_NEXT(node->branches, &j, &f);)
		uCount(dug, f, v_list, def, def->ref_type, counts);
	free(v_list);
    }
}
Esempio n. 2
0
 virtual size_t
 LevelCount(
     EDiagSev eSev ) {
     
     size_t uCount( 0 );
     for ( size_t u=0; u < Count(); ++u ) {
         if ( m_Errors[u]->Severity() == eSev ) ++uCount;
     }
     return uCount;
 };
Esempio n. 3
0
static void
uCount(DUG * dug,		/* flow graph */
       BRANCH * branch,		/* branch to possible use node */
       BVPTR * list,		/* list of nodes visited already */
       DU * def,		/* symbol definition */
       int p_use,		/* use type of previous node */
       int *counts)		/* counts of C-uses & P-uses */
{
    LIST *i;
    BRANCH *f;
    DU *use;
    int use_type;

    if (branch->to->block_id == 0)
	return;
    /*
     * ?unknown?  Block 0 is the start block.  But, branch back to block 0
     * means return.  This should be a valid P-USE but the runtime won't
     * catch it so we don't report it.  Since block 0 always has exactly
     * one branch, to block 1, and block 1 is on the visited list, and
     * there are never any Uses at block 0, we could just remove the line
     * above this comment to have the "P-USE at return" print.
     */

    /*
     * If PUSE in previous node, print PUSE here.
     */
    if (p_use & VAR_PUSE)
	++counts[1];

    /*
     * Already visited this node ?
     */
    if (BVTEST(list, branch->to->block_id))
	return;
    BVSET(list, branch->to->block_id);

    use = du_use_type(dug, branch->to, ID_SYM(def->var_id), def->ref_type);
    if (use) {
	use_type = use->ref_type;
    } else {
	use_type = 0;
    }

    /*
     * If C-USE at node, print it.
     */
    if (use_type & VAR_CUSE)
	++counts[0];

    /*
     * Defining use?
     */
    if (use_type & VAR_DEF)
	return;

    /*
     * Visit each node reachable from node.
     */
    if (branch->to->branches)
	for (i = 0; LIST_NEXT(branch->to->branches, &i, &f);)
	    uCount(dug, f, list, def, use_type, counts);
}