Exemplo n.º 1
0
        public static void Transform(LinearTypeChecker linearTypeChecker, CivlTypeChecker civlTypeChecker)
        {
            List <Declaration> originalDecls = new List <Declaration>();
            Program            program       = linearTypeChecker.program;

            foreach (var decl in program.TopLevelDeclarations)
            {
                Procedure proc = decl as Procedure;
                if (proc != null && civlTypeChecker.procToActionInfo.ContainsKey(proc))
                {
                    originalDecls.Add(proc);
                    continue;
                }
                Implementation impl = decl as Implementation;
                if (impl != null && civlTypeChecker.procToActionInfo.ContainsKey(impl.Proc))
                {
                    originalDecls.Add(impl);
                }
            }

            List <Declaration> decls = new List <Declaration>();

            if (!CommandLineOptions.Clo.TrustAtomicityTypes)
            {
                MoverCheck.AddCheckers(linearTypeChecker, civlTypeChecker, decls);
            }
            CivlRefinement.AddCheckers(linearTypeChecker, civlTypeChecker, decls);
            foreach (AtomicActionInfo info in civlTypeChecker.procToActionInfo.Values.Where(x => x is AtomicActionInfo))
            {
                decls.AddRange(info.triggerFuns.Values);
            }
            foreach (Declaration decl in decls)
            {
                CivlAttributes.RemoveYieldsAttribute(decl);
            }
            program.RemoveTopLevelDeclarations(x => originalDecls.Contains(x));
            program.AddTopLevelDeclarations(decls);
        }
Exemplo n.º 2
0
 public override Function VisitFunction(Function node)
 {
   CivlAttributes.RemoveLinearAttributes(node);
   return base.VisitFunction(node);
 }
Exemplo n.º 3
0
 public override Variable VisitVariable(Variable node)
 {
   CivlAttributes.RemoveLinearAttributes(node);
   return base.VisitVariable(node);
 }