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


C# Core.Block类代码示例

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


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

示例1: CreateBlockFlow

 private BlockFlow CreateBlockFlow(Block block, Frame frame)
 {
     return new BlockFlow(
         block,
         prog.Architecture.CreateRegisterBitset(),
         new SymbolicEvaluationContext(prog.Architecture, frame));
 }
开发者ID:gh0std4ncer,项目名称:reko,代码行数:7,代码来源:TerminationAnalysisTests.cs

示例2: CreateBlockFlow

 private BlockFlow CreateBlockFlow(Block block, Frame frame)
 {
     return new BlockFlow(
         block,
         new HashSet<RegisterStorage>(),
         new SymbolicEvaluationContext(program.Architecture, frame));
 }
开发者ID:gitter-badger,项目名称:reko,代码行数:7,代码来源:TerminationAnalysisTests.cs

示例3: FixInboundEdges

 public void FixInboundEdges(Block blockToPromote)
 {
     // Get all blocks that are from "outside" blocks.
     var inboundBlocks = blockToPromote.Pred.Where(p => p.Procedure != ProcNew).ToArray();
     foreach (var inb in inboundBlocks)
     {
         if (inb.Statements.Count > 0)
         {
             var lastAddress = GetAddressOfLastInstruction(inb);
             var callRetThunkBlock = Scanner.CreateCallRetThunk(lastAddress, inb.Procedure, ProcNew);
             ReplaceSuccessorsWith(inb, blockToPromote, callRetThunkBlock);
             callRetThunkBlock.Pred.Add(inb);
         }
         else
         {
             inb.Statements.Add(0, new CallInstruction(
                             new ProcedureConstant(Program.Platform.PointerType, ProcNew),
                             new CallSite(ProcNew.Signature.ReturnAddressOnStack, 0)));
             Program.CallGraph.AddEdge(inb.Statements.Last, ProcNew);
             inb.Statements.Add(0, new ReturnInstruction());
             inb.Procedure.ControlGraph.AddEdge(inb, inb.Procedure.ExitBlock);
         }
     }
     foreach (var p in inboundBlocks)
     {
         blockToPromote.Pred.Remove(p);
     }
 }
开发者ID:nemerle,项目名称:reko,代码行数:28,代码来源:PromoteBlockWorkItem.cs

示例4: Setup

 public void Setup()
 {
     mr = new MockRepository();
     program = new Program();
     proc = new Procedure("testProc", new Frame(PrimitiveType.Word32));
     block = proc.AddBlock("l00100000");
     trace = new RtlTrace(0x00100000);
     r0 = new Identifier("r0", PrimitiveType.Word32, new RegisterStorage("r0", 0, 0, PrimitiveType.Word32));
     r1 = new Identifier("r1", PrimitiveType.Word32, new RegisterStorage("r1", 1, 0, PrimitiveType.Word32));
     r2 = new Identifier("r2", PrimitiveType.Word32, new RegisterStorage("r2", 2, 0, PrimitiveType.Word32));
     sp = new Identifier("sp", PrimitiveType.Word32, new RegisterStorage("sp", 15, 0, PrimitiveType.Word32));
     grf = proc.Frame.EnsureFlagGroup(Registers.eflags, 3, "SCZ", PrimitiveType.Byte);
     var sc = new ServiceContainer();
     var listener = mr.Stub<DecompilerEventListener>();
     scanner = mr.StrictMock<IScanner>();
     arch = mr.Stub<IProcessorArchitecture>();
     program.Architecture = arch;
     program.SegmentMap = new SegmentMap(
         Address.Ptr32(0x00100000),
         new ImageSegment(
             ".text",
             new MemoryArea(Address.Ptr32(0x00100000), new byte[0x20000]),
             AccessMode.ReadExecute));
     arch.Replay();
     program.Platform = new DefaultPlatform(null, arch);
     arch.BackToRecord();
     arch.Stub(s => s.StackRegister).Return((RegisterStorage)sp.Storage);
     arch.Stub(s => s.PointerType).Return(PrimitiveType.Pointer32);
     scanner.Stub(s => s.Services).Return(sc);
     sc.AddService<DecompilerEventListener>(listener);
 }
开发者ID:relaxar,项目名称:reko,代码行数:31,代码来源:BlockWorkitemTests.cs

示例5: EndsInBranch

		private bool EndsInBranch(Block block)
		{
			if (block.Succ.Count != 2)
				return false;
			if (block.Statements.Count < 1)
				return false;
			return block.Statements.Last.Instruction is Branch;
		}
开发者ID:gitter-badger,项目名称:reko,代码行数:8,代码来源:ControlFlowGraphCleaner.cs

示例6: ReplaceJumpWithBranch

		private void ReplaceJumpWithBranch(Block b1, Block b2)
		{
			Branch br = b2.Statements.Last.Instruction as Branch;
            proc.ControlGraph.RemoveEdge(b1, b2);
			b1.Statements.Add(b2.Statements.Last.LinearAddress, new Branch(br.Condition, b2.Succ[1]));
            proc.ControlGraph.AddEdge(b1, b2.Succ[0]);
            proc.ControlGraph.AddEdge(b1, b2.Succ[1]);
		}
