[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: pointers from locals to uses and definitions



Please separate new text from old text.

On Wed, 12 Feb 2003, Chris Pickett wrote:

  
Here you're asking a question about all locals, not any particular one.  I
think that answering the question for all locals would be O(mn), where m
is the number of locals and n is the number of units.


      
If you do it like this isn't it about the same anyway, because for each
use or definition, you still have to iterate through the locals chain?

I suppose I could put all the locals into a HashMap or something, but
because what I want to do is replace all locals with temporaries, this
makes life more complicated.  Probably just stick with the slow way for now.
    

As I said, it depends on which question you're asking.  If you have a
particular local L which you're asking this question of, then it's not the
same: you're looking for local L in your chains.  If you want to answer
this for all locals in your method, that's a different question.

If what you want to do is to replace locals with temporaries, you should
have a replacementMap.  Iterate through units, then iterate through
useAndDefBoxes.  For each useAndDefBox, check if the value in the box is
in your replacementMap; if so, replace.  This would be linear.
Okay, I'll do it like that.  Thank-you.
Chris