本文整理汇总了C#中InstructionNode.Empty方法的典型用法代码示例。如果您正苦于以下问题:C# InstructionNode.Empty方法的具体用法?C# InstructionNode.Empty怎么用?C# InstructionNode.Empty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InstructionNode
的用法示例。
在下文中一共展示了InstructionNode.Empty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Empty
private static void Empty(InstructionNode node)
{
node.Empty();
}
示例2: ProcessInstruction
private void ProcessInstruction(InstructionNode node)
{
if (node.Instruction == IRInstruction.Load)
{
if (node.MosaType != null && TypeLayout.IsCompoundType(node.MosaType))
{
if (node.Result.IsVirtualRegister && !repl.ContainsKey(node.Result))
{
repl[node.Result] = MethodCompiler.StackLayout.AddStackLocal(node.MosaType);
}
node.ReplaceInstructionOnly(IRInstruction.CompoundLoad);
}
}
else if (node.Instruction == IRInstruction.Store)
{
if (node.MosaType != null && TypeLayout.IsCompoundType(node.MosaType))
{
if (node.Operand3.IsVirtualRegister && !repl.ContainsKey(node.Operand3))
{
repl[node.Operand3] = MethodCompiler.StackLayout.AddStackLocal(node.MosaType);
}
node.ReplaceInstructionOnly(IRInstruction.CompoundStore);
}
}
else if (node.Instruction == IRInstruction.Move)
{
if (node.Result.Type.Equals(node.Operand1.Type) && TypeLayout.IsCompoundType(node.Result.Type))
{
var prevNode = node.Previous;
var nextNode = node.Next;
while (prevNode.IsEmpty)
prevNode = prevNode.Previous;
while (nextNode.IsEmpty)
nextNode = nextNode.Next;
// If this move is proceeded by a return then remove this instruction
// It is basically a double up caused by some instructions result in the same instruction output
if (nextNode.Instruction == IRInstruction.Return && nextNode.Operand1 == node.Result)
{
nextNode.Operand1 = node.Operand1;
node.Empty();
return;
}
// If this move is preceded by a compound move (which will turn into a compound move) remove this instruction
// It is basically a double up caused by some instructions result in the same IR output
if ((prevNode.Instruction == IRInstruction.CompoundMove
|| prevNode.Instruction == IRInstruction.CompoundLoad
|| prevNode.Instruction == IRInstruction.Call)
&& prevNode.Result == node.Operand1)
{
if (repl.ContainsKey(prevNode.Result))
repl[node.Result] = repl[prevNode.Result];
prevNode.Result = node.Result;
node.Empty();
return;
}
if (node.Result.IsVirtualRegister && !repl.ContainsKey(node.Result))
{
repl[node.Result] = MethodCompiler.StackLayout.AddStackLocal(node.Result.Type);
}
if (node.Operand1.IsVirtualRegister && !repl.ContainsKey(node.Operand1))
{
repl[node.Operand1] = MethodCompiler.StackLayout.AddStackLocal(node.Operand1.Type);
}
node.ReplaceInstructionOnly(IRInstruction.CompoundMove);
}
else if (node.Result.Type.Equals(node.Operand1.Type) && node.Result.IsStackLocal && node.Operand1.IsStackLocal)
{
node.ReplaceInstructionOnly(IRInstruction.CompoundMove);
}
}
else if (node.Instruction == IRInstruction.Call)
{
if (node.Result != null && TypeLayout.IsCompoundType(node.Result.Type))
{
if (node.Result.IsVirtualRegister && !repl.ContainsKey(node.Result))
{
repl[node.Result] = MethodCompiler.StackLayout.AddStackLocal(node.Result.Type);
}
}
}
}