Ejemplo n.º 1
0
        public override object Visit(PathExpression that, object value)
        {
            Storage index = new TemporaryStorage(CreateTemporary());

            switch (that.PathKind)
            {
                case PathKind.Absolute:
                    break;

                case PathKind.Instance:
                    //_writer.Write("_");
                    break;

                case PathKind.Relative:
                    break;
            }

            _writer.Write(index.ToString() + " = ");
            that.Expression.Visit(this);
            _writer.WriteLine();

            return (object) index;
        }
Ejemplo n.º 2
0
        public override object Visit(NewExpression that, object value)
        {
            Storage index = new TemporaryStorage(CreateTemporary());

            _writer.WriteLine(index.ToString() + " = call i8* @malloc(117)");

            uint result = CreateTemporary();
            _writer.WriteLine("%call i8* %" + result.ToString() + "@memset(i8* " + index.ToString() + ", 0, 117)");
            //that.Type.Visit(this);

            return (object) index;
        }
Ejemplo n.º 3
0
        public override object Visit(MemberReference that, object value)
        {
            Storage index = new TemporaryStorage(CreateTemporary());

            _writer.Write(index.ToString() + " = getelementptr ");
            #if DONE && CORRECT
            /** \todo Look up the containing class, output its name, and so on. */
            that.First.Type.Visit(this);

            _writer.Write("* %");
            that.First.Visit(this);

            _writer.Write(", i32 0, i32 ");
            that.Other.Visit(this);

            /** \todo Map member name to LLVM index. */
            that.First.Visit(this);

            _writer.WriteLine();
            #endif
            return (object) index;
        }
Ejemplo n.º 4
0
        public override object Visit(ArrayExpression that, object value)
        {
            Storage index = new TemporaryStorage(CreateTemporary());

            _writer.Write(index.ToString() + " = ");
            _writer.Write("getelementptr ");
            that.Type.Visit(this);
            _writer.Write("* ");
            that.Array.Visit(this);
            _writer.Write(", i32 ");
            that.Index.Visit(this);
            _writer.Write(", i32 0");
            _writer.WriteLine();

            return (object) index;
        }
Ejemplo n.º 5
0
        public override object Visit(CallExpression that, object value)
        {
            Storage index = (Storage) value;
            if (index == null)
                index = new TemporaryStorage(CreateTemporary());

            _writer.Write("call ");
            _writer.Write(index.ToString());
            #if FINISHED
            that.Callee.Type.Visit(this);
            #endif
            _writer.Write(" @");
            _writer.Write(EncodeEncoded(that.Encoded));
            _writer.Write('(');
            foreach (Expression argument in that.Arguments)
            {
                argument.Visit(this);
                if (argument != that.Arguments[that.Arguments.Length - 1])
                    _writer.Write(", ");
            }
            _writer.Write(')');

            return (object) index;
        }