diff options
| author | FICTURE7 <FICTURE7@gmail.com> | 2021-05-17 03:54:53 +0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-05-17 01:54:53 +0200 |
| commit | c805542b29975b0d9bf3ea324526f62cfe4331bf (patch) | |
| tree | 7c29106997c8f08b9335f7de856518f103e7f42c /ARMeilleure/IntermediateRepresentation/Operand.cs | |
| parent | 212e472c9fac8253456d710e0b071579da330c0a (diff) | |
Allow `LocalVariable` to be assigned more than once (#2288)
* Allow `LocalVariable` to be assigned more than once
This allows us to write flow controls like loops and if-elses with
LocalVariables participating in phi nodes.
* Add `GetLocalNumber` to operand
Diffstat (limited to 'ARMeilleure/IntermediateRepresentation/Operand.cs')
| -rw-r--r-- | ARMeilleure/IntermediateRepresentation/Operand.cs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/ARMeilleure/IntermediateRepresentation/Operand.cs b/ARMeilleure/IntermediateRepresentation/Operand.cs index 7b486c55..ec023939 100644 --- a/ARMeilleure/IntermediateRepresentation/Operand.cs +++ b/ARMeilleure/IntermediateRepresentation/Operand.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Runtime.CompilerServices; namespace ARMeilleure.IntermediateRepresentation @@ -91,6 +92,13 @@ namespace ARMeilleure.IntermediateRepresentation return new Register((int)Value & 0xffffff, (RegisterType)(Value >> 24)); } + public int GetLocalNumber() + { + Debug.Assert(Kind == OperandKind.LocalVariable); + + return (int)Value; + } + public byte AsByte() { return (byte)Value; |