开发者ID:gitter-badger,项目名称:reko,代码行数:8,代码来源:ControlFlowGraphCleaner.cs

示例7: InsertAssignmentNewId

		public Identifier InsertAssignmentNewId(Identifier idOld, Block b, int i)
		{
			Statement stm = new Statement(0, null, b);
            SsaIdentifier sidNew = ssaIds.Add((Identifier)ssaIds[idOld].OriginalIdentifier, stm, idOld, false);
			stm.Instruction = new Assignment(sidNew.Identifier, idOld);
			b.Statements.Insert(i, stm);
			return sidNew.Identifier;
		}
开发者ID:gitter-badger,项目名称:reko,代码行数:8,代码来源:LiveCopyInserter.cs

示例8: InsertPhiStatement

		/// <summary>
		/// Creates a phi statement with slots for each predecessor block, then
		/// inserts the phi statement as the first statement of the block.
		/// </summary>
		/// <param name="b">Block into which the phi statement is inserted</param>
		/// <param name="v">Destination variable for the phi assignment</param>
		/// <returns>The inserted phi Assignment</returns>
		private Instruction InsertPhiStatement(Block b, Identifier v)
		{
			var stm = new Statement(
                0,
				new PhiAssignment(v, b.Pred.Count),
				b);
			b.Statements.Insert(0, stm);
			return stm.Instruction;
		}
开发者ID:melbcat,项目名称:reko,代码行数:16,代码来源:SsaTransform.cs

示例9: Analyze

 public void Analyze(Block b)
 {
     curBlock = b;
     foreach (var stm in b.Statements)
     {
         if (flow[b].TerminatesProcess)
             return;
         stm.Instruction.Accept(this);
     }
 }
开发者ID:relaxar,项目名称:reko,代码行数:10,代码来源:TerminationAnalysis.cs

示例10: IndexOfInsertedCopy

		public int IndexOfInsertedCopy(Block b)
		{
			int i = b.Statements.Count;
			if (i > 0)
			{
				if (b.Statements[i-1].Instruction.IsControlFlow)
					--i;
			}
			return i;
		}
开发者ID:gitter-badger,项目名称:reko,代码行数:10,代码来源:LiveCopyInserter.cs

示例11: IsLiveAtCopyPoint

		public bool IsLiveAtCopyPoint(Identifier id, Block b)
		{
			if (b.Statements.Count == 0)
				return sla.IsLiveOut(id, b);
			int i = IndexOfInsertedCopy(b);
			if (i >= b.Statements.Count)
				return sla.IsLiveOut(id, b.Statements[i-1]);
			else
				return sla.IsLiveIn(id, b.Statements[i]);
		}
开发者ID:gitter-badger,项目名称:reko,代码行数:10,代码来源:LiveCopyInserter.cs

示例12: CreateBlockFlow

 private BlockFlow CreateBlockFlow(Block block, Frame frame)
 {
     var bflow = new BlockFlow(
         block,
         prog.Architecture.CreateRegisterBitset(),
         new SymbolicEvaluationContext(
             prog.Architecture,
             frame));
     flow[block] = bflow;
     return bflow;
 }
开发者ID:gh0std4ncer,项目名称:reko,代码行数:11,代码来源:TrashedRegisterFinderTests.cs

示例13: EarInsertFrameReference

		public void EarInsertFrameReference()
		{
			Procedure proc = new Procedure("foo", new Frame(PrimitiveType.Word32));
			Block b = new Block(proc, "foo_1");
			proc.ControlGraph.AddEdge(proc.EntryBlock, b);
            proc.ControlGraph.AddEdge(b, proc.ExitBlock);
			EscapedAccessRewriter ear = new EscapedAccessRewriter(proc);
			ear.InsertFramePointerAssignment(new Mocks.FakeArchitecture());
			Block x = proc.EntryBlock.Succ[0];
			Assert.AreEqual(1, x.Statements.Count);
			Assert.AreEqual("fp = &foo_frame", x.Statements[0].Instruction.ToString());
		}
开发者ID:gitter-badger,项目名称:reko,代码行数:12,代码来源:EscapedAccessRewriterTests.cs

示例14: Coalesce

		public static void Coalesce(Block block, Block next)
		{
			foreach (Statement stm in next.Statements)
			{
				block.Statements.Add(stm);
			}

			block.Succ = new List<Block>(next.Succ);
			ReplaceJumpsFrom(next, block);
			next.Pred.Clear();
			next.Statements.Clear();
			next.Succ.Clear();
		}
开发者ID:gitter-badger,项目名称:reko,代码行数:13,代码来源:Block.cs

示例15: ReplaceJumpsFrom

		public static bool ReplaceJumpsFrom(Block block, Block next)
		{
			bool change = false;
			foreach (Block s in block.Succ)
			{
				for (int i = 0; i < s.Pred.Count; ++i)
				{
					if (s.Pred[i] == block)
					{
						s.Pred[i] = next;
						change = true;
					}
				}
			}
			return change;
		}
开发者ID:gitter-badger,项目名称:reko,代码行数:16,代码来源:Block.cs


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