[LLVMdev] Value liveout (uses)

Rotem Varon varonrotem at gmail.com
Sun May 31 11:03:32 PDT 2009


Hi,
Do i need to set the "LiveValues" pass in the PassManager as a prerequisite?
if so how do i get the results ?
Can i simply use its public function ?
Can you explain what exactly do mean by "conservative approximations" ? Can
it determine the live out of llvm:Value accurately?

Thank you very much.


On Sun, May 31, 2009 at 7:19 PM, Dan Gohman <gohman at apple.com> wrote:

> The pass you're referring to is in include/llvm/Analysis/LiveValues.h
> and lib/Analysis/LiveValues.cpp. It computes conservative
> approximations for specific liveness queries, rather than full
> livein/liveout information. It's intended to be used as a heuristic.
>
> Dan
>
> On May 30, 2009, at 3:51 PM, Evan Cheng wrote:
>
> > I believe Dan has added a pass to compute livein / liveout values.
> >
> > Evan
> >
> > Sent from my iPhone
> >
> > On May 30, 2009, at 5:03 AM, Rotem Varon <varonrotem at gmail.com> wrote:
> >
> >> Thank you.
> >>
> >> Is it possible to determine the liveout of the operands (see
> >> example bellow) ?
> >>
> >>         %5 = add i32 %4, %3
> >>
> >> For '%5': i can simply use " i->isUsedOutsideOfBlock() "
> >> For '%3' and '%4' : this is the question ...
> >>
> >> From your answer, is it possible to determine which value is
> >> liveout ( in binary instruction)?
> >>
> >>
> >> On Sat, May 30, 2009 at 2:57 AM, John McCall <rjmccall at apple.com>
> >> wrote:
> >> On May 29, 2009, at 11:37 PM, Rotem Varon wrote:
> >> > How can i know, if a value have uses outside of the current basic
> >> > block (liveout), without iterating through all the basic block ?
> >>
> >> If the value is created within the basic block in question, and the
> >> block doesn't loop to itself, then you can just iterate through the
> >> uses and note if the use is an instruction in a different block:
> >>
> >> bool isLiveOut(Instruction* I) {
> >>        BasicBlock* I_BB = I->getParent():
> >>        for (Value::use_iterator ui = I->use_begin(), ue = I-
> >> >use_end(); ui !
> >> = ue; ++ui)
> >>                if (cast<Instruction>(ui)->getParent() != I_BB)
> >>                        return true;
> >>        }
> >> }
> >>
> >> If the value is created within the block but the block loops to
> >> itself, you can get away with a very slight adjustment:
> >>
> >>                if (cast<Instruction>(ui)->getParent() != I_BB && !
> >> isa<PHINode>(ui))
> >>
> >> If the value is created in one block and you want to know if it's
> >> live
> >> out of some dominated block, that's a lot more complicated (and
> >> expensive).
> >>
> >> John.
> >> _______________________________________________
> >> LLVM Developers mailing list
> >> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
> >>
> >> _______________________________________________
> >> LLVM Developers mailing list
> >> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090531/72e187ee/attachment.html>


More information about the llvm-dev mailing list