コード例 #1
0
ファイル: DasmCodegen.cs プロジェクト: DanielKeep/Dk.Dasm
        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);
        }
コード例 #2
0
ファイル: DasmCodegen.cs プロジェクト: DanielKeep/Dk.Dasm
 public Code(Instruction instr)
 {
     this.Type = CodeType.Instruction;
     this.Value = instr.Value;
     this.Flags = CodeFlags.None;
 }
コード例 #3
0
ファイル: DasmCodegen.cs プロジェクト: DanielKeep/Dk.Dasm
        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);
        }