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


C# Instruction类代码示例

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


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

示例1: CompiledInstruction

 public CompiledInstruction(Instruction Instr, int MemSize, int InputSize)
 {
     InAdrA = ConvertMemAdrToInt(Instr.InAdrA, MemSize, InputSize);
     HyAdrB = ConvertMemAdrToInt(Instr.HyAdrB, MemSize, InputSize);
     OutAdr = ConvertMemAdrToInt(Instr.OutAdr, MemSize, InputSize);
     Instuct = Instr.Instuct;
 }
开发者ID:aidded,项目名称:ClassLibary5194,代码行数:7,代码来源:Instruction.cs

示例2:

        void ICilCompilerAware.ImplementInCil(CompilerState state, Instruction ins)
        {
            var argc = ins.Arguments;

            if (argc < 2)
            {
                state.EmitLoadNullAsPValue();
            }
            else
            {
                //pop excessive arguments
                for (var i = 2; i < argc; i++)
                    state.Il.Emit(OpCodes.Pop);

                //make pvkvp
                state.Il.Emit(OpCodes.Newobj, Compiler.Cil.Compiler.NewPValueKeyValuePair);

                //save pvkvp in temporary variable
                state.EmitStoreTemp(0);

                //PType.Object.CreatePValue(temp)
                state.Il.EmitCall(OpCodes.Call, Compiler.Cil.Compiler.GetObjectPTypeSelector, null);
                state.EmitLoadTemp(0);
                state.Il.EmitCall(OpCodes.Call, Compiler.Cil.Compiler.CreatePValueAsObject, null);
            }
        }
开发者ID:SealedSun,项目名称:prx,代码行数:26,代码来源:Pair.cs

示例3: typeof

 void ICilCompilerAware.ImplementInCil(CompilerState state, Instruction ins)
 {
     state.EmitIgnoreArguments(ins.Arguments);
     state.Il.Emit(OpCodes.Newobj, _channelCtor);
     PType.PrexoniteObjectTypeProxy._ImplementInCil(state, typeof (Channel));
     state.Il.Emit(OpCodes.Newobj, _newPValue);
 }
开发者ID:SealedSun,项目名称:prx,代码行数:7,代码来源:Chan.cs

示例4: IsSimpleConstant

 /// <summary>
 /// Run a simple check on a list of instructions to check if it evaluates to a constant
 /// value.
 /// </summary>
 /// <param name="expression"></param>
 /// <returns></returns>
 public static bool IsSimpleConstant(Instruction[] expression)
 {
     // First pass, check basic instructions.
     foreach (Instruction instruction in expression)
     {
         // These are "constant" instructions which can be evaluated without any
         // context (no locals, globals, instance, or system required).
         if (
             !(instruction is LoadConstant) &&
             !(instruction is CallFunction) &&
             !(instruction is BinaryAdd) &&
             !(instruction is BinaryDiv) &&
             !(instruction is BinaryMod) &&
             !(instruction is BinaryMul) &&
             !(instruction is BinaryPow) &&
             !(instruction is BinarySub) &&
             !(instruction is UnaryAbs) &&
             !(instruction is UnaryNeg)
             )
             return false;
     }
     // Second pass, check for pure functions.
     for (int i = 0; i < expression.Length; i++)
     {
         if (expression[i] is CallFunction)
         {
             var previous = ((LoadConstant)expression[i - 1]).constant;
             if (!((DmlFunction)previous.Value).IsPure)
                 return false;
         }
     }
     return true;
 }
开发者ID:roflwaffl,项目名称:Phosphaze,代码行数:39,代码来源:DmlParser.cs

示例5: Instruction

 public Instruction(Instruction i)
 {
     InAdrA = i.InAdrA;
     HyAdrB = i.HyAdrB;
     OutAdr = i.OutAdr;
     Instuct = i.Instuct;
 }
开发者ID:aidded,项目名称:ClassLibary5194,代码行数:7,代码来源:Instruction.cs

示例6: Execute

        public void Execute(Machine machine, Stack<object> stack, Scope scope, Instruction instr)
        {
            int length = (int)machine.TakeByte();
            string name = machine.TakeBytes(length * sizeof(char)).AsString();

            scope.GetFunction(name).Call(machine);
        }
开发者ID:Spanfile,项目名称:Englang,代码行数:7,代码来源:CallInstructlet.cs

示例7: Execute

        public void Execute(Machine machine, Stack<object> stack, Scope scope, Instruction instr)
        {
            Instruction type = (Instruction)machine.TakeByte();

            switch (type)
            {
                default:
                    throw new VMException("Unhandled literal type: {0}", type.ToString());

                case Instruction.TypeNumeral:
                    byte[] numBytes = machine.TakeBytes(8);
                    stack.Push(numBytes.AsDouble());
                    break;

                case Instruction.TypeString:
                    double length = machine.TakeBytes(8).AsDouble();
                    string text = machine.TakeBytes((int)length * sizeof(char)).AsString();
                    stack.Push(text);
                    break;

                case Instruction.TypeBoolean:
                    stack.Push(Convert.ToBoolean(machine.TakeByte()));
                    break;
            }
        }
开发者ID:Spanfile,项目名称:Englang,代码行数:25,代码来源:LiteralInstructlet.cs

示例8: OpCodeCost

        private int OpCodeCost(Instruction instruction)
        {
            switch (instruction.instruction)
            {
                case 0x0:
                    switch (instruction.a)
                    {
                        case 0x01:
                            return 3;
                    }
                    return 0;
                case 0x01:
                    return 1;

                case 0x06:
                case 0x07:
                case 0x08:
                    return 3;
                case 0x09:
                case 0x0a:
                case 0x0b:
                    return 1;

                default:
                    return 2;
            }
        }
