Exemplo n.º 1
0
 private void RewriteBcc(ConditionCode cc, FlagM flags)
 {
     emitter.Branch(
         emitter.Test(cc, orw.FlagGroup(flags)),
         ((M68kAddressOperand) di.op1).Address,
         RtlClass.ConditionalTransfer);
 }
Exemplo n.º 2
0
 private Identifier Grf(FlagM grf)
 {
     return frame.EnsureFlagGroup(
         (uint) grf, 
         arch.GrfToString((uint) grf),
         (grf & (grf - 1)) != 0 ? PrimitiveType.Byte : PrimitiveType.Bool);
 }
Exemplo n.º 3
0
 private void RewriteBxx(Pdp11Instruction instr, ConditionCode cc, FlagM flags)
 {
     this.rtlCluster.Class = RtlClass.Transfer;
     m.Branch(
         m.Test(cc, frame.EnsureFlagGroup(arch.GetFlagGroup((uint)flags))),
         ((AddressOperand)instr.op1).Address,
         RtlClass.ConditionalTransfer);
 }
Exemplo n.º 4
0
        private void RewriteDbcc(ConditionCode cc, FlagM flags)
        {
            if (cc != ConditionCode.None)
            {
                emitter.Branch(
                    emitter.Test(cc, orw.FlagGroup(flags)),
                    di.Address + 4,
                    RtlClass.ConditionalTransfer);
            }
            var src = orw.RewriteSrc(di.op1, di.Address);

            emitter.Assign(src, emitter.ISub(src, 1));
            emitter.Branch(
                emitter.Ne(src, emitter.Int32(-1)),
                (Address) orw.RewriteSrc(di.op2, di.Address, true),
                RtlClass.ConditionalTransfer);
        }
Exemplo n.º 5
0
        private void RewriteBranch(ConditionCode cc, FlagM flags)
        {
            var flagGrp = binder.EnsureFlagGroup(arch.GetFlagGroup(Registers.CC, (uint)flags));

            m.Branch(m.Test(cc, flagGrp), ((AddressOperand)instr.Operands[0]).Address, instr.InstructionClass);
        }
Exemplo n.º 6
0
 public Identifier FlagGroup(FlagM flags)
 {
     return frame.EnsureFlagGroup((uint)flags, arch.GrfToString((uint)flags), PrimitiveType.Byte);
 }
Exemplo n.º 7
0
 protected Identifier FlagGroup(FlagM flags)
 => binder.EnsureFlagGroup(PICRegisters.STATUS, (uint)flags, arch.GrfToString((uint)flags), PrimitiveType.Byte);
Exemplo n.º 8
0
 private void AssignCond(FlagM flags, Expression dst)
 {
     m.Assign(FlagGroup(flags), m.Cond(dst));
 }
Exemplo n.º 9
0
        private void RewriteBinop(Func <Expression, Expression, BinaryExpression> fn, FlagM grf)
        {
            var dst = OpSrc(instr.Operands[0]);
            var src = OpSrc(instr.Operands[1]);

            m.Assign(dst, fn(dst, src));
            if (grf != 0)
            {
                var flg = arch.GetFlagGroup((uint)grf);
                m.Assign(binder.EnsureFlagGroup(flg), m.Cond(dst));
            }
        }
Exemplo n.º 10
0
 public Identifier FlagGroup(FlagM flags)
 {
     return(binder.EnsureFlagGroup(Registers.ccr, (uint)flags, arch.GrfToString((uint)flags), PrimitiveType.Byte));
 }
Exemplo n.º 11
0
 private static FlagGroupStorage FlagRegister(string name, RegisterStorage freg, FlagM grf)
 {
     return(new FlagGroupStorage(freg, (uint)grf, name, PrimitiveType.Bool));
 }
Exemplo n.º 12
0
 private void RewriteBinOp(Func<Expression, Expression, Expression> opGen, FlagM flags)
 {
     var opSrc = orw.RewriteSrc(di.op1, di.Address);
     var opDst = orw.RewriteDst(di.op2, di.Address, opSrc, opGen);
     emitter.Assign(orw.FlagGroup(flags), emitter.Cond(opDst));
 }
Exemplo n.º 13
0
 private void RewriteLoop(FlagM useFlags, ConditionCode cc)
 {
     Identifier cx = orw.AluRegister(Registers.ecx, instrCur.dataWidth);
     emitter.Assign(cx, emitter.ISub(cx, 1));
     if (useFlags != 0)
     {
         emitter.Branch(
             emitter.Cand(
                 emitter.Test(cc, orw.FlagGroup(useFlags)),
                 emitter.Ne0(cx)),
             OperandAsCodeAddress(instrCur.op1),
             RtlClass.ConditionalTransfer);
         ric.Class = RtlClass.ConditionalTransfer;
     }
     else
     {
         emitter.Branch(emitter.Ne0(cx), OperandAsCodeAddress(instrCur.op1), RtlClass.ConditionalTransfer);
         ric.Class = RtlClass.ConditionalTransfer;
     }
 }
Exemplo n.º 14
0
        private void AssignFlag(FlagM flag, bool value)
        {
            var grf = arch.GetFlagGroup(Registers.ccr, (uint)flag);

            m.Assign(binder.EnsureFlagGroup(grf), Constant.Bool(value));
        }
Exemplo n.º 15
0
 private static FlagGroupStorage FlagGroup(FlagM bits, string name)
 => new FlagGroupStorage(Registers.PSW, (uint)bits, name, Registers.PSW.DataType);
Exemplo n.º 16
0
 private static FlagGroupStorage FlagBit(FlagM bit, string name)
 => new FlagGroupStorage(Registers.PSW, (uint)bit, name, PrimitiveType.Bool);
