Exemple #1
0
        public Identifier Deserialize(StackVariable_v1 ss)
        {
            if (argCur.Name == "...")
            {
                return(procSer.CreateId(
                           "...",
                           new UnknownType(),
                           new StackArgumentStorage(
                               procSer.StackOffset + retAddressOnStack,
                               new UnknownType())));
            }
            if (argCur.Type == null)
            {
                throw new ApplicationException(string.Format("Argument '{0}' has no type.", argCur.Name));
            }
            var dt = this.argCur.Type.Accept(procSer.TypeLoader);

            if (dt is VoidType)
            {
                return(null);
            }
            var name = Frame.FormatStackAccessName(
                dt,
                "Arg",
                procSer.StackOffset + retAddressOnStack,
                argCur.Name);
            var idArg = procSer.CreateId(
                name,
                dt,
                new StackArgumentStorage(procSer.StackOffset + retAddressOnStack, dt));
            int words = (dt.Size + (stackAlignment - 1)) / stackAlignment;

            procSer.StackOffset += words * stackAlignment;
            return(idArg);
        }
Exemple #2
0
 public Identifier Deserialize(StackVariable_v1 ss)
 {
     if (argCur.Name == "...")
     {
         return procSer.CreateId(
             "...",
             new UnknownType(),
             new StackArgumentStorage(
                 procSer.StackOffset + retAddressOnStack,
                 new UnknownType()));
     }
     if (argCur.Type == null)
         throw new ApplicationException(string.Format("Argument '{0}' has no type.", argCur.Name));
     var dt = this.argCur.Type.Accept(procSer.TypeLoader);
     if (dt is VoidType)
     {
         return null;
     }
     var name = frame.FormatStackAccessName(
         dt,
         "Arg",
         procSer.StackOffset + retAddressOnStack,
         argCur.Name);
     var idArg = procSer.CreateId(
         name,
         dt,
         new StackArgumentStorage(procSer.StackOffset + retAddressOnStack, dt));
     int words = (dt.Size + (stackAlignment - 1)) / stackAlignment;
     procSer.StackOffset += words * stackAlignment;
     return idArg;
 }
Exemple #3
0
        /// <summary>
        /// Deserializes an argument.
        /// </summary>
        /// <param name="arg"></param>
        /// <param name="idx"></param>
        /// <param name="convention"></param>
        /// <returns></returns>
        public Identifier DeserializeArgument(Argument_v1 arg, int idx, string convention)
        {
            var kind = arg.Kind;

            if (kind == null)
            {
                kind = new StackVariable_v1();
            }
            return(argDeser.Deserialize(arg, kind));
        }
Exemple #4
0
 public Identifier Deserialize(StackVariable_v1 ss)
 {
     if (argCur.Name == "...")
     {
         return procSer.CreateId("...", new UnknownType(), new StackArgumentStorage(procSer.StackOffset, new UnknownType()));
     }
     if (argCur.Type == null)
         throw new ApplicationException(string.Format("Argument '{0}' has no type.", argCur.Name));
     var dt = this.argCur.Type.Accept(procSer.TypeLoader);
     if (dt is VoidType)
     {
         return null;
     }
     var idArg = procSer.CreateId(
         argCur.Name ?? "arg" + procSer.StackOffset,
         dt,
         new StackArgumentStorage(procSer.StackOffset, dt));
     procSer.StackOffset += dt.Size;
     return idArg;
 }
Exemple #5
0
        public Identifier Deserialize(StackVariable_v1 ss)
        {
            if (argCur.Name == "...")
            {
                return(procSer.CreateId("...", new UnknownType(), new StackArgumentStorage(procSer.StackOffset, new UnknownType())));
            }
            if (argCur.Type == null)
            {
                throw new ApplicationException(string.Format("Argument '{0}' has no type.", argCur.Name));
            }
            var dt = this.argCur.Type.Accept(procSer.TypeLoader);

            if (dt is VoidType)
            {
                return(null);
            }
            var idArg = procSer.CreateId(
                argCur.Name ?? "arg" + procSer.StackOffset,
                dt,
                new StackArgumentStorage(procSer.StackOffset, dt));

            procSer.StackOffset += dt.Size;
            return(idArg);
        }