aboutsummaryrefslogtreecommitdiff
path: root/ARMeilleure/IntermediateRepresentation/Operation.cs
diff options
context:
space:
mode:
Diffstat (limited to 'ARMeilleure/IntermediateRepresentation/Operation.cs')
-rw-r--r--ARMeilleure/IntermediateRepresentation/Operation.cs40
1 files changed, 40 insertions, 0 deletions
diff --git a/ARMeilleure/IntermediateRepresentation/Operation.cs b/ARMeilleure/IntermediateRepresentation/Operation.cs
new file mode 100644
index 00000000..620bf3f6
--- /dev/null
+++ b/ARMeilleure/IntermediateRepresentation/Operation.cs
@@ -0,0 +1,40 @@
+namespace ARMeilleure.IntermediateRepresentation
+{
+ class Operation : Node
+ {
+ public Instruction Instruction { get; private set; }
+
+ public Operation(
+ Instruction instruction,
+ Operand destination,
+ params Operand[] sources) : base(destination, sources.Length)
+ {
+ Instruction = instruction;
+
+ for (int index = 0; index < sources.Length; index++)
+ {
+ SetSource(index, sources[index]);
+ }
+ }
+
+ public Operation(
+ Instruction instruction,
+ Operand[] destinations,
+ Operand[] sources) : base(destinations, sources.Length)
+ {
+ Instruction = instruction;
+
+ for (int index = 0; index < sources.Length; index++)
+ {
+ SetSource(index, sources[index]);
+ }
+ }
+
+ public void TurnIntoCopy(Operand source)
+ {
+ Instruction = Instruction.Copy;
+
+ SetSources(new Operand[] { source });
+ }
+ }
+} \ No newline at end of file