[sh4] Fix build (broken since r159346).
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 16 Nov 2013 22:28:27 +0000 (22:28 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 16 Nov 2013 22:28:27 +0000 (22:28 +0000)
https://bugs.webkit.org/show_bug.cgi?id=124455

Patch by Julien Brianceau <jbriance@cisco.com> on 2013-11-16
Reviewed by Oliver Hunt.

Fix LLINT implementation for sh4 architecture to handle properly load and store operations with pr register.

* offlineasm/sh4.rb:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@159381 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/offlineasm/sh4.rb

index fdc31b8..8c8fb62 100644 (file)
@@ -1,3 +1,14 @@
+2013-11-16  Julien Brianceau  <jbriance@cisco.com>
+
+        [sh4] Fix build (broken since r159346).
+        https://bugs.webkit.org/show_bug.cgi?id=124455
+
+        Reviewed by Oliver Hunt.
+
+        Fix LLINT implementation for sh4 architecture to handle properly load and store operations with pr register.
+
+        * offlineasm/sh4.rb:
+
 2013-11-15  Alexey Proskuryakov  <ap@apple.com>
 
         Support exporting symmetric keys as JWK
index 8744c26..c2ad842 100644 (file)
@@ -473,6 +473,50 @@ end
 
 
 #
+# Lowering of misplaced special registers for SH4. For example:
+#
+# storep pr, foo
+#
+# becomes:
+#
+# stspr tmp
+# storep tmp, foo
+#
+
+def sh4LowerMisplacedSpecialRegisters(list)
+    newList = []
+    list.each {
+        | node |
+        if node.is_a? Instruction
+            case node.opcode
+            when "loadi", "loadis", "loadp"
+                if node.operands[1].is_a? RegisterID and node.operands[1].sh4Operand == "pr"
+                    tmp = Tmp.new(codeOrigin, :gpr)
+                    newList << Instruction.new(codeOrigin, node.opcode, [node.operands[0], tmp])
+                    newList << Instruction.new(codeOrigin, "ldspr", [tmp])
+                else
+                    newList << node
+                end
+            when "storei", "storep"
+                if node.operands[0].is_a? RegisterID and node.operands[0].sh4Operand == "pr"
+                    tmp = Tmp.new(codeOrigin, :gpr)
+                    newList << Instruction.new(codeOrigin, "stspr", [tmp])
+                    newList << Instruction.new(codeOrigin, node.opcode, [tmp, node.operands[1]])
+                else
+                    newList << node
+                end
+            else
+                newList << node
+            end
+        else
+            newList << node
+        end
+    }
+    newList
+end
+
+
+#
 # Group immediate values outside -128..127 range into constant pools for SH4.
 # These constant pools will be placed behind non-return opcodes jmp and ret, for example:
 #
@@ -680,6 +724,7 @@ class Sequence
         result = riscLowerMalformedImmediates(result, -128..127)
         result = sh4LowerMisplacedLabels(result)
         result = riscLowerMisplacedAddresses(result)
+        result = sh4LowerMisplacedSpecialRegisters(result)
 
         result = assignRegistersToTemporaries(result, :gpr, SH4_TMP_GPRS)
         result = assignRegistersToTemporaries(result, :gpr, SH4_TMP_FPRS)