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

Re: why CmpExpr?



Jooyong Lee <jlee@brics.dk> wrote:
> I'm trying to conver the conditions in IfStmt, so I need to recognize 
> all possible cases. Obviously I may have to deal with GtExpr, GeExpr, 
> LeExp, LtExpr, EqExpr and NeExpr. I wonder, however if I should consider 
> CmpExpr, CmpgExpr and CmplExpr, too. Frankly, I don't even know why they 
> exist in Soot.

No you don't need to consider these.  All you need to worry about are
the subclasses of ConditionExpr.

> What expression do they represent?

In most cases they seem to be used for comparing longs -- perhaps
because this is a more complex comparison than comparing ints.

For example, jimplifying:

        public void test()
	{
        	long i = 8, j = 9;

        	if(i == j)
                	System.exit(1);
        }

gives you:

        l0 = 8L;
        l1 = 9L;
        $b2 = l0 cmp l1;
        if $b2 != 0 goto label0;

Cheers,
Navin.