Forráskód Böngészése

Fix PPTC on Windows 7. (#1369)

* Fix PPTC on Windows 7.

* Address gdkchan comment.
LDj3SNuD 5 éve
szülő
commit
c050994995

+ 1 - 1
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;
                 }

+ 1 - 1
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);
 

+ 2 - 2
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);
 

+ 12 - 7
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)

+ 2 - 2
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)

+ 1 - 1
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";