Ejemplo n.º 1
0
        public void CgExtInstruction(ParseTreeNode node, ref CgContext ctx)
        {
            var op = node.ChildNodes[0];
            var arg = node.ChildNodes[1];

            Instruction instr = new Instruction();
            Code? tail;

            instr.BasicOpcode = BasicOpcode.Ext;
            instr.ExtOpcode = op.ChildNodes[0].Token.Text.ToExtOpcode();
            instr.ArgA = CgArgument(arg, ref ctx, out tail, shortForm: false);

            ctx.Write(new Code(instr));
            if (tail.HasValue) ctx.Write(tail.Value);
        }
Ejemplo n.º 2
0
 public Code(Instruction instr)
 {
     this.Type = CodeType.Instruction;
     this.Value = instr.Value;
     this.Flags = CodeFlags.None;
 }
Ejemplo n.º 3
0
        public void CgBasicInstruction(ParseTreeNode node, ref CgContext ctx)
        {
            var op = node.ChildNodes[0].ChildNodes[0];
            var argB = node.ChildNodes[1];
            var argA = node.ChildNodes[2];

            Instruction instr = new Instruction();
            Code? tailA, tailB;

            instr.BasicOpcode = op.Term.Name.ToBasicOpcode();
            instr.ArgA = CgArgument(argA, ref ctx, out tailA, shortForm: false);
            instr.ArgB = CgArgument(argB, ref ctx, out tailB, shortForm: true);

            ctx.Write(new Code(instr));
            if (tailA.HasValue) ctx.Write(tailA.Value);
            if (tailB.HasValue) ctx.Write(tailB.Value);
        }