vcc: Mark subs statically reachable via dynamic subs as "dynamic"

In follow up commits, we will need a marker for subs which can be
reachable via dynamically referenced SUBs.

We use "more references than calls" is this marker.  When walking
the call trees, we add one reference for all subs which are called from
a SUB having this marker, thus marking those, too.
parent d86a90ee
......@@ -195,6 +195,10 @@ vcc_CheckActionRecurse(struct vcc *tl, struct proc *p, unsigned bitmap)
vcc_ErrWhere(tl, p->name);
return (1);
}
// more references than calls -> sub is referenced for dynamic calls
u = (p->sym->nref > p->called);
p->active = 1;
VTAILQ_FOREACH(pc, &p->calls, list) {
if (pc->sym->proc == NULL) {
......@@ -204,6 +208,7 @@ vcc_CheckActionRecurse(struct vcc *tl, struct proc *p, unsigned bitmap)
return (1);
}
pc->sym->proc->called++;
pc->sym->nref += u;
if (vcc_CheckActionRecurse(tl, pc->sym->proc, bitmap)) {
VSB_printf(tl->sb, "\n...called from \"%.*s\"\n",
PF(p->name));
......
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