harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Egor Pasko <egor.pa...@gmail.com>
Subject Re: [drlvm][jitrino]questiones about check instructions
Date Tue, 25 Mar 2008 10:01:42 GMT
On the 0x412 day of Apache Harmony Pamela Yuan wrote:
> Hi,all.
>     We know that each operand must be defined at the usage point.
>     In LIR Ia32IRManager.cpp, the following method can inspect whether
> a operand is defined before it is used.
> 
>     bool IRManager::verifyLiveness() {
>         Node* prolog=fg->getEntryNode();
>         bool failed=false;
>         BitSet * ls=getLiveAtEntry(prolog);
>         assert(ls!=NULL);
>        Constraint
> calleeSaveRegs=getCallingConvention()->getCalleeSavedRegs(OpndKind_GPReg);
>        BitSet::IterB lives(*ls);
>        for (int i = lives.getNext(); i != -1; i = lives.getNext()){
>            Opnd * opnd=getOpnd(i);
>            assert(opnd!=NULL);
>            if ( opnd->isSubjectForLivenessAnalysis() &&
> 
> (opnd->isPlacedIn(RegName_EFLAGS)||!isPreallocatedRegOpnd(opnd))) {
>             VERIFY_OUT("Operand live at entry: " << opnd << ::std::endl);
>             VERIFY_OUT("This means there is a use of the operand when
> it is not yet defined" << ::std::endl);
>             failed=true;
>         };
>     }
>     if (failed)
>         VERIFY_OUT(::std::endl << "Liveness verification failure" <<
> ::std::endl);
>     return !failed;
> }
> 
> Are there some check instructions to do the same work in HIR ?
> Thanks.

In SSA form each operand should have a producer-instruction via
getInst(). You probably need to check that it is in the right place of
dominator tree (producer dominates usage).

If HIR is not in SSA form you can run ssa pass, I believe, it breaks if
Liveness is not OK.



-- 
Egor Pasko


Mime
View raw message