public AtomicAction(Procedure proc, Implementation impl, MoverType moverType, LayerRange layerRange) { this.proc = proc; this.impl = impl; this.moverType = moverType; this.layerRange = layerRange; CivlUtil.AddInlineAttribute(proc); CivlUtil.AddInlineAttribute(impl); // The gate of an atomic action is represented as asserts at the beginning of the procedure body. this.gate = impl.Blocks[0].cmds.TakeWhile((c, i) => c is AssertCmd).Cast <AssertCmd>().ToList(); impl.Blocks[0].cmds.RemoveRange(0, gate.Count); gateUsedGlobalVars = new HashSet <Variable>(VariableCollector.Collect(gate).Where(x => x is GlobalVariable)); actionUsedGlobalVars = new HashSet <Variable>(VariableCollector.Collect(impl).Where(x => x is GlobalVariable)); modifiedGlobalVars = new HashSet <Variable>(AssignedVariables().Where(x => x is GlobalVariable)); // We usually declare the Boogie procedure and implementation of an atomic action together. // Since Boogie only stores the supplied attributes (in particular linearity) in the procedure parameters, // we copy them into the implementation parameters here. for (int i = 0; i < proc.InParams.Count; i++) { impl.InParams[i].Attributes = proc.InParams[i].Attributes; } for (int i = 0; i < proc.OutParams.Count; i++) { impl.OutParams[i].Attributes = proc.OutParams[i].Attributes; } AtomicActionDuplicator.SetupCopy(this, ref firstGate, ref firstImpl, "first_"); AtomicActionDuplicator.SetupCopy(this, ref secondGate, ref secondImpl, "second_"); DeclareTriggerFunctions(); }
public AtomicAction(Procedure proc, Implementation impl, LayerRange layerRange, MoverType moverType) : base(proc, impl, layerRange) { this.moverType = moverType; AtomicActionDuplicator.SetupCopy(this, ref firstGate, ref firstImpl, "first_"); AtomicActionDuplicator.SetupCopy(this, ref secondGate, ref secondImpl, "second_"); DeclareTriggerFunctions(); }