Пример #1
0
        private void ProcessPacket(HexagonPacket packet)
        {
            foreach (var instr in packet.Instructions)
            {
                this.iclass = instr.InstructionClass;
                switch (instr.Mnemonic)
                {
                default:
                    host.Error(
                        instr.Address,
                        string.Format("Hexagon instruction '{0}' is not supported yet.", instr));
                    EmitUnitTest(packet, instr.Mnemonic.ToString());
                    break;

                case Mnemonic.ASSIGN: RewriteAssign(instr.Operands[0], instr.Operands[1]); break;

                case Mnemonic.ADDEQ: RewriteAugmentedAssign(instr.Operands[0], m.IAdd, instr.Operands[1]); break;

                case Mnemonic.ANDEQ: RewriteAugmentedAssign(instr.Operands[0], m.And, instr.Operands[1]); break;

                case Mnemonic.OREQ: RewriteAugmentedAssign(instr.Operands[0], m.Or, instr.Operands[1]); break;

                case Mnemonic.SUBEQ: RewriteAugmentedAssign(instr.Operands[0], m.ISub, instr.Operands[1]); break;

                case Mnemonic.XOREQ: RewriteAugmentedAssign(instr.Operands[0], m.Xor, instr.Operands[1]); break;

                case Mnemonic.SIDEEFFECT: RewriteSideEffect(instr.InstructionClass, instr.Operands[0]); break;

                case Mnemonic.call: RewriteCall(instr); break;

                case Mnemonic.callr: RewriteCall(instr); break;

                case Mnemonic.deallocframe: RewriteDeallocFrame(); break;

                case Mnemonic.dealloc_return: RewriteDeallocReturn(); break;

                case Mnemonic.jump: RewriteJump(instr, instr.Operands[0]); break;

                case Mnemonic.jumpr: RewriteJumpr(instr.Operands[0]); break;

                case Mnemonic.nop: m.Nop(); break;

                case Mnemonic.rte: RewriteRte(); break;

                case Mnemonic.brkpt:
                case Mnemonic.dckill:
                case Mnemonic.ickill:
                case Mnemonic.isync:
                case Mnemonic.l2kill:
                case Mnemonic.syncht:
                    m.SideEffect(RewriteIntrinsic(instr.Mnemonic.ToString(), true, VoidType.Instance)); break;
                }
                m.Instructions.Last().Class = this.iclass;
            }
        }
Пример #2
0
        private void EmitUnitTest(HexagonPacket packet, string mnemonic)
        {
            var testGenSvc = arch.Services.GetService <ITestGenerationService>();

            testGenSvc?.ReportMissingRewriter("HexagonRw", packet, mnemonic, rdr, "");
        }