开发者ID:FredrikL,项目名称:DCPU16,代码行数:27,代码来源:CostCalculator.cs

示例9: ValueCost

        private int ValueCost(Instruction instruction)
        {
            if (instruction.instruction == 0x0) // extended
                return ValueCost(instruction.b);

            return ValueCost(instruction.a) + ValueCost(instruction.b);
        }
开发者ID:FredrikL,项目名称:DCPU16,代码行数:7,代码来源:CostCalculator.cs

示例10: instr

 public static void instr(Instruction instr, TargetRegister op1, byte op2)
 {
     BuildInstruction (instr);
     BuildLengthPrefix (LengthPrefix.f_reg | LengthPrefix.s_8);
     BuildRegister (op1);
     bitstream.Write (op2 & 0xFF);
 }
开发者ID:SplittyDev,项目名称:Imardin2,代码行数:7,代码来源:Emit.cs

示例11: CreateBinaryInstruction

        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;
        }
开发者ID:harnold,项目名称:cobe,代码行数:29,代码来源:Utilities.cs

示例12: Disassemble

        public Result Disassemble(uint PC, Instruction Instruction)
        {
            if (ProcessCallback == null)
            {
                var Dictionary = new Dictionary<InstructionInfo, int>();

                InstructionLookup = InstructionTable.ALL.ToArray();
                for (int n = 0; n < InstructionLookup.Length; n++) Dictionary[InstructionLookup[n]] = n;

                ProcessCallback = EmitLookupGenerator.GenerateSwitch<Func<uint, MipsDisassembler, Result>>("", InstructionTable.ALL, (InstructionInfo) =>
                {
                    return ast.Return(ast.CallStatic(
                        (Func<uint, int, Result>)MipsDisassembler._InternalHandle,
                        ast.Argument<uint>(0),
                        (InstructionInfo != null) ? Dictionary[InstructionInfo] : -1
                    ));
                });
            }

            var Result = ProcessCallback(Instruction, this);
            if (Result.InstructionInfo == null)
            {
                Console.Error.WriteLine(String.Format("Instruction at 0x{0:X8} with data 0x{1:X8} didn't generate a value", PC, (uint)Instruction));
                Result.InstructionInfo = InstructionTable.Unknown;
            }
            Result.InstructionPC = PC;
            return Result;
        }
开发者ID:soywiz,项目名称:cspspemu,代码行数:28,代码来源:MipsDisassembler.cs

示例13: MakeLastStatementReturn

    public void MakeLastStatementReturn()
    {
        instructions = Method.Body.Instructions;
        FixHangingHandlerEnd();

        sealBranchesNop = Instruction.Create(OpCodes.Nop);
           instructions.Add(sealBranchesNop);

        NopBeforeReturn = Instruction.Create(OpCodes.Nop);

        foreach (var instruction in instructions)
        {
            var operand = instruction.Operand as Instruction;
            if (operand != null)
            {
                if (operand.OpCode == OpCodes.Ret)
                {
                    instruction.Operand = sealBranchesNop;
                }
            }
        }

        if (Method.MethodReturnType.ReturnType.Name == "Void")
        {
            WithNoReturn();
            return;
        }
        WithReturnValue();
    }
开发者ID:roberocity,项目名称:MethodTimer,代码行数:29,代码来源:ReturnFixer.cs

示例14: Disassemble

        public Result Disassemble(uint PC, Instruction Instruction)
        {
            if (ProcessCallback == null)
            {
                InstructionDictionary = InstructionTable.ALL.ToDictionary(Item => Item.Name);
                ProcessCallback = EmitLookupGenerator.GenerateSwitch<Func<uint, MipsDisassembler, Result>>(InstructionTable.ALL, (SafeILGenerator, InstructionInfo) =>
                {
                    //SafeILGenerator.LoadArgument<MipsDisassembler>(1);
                    SafeILGenerator.LoadArgument<uint>(0);
                    if (InstructionInfo == null)
                    {
                        SafeILGenerator.Push("Unknown");
                    }
                    else
                    {
                        SafeILGenerator.Push(InstructionInfo.Name);
                    }
                    SafeILGenerator.Call((Func<uint, String, Result>)MipsDisassembler._InternalHandle);
                });
            }

            var Result = ProcessCallback(Instruction, this);
            Result.InstructionPC = PC;
            return Result;
        }
开发者ID:e-COS,项目名称:cspspemu,代码行数:25,代码来源:MipsDisassembler.cs

示例15: Execute

        public void Execute(Machine machine, Stack<object> stack, Scope scope, Instruction instr)
        {
            int length;
            string name;

            switch (instr)
            {
                default:
                    throw new VMException("Something just went horribly wrong. Variable instructlet is not supposed to receive {0}", instr.ToString());

                case Instruction.SetVar:
                    length = (int)machine.TakeByte();
                    name = machine.TakeBytes(length).AsString();

                    machine.ExecuteNextInstructlet();
                    scope.SetVariable(name, stack.Pop());
                    break;

                case Instruction.GetVar:
                    length = (int)machine.TakeByte();
                    name = machine.TakeBytes((int)length).AsString();

                    stack.Push(scope.GetVariable(name));
                    break;
            }
        }
开发者ID:Spanfile,项目名称:Englang,代码行数:26,代码来源:VariableInstructlet.cs


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