本文整理汇总了C#中ILOpCode.IsBranch方法的典型用法代码示例。如果您正苦于以下问题:C# ILOpCode.IsBranch方法的具体用法?C# ILOpCode.IsBranch怎么用?C# ILOpCode.IsBranch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ILOpCode
的用法示例。
在下文中一共展示了ILOpCode.IsBranch方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetBranchCode
public void SetBranchCode(ILOpCode newBranchCode)
{
Debug.Assert(this.BranchCode.IsConditionalBranch() == newBranchCode.IsConditionalBranch());
Debug.Assert(newBranchCode.IsBranch() == (_branchLabel != null));
this.BranchCode = newBranchCode;
}
示例2: EmitCondBranchForSwitch
private void EmitCondBranchForSwitch(ILOpCode branchCode, ConstantValue constant, object targetLabel)
{
Debug.Assert(branchCode.IsBranch());
Debug.Assert(constant != null &&
SwitchConstantValueHelper.IsValidSwitchCaseLabelConstant(constant));
Debug.Assert(targetLabel != null);
// ldloc key
// ldc constant
// branch branchCode targetLabel
_builder.EmitLoad(_key);
_builder.EmitConstantValue(constant);
_builder.EmitBranch(branchCode, targetLabel, GetReverseBranchCode(branchCode));
}
示例3: EmitBranch
internal void EmitBranch(ILOpCode code, object label, ILOpCode revOpCode = ILOpCode.Nop)
{
bool validOpCode = (code == ILOpCode.Nop) || code.IsBranch();
Debug.Assert(validOpCode);
Debug.Assert(revOpCode == ILOpCode.Nop || revOpCode.IsBranch());
Debug.Assert(!code.HasVariableStackBehavior());
_emitState.AdjustStack(code.NetStackBehavior());
bool isConditional = code.IsConditionalBranch();
LabelInfo labelInfo;
if (!_labelInfos.TryGetValue(label, out labelInfo))
{
_labelInfos.Add(label, new LabelInfo(_emitState.CurStack, isConditional));
}
else
{
Debug.Assert(labelInfo.stack == _emitState.CurStack, "branches to same label with different stacks");
}
var block = this.GetCurrentBlock();
// If this is a special block at the end of an exception handler,
// the branch should be to the block itself.
Debug.Assert((code != ILOpCode.Nop) || (block == _labelInfos[label].bb));
block.SetBranch(label, code, revOpCode);
if (code != ILOpCode.Nop)
{
_emitState.InstructionAdded();
}
this.EndBlock();
}