[m-dev.] ground->clobbered argument modes

Simon Taylor stayl at cs.mu.OZ.AU
Thu Aug 5 15:27:06 AEST 1999

David Overton wrote:
> On Wed, 04 Aug, 1999 at 05:37:37PM EST, Fergus Henderson wrote:
> > On 04-Aug-1999, Simon Taylor <stayl at cs.mu.OZ.AU> wrote:
> > 
> > According to this analysis, the code for sc_get/3 is OK;
> > the mode checker should allow that.  Instead, the uncaught mode error
> > in this module is in the call to sc_set/3 in sc2/4; this code should
> > be illegal because sc2/4 calls sc_set/3 with an argument which is still
> > (in part) live, even though the final inst is `clobbered'.
> > When checking if a variable is live, mode analysis needs to also check whether
> > any of the variables that it (or any part of it) is aliased to are live.
> I have had a change sitting around for a few months that does this
> check.  It is part of a larger incomplete change to provide better
> support for partially instantiated data structures which I haven't
> worked on for quite a while.
> I'm not going to commit the code as it is, because it is currently
> extremely inefficient.  Basically it collects all the inst_keys in the
> current inst of the variable and then does a search through the
> whole instmap looking for a live variable that contains one of those
> inst_keys in its current inst.

> I think some sort of backwards mapping from inst_keys to variables
> will be needed to make this more efficient.  Anyway, it's on my list
> of things to do.

I've implemented something like that for structure reuse analysis
(`:- type bwd_instmap' in /home/mercury1/stayl/mercury3/compiler/instmap.m).
I'm not sure how much work it would be to add it to mode analysis.
We should talk.

mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au

More information about the developers mailing list