On 11/05/2014, at 10:42 PM, john skaller wrote:

>> To clarify, the table is an adjacency matrix?
> 
> To clarify, see src/compiler/flx_frontend/flx_use.ml
> 
> In particular there is already a function cal_use_closure.
> 
> Maybe there's nothing to do, i don't know.
> I need this for the monomorphisation anyhow.
> 
> The old routine is driven by the instantiator, but that
> instantiates *everything*, i.e. it doesn't trace through 
> from the roots.


basically for usage, I need to carefully write down the rules
about what uses what. It's quite tricky!

Generally, for a monomorphic function,

(a) the parameters are used
(b) Every symbol in every statement is used by the function EXCEPT
(c) the symbols in an assignment or initialiser of a simple variable
are used by the variable (not the containing function)

But his is not enough. First, child functions use the parent.
A child isn't use by the parent unless it is called (or a closure
formed).

Obviously, symbols used in unreachable statements aren't
considered used.

If the LHS is an assignment to a projection of a variable,
things get really tricky. If the project is a constant projection,
its the same as for a whole variable. Recursively: the RHS is
used by the variable.

If the project is not constant, i.e. indexing an array by an expression,
the index expression is used by what? If the array variable
isn't used, the assignment should be deleted, so it's used by
the array variable, not the containing function.

There's a lot more. Consider for example:

        if x goto lab;
        lab:

Well, we can deleted the conditional goto, so x isn't used.

--
john skaller
skal...@users.sourceforge.net
http://felix-lang.org




------------------------------------------------------------------------------
Is your legacy SCM system holding you back? Join Perforce May 7 to find out:
• 3 signs your SCM is hindering your productivity
• Requirements for releasing software faster
• Expert tips and advice for migrating your SCM now
http://p.sf.net/sfu/perforce
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to