예제 #1
0
        public IEnumerator <RtlInstructionCluster> GetEnumerator()
        {
            while (dasm.MoveNext())
            {
                this.instrCur = dasm.Current;
                this.iclass   = instrCur.InstructionClass;
                var instrs = new List <RtlInstruction>();
                this.m = new RtlEmitter(instrs);
                switch (instrCur.Mnemonic)
                {
                default:
                    EmitUnitTest();
                    this.iclass = InstrClass.Invalid;
                    goto case Mnemonic.Invalid;

                case Mnemonic.Invalid:
                    m.Invalid();
                    break;

                case Mnemonic.j: RewriteJ(); break;

                case Mnemonic._and: Rewrite3(m.And); break;

                case Mnemonic._mov: RewriteMov(); break;

                case Mnemonic._fmul: Rewrite3(m.FMul); break;
                }
                yield return(m.MakeCluster(instrCur.Address, instrCur.Length, iclass));
            }
        }
예제 #2
0
 public YmpRewriter(CrayYmpArchitecture arch, Decoder <YmpDisassembler, Mnemonic, CrayInstruction> decoder, EndianImageReader rdr, ProcessorState state, IStorageBinder binder, IRewriterHost host)
 {
     this.arch     = arch;
     this.rdr      = rdr;
     this.state    = state;
     this.binder   = binder;
     this.host     = host;
     this.dasm     = new YmpDisassembler(arch, decoder, rdr).GetEnumerator();
     this.instrCur = null !;
     this.m        = null !;
 }
예제 #3
0
            public override CrayInstruction Decode(uint wInstr, Cray1Disassembler dasm)
            {
                foreach (var m in mutators)
                {
                    if (!m(wInstr, dasm))
                    {
                        return(dasm.CreateInvalidInstruction());
                    }
                }
                var instr = new CrayInstruction
                {
                    InstructionClass = this.iclass,
                    Mnemonic         = this.mnemonic,
                    Operands         = dasm.ops.ToArray(),
                };

                return(instr);
            }
예제 #4
0
        public IEnumerator <RtlInstructionCluster> GetEnumerator()
        {
            while (dasm.MoveNext())
            {
                this.instrCur = dasm.Current;
                this.iclass   = instrCur.InstructionClass;
                var instrs = new List <RtlInstruction>();
                this.m = new RtlEmitter(instrs);
                switch (instrCur.Mnemonic)
                {
                default:
                    EmitUnitTest();
                    this.iclass = InstrClass.Invalid;
                    goto case Mnemonic.Invalid;

                case Mnemonic.Invalid:
                    m.Invalid();
                    break;

                case Mnemonic.j: RewriteJ(); break;

                case Mnemonic.jan: RewriteJxx(Registers.ARegs[0], m.Ne0); break;

                case Mnemonic.jam: RewriteJxx(Registers.ARegs[0], m.Lt0); break;

                case Mnemonic.jap: RewriteJxx(Registers.ARegs[0], m.Ge0); break;

                case Mnemonic.jaz: RewriteJxx(Registers.ARegs[0], m.Eq0); break;

                case Mnemonic.jsn: RewriteJxx(Registers.SRegs[0], m.Ne0); break;

                case Mnemonic.jsm: RewriteJxx(Registers.SRegs[0], m.Lt0); break;

                case Mnemonic.jsp: RewriteJxx(Registers.SRegs[0], m.Ge0); break;

                case Mnemonic.jsz: RewriteJxx(Registers.SRegs[0], m.Eq0); break;

                case Mnemonic.r: RewriteR(); break;

                case Mnemonic._and: Rewrite3(m.And); break;

                case Mnemonic._clz: RewriteIntrinsic("__clz", true); break;

                case Mnemonic._popcnt: RewriteIntrinsic("__popcnt", true); break;

                case Mnemonic._fmul: Rewrite3(m.FMul); break;

                case Mnemonic._iadd: Rewrite3(m.IAdd); break;

                case Mnemonic._isub: Rewrite3(m.ISub); break;

                case Mnemonic._mov: RewriteMov(); break;

                case Mnemonic._movz: RewriteMovz(); break;

                case Mnemonic._lmask: RewriteLmask(); break;

                case Mnemonic._load: RewriteLoad(); break;

                case Mnemonic._lsl: RewriteShift(m.Shl); break;

                case Mnemonic._lsr: RewriteShift(m.Shr); break;

                case Mnemonic._vor: Rewrite3(m.Or); break;

                case Mnemonic._store: RewriteStore(); break;

                case Mnemonic._xor: Rewrite3(m.Xor); break;
                }
                yield return(m.MakeCluster(instrCur.Address, instrCur.Length, iclass));
            }
        }