Operation.cs 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. namespace ARMeilleure.IntermediateRepresentation
  2. {
  3. class Operation : Node
  4. {
  5. public Instruction Instruction { get; private set; }
  6. public Operation(
  7. Instruction instruction,
  8. Operand destination,
  9. params Operand[] sources) : base(destination, sources.Length)
  10. {
  11. Instruction = instruction;
  12. for (int index = 0; index < sources.Length; index++)
  13. {
  14. SetSource(index, sources[index]);
  15. }
  16. }
  17. public Operation(
  18. Instruction instruction,
  19. Operand[] destinations,
  20. Operand[] sources) : base(destinations, sources.Length)
  21. {
  22. Instruction = instruction;
  23. for (int index = 0; index < sources.Length; index++)
  24. {
  25. SetSource(index, sources[index]);
  26. }
  27. }
  28. public void TurnIntoCopy(Operand source)
  29. {
  30. Instruction = Instruction.Copy;
  31. SetSources(new Operand[] { source });
  32. }
  33. }
  34. }