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);
if (srcOp.Kind != OperandKind.Constant || srcOp.DisableCF)
if (srcOp.Kind != OperandKind.Constant || srcOp.Relocatable)
{
return false;
}

View File

@ -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);

View File

@ -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);

View File

@ -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)

View File

@ -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)

View File

@ -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";