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


C# ProcedureBuilder.Fn方法代码示例

本文整理汇总了C#中Reko.UnitTests.Mocks.ProcedureBuilder.Fn方法的典型用法代码示例。如果您正苦于以下问题:C# ProcedureBuilder.Fn方法的具体用法?C# ProcedureBuilder.Fn怎么用?C# ProcedureBuilder.Fn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Reko.UnitTests.Mocks.ProcedureBuilder的用法示例。


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

示例1: DeadFnReturn

		public void DeadFnReturn()
		{
			ProcedureBuilder m = new ProcedureBuilder("foo");
			Identifier unused = m.Local32("unused");
			m.Assign(unused, m.Fn("foo", Constant.Word32(1)));
			m.Return();
			RunTest(m, "Analysis/DeadFnReturn.txt");
		}
开发者ID:melbcat,项目名称:reko,代码行数:8,代码来源:DeadCodeTests.cs

示例2: TrcoCallFunctionWithArraySize

        public void TrcoCallFunctionWithArraySize()
        {
            var m = new ProcedureBuilder();
            var sig = new ProcedureSignature(null, 
                m.Frame.EnsureStackArgument(0, PrimitiveType.Word32));
            var ex = new ExternalProcedure("malloc", sig, new ProcedureCharacteristics
            {
                Allocator = true,
                ArraySize = new ArraySizeCharacteristic
                {
                    Argument = "r",
                    Factors = new ArraySizeFactor[] 
                    {
                        new ArraySizeFactor { Constant = "1" }
                    }
                }
            });

            Identifier eax = m.Local32("eax");
            var call = m.Assign(eax, m.Fn(new ProcedureConstant(PrimitiveType.Word32, ex), m.Word32(3)));

            coll = CreateCollector();
            call.Accept(eqb);
            call.Accept(coll);
            StringWriter sw = new StringWriter();
            handler.Traits.Write(sw);
            string sExp =
                "T_1 (in malloc : word32)" + nl +
                "\ttrait_func(T_4 -> T_5)" + nl +
                "T_3 (in dwArg00 : word32)" + nl +
                "\ttrait_primitive(word32)" + nl +
                "T_4 (in 0x00000003 : word32)" + nl +
                "\ttrait_primitive(word32)" + nl +
                "\ttrait_equal(T_3)" + nl +
                "T_5 (in malloc(0x00000003) : word32)" + nl +
                "\ttrait_primitive(word32)"; 
            Console.WriteLine(sw.ToString());
            Assert.AreEqual(sExp, sw.ToString());
        }
开发者ID:gitter-badger,项目名称:reko,代码行数:39,代码来源:TraitCollectorTests.cs

示例3: Pdg_InfiniteLoop

        public void Pdg_InfiniteLoop()
        {
            ProcedureBuilder m = new ProcedureBuilder();
            m.Label("Infinity");
            m.BranchIf(m.Eq(m.LoadW(m.Word16(0x1234)), 0), "hop");
            m.SideEffect(m.Fn("foo"));
            m.Label("hop");
            m.BranchIf(m.Eq(m.LoadW(m.Word16(0x5123)), 1), "Infinity");
            m.SideEffect(m.Fn("bar"));
            m.Jump("Infinity");
            m.Return();

            FindPostDominators(m);
            string sExp = 
                "hop (4): idom ProcedureBuilder_exit (6)" + nl +
                "Infinity (2): idom hop (4)" + nl +
                "l1 (3): idom hop (4)" + nl +
                "l2 (5): idom ProcedureBuilder_exit (6)" + nl +
                "ProcedureBuilder_entry (1): idom Infinity (2)" + nl +
                "ProcedureBuilder_exit (6): idom " + nl;
            Assert.AreEqual(sExp, sw.ToString());
        }
开发者ID:melbcat,项目名称:reko,代码行数:22,代码来源:PostDominatorGraphTests.cs

示例4: SsaOutParamters

        public void SsaOutParamters()
        {
            ProcedureBuilder m = new ProcedureBuilder("foo");
            Identifier r4 = m.Register(4);
            m.Store(m.Int32(0x400), m.Fn("foo", m.Out(PrimitiveType.Pointer32, r4)));
            m.Return();

            RunFileTest(m, "Analysis/SsaOutParameters.txt");
        }
开发者ID:relaxar,项目名称:reko,代码行数:9,代码来源:SsaTests.cs

示例5: Pdg_LoopWithIfElse

        public void Pdg_LoopWithIfElse()
        {
            var m = new ProcedureBuilder();
            var c = m.Declare(PrimitiveType.Word32, "c");
            var f = m.Declare(PrimitiveType.Bool, "f");
            m.Label("loopHead");
            m.BranchIf(m.Eq(c, 0), "done");
            m.BranchIf(f, "then");
            m.Label("else");
            m.SideEffect(m.Fn("CallElse"));
            m.Jump("loopHead");
            m.Label("then");
            m.SideEffect(m.Fn("CallThen"));
            m.Jump("loopHead");
            m.Label("done");
            m.Return();

            FindPostDominators(m);

            string sExp =
                "done (6): idom ProcedureBuilder_exit (7)" + nl +
                "else (4): idom loopHead (2)" + nl +
                "l1 (3): idom loopHead (2)" + nl +
                "loopHead (2): idom done (6)" + nl +
                "ProcedureBuilder_entry (1): idom loopHead (2)" + nl +
                "ProcedureBuilder_exit (7): idom " + nl +
                "then (5): idom loopHead (2)" + nl;
            Assert.AreEqual(sExp, sw.ToString());
        }
开发者ID:melbcat,项目名称:reko,代码行数:29,代码来源:PostDominatorGraphTests.cs


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