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


C# ProcedureBuilder.Local32方法代码示例

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


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

示例1: Test1

		public void Test1()
		{
			var m = new ProcedureBuilder();
			var id = m.Local32("id");
			var x = m.Local32("x");
			var stm = m.Assign(x, m.IAdd(m.SMul(id, 4), id));
		}
开发者ID:gitter-badger,项目名称:reko,代码行数:7,代码来源:Add_id_c_id_RuleTest.cs

示例2: Setup

		public void Setup()
		{
			m = new ProcedureBuilder();
			i = m.Local32("i");
			c = m.Int32(16);
			off = m.Int32(42);
			r = m.Local32("r");
			aem = new ArrayExpressionMatcher(PrimitiveType.Pointer32);
		}
开发者ID:gitter-badger,项目名称:reko,代码行数:9,代码来源:ArrayExpressionMatcherTests.cs

示例3: SetUp

		public void SetUp()
		{
			m = new ProcedureBuilder();
			id = m.Local32("id");
			x = m.Local32("x");
			ssaIds = new SsaIdentifierCollection();
			foreach (Identifier i in m.Procedure.Frame.Identifiers)
			{
				ssaIds.Add(i, null, null, false);
			}
		}
开发者ID:gitter-badger,项目名称:reko,代码行数:11,代码来源:Shl_mul_e_RuleTest.cs

示例4: Pdg_PostDominateIfElse

        public void Pdg_PostDominateIfElse()
        {
            ProcedureBuilder m = new ProcedureBuilder();
            m.BranchIf(m.Local32("a"), "then");
            m.Assign(m.Local32("b"), m.Int32(0));
            m.Jump("join");
            m.Label("then");
            m.Assign(m.Local32("c"), m.Int32(0));
            m.Label("join");
            m.Return();

            FindPostDominators(m);
        }
开发者ID:melbcat,项目名称:reko,代码行数:13,代码来源:PostDominatorGraphTests.cs

示例5: 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

示例6: BuildSimpleLoop

        private Procedure BuildSimpleLoop()
        {
            ProcedureBuilder m = new ProcedureBuilder();
            Identifier p = m.Local32("p");
            m.Assign(p, 0);

            m.Label("loop");
            m.BranchIf(m.Eq(p, 0x4000), "done");
            m.Store(m.IAdd(p, 0x3000), m.Int32(0));
            m.Assign(p, m.IAdd(p, 4));
            m.Goto("loop");

            m.Label("done");
            m.Return();
            return m.Procedure;
        }
开发者ID:gitter-badger,项目名称:reko,代码行数:16,代码来源:StrengthReductionTests.cs

示例7: 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

示例8: TrcoDbp

 public void TrcoDbp()
 {
     ProcedureBuilder m = new ProcedureBuilder();
     Identifier a = m.Local32("a");
     Identifier b = m.LocalByte("b");
     var s = m.Assign(a, m.Dpb(a, b, 0));
     coll = CreateCollector();
     s.Accept(eqb);
     s.Accept(coll);
     StringWriter sb = new StringWriter();
     handler.Traits.Write(sb);
     Console.WriteLine(sb);
     string exp =
         "T_1 (in a : word32)" + nl +
         "\ttrait_primitive(word32)" + nl +
         "\ttrait_primitive(word32)" + nl +
         "\ttrait_primitive(word32)" + nl +
         "\ttrait_equal(T_3)" + nl +
         "T_2 (in b : byte)" + nl +
         "\ttrait_primitive(byte)" + nl +
         "T_3 (in DPB(a, b, 0) : word32)" + nl +
         "\ttrait_primitive(word32)" + nl;
     Assert.AreEqual(exp, sb.ToString());
 }
开发者ID:gitter-badger,项目名称:reko,代码行数:24,代码来源:TraitCollectorTests.cs

示例9: TrcoIcall

		public void TrcoIcall()
		{
			ProcedureBuilder m = new ProcedureBuilder();
			Identifier pfn = m.Local32("pfn");
			Expression l = m.Load(PrimitiveType.Word32, pfn);
			CallInstruction icall = new CallInstruction(l, new CallSite(0, 0));

            coll = CreateCollector();
			icall.Accept(eqb);
			icall.Accept(coll);
			StringWriter sw = new StringWriter();
			handler.Traits.Write(sw);
            string exp =
                "T_1 (in pfn : word32)" + nl +
                "\ttrait_primitive(word32)" + nl +
                "\ttrait_mem(T_2, 0)" + nl +
                "T_2 (in Mem0[pfn:word32] : word32)" + nl +
                "\ttrait_primitive((ptr code))" + nl +
                "\ttrait_primitive(word32)" + nl;
            Console.WriteLine(sw.ToString());
			Assert.AreEqual(exp, sw.ToString());
		}
开发者ID:gitter-badger,项目名称:reko,代码行数:22,代码来源:TraitCollectorTests.cs

示例10: TrcoMultiplication

        public void TrcoMultiplication()
        {
            var prog = CreateProgram();
            var m = new ProcedureBuilder();
            var id = m.Local32("id");
            var e = m.IMul(id, id);

            coll = CreateCollector(prog);
            e = e.Accept(en);
            e.Accept(eqb);
            e.Accept(coll);
            Verify(null, "Typing/TrcoMultiplication.txt");
        }
开发者ID:gitter-badger,项目名称:reko,代码行数:13,代码来源:TraitCollectorTests.cs

示例11: TrcoGlobalArray

		public void TrcoGlobalArray()
		{
            Program prog = CreateProgram();
            ProcedureBuilder m = new ProcedureBuilder();
            Identifier i = m.Local32("i");
            Expression ea = m.IAdd(prog.Globals, m.IAdd(m.Shl(i, 2), 0x3000));
            Expression e = m.Load(PrimitiveType.Int32, ea);

            coll = CreateCollector(prog);
			e = e.Accept(en);
			e.Accept(eqb);
			e.Accept(coll);
			Verify(null, "Typing/TrcoGlobalArray.txt");
		}
开发者ID:gitter-badger,项目名称:reko,代码行数:14,代码来源:TraitCollectorTests.cs

示例12: DtbSignedCompare

        public void DtbSignedCompare()
        {
            ProcedureBuilder m = new ProcedureBuilder();
            Identifier p = m.Local32("p");
            Identifier ds = m.Local16("ds");
            ds.DataType = PrimitiveType.SegmentSelector;
            Identifier ds2 = m.Local16("ds2");
            ds.DataType = PrimitiveType.SegmentSelector;
            m.Assign(ds2, ds);
            m.Store(
                m.SegMem(PrimitiveType.Bool, ds, m.Word16(0x5400)),
                m.Lt(m.SegMemW(ds, m.Word16(0x5404)), m.Word16(20)));
            m.Store(m.SegMemW(ds2, m.Word16(0x5404)), m.Word16(0));

            ProgramBuilder prog = new ProgramBuilder();
            prog.Add(m);
            RunTest(prog.BuildProgram(), "Typing/DtbSignedCompare.txt");
        }
开发者ID:melbcat,项目名称:reko,代码行数:18,代码来源:DataTypeBuilderTests.cs

示例13: CreateNoincInitialValue

		public void CreateNoincInitialValue()
		{
			ProcedureBuilder m = new ProcedureBuilder();
			ssaIds = new SsaIdentifierCollection();
			SsaId(new Identifier("id0", PrimitiveType.Word32, new TemporaryStorage("id0", 0, PrimitiveType.Word32)), null, null, false);
			SsaId(new Identifier("id1", PrimitiveType.Word32, new TemporaryStorage("id1", 1, PrimitiveType.Word32)), null, null, false);
			LinearInductionVariableFinder liv = new LinearInductionVariableFinder(null, ssaIds, null);

			liv.Context.InitialValue = Constant.Word32(0);
			Identifier id2 = m.Local32("id_2");
			SsaId(id2, new Statement(0, null, null), null, false);
			Assert.AreEqual(3, ssaIds.Count);

			Identifier id3 = m.Local32("id_3");
			Identifier id4 = m.Local32("id_4");
			liv.Context.PhiStatement = m.Phi(id3, id2, id4);
			liv.Context.PhiIdentifier = id3;
			SsaId(id3, liv.Context.PhiStatement, ((PhiAssignment)liv.Context.PhiStatement.Instruction).Src, false);
			Assert.AreEqual(4, ssaIds.Count);

			Statement use = new Statement(0, null, null);
			ssaIds[id3].Uses.Add(use);

			liv.Context.DeltaValue = m.Int32(1);
            m.Assign(id4, m.IAdd(id3, liv.Context.DeltaValue));
            liv.Context.DeltaStatement = m.Block.Statements.Last;
			ssaIds[id3].Uses.Add(liv.Context.DeltaStatement);

			LinearInductionVariable iv = liv.CreateInductionVariable();
			Assert.AreEqual("(0x00000000 0x00000001 ?)", iv.ToString());

		}
开发者ID:gitter-badger,项目名称:reko,代码行数:32,代码来源:LinearInductionVariableTests.cs


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