本文整理汇总了C#中Op.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Op.ToString方法的具体用法?C# Op.ToString怎么用?C# Op.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Op
的用法示例。
在下文中一共展示了Op.ToString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: genComp
/// <summary>
/// generate a comparison header for jump
/// (futur improvement: use branch when possible)
/// </summary>
/// <param name="op"></param>
private void genComp(Op op)
{
int temp1, temp2;
//we take the last two operands pushed on the stack
temp1 = operationStack[operationStack.Count - 2];
temp2 = operationStack[operationStack.Count - 1];
if (conditionDef)
{
int temp = manager.getNextEmptyRegister(8, 15);
outputFile.Add("LI $" + temp + " LABEL " + currentCondition.ifStart + ";");
outputFile.Add("COMP $" + temp1 + " $" + temp2 + ";");
outputFile.Add("J" + op.ToString() + " $" + temp + ";");
int Temp = manager.getNextEmptyRegister(8, 15);
manager.RegisterFile[Temp] = "ELSE";
if (hasElse)
{ outputFile.Add("LI $" + Temp + " LABEL " + currentCondition.elseStart + ";"); }
else
{ outputFile.Add("LI $" + Temp + " LABEL " + currentCondition.ifEnd + ";"); }
outputFile.Add("JUMP $" + Temp + ";");
manager.RegisterFile[Temp] = "";
}
else if (whileDef || forDef)
{
int temp = manager.getNextEmptyRegister(8, 15);
outputFile.Add("LI $" + temp + " LABEL " + currentLoop.Start + ";");
outputFile.Add("COMP $" + temp1 + " $" + temp2 + ";");
outputFile.Add("J" + op.ToString() + " $" + temp + ";");
int Temp = manager.getNextEmptyRegister(8, 15);
manager.RegisterFile[Temp] = "LOOPEND";
outputFile.Add("LI $" + Temp + " LABEL " + currentLoop.End + ";");
outputFile.Add("JUMP $" + Temp + ";");
manager.RegisterFile[Temp] = "";
}
//common dispose part
manager.RegisterFile[operationStack[operationStack.Count - 1]] = "";
manager.RegisterFile[operationStack[operationStack.Count - 2]] = "";
operationStack.Clear();
}
示例2: GetMnemonic
public static string GetMnemonic(Op op)
{
return op.ToString().ToLower().Replace("__", "/");
}