Exemplo n.º 17
0
 public Identifier FlagGroup(FlagM flags)
 {
     return(frame.EnsureFlagGroup((uint)flags, arch.GrfToString((uint)flags), PrimitiveType.Byte));
 }
Exemplo n.º 18
0
        private static FlagGroupStorage FlagRegister(string name, RegisterStorage freg, FlagM grf)
        {
            var dt = Bits.IsSingleBitSet((uint)grf) ? PrimitiveType.Bool : PrimitiveType.Byte;

            return(new FlagGroupStorage(freg, (uint)grf, name, dt));
        }
Exemplo n.º 19
0
 private void RewriteBranch(ConditionCode cc, FlagM flags)
 {
     emitter.Branch(
         emitter.Test(cc, FlagGroup(flags)),
         ((AddressOperand)dasm.Current.Operands[0]).Address,
         RtlClass.ConditionalTransfer);
     rtlc.Class = RtlClass.ConditionalTransfer;
 }
Exemplo n.º 20
0
 public Identifier FlagGroup(FlagM flags)
 {
     return(binder.EnsureFlagGroup(arch.GetFlagGroup((uint)flags)));;
 }
Exemplo n.º 21
0
 private void RewriteScc(ConditionCode cc, FlagM flagsUsed)
 {
     orw.RewriteMoveDst(instr.Operands[0], instr.Address, PrimitiveType.Byte, orw.FlagGroup(flagsUsed));
 }
Exemplo n.º 22
0
 private Identifier FlagGroup(FlagM flags)
 {
     return(frame.EnsureFlagGroup(Registers.psw, (uint)flags, arch.GrfToString((uint)flags), PrimitiveType.Byte));
 }
Exemplo n.º 23
0
 private void AssignCond(FlagM flags, Expression dst)
 {
     emitter.Assign(FlagGroup(flags), emitter.Cond(dst));
 }
Exemplo n.º 24
0
 private void RewriteScc(ConditionCode cc, FlagM flagsUsed)
 {
     orw.RewriteMoveDst(di.op1, di.Address, PrimitiveType.Byte, orw.FlagGroup(flagsUsed));
 }
Exemplo n.º 25
0
        Identifier FlagGroup(FlagM bits, string name, PrimitiveType type)
        {
            var grf = arch.GetFlagGroup((uint)bits);

            return(binder.EnsureFlagGroup(grf));
        }
Exemplo n.º 26
0
 /// <summary>
 /// Emits an assignment to a flag-group pseudoregister.
 /// </summary>
 /// <param name="v"></param>
 /// <param name="defFlags">flags defined by the intel instruction</param>
 private void EmitCcInstr(Expression expr, FlagM defFlags)
 {
     m.Assign(orw.FlagGroup(defFlags), new ConditionOf(expr.CloneExpression()));
 }
Exemplo n.º 27
0
 private Identifier FlagGroup(FlagM bits, string name, PrimitiveType type)
 {
     return(frame.EnsureFlagGroup((uint)bits, name, type));
 }
Exemplo n.º 28
0
 private void RewriteSetBit(FlagM grf, bool value)
 {
     m.Assign(binder.EnsureFlagGroup(arch.GetFlagGroup((uint)grf)), Constant.Bool(value));
 }
Exemplo n.º 29
0
 private void RewriteScc(ConditionCode cc, FlagM flagsUsed)
 {
     orw.RewriteMoveDst(di.op1, di.Address, PrimitiveType.Byte, orw.FlagGroup(flagsUsed));
 }
Exemplo n.º 30
0
        private Identifier FlagGroupStorage(FlagM flags)
        {
            var grf = arch.GetFlagGroup(Registers.p, (uint)flags);

            return(binder.EnsureFlagGroup(grf));
        }
Exemplo n.º 31
0
 private Identifier FlagGroup(FlagM flags)
 {
     return(binder.EnsureFlagGroup(arch.GetFlagGroup(Registers.psw, (uint)flags)));
 }
Exemplo n.º 32
0
 public Identifier FlagGroup(FlagM flags)
 {
     return(binder.EnsureFlagGroup(arch.GetFlagGroup(Registers.f, (uint)flags)));
 }
Exemplo n.º 33
0
 /// <summary>
 /// Emits an assignment to a flag-group pseudoregister.
 /// </summary>
 /// <param name="v"></param>
 /// <param name="defFlags">flags defined by the intel instruction</param>
 private void EmitCcInstr(Expression expr, FlagM defFlags)
 {
     emitter.Assign(orw.FlagGroup(defFlags), new ConditionOf(expr.CloneExpression()));
 }
Exemplo n.º 34
0
 private void RewriteLoop(FlagM useFlags, ConditionCode cc)
 {
     Identifier cx = orw.AluRegister(Registers.ecx, instrCur.dataWidth);
     emitter.Assign(cx, emitter.ISub(cx, 1));
     if (useFlags != 0)
     {
         emitter.Branch(
             new BinaryExpression(Operator.Cand, PrimitiveType.Bool,
                 new TestCondition(cc, orw.FlagGroup(useFlags)),
                 emitter.Ne0(cx)),
             OperandAsCodeAddress(instrCur.op1),
             RtlClass.ConditionalTransfer);
     }
     else
     {
         emitter.Branch(emitter.Ne0(cx), OperandAsCodeAddress(instrCur.op1), RtlClass.ConditionalTransfer);
     }
 }
Exemplo n.º 35
0
 private void RewriteSetFlag(FlagM flagM, Constant value)
 {
     var reg = arch.GetFlagGroup((uint) flagM);
     state.SetFlagGroup(reg, value);
     var id = orw.FlagGroup(flagM);
     emitter.Assign(id, value);
 }