mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-07-25 04:07:11 +02:00
Move solution and projects to src
This commit is contained in:
parent
cd124bda58
commit
cee7121058
3466 changed files with 55 additions and 55 deletions
48
src/ARMeilleure/Translation/SsaDeconstruction.cs
Normal file
48
src/ARMeilleure/Translation/SsaDeconstruction.cs
Normal file
|
@ -0,0 +1,48 @@
|
|||
using ARMeilleure.IntermediateRepresentation;
|
||||
|
||||
using static ARMeilleure.IntermediateRepresentation.Operand.Factory;
|
||||
using static ARMeilleure.IntermediateRepresentation.Operation.Factory;
|
||||
|
||||
namespace ARMeilleure.Translation
|
||||
{
|
||||
static partial class Ssa
|
||||
{
|
||||
public static void Deconstruct(ControlFlowGraph cfg)
|
||||
{
|
||||
for (BasicBlock block = cfg.Blocks.First; block != null; block = block.ListNext)
|
||||
{
|
||||
Operation operation = block.Operations.First;
|
||||
|
||||
while (operation != default && operation.Instruction == Instruction.Phi)
|
||||
{
|
||||
Operation nextNode = operation.ListNext;
|
||||
|
||||
Operand local = Local(operation.Destination.Type);
|
||||
|
||||
PhiOperation phi = operation.AsPhi();
|
||||
|
||||
for (int index = 0; index < phi.SourcesCount; index++)
|
||||
{
|
||||
BasicBlock predecessor = phi.GetBlock(cfg, index);
|
||||
|
||||
Operand source = phi.GetSource(index);
|
||||
|
||||
predecessor.Append(Operation(Instruction.Copy, local, source));
|
||||
|
||||
phi.SetSource(index, default);
|
||||
}
|
||||
|
||||
Operation copyOp = Operation(Instruction.Copy, operation.Destination, local);
|
||||
|
||||
block.Operations.AddBefore(operation, copyOp);
|
||||
|
||||
operation.Destination = default;
|
||||
|
||||
block.Operations.Remove(operation);
|
||||
|
||||
operation = nextNode;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue