本文整理汇总了C#中Reko.UnitTests.Mocks.ProcedureBuilder.Shl方法的典型用法代码示例。如果您正苦于以下问题:C# ProcedureBuilder.Shl方法的具体用法?C# ProcedureBuilder.Shl怎么用?C# ProcedureBuilder.Shl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Reko.UnitTests.Mocks.ProcedureBuilder
的用法示例。
在下文中一共展示了ProcedureBuilder.Shl方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VpMulBy6
public void VpMulBy6()
{
var m = new ProcedureBuilder();
var r1 = m.Reg16("r1", 1);
var r2 = m.Reg16("r1", 2);
m.Assign(r2, r1); // r1
m.Assign(r1, m.Shl(r1, 1)); // r1 * 2
m.Assign(r1, m.IAdd(r1, r2)); // r1 * 3
m.Assign(r1, m.Shl(r1, 1)); // r1 * 6
var ssa = RunTest(m);
var sExp =
#region Expected
@"r1:r1
def: def r1
uses: r1_1 = r1
r1_2 = r1 << 0x01
r1_3 = r1 * 0x0003
r1_4 = r1 * 0x0006
r1_1: orig: r1
def: r1_1 = r1
r1_2: orig: r1
def: r1_2 = r1 << 0x01
r1_3: orig: r1
def: r1_3 = r1 * 0x0003
r1_4: orig: r1
def: r1_4 = r1 * 0x0006
// ProcedureBuilder
// Return size: 0
void ProcedureBuilder()
ProcedureBuilder_entry:
def r1
// succ: l1
l1:
r1_1 = r1
r1_2 = r1 << 0x01
r1_3 = r1 * 0x0003
r1_4 = r1 * 0x0006
ProcedureBuilder_exit:
";
#endregion
AssertStringsEqual(sExp, ssa);
}
示例2: VpShiftShift
public void VpShiftShift()
{
Identifier id = Reg32("id");
ProcedureBuilder m = new ProcedureBuilder();
Expression e = m.Shl(m.Shl(id, 1), 4);
var vp = new ExpressionSimplifier(new SsaEvaluationContext(arch, ssaIds));
e = e.Accept(vp);
Assert.AreEqual("id << 0x05", e.ToString());
}
示例3: VpShiftSum
public void VpShiftSum()
{
ProcedureBuilder m = new ProcedureBuilder();
Expression e = m.Shl(1, m.ISub(Constant.Byte(32), 1));
var vp = new ExpressionSimplifier(new SsaEvaluationContext(arch, ssaIds));
e = e.Accept(vp);
Assert.AreEqual("0x80000000", e.ToString());
}
示例4: 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");
}