Exemplo n.º 1
0
        IRPointer ReadPointer(Node node)
        {
            var        type    = ASTType.I4;
            TypeSig    rawType = null;
            IRRegister reg     = null;
            int        offset  = 0;

            for (int i = 0; i < node.Count; i++)
            {
                var child = node[i];
                if (child.Id == (int)IRConstants.TYPE)
                {
                    ReadType(child, ref type, ref rawType);
                }
                else if (child.Id == (int)IRConstants.REGISTER)
                {
                    reg = ReadRegister(child);
                }
                else if (child.Id == (int)IRConstants.POINTER_OFFSET)
                {
                    offset = (int)ParseUInt32((Token)child[1]);
                    if (child[0].Id == (int)IRConstants.MINUS)
                    {
                        offset = -offset;
                    }
                }
            }
            return(new IRPointer {
                Register = reg,
                Type = type,
                Offset = offset,
                SourceVariable = rawType == null ? null : GetTypedVariable(type, rawType)
            });
        }
 public static ILOpCode GetLIND(this IRRegister reg) => GetLIND(reg.Type, reg.SourceVariable == null ? null : reg.SourceVariable.RawType);
Exemplo n.º 3
0
 public static ILOpCode GetPUSHR(this IRRegister reg)
 {
     return(GetPUSHR(reg.Type, reg.SourceVariable == null ? null : reg.SourceVariable.RawType));
 }