本文整理汇总了C#中CodeGeneration.CGenState.JNZ方法的典型用法代码示例。如果您正苦于以下问题:C# CGenState.JNZ方法的具体用法?C# CGenState.JNZ怎么用?C# CGenState.JNZ使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CodeGeneration.CGenState
的用法示例。
在下文中一共展示了CGenState.JNZ方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CGenValue
public override Reg CGenValue(CGenState state) {
Int32 label_set = state.label_idx;
state.label_idx++;
Int32 label_finish = state.label_idx;
state.label_idx++;
Reg ret = this.Left.CGenValue(state);
switch (ret) {
case Reg.EAX:
state.TESTL(Reg.EAX, Reg.EAX);
state.JNZ(label_set);
break;
case Reg.ST0:
state.FLDZ();
state.FUCOMIP();
state.FSTP(Reg.ST0);
state.JNZ(label_set);
break;
default:
throw new InvalidProgramException();
}
ret = this.Right.CGenValue(state);
switch (ret) {
case Reg.EAX:
state.TESTL(Reg.EAX, Reg.EAX);
state.JNZ(label_set);
break;
case Reg.ST0:
state.FLDZ();
state.FUCOMIP();
state.FSTP(Reg.ST0);
state.JNZ(label_set);
break;
default:
throw new InvalidProgramException();
}
state.MOVL(0, Reg.EAX);
state.JMP(label_finish);
state.CGenLabel(label_set);
state.MOVL(1, Reg.EAX);
state.CGenLabel(label_finish);
return Reg.EAX;
}
示例2: CGenStmt
public override void CGenStmt(Env env, CGenState state) {
Int32 start_label = state.RequestLabel();
Int32 finish_label = state.RequestLabel();
Int32 continue_label = state.RequestLabel();
// start:
state.CGenLabel(start_label);
// Body
state.InLoop(continue_label, finish_label);
this.Body.CGenStmt(env, state);
state.OutLabels();
state.CGenLabel(continue_label);
// test Cond
Reg ret = CGenExprStmt(env, this.Cond, state);
CGenTest(ret, state);
state.JNZ(start_label);
state.CGenLabel(finish_label);
}