aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ARMeilleure/CodeGen/Optimizations/ConstantFolding.cs2
-rw-r--r--ARMeilleure/CodeGen/X86/Assembler.cs2
-rw-r--r--ARMeilleure/CodeGen/X86/X86Optimizer.cs4
-rw-r--r--ARMeilleure/IntermediateRepresentation/Operand.cs19
-rw-r--r--ARMeilleure/IntermediateRepresentation/OperandHelper.cs4
-rw-r--r--ARMeilleure/Translation/PTC/Ptc.cs2
6 files changed, 19 insertions, 14 deletions
diff --git a/ARMeilleure/CodeGen/Optimizations/ConstantFolding.cs b/ARMeilleure/CodeGen/Optimizations/ConstantFolding.cs
index eff53217..790fd53d 100644
--- a/ARMeilleure/CodeGen/Optimizations/ConstantFolding.cs
+++ b/ARMeilleure/CodeGen/Optimizations/ConstantFolding.cs
@@ -218,7 +218,7 @@ namespace ARMeilleure.CodeGen.Optimizations
{
Operand srcOp = operation.GetSource(index);
- if (srcOp.Kind != OperandKind.Constant || srcOp.DisableCF)
+ if (srcOp.Kind != OperandKind.Constant || srcOp.Relocatable)
{
return false;
}
diff --git a/ARMeilleure/CodeGen/X86/Assembler.cs b/ARMeilleure/CodeGen/X86/Assembler.cs
index 99df3cb5..62ca05b2 100644
--- a/ARMeilleure/CodeGen/X86/Assembler.cs
+++ b/ARMeilleure/CodeGen/X86/Assembler.cs
@@ -914,7 +914,7 @@ namespace ARMeilleure.CodeGen.X86
WriteByte((byte)imm);
}
- else if (IsImm32(imm, type) && info.OpRMImm32 != BadOp)
+ else if (!source.Relocatable && IsImm32(imm, type) && info.OpRMImm32 != BadOp)
{
WriteOpCode(dest, null, null, type, info.Flags, info.OpRMImm32);
diff --git a/ARMeilleure/CodeGen/X86/X86Optimizer.cs b/ARMeilleure/CodeGen/X86/X86Optimizer.cs
index 30fd6c71..643b515f 100644
--- a/ARMeilleure/CodeGen/X86/X86Optimizer.cs
+++ b/ARMeilleure/CodeGen/X86/X86Optimizer.cs
@@ -31,7 +31,7 @@ namespace ARMeilleure.CodeGen.X86
Operand src1 = operation.GetSource(0);
Operand src2 = operation.GetSource(1);
- if (src1.Kind == OperandKind.Constant && CodeGenCommon.IsLongConst(src1))
+ if (src1.Kind == OperandKind.Constant && (src1.Relocatable || CodeGenCommon.IsLongConst(src1)))
{
Operand temp = Local(src1.Type);
@@ -42,7 +42,7 @@ namespace ARMeilleure.CodeGen.X86
operation.SetSource(0, temp);
}
- if (src2.Kind == OperandKind.Constant && CodeGenCommon.IsLongConst(src2))
+ if (src2.Kind == OperandKind.Constant && (src2.Relocatable || CodeGenCommon.IsLongConst(src2)))
{
Operand temp = Local(src2.Type);
diff --git a/ARMeilleure/IntermediateRepresentation/Operand.cs b/ARMeilleure/IntermediateRepresentation/Operand.cs
index 6f6caea7..b8650d5a 100644
--- a/ARMeilleure/IntermediateRepresentation/Operand.cs
+++ b/ARMeilleure/IntermediateRepresentation/Operand.cs
@@ -10,8 +10,8 @@ namespace ARMeilleure.IntermediateRepresentation
public ulong Value { get; private set; }
- public bool DisableCF { get; private set; }
- public int? PtcIndex { 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; }
@@ -28,15 +28,20 @@ namespace ARMeilleure.IntermediateRepresentation
Type = type;
}
- public Operand With(OperandKind kind, OperandType type = OperandType.None, ulong value = 0, bool disableCF = false, int? index = null)
+ public Operand With(
+ OperandKind kind,
+ OperandType type = OperandType.None,
+ ulong value = 0,
+ bool relocatable = false,
+ int? index = null)
{
Kind = kind;
Type = type;
Value = value;
- DisableCF = disableCF;
- PtcIndex = index;
+ Relocatable = relocatable;
+ PtcIndex = index;
Assignments.Clear();
Uses.Clear();
@@ -54,9 +59,9 @@ namespace ARMeilleure.IntermediateRepresentation
return With(OperandKind.Constant, OperandType.I32, value);
}
- public Operand With(long value, bool disableCF = false, int? index = null)
+ public Operand With(long value, bool relocatable = false, int? index = null)
{
- return With(OperandKind.Constant, OperandType.I64, (ulong)value, disableCF, index);
+ return With(OperandKind.Constant, OperandType.I64, (ulong)value, relocatable, index);
}
public Operand With(ulong value)
diff --git a/ARMeilleure/IntermediateRepresentation/OperandHelper.cs b/ARMeilleure/IntermediateRepresentation/OperandHelper.cs
index 10040977..c97023fc 100644
--- a/ARMeilleure/IntermediateRepresentation/OperandHelper.cs
+++ b/ARMeilleure/IntermediateRepresentation/OperandHelper.cs
@@ -34,9 +34,9 @@ namespace ARMeilleure.IntermediateRepresentation
return Operand().With(value);
}
- public static Operand Const(long value, bool disableCF = false, int? index = null)
+ public static Operand Const(long value, bool relocatable = false, int? index = null)
{
- return Operand().With(value, disableCF, index);
+ return Operand().With(value, relocatable, index);
}
public static Operand Const(ulong value)
diff --git a/ARMeilleure/Translation/PTC/Ptc.cs b/ARMeilleure/Translation/PTC/Ptc.cs
index 2b4059ec..c7151603 100644
--- a/ARMeilleure/Translation/PTC/Ptc.cs
+++ b/ARMeilleure/Translation/PTC/Ptc.cs
@@ -20,7 +20,7 @@ namespace ARMeilleure.Translation.PTC
{
private const string HeaderMagic = "PTChd";
- private const int InternalVersion = 2; //! To be incremented manually for each change to the ARMeilleure project.
+ private const int InternalVersion = 3; //! To be incremented manually for each change to the ARMeilleure project.
private const string BaseDir = "Ryujinx";