Ejemplo n.º 1
0
        public void CrwFPUReturnNotFound()
        {
            var ret = new FpuStackStorage(0, PrimitiveType.Real64);
            var ssa = Given_Procedure("main", m =>
            {
                m.Label("body");
                m.Call("fn", 4, new Identifier[] { }, new Identifier[] { });
                m.Return();
            });

            Given_Procedure("fn", m => { });
            Given_Signature(
                "fn",
                FunctionType.Func(
                    new Identifier(
                        "ret",
                        ret.DataType,
                        ret)));

            When_RewriteCalls(ssa);

            var sExp =
                #region Expected
                @"main_entry:
body:
	fn()
	return
main_exit:
";

            #endregion
            AssertProcedureCode(sExp, ssa);
        }
        public override Expression VisitFpuStackStorage(FpuStackStorage fpu)
        {
            Expression e      = binder.EnsureRegister(Registers.Top);
            int        offset = fpu.FpuStackOffset;

            if (this.simulateFpuFrameShift)
            {
                offset -= sigCallee.FpuStackDelta;
            }
            if (offset != 0)
            {
                BinaryOperator op;
                if (offset < 0)
                {
                    offset = -offset;
                    op     = Operator.ISub;
                }
                else
                {
                    op = Operator.IAdd;
                }
                e = new BinaryExpression(op, e.DataType, e, Constant.Create(e.DataType, offset));
            }
            return(new MemoryAccess(Registers.ST, e, fpu.DataType));
        }
Ejemplo n.º 3
0
 public Storage VisitFpuStackStorage(FpuStackStorage fpu)
 {
     if (defining)
     {
         regDefs[fpu] = value;
     }
     else
     {
         value = null;
         regDefs.TryGetValue(fpu, out value);
     }
     return(fpu);
 }
Ejemplo n.º 4
0
 public Expression VisitFpuStackStorage(FpuStackStorage fpu)
 {
     foreach (var de in this.map
              .Where(d => d.Value.Storage is FpuStackStorage))
     {
         if (((FpuStackStorage)de.Value.Storage).FpuStackOffset == fpu.FpuStackOffset)
         {
             return(de.Value.Expression);
         }
     }
     if (!bindUses)
     {
         return(null);
     }
     throw new NotImplementedException(string.Format("Offsets not matching? SP({0})", fpu.FpuStackOffset));
 }
Ejemplo n.º 5
0
        private List <CallBinding> CreateFpuStackTemporaryBindings(
            int fpuStackDelta)
        {
            var fpuDefs = new List <CallBinding>();

            for (int offset = fpuStackDelta; offset < 0; offset++)
            {
                var stg = new FpuStackStorage(
                    offset,
                    PrimitiveType.Real64);
                var name = $"rRet{stg.FpuStackOffset - offset}";
                var id   = ssa.Procedure.Frame.CreateTemporary(
                    name,
                    stg.DataType);
                var fpuDefSid = ssa.Identifiers.Add(id, null, null, false);
                var fpuDefId  = fpuDefSid.Identifier;
                fpuDefs.Add(new CallBinding(stg, fpuDefId));
            }
            return(fpuDefs);
        }
Ejemplo n.º 6
0
 public Identifier VisitFpuStackStorage(FpuStackStorage fpu)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 7
0
 public Storage VisitFpuStackStorage(FpuStackStorage fpu)
 {
     return(null);
 }
Ejemplo n.º 8
0
 public bool VisitFpuStackStorage(FpuStackStorage fpu, bool defining)
 {
     return(true);
 }
Ejemplo n.º 9
0
 public Identifier VisitFpuStackStorage(FpuStackStorage fpu)
 {
     return(frame.EnsureFpuStackVariable(fpu.FpuStackOffset, id.DataType));
 }
Ejemplo n.º 10
0
 public bool VisitFpuStackStorage(FpuStackStorage fpu)
 {
     return(liveState.LiveStorages.ContainsKey(fpu));
 }
Ejemplo n.º 11
0
 public string VisitFpuStackStorage(FpuStackStorage fpu)
 {
     return("fpu");
 }