72 snprintf(name, 256,
"SHARED IN %p : ", (
CTree*)t);
131 cerr <<
"Annotate " << *t << endl;
136 if (
isRec(t, var, body)) {
143 if (n>0 && ! foo(t)) {
Symbol * unique(const char *str)
Returns a new unique symbol of name strxxx.
Tree shlysis(Tree t, barrier foo)
Do a sharing analysis : annotates all the subtrees of t with there occurences.
Tree shprkey(Tree t)
Create a specific property key for the sharing count of subtrees of t.
static bool nobarrier(const Tree &t)
A CTree = (Node x [CTree]) is a Node associated with a list of subtrees called branches.
const Node & node() const
return the content of the tree
int shcount(Tree key, Tree t)
Return the value of sharing count or 0.
bool(* barrier)(const Tree &t)
int arity() const
return the number of branches (subtrees) of a tree
const char * name(Symbol *sym)
Returns the name of a symbol.
bool isRec(Tree t, Tree &body)
is t a de Bruijn recursive tree
void setProperty(Tree t, Tree key, Tree val)
Tree branch(int i) const
return the ith branch (subtree) of a tree
static void annotate(Tree k, Tree t, barrier foo)
Recursively increment the occurences count of t and its subtrees.
bool getProperty(Tree t, Tree key, Tree &val)