aboutsummaryrefslogtreecommitdiff
path: root/ARMeilleure/IntermediateRepresentation
diff options
context:
space:
mode:
Diffstat (limited to 'ARMeilleure/IntermediateRepresentation')
-rw-r--r--ARMeilleure/IntermediateRepresentation/Operand.cs22
-rw-r--r--ARMeilleure/IntermediateRepresentation/OperandHelper.cs14
2 files changed, 23 insertions, 13 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)
diff --git a/ARMeilleure/IntermediateRepresentation/OperandHelper.cs b/ARMeilleure/IntermediateRepresentation/OperandHelper.cs
index 1b748f6a..420555a7 100644
--- a/ARMeilleure/IntermediateRepresentation/OperandHelper.cs
+++ b/ARMeilleure/IntermediateRepresentation/OperandHelper.cs
@@ -1,4 +1,5 @@
using ARMeilleure.Common;
+using ARMeilleure.Translation.PTC;
using System.Runtime.CompilerServices;
namespace ARMeilleure.IntermediateRepresentation
@@ -25,9 +26,14 @@ namespace ARMeilleure.IntermediateRepresentation
return Operand().With(value);
}
- public static Operand Const(long value, bool relocatable = false, int? index = null)
+ public static Operand Const(long value)
{
- return Operand().With(value, relocatable, index);
+ return Operand().With(value);
+ }
+
+ public static Operand Const(long value, Symbol symbol)
+ {
+ return Operand().With(value, symbol);
}
public static Operand Const(ulong value)
@@ -35,9 +41,9 @@ namespace ARMeilleure.IntermediateRepresentation
return Operand().With(value);
}
- public static unsafe Operand Const<T>(ref T reference, int? index = null)
+ public static unsafe Operand Const<T>(ref T reference, Symbol symbol = default)
{
- return Operand().With((long)Unsafe.AsPointer(ref reference), index != null, index);
+ return Operand().With((long)Unsafe.AsPointer(ref reference), symbol);
}
public static Operand ConstF(float value)