aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics/Shader/IntermediateRepresentation/PhiNode.cs
diff options
context:
space:
mode:
authorgdk <gab.dark.100@gmail.com>2019-10-13 03:02:07 -0300
committerThog <thog@protonmail.com>2020-01-09 02:13:00 +0100
commit1876b346fea647e8284a66bb6d62c38801035cff (patch)
tree6eeff094298cda84d1613dc5ec0691e51d7b35f1 /Ryujinx.Graphics/Shader/IntermediateRepresentation/PhiNode.cs
parentf617fb542a0e3d36012d77a4b5acbde7b08902f2 (diff)
Initial work
Diffstat (limited to 'Ryujinx.Graphics/Shader/IntermediateRepresentation/PhiNode.cs')
-rw-r--r--Ryujinx.Graphics/Shader/IntermediateRepresentation/PhiNode.cs94
1 files changed, 0 insertions, 94 deletions
diff --git a/Ryujinx.Graphics/Shader/IntermediateRepresentation/PhiNode.cs b/Ryujinx.Graphics/Shader/IntermediateRepresentation/PhiNode.cs
deleted file mode 100644
index 13ff41bd..00000000
--- a/Ryujinx.Graphics/Shader/IntermediateRepresentation/PhiNode.cs
+++ /dev/null
@@ -1,94 +0,0 @@
-using System.Collections.Generic;
-
-namespace Ryujinx.Graphics.Shader.IntermediateRepresentation
-{
- class PhiNode : INode
- {
- private Operand _dest;
-
- public Operand Dest
- {
- get => _dest;
- set => _dest = AssignDest(value);
- }
-
- private HashSet<BasicBlock> _blocks;
-
- private class PhiSource
- {
- public BasicBlock Block { get; }
- public Operand Operand { get; set; }
-
- public PhiSource(BasicBlock block, Operand operand)
- {
- Block = block;
- Operand = operand;
- }
- }
-
- private List<PhiSource> _sources;
-
- public int SourcesCount => _sources.Count;
-
- public PhiNode(Operand dest)
- {
- _blocks = new HashSet<BasicBlock>();
-
- _sources = new List<PhiSource>();
-
- dest.AsgOp = this;
-
- Dest = dest;
- }
-
- private Operand AssignDest(Operand dest)
- {
- if (dest != null && dest.Type == OperandType.LocalVariable)
- {
- dest.AsgOp = this;
- }
-
- return dest;
- }
-
- public void AddSource(BasicBlock block, Operand operand)
- {
- if (_blocks.Add(block))
- {
- if (operand.Type == OperandType.LocalVariable)
- {
- operand.UseOps.Add(this);
- }
-
- _sources.Add(new PhiSource(block, operand));
- }
- }
-
- public Operand GetSource(int index)
- {
- return _sources[index].Operand;
- }
-
- public BasicBlock GetBlock(int index)
- {
- return _sources[index].Block;
- }
-
- public void SetSource(int index, Operand source)
- {
- Operand oldSrc = _sources[index].Operand;
-
- if (oldSrc != null && oldSrc.Type == OperandType.LocalVariable)
- {
- oldSrc.UseOps.Remove(this);
- }
-
- if (source.Type == OperandType.LocalVariable)
- {
- source.UseOps.Add(this);
- }
-
- _sources[index].Operand = source;
- }
- }
-} \ No newline at end of file