DeserializeReturnValue() public method

public DeserializeReturnValue ( Reko.Core.Serialization.Argument_v1 arg ) : Identifier
arg Reko.Core.Serialization.Argument_v1
return Identifier
Exemplo n.º 1
0
        public override FunctionType Deserialize(SerializedSignature ss, Frame frame)
        {
            if (ss == null)
                return new FunctionType();
            if (ss == null)
                return null;
            var argser = new ArgumentDeserializer(this, Architecture, frame, 0, Architecture.WordWidth.Size);
            Identifier ret = null;

            if (ss.ReturnValue != null)
            {
                ret = argser.DeserializeReturnValue(ss.ReturnValue);
            }

            var args = new List<Identifier>();
            this.gr = 0;
            if (ss.Arguments != null)
            {
                for (int iArg = 0; iArg < ss.Arguments.Length; ++iArg)
                {
                    var sArg = ss.Arguments[iArg];
                    Identifier arg = DeserializeArgument(argser, sArg);
                    args.Add(arg);
                }
            }

            var sig = new FunctionType(ret, args.ToArray());
            return sig;
        }
Exemplo n.º 2
0
        public override FunctionType Deserialize(SerializedSignature ss, Frame frame)
        {
            if (ss == null)
                return null;
            this.argDeser = new ArgumentDeserializer(this, Architecture, frame, 0, Architecture.WordWidth.Size);
            Identifier ret = null;
            int fpuDelta = FpuStackOffset;

            FpuStackOffset = 0;
            if (ss.ReturnValue != null)
            {
                ret = argDeser.DeserializeReturnValue(ss.ReturnValue);
                fpuDelta += FpuStackOffset;
            }

            FpuStackOffset = 0;
            var args = new List<Identifier>();
            if (ss.Arguments != null)
            {
                for (int iArg = 0; iArg < ss.Arguments.Length; ++iArg)
                {
                    var sArg = ss.Arguments[iArg];
                    var arg = DeserializeArgument(sArg, iArg, ss.Convention);
                    args.Add(arg);
                }
                fpuDelta -= FpuStackOffset;
            }
            FpuStackOffset = fpuDelta;

            var sig = new FunctionType(ret, args.ToArray());
            ApplyConvention(ss, sig);
            return sig;
        }
Exemplo n.º 3
0
        public override FunctionType Deserialize(SerializedSignature ss, Frame frame)
        {
            int ncrn = 0;
            int nsaa = 0;
            // mem arg forb ret val

            var argser = new ArgumentDeserializer(
               this,
               Architecture,
               frame,
               Architecture.PointerType.Size,
               Architecture.WordWidth.Size);

            Identifier ret = null;
            if (ss.ReturnValue != null)
            {
                ret = argser.DeserializeReturnValue(ss.ReturnValue);
            }

            var args = new List<Identifier>();
            if (ss.Arguments != null)
            {
                foreach (var sArg in ss.Arguments)
                {
                    var dt = sArg.Type.Accept(TypeLoader);
                    var sizeInWords = (dt.Size + 3) / 4;

                    if (sizeInWords == 2 && (ncrn & 1) == 1)
                        ++ncrn;
                    Identifier arg;
                    if (sizeInWords <= 4 - ncrn)
                    {
                        if (sizeInWords == 2)
                        {
                            arg = frame.EnsureSequence(
                                Architecture.GetRegister(argRegs[ncrn]),
                                Architecture.GetRegister(argRegs[ncrn + 1]),
                                dt);
                            ncrn += 2;
                        }
                        else
                        {
                            arg = frame.EnsureRegister(
                                Architecture.GetRegister(argRegs[ncrn]));
                            ncrn += 1;
                        }
                    }
                    else
                    {
                        arg = frame.EnsureStackArgument(nsaa, dt);
                        nsaa += AlignedStackArgumentSize(dt);
                    }
                    args.Add(arg);
                }
            }
            return new FunctionType(ret, args.ToArray());
        }
Exemplo n.º 4
0
        public override FunctionType Deserialize(SerializedSignature ss, Frame frame)
        {
            if (ss == null)
                return null;
            this.argDeser = new ArgumentDeserializer(
                this,
                Architecture,
                frame,
                Architecture.PointerType.Size, //$BUG: x86 real mode?
                Architecture.WordWidth.Size);
            Identifier ret = null;
            int fpuDelta = FpuStackOffset;

            FpuStackOffset = 0;
            if (ss.ReturnValue != null)
            {
                ret = argDeser.DeserializeReturnValue(ss.ReturnValue);
                fpuDelta += FpuStackOffset;
            }

            FpuStackOffset = 0;
            var args = new List<Identifier>();
            if (ss.EnclosingType != null)
            {
                var arg = DeserializeImplicitThisArgument(ss);
                args.Add(arg);
            }
            if (ss.Arguments != null)
            {
                if (ss.Convention == "pascal")
                {
                    for (int iArg = ss.Arguments.Length -1; iArg >= 0; --iArg)
                    {
                        var sArg = ss.Arguments[iArg];
                        var arg = DeserializeArgument(sArg, iArg, ss.Convention);
                        args.Add(arg);
                    }
                    args.Reverse();
                }
                else
                {
                    for (int iArg = 0; iArg < ss.Arguments.Length; ++iArg)
                    {
                        var sArg = ss.Arguments[iArg];
                        var arg = DeserializeArgument(sArg, iArg, ss.Convention);
                        args.Add(arg);
                    }
                }
                fpuDelta -= FpuStackOffset;
            }
            FpuStackOffset = fpuDelta;
            var sig = new FunctionType(ret, args.ToArray());
            sig.IsInstanceMetod = ss.IsInstanceMethod;
            ApplyConvention(ss, sig);
            return sig;
        }
Exemplo n.º 5
0
        public override FunctionType Deserialize(SerializedSignature ss, Frame frame)
        {
            if (ss == null)
                return null;
            this.argDeser = new ArgumentDeserializer(
                this,
                Architecture,
                frame,
                Architecture.PointerType.Size,
                Architecture.WordWidth.Size);
            Identifier ret = null;

            if (ss.ReturnValue != null)
            {
                ret = argDeser.DeserializeReturnValue(ss.ReturnValue);
            }

            var args = new List<Identifier>();
            int iArg = 0;
            if (ss.EnclosingType != null && ss.IsInstanceMethod)
            {
                var arg = DeserializeImplicitThisArgument(ss);
                args.Add(arg);
                ++iArg;
            }
            if (ss.Arguments != null)
            {
                for (iArg = 0; iArg < ss.Arguments.Length; ++iArg)
                {
                    var sArg = ss.Arguments[iArg];
                    var arg = DeserializeArgument(sArg, iArg, ss.Convention);
                    args.Add(arg);
                }
            }
            var sig = new FunctionType(ret, args.ToArray());
            sig.IsInstanceMetod = ss.IsInstanceMethod;
            ApplyConvention(ss, sig);
            return sig;
        }