Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
0
        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)));
        }
Exemplo n.º 3
0
        private static Command CreateWhileCommand(ParsingInfo info)
        {
            var cmd = new WhileCmd();

            cmd.condition = CreateCondition(info.MandatoryChild("condition"));

            cmd.command = CreateCommand(info.MandatoryChild("Command"));

            return(cmd);
        }
Exemplo n.º 4
0
 private static void ExecuteWhile(WhileCmd w)
 {
     onLoop++;
     while (ConditionEvaluator.Evaluate(w.condition))
     {
         Execute(w.command);
         if (breakSet)
         {
             breakSet = false;
             break;
         }
     }
     onLoop--;
 }
Exemplo n.º 5
0
 private void SetNonUniform(string procedureName, WhileCmd wc)
 {
     nonUniformLoops[procedureName].Add(GetLoopId(wc));
     RecordProcedureChanged();
 }