コード例 #1
0
ファイル: Utilities.cs プロジェクト: harnold/cobe
        public static Instruction CreateBinaryInstruction(
            string mnemonic, OperationNode op, int exUnit,
            ValueNode vres, RegisterSet vresRegs,
            ValueNode v1, RegisterSet v1Regs,
            ValueNode v2, RegisterSet v2Regs)
        {
            InstructionPattern ip = new InstructionPattern();

            ip.AddNode(op);
            ip.AddNode(vres);
            ip.AddNode(v1);
            ip.AddNode(v2);
            ip.AddEdge(op, vres);
            ip.AddEdge(v1, op);
            ip.AddEdge(v2, op);

            ip.OperandValues.Add(v1);
            ip.OperandValues.Add(v2);
            ip.ResultValue = vres;

            Instruction i = new Instruction(mnemonic, ip);

            i.ExecutionUnit = exUnit;
            i.ResultRegisters = vresRegs;
            i.OperandsRegisters[0] = v1Regs;
            i.OperandsRegisters[1] = v2Regs;

            return i;
        }
コード例 #2
0
ファイル: Utilities.cs プロジェクト: harnold/cobe
        public static Instruction CreateLeftTernaryInstruction(
            string mnemonic, OperationNode op1, OperationNode op2, int exUnit,
            ValueNode vres, RegisterSet vresRegs,
            ValueNode v1, RegisterSet v1Regs,
            ValueNode v2, RegisterSet v2Regs,
            ValueNode v3, RegisterSet v3Regs)
        {
            InstructionPattern ip = new InstructionPattern();

            ip.AddNode(op1);
            ip.AddNode(op2);
            ip.AddNode(vres);
            ip.AddNode(v1);
            ip.AddNode(v2);
            ip.AddNode(v3);

            ValueNode iv1 = new RegisterValueNode(v1.Datatype);

            ip.AddNode(iv1);

            ip.AddEdge(v1, op1);
            ip.AddEdge(v2, op1);
            ip.AddEdge(op1, iv1);
            ip.AddEdge(iv1, op2);
            ip.AddEdge(v3, op2);
            ip.AddEdge(op2, vres);

            ip.OperandValues.Add(v1);
            ip.OperandValues.Add(v2);
            ip.OperandValues.Add(v3);
            ip.ResultValue = vres;

            Instruction i = new Instruction(mnemonic, ip);

            i.ExecutionUnit = exUnit;
            i.ResultRegisters = vresRegs;
            i.OperandsRegisters[0] = v1Regs;
            i.OperandsRegisters[1] = v2Regs;
            i.OperandsRegisters[2] = v3Regs;

            return i;
        }