当前位置: 首页>>代码示例>>C#>>正文


C# Machine.MachineOperand类代码示例

本文整理汇总了C#中Reko.Core.Machine.MachineOperand的典型用法代码示例。如果您正苦于以下问题:C# MachineOperand类的具体用法?C# MachineOperand怎么用?C# MachineOperand使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MachineOperand类属于Reko.Core.Machine命名空间,在下文中一共展示了MachineOperand类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ShiftOperand

 public ShiftOperand(MachineOperand op, Opcode opcode, MachineOperand shAmt)
     : base(op.Width)
 {
     this.Operand = op;
     this.Opcode = opcode;
     this.Shift = shAmt;
 }
开发者ID:melbcat,项目名称:reko,代码行数:7,代码来源:ShiftOperand.cs

示例2: Write

 private void Write(MachineOperand op, MachineInstructionWriter writer)
 {
     var reg = op as RegisterOperand;
     if (reg != null)
     {
         writer.Write("%{0}", reg.Register.Name);
         return;
     }
     var imm = op as ImmediateOperand;
     if (imm != null)
     {
         writer.Write(imm.Value.ToString());
         return;
     }
     var mem = op as MemoryOperand;
     if (mem != null)
     {
         mem.Write(false, writer);
         return;
     }
     var idx = op as IndexedMemoryOperand;
     if (idx != null)
     {
         idx.Write(false, writer);
         return;
     }
     writer.Write(op.ToString());
 }
开发者ID:gh0std4ncer,项目名称:reko,代码行数:28,代码来源:SparcInstruction.cs

示例3: ArmMemoryOperand

 public ArmMemoryOperand(PrimitiveType width, RegisterStorage regBase, MachineOperand offset) : base(width)
 {
     if (width == null)
         throw new ArgumentNullException("width");
     Base = regBase;
     Offset = offset;
 }
开发者ID:melbcat,项目名称:reko,代码行数:7,代码来源:ArmMemoryOperand.cs

示例4: Write

 public void Write(MachineOperand op, MachineInstructionWriter writer)
 {
     var imm = op as ImmediateOperand;
     if (imm != null)
     {
         writer.Write("#");
         int imm8 = imm.Value.ToInt32();
         if (imm8 > 256 && ((imm8 & (imm8 - 1)) == 0))
         {
             /* only one bit set, and that later than bit 8.
              * Represent as 1<<... .
              */
             writer.Write("1<<");
             {
                 uint n = 0;
                 while ((imm8 & 15) == 0)
                 {
                     n += 4; imm8 = imm8 >> 4;
                 }
                 // Now imm8 is 1, 2, 4 or 8. 
                 n += (uint)((0x30002010 >> (int)(4 * (imm8 - 1))) & 15);
                 writer.Write(n);
             }
         }
         else
         {
             var fmt = (-9 <= imm8 && imm8 <= 9) ? "{0}{1}" : "&{0}{1:X}";
             var sign = "";
             if (((int)imm8) < 0 && ((int)imm8) > -100)
             {
                 imm8 = -imm8;
                 sign = "-";
             }
             writer.Write(fmt,sign,imm8);
         }
         return;
     }
     var adr = op as AddressOperand;
     if (adr != null)
     {
         adr.Write(false, writer);
         return;
     }
     var mem = op as ArmMemoryOperand;
     if (mem != null)
     {
         mem.Write(false, writer);
         return;
     }
     var sh = op as ShiftOperand;
     if (sh != null)
     {
         sh.Write(false, writer);
         return;
     }
     if (op == null)
         writer.Write("<null>");
     else 
         op.Write(false, writer);
 }
开发者ID:melbcat,项目名称:reko,代码行数:60,代码来源:ArmInstruction.cs

示例5: PowerPcInstruction

 public PowerPcInstruction(Opcode opcode, MachineOperand op1, MachineOperand op2, MachineOperand op3, bool setsCR0)
 {
     this.opcode = opcode;
     this.op1 = op1;
     this.op2 = op2;
     this.op3 = op3;
     this.setsCR0 = setsCR0;
 }
开发者ID:gh0std4ncer,项目名称:reko,代码行数:8,代码来源:PowerPcInstruction.cs

示例6: OpToString

 private void OpToString(MachineOperand op, MachineInstructionWriter writer)
 {
     if (op is ImmediateOperand)
     {
         writer.Write("#" + op.ToString());
     }
     else
     {
         writer.Write(op.ToString());
     }
 }
开发者ID:gitter-badger,项目名称:reko,代码行数:11,代码来源:Pdp11Instruction.cs

示例7: GetFpuRegPair

 private Identifier GetFpuRegPair(MachineOperand op)
 {
     var freg0 = ((RegisterOperand)op).Register;
     Debug.Assert(freg0.Number % 2 == 0);
     var freg1 = Registers.fpuRegs[1 + (freg0.Number & 0x1F)];
     var seq = frame.EnsureSequence(
         freg0,
         freg1,
         PrimitiveType.Real64);
     return seq;
 }
开发者ID:relaxar,项目名称:reko,代码行数:11,代码来源:MipsRewriter.Fpu.cs

示例8: OperandAsCodeAddress

 public Address OperandAsCodeAddress(MachineOperand op)
 {
     AddressOperand ado = op as AddressOperand;
     if (ado != null)
         return ado.Address;
     ImmediateOperand imm = op as ImmediateOperand;
     if (imm != null)
     {
         return orw.ImmediateAsAddress(instrCur.Address, imm);
     }
     return null;
 }
开发者ID:feelworld,项目名称:reko,代码行数:12,代码来源:X86Rewriter.Control.cs

示例9: EmitBinOp

 public void EmitBinOp(BinaryOperator binOp, MachineOperand dst, DataType dtDst, Expression left, Expression right, CopyFlags flags)
 {
     Constant c = right as Constant;
     if (c != null)
     {
         if (c.DataType == PrimitiveType.Byte && left.DataType != c.DataType)
         {
             right = emitter.Const(left.DataType, c.ToInt32());
         }
     }
     //EmitCopy(dst, new BinaryExpression(binOp, dtDst, left, right), true, emitCc);
     EmitCopy(dst, new BinaryExpression(binOp, dtDst, left, right), flags);
 }
开发者ID:nemerle,项目名称:reko,代码行数:13,代码来源:X86Rewriter.Alu.cs

示例10: IntelInstruction

		public IntelInstruction(Opcode code, PrimitiveType dataWidth, PrimitiveType addrWidth, params MachineOperand [] ops)
		{
			this.code = code;
			this.dataWidth = dataWidth;
			this.addrWidth = addrWidth;
			if (ops.Length >= 1)
			{
				op1 = ops[0];
				if (ops.Length >= 2)
				{
					op2 = ops[1];
					if (ops.Length == 3)
						op3 = ops[2];
					else if (ops.Length >= 4)
						throw new ArgumentException("Too many operands.");
				}
			}
		}
开发者ID:gh0std4ncer,项目名称:reko,代码行数:18,代码来源:IntelInstruction.cs

示例11: Transform

 public Expression Transform(IntelInstruction instr, MachineOperand op, PrimitiveType opWidth, X86State state)
 {
     var reg = op as RegisterOperand;
     if (reg != null)
         return AluRegister(reg);
     var mem = op as MemoryOperand;
     if (mem != null)
         return CreateMemoryAccess(instr, mem, opWidth, state);
     var imm = op as ImmediateOperand;
     if (imm != null)
         return CreateConstant(imm, opWidth);
     var fpu = op as FpuOperand;
     if (fpu != null)
         return FpuRegister(fpu.StNumber, state);
     var addr = op as AddressOperand;
     if (addr != null)
         return addr.Address;
     throw new NotImplementedException(string.Format("Operand {0}", op));
 }
开发者ID:gh0std4ncer,项目名称:reko,代码行数:19,代码来源:OperandRewriter.cs

示例12: CompareOperands

		private int CompareOperands(MachineOperand opA, MachineOperand opB)
		{
			if (!opA.GetType().IsAssignableFrom(opB.GetType()))
				return -1;

			RegisterOperand regOpA = opA as RegisterOperand;
			if (regOpA != null)
			{
				RegisterOperand regOpB = (RegisterOperand) opB;
				return (int) regOpB.Register.Number - (int) regOpA.Register.Number;
			}
			ImmediateOperand immOpA = opA as ImmediateOperand;
			if (immOpA != null)
			{
				ImmediateOperand immOpB = (ImmediateOperand) opB;
				return 0;			// disregard immediate values.
			}
			throw new NotImplementedException("NYI");
		}
开发者ID:melbcat,项目名称:reko,代码行数:19,代码来源:IntelInstructionComparer.cs

示例13: CompareOperands

        public bool CompareOperands(MachineOperand opA, MachineOperand opB)
        {
            if (opA.GetType() != opB.GetType())
                return false;

            RegisterOperand regOpA = opA as RegisterOperand;
            if (regOpA != null)
            {
                RegisterOperand regOpB = (RegisterOperand) opB;
                return NormalizeRegisters || regOpA.Register == regOpB.Register;
            }
            ImmediateOperand immOpA = opA as ImmediateOperand;
            if (immOpA != null)
            {
                var immOpB = (ImmediateOperand) opB;
                return NormalizeConstants || immOpA.Value.Equals(immOpB.Value);			// disregard immediate values.
            }
            var addrOpA = opA as AddressOperand;
            if (addrOpA != null)
            {
                var addrOpB = (AddressOperand)opB;
                return NormalizeConstants || addrOpA.Address == addrOpB.Address;
            }
            var memOpA = opA as MemoryOperand;
            if (memOpA != null)
            {
                var memOpB = (MemoryOperand)opB;
                if (!base.CompareRegisters(memOpA.Base, memOpB.Base))
                    return false;
                if (!base.CompareRegisters(memOpA.Index, memOpB.Index))
                    return false;
                if (memOpA.Scale != memOpB.Scale)
                    return false;
                return base.CompareValues(memOpA.Offset, memOpB.Offset);
            }
            throw new NotImplementedException("NYI");
        }
开发者ID:nemerle,项目名称:reko,代码行数:37,代码来源:X86InstructionComparer.cs

示例14: GetEffectiveAddress

 public Expression GetEffectiveAddress(MachineOperand op)
 {
     var mem = op as MemoryOperand;
     if (mem != null)
     {
         if (mem.Base == null)
         {
             return mem.Offset;
         }
         else if (mem.Base == Registers.pc)
         {
             return di.Address + mem.Offset.ToInt32();
         }
         else if (mem.Offset == null)
         {
             return frame.EnsureRegister(mem.Base);
         }
         else {
             return emitter.IAdd(
                 frame.EnsureRegister(mem.Base),
                 Constant.Int32(mem.Offset.ToInt32()));
         }
     }
     var addrOp = di.op1 as AddressOperand;
     if (addrOp != null)
     {
         return addrOp.Address;
     }
     var indIdx = di.op1 as IndirectIndexedOperand;
     if (indIdx != null)
     {
         var a = frame.EnsureRegister(indIdx.ARegister);
         var x = frame.EnsureRegister(indIdx.XRegister);
         return emitter.IAdd(a, x);        //$REVIEW: woefully incomplete...
     }
     throw new NotImplementedException(string.Format("{0} ({1})", op, op.GetType().Name));
 }
开发者ID:nemerle,项目名称:reko,代码行数:37,代码来源:Rewriter.Alu.cs

示例15: Lea

 public void Lea(MachineOperand ea, RegisterOperand aReg)
 {
     Emit(0x41C0 | Ea(ea, 0) | AReg(aReg) << 9);
 }
开发者ID:gitter-badger,项目名称:reko,代码行数:4,代码来源:M68kAssembler.cs


注:本文中的Reko.Core.Machine.MachineOperand类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。