aboutsummaryrefslogtreecommitdiff
path: root/ARMeilleure/IntermediateRepresentation/Operand.cs
diff options
context:
space:
mode:
Diffstat (limited to 'ARMeilleure/IntermediateRepresentation/Operand.cs')
-rw-r--r--ARMeilleure/IntermediateRepresentation/Operand.cs22
1 files changed, 13 insertions, 9 deletions
diff --git a/ARMeilleure/IntermediateRepresentation/Operand.cs b/ARMeilleure/IntermediateRepresentation/Operand.cs
index ec023939..64df416f 100644
--- a/ARMeilleure/IntermediateRepresentation/Operand.cs
+++ b/ARMeilleure/IntermediateRepresentation/Operand.cs
@@ -1,3 +1,4 @@
+using ARMeilleure.Translation.PTC;
using System;
using System.Collections.Generic;
using System.Diagnostics;
@@ -12,12 +13,12 @@ namespace ARMeilleure.IntermediateRepresentation
public ulong Value { get; private set; }
- public bool Relocatable { get; private set; }
- public int? PtcIndex { get; private set; }
-
public List<Node> Assignments { get; }
public List<Node> Uses { get; }
+ public Symbol Symbol { get; private set; }
+ public bool Relocatable => Symbol.Type != SymbolType.None;
+
public Operand()
{
Assignments = new List<Node>();
@@ -34,16 +35,14 @@ namespace ARMeilleure.IntermediateRepresentation
OperandKind kind,
OperandType type = OperandType.None,
ulong value = 0,
- bool relocatable = false,
- int? index = null)
+ Symbol symbol = default)
{
Kind = kind;
Type = type;
Value = value;
- Relocatable = relocatable;
- PtcIndex = index;
+ Symbol = symbol;
Assignments.Clear();
Uses.Clear();
@@ -61,9 +60,14 @@ namespace ARMeilleure.IntermediateRepresentation
return With(OperandKind.Constant, OperandType.I32, value);
}
- public Operand With(long value, bool relocatable = false, int? index = null)
+ public Operand With(long value)
+ {
+ return With(OperandKind.Constant, OperandType.I64, (ulong)value);
+ }
+
+ public Operand With(long value, Symbol symbol)
{
- return With(OperandKind.Constant, OperandType.I64, (ulong)value, relocatable, index);
+ return With(OperandKind.Constant, OperandType.I64, (ulong)value, symbol);
}
public Operand With(ulong value)