private void Analyse(Implementation impl, BigBlock bb) { Analyse(impl, bb.simpleCmds); if (bb.ec is WhileCmd) { WhileCmd wc = bb.ec as WhileCmd; ExprMayAffectControlFlow(impl.Name, wc.Guard); Analyse(impl, wc.Body); } else if (bb.ec is IfCmd) { IfCmd ifCmd = bb.ec as IfCmd; ExprMayAffectControlFlow(impl.Name, ifCmd.Guard); Analyse(impl, ifCmd.thn); if (ifCmd.elseBlock != null) { Analyse(impl, ifCmd.elseBlock); } Debug.Assert(ifCmd.elseIf == null); } }
private int GetLoopId(WhileCmd wc) { AssertCmd inv = wc.Invariants[0] as AssertCmd; Debug.Assert(inv.Attributes.Key.Contains("loophead_")); return(Convert.ToInt32(inv.Attributes.Key.Substring("loophead_".Length))); }
private static Command CreateWhileCommand(ParsingInfo info) { var cmd = new WhileCmd(); cmd.condition = CreateCondition(info.MandatoryChild("condition")); cmd.command = CreateCommand(info.MandatoryChild("Command")); return(cmd); }
private static void ExecuteWhile(WhileCmd w) { onLoop++; while (ConditionEvaluator.Evaluate(w.condition)) { Execute(w.command); if (breakSet) { breakSet = false; break; } } onLoop--; }
private void SetNonUniform(string procedureName, WhileCmd wc) { nonUniformLoops[procedureName].Add(GetLoopId(wc)); RecordProcedureChanged(); }