On Thu, Dec 20, 2012 at 08:23:20AM +0800, TheAnh Do wrote: > In Cil, it automatically simplify If conditional expressions to have a > cascade of simple predicates. For example, > if (x > 10 && x < 100) > will be transformed to > if (x > 10) > if (x < 100)
Yes, unless you use the flag --useLogicalOperators. > Could anyone please point me to the code of this functionality in the Cil > framework? Like most of CIL transformations, it happens in the file src/frontc/cabs2cil.ml. The function compileCondExp does the actual transformation, using CEAnd and CEOr constructors (of type condExpRes) returned by doCondExp. This compileCondExp is called by doCondition, which handles the IF case in doStatement (but also in a number of other cases, like WHILE, DOWHILE, FOR, etc.), as well as by doExp directly to handle arbitrary expressions involving && and ||. The QUESTION case (corresponding to the ternary operator ?:) is a more complicated matter and I suggest you to ignore it until you fully understand how the previous functions work. Best, -- Gabriel ------------------------------------------------------------------------------ LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d _______________________________________________ CIL-users mailing list CIL-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/cil-users