Fix PPTC on Windows 7. (#1369)

* Fix PPTC on Windows 7.

* Address gdkchan comment.
This commit is contained in:
LDj3SNuD 2020-07-09 02:45:24 +02:00 committed by GitHub
parent 484eb645ae
commit c050994995
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 19 additions and 14 deletions

View file

@ -218,7 +218,7 @@ namespace ARMeilleure.CodeGen.Optimizations
{ {
Operand srcOp = operation.GetSource(index); Operand srcOp = operation.GetSource(index);
if (srcOp.Kind != OperandKind.Constant || srcOp.DisableCF) if (srcOp.Kind != OperandKind.Constant || srcOp.Relocatable)
{ {
return false; return false;
} }

View file

@ -914,7 +914,7 @@ namespace ARMeilleure.CodeGen.X86
WriteByte((byte)imm); 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); WriteOpCode(dest, null, null, type, info.Flags, info.OpRMImm32);

View file

@ -31,7 +31,7 @@ namespace ARMeilleure.CodeGen.X86
Operand src1 = operation.GetSource(0); Operand src1 = operation.GetSource(0);
Operand src2 = operation.GetSource(1); 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); Operand temp = Local(src1.Type);
@ -42,7 +42,7 @@ namespace ARMeilleure.CodeGen.X86
operation.SetSource(0, temp); 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); Operand temp = Local(src2.Type);

View file

@ -10,8 +10,8 @@ namespace ARMeilleure.IntermediateRepresentation
public ulong Value { get; private set; } public ulong Value { get; private set; }
public bool DisableCF { get; private set; } public bool Relocatable { get; private set; }
public int? PtcIndex { get; private set; } public int? PtcIndex { get; private set; }
public List<Node> Assignments { get; } public List<Node> Assignments { get; }
public List<Node> Uses { get; } public List<Node> Uses { get; }
@ -28,15 +28,20 @@ namespace ARMeilleure.IntermediateRepresentation
Type = type; 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; Kind = kind;
Type = type; Type = type;
Value = value; Value = value;
DisableCF = disableCF; Relocatable = relocatable;
PtcIndex = index; PtcIndex = index;
Assignments.Clear(); Assignments.Clear();
Uses.Clear(); Uses.Clear();
@ -54,9 +59,9 @@ namespace ARMeilleure.IntermediateRepresentation
return With(OperandKind.Constant, OperandType.I32, value); 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) public Operand With(ulong value)

View file

@ -34,9 +34,9 @@ namespace ARMeilleure.IntermediateRepresentation
return Operand().With(value); 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) public static Operand Const(ulong value)

View file

@ -20,7 +20,7 @@ namespace ARMeilleure.Translation.PTC
{ {
private const string HeaderMagic = "PTChd"; 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"; private const string BaseDir = "Ryujinx";