예제 #1
0
            public override void Compile(CallStatement call, ICompilerBackend backend)
            {
                switch (_type)
                {
                    case EBarrierType.Global:
                        backend.InstallBarrier();
                        break;

                    case EBarrierType.PortIO:
                        backend.InstallBarrier(InstructionCodes.WrPort, InstructionCodes.RdPort);
                        break;

                    default:
                        throw new NotImplementedException();
                }
            }
예제 #2
0
 public override void AcceptCall(CallStatement stmt)
 {
     var fspec = stmt.Callee as FunctionSpec;
     if (fspec != null &&
         fspec.IntrinsicRep != null &&
         fspec.IntrinsicRep.Action == IntrinsicFunction.EAction.Fork)
     {
         var task = (Task)fspec.IntrinsicRep.Parameter;
         var cofsm = _me._coFSMs.Map[task];
         var call = stmt.Arguments[0] as FunctionCall;
         var args = call.Arguments;
         for (int i = 1; i < args.Length; i++)
         {
             var argType = args[i].ResultType.CILType;
             if (argType.IsGenericType &&
                 argType.GetGenericTypeDefinition().Equals(typeof(Task<>)))
             {
                 // nop
             }
             else
             {
                 Store(cofsm.Arguments[i - 1], args[i]);
             }
         }
         cofsm.InitialHandler.Accept(this);
     }
     else
     {
         base.AcceptCall(stmt);
     }
 }
예제 #3
0
 public override void AcceptCall(CallStatement stmt)
 {
     var fspec = stmt.Callee as FunctionSpec;
     if (fspec != null &&
         fspec.IntrinsicRep != null &&
         fspec.IntrinsicRep.Action == IntrinsicFunction.EAction.ProceedWithState)
     {
         var pi = (ProceedWithStateInfo)fspec.IntrinsicRep.Parameter;
         if (pi.TargetState == null)
         {
             // final state of co fsm
             var fa = LiteralReference.CreateConstant(false);
             Store(_activeVars[_ownState], fa);
         }
         else
         {
             var si = _me._stateInfos[pi.TargetState];
             if (pi.LambdaTransition)
             {
                 si.Result.Decompiled.Body.Accept(this);
             }
             else
             {
                 int index = (int)(pi.TargetWaitState ? si.WaitStateValue : si.StateValue);
                 var tr = LiteralReference.CreateConstant(true);
                 var fa = LiteralReference.CreateConstant(false);
                 Store(_activeVars[index], tr);
                 Store(_activeVars[_ownState], fa);
             }
         }
     }
     else
     {
         base.AcceptCall(stmt);
     }
 }
예제 #4
0
 public override void AcceptCall(CallStatement stmt)
 {
     var fspec = stmt.Callee as FunctionSpec;
     if (fspec != null &&
         fspec.IntrinsicRep != null &&
         fspec.IntrinsicRep.Action == IntrinsicFunction.EAction.ProceedWithState)
     {
         var pi = (ProceedWithStateInfo)fspec.IntrinsicRep.Parameter;
         var si = _me._stateInfos[pi.TargetState];
         if (pi.LambdaTransition)
         {
             si.Result.Decompiled.Body.Accept(this);
         }
         else if (!_singleState)
         {
             var lhs = SignalRef.Create(_me._nextStateSignal, SignalRef.EReferencedProperty.Next);
             var rhs = LiteralReference.CreateConstant(pi.TargetWaitState ? si.WaitStateValue : si.StateValue);
             Store(lhs, rhs);
         }
     }
     else
     {
         base.AcceptCall(stmt);
     }
 }
예제 #5
0
 public void AcceptCall(CallStatement stmt)
 {
 }
예제 #6
0
 public void AcceptCall(CallStatement stmt)
 {
     throw new NotConvertibleToInlineExpressionException();
 }
예제 #7
0
 public void AcceptCall(CallStatement stmt)
 {
     foreach (Expression arg in stmt.Arguments)
         arg.CheckConsistency();
 }
예제 #8
0
 public virtual void Call(ICallable callee, Expression[] arguments)
 {
     CallStatement stmt = new CallStatement()
     {
         Callee = callee,
         Arguments = arguments
     };
     _cstack.Peek().Statements.Add(stmt);
 }
 public void AcceptCall(CallStatement stmt)
 {
     foreach (var arg in stmt.Arguments)
         Resolve(arg);
     ProcessCallable(stmt.Callee);
 }
예제 #10
0
 public void AcceptCall(CallStatement stmt)
 {
     for (int i = 0; i < stmt.Arguments.Length; i++)
         stmt.Arguments[i] = SubstExpression(stmt.Arguments[i]);
 }
        public void AcceptCall(CallStatement stmt)
        {
            object[] evalArgs = new object[stmt.Arguments.Length];
            for (int i = 0; i < stmt.Arguments.Length; i++)
                evalArgs[i] = stmt.Arguments[i].Eval(Evaluator);

            EvalFunction(stmt.Callee, evalArgs);
        }
 public override void AcceptCall(CallStatement stmt)
 {
     Success = false;
 }
예제 #13
0
 public override void Compile(CallStatement call, ICompilerBackend backend)
 {
 }
예제 #14
0
 /// <summary>
 /// Compiles the method call
 /// </summary>
 /// <param name="call">method call statement</param>
 /// <param name="backend">compiler interface to emit XIL instructions</param>
 public abstract void Compile(CallStatement call, ICompilerBackend backend);
예제 #15
0
 public void AcceptCall(CallStatement stmt)
 {
     GenerateComments(stmt);
     FunctionCall tmp = new FunctionCall()
     {
         Callee = stmt.Callee,
         Arguments = stmt.Arguments
     };
     _tw.Write(tmp.ToString(_vhdg));
     _tw.WriteLine(";");
 }