Fix sh4 LLINT build.

https://bugs.webkit.org/show_bug.cgi?id=125454

Patch by Julien Brianceau <jbriance@cisco.com> on 2013-12-09
Reviewed by Michael Saboff.

In LLINT, sh4 backend implementation didn't handle properly conditional jumps using
a LabelReference instance. This patch fixes it through sh4LowerMisplacedLabels phase.
Also, to avoid the need of a 4th temporary gpr, this phase is triggered later in
getModifiedListSH4.

* offlineasm/sh4.rb:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160315 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 0eddb455
2013-12-09 Julien Brianceau <jbriance@cisco.com>
Fix sh4 LLINT build.
https://bugs.webkit.org/show_bug.cgi?id=125454
Reviewed by Michael Saboff.
In LLINT, sh4 backend implementation didn't handle properly conditional jumps using
a LabelReference instance. This patch fixes it through sh4LowerMisplacedLabels phase.
Also, to avoid the need of a 4th temporary gpr, this phase is triggered later in
getModifiedListSH4.
* offlineasm/sh4.rb:
2013-12-08 Filip Pizlo <fpizlo@apple.com>
Add the notion of ConstantStoragePointer to DFG IR
......
......@@ -452,18 +452,19 @@ def sh4LowerMisplacedLabels(list)
list.each {
| node |
if node.is_a? Instruction
case node.opcode
when "jmp", "call"
if node.operands[0].is_a? LabelReference
tmp = Tmp.new(codeOrigin, :gpr)
newList << Instruction.new(codeOrigin, "move", [node.operands[0], tmp])
newList << Instruction.new(codeOrigin, node.opcode, [tmp])
operands = node.operands
newOperands = []
operands.each {
| operand |
if operand.is_a? LabelReference
tmp = Tmp.new(operand.codeOrigin, :gpr)
newList << Instruction.new(operand.codeOrigin, "move", [operand, tmp])
newOperands << tmp
else
newList << node
newOperands << operand
end
else
newList << node
end
}
newList << Instruction.new(node.codeOrigin, node.opcode, newOperands, node.annotation)
else
newList << node
end
......@@ -730,8 +731,8 @@ class Sequence
"bbeq", "bbneq", "bbb", "bieq", "bpeq", "bineq", "bpneq", "bia", "bpa", "biaeq", "bpaeq", "bib", "bpb",
"bigteq", "bpgteq", "bilt", "bplt", "bigt", "bpgt", "bilteq", "bplteq", "btiz", "btpz", "btinz", "btpnz", "btbz", "btbnz"])
result = riscLowerMalformedImmediates(result, -128..127)
result = sh4LowerMisplacedLabels(result)
result = riscLowerMisplacedAddresses(result)
result = sh4LowerMisplacedLabels(result)
result = sh4LowerMisplacedSpecialRegisters(result)
result = assignRegistersToTemporaries(result, :gpr, SH4_TMP_GPRS)
......@@ -749,6 +750,7 @@ def sh4Operands(operands)
end
def emitSH4Branch(sh4opcode, operand)
raise "Invalid operand #{operand}" unless operand.is_a? RegisterID or operand.is_a? SpecialRegister
$asm.puts "#{sh4opcode} @#{operand.sh4Operand}"
$asm.puts "nop"
end
......@@ -772,12 +774,16 @@ def emitSH4ShiftImm(val, operand, direction)
end
end
def emitSH4BranchIfT(label, neg)
def emitSH4BranchIfT(dest, neg)
outlabel = LocalLabel.unique("branchIfT")
sh4opcode = neg ? "bt" : "bf"
$asm.puts "#{sh4opcode} #{LocalLabelReference.new(codeOrigin, outlabel).asmLabel}"
$asm.puts "bra #{label.asmLabel}"
$asm.puts "nop"
if dest.is_a? LocalLabelReference
$asm.puts "bra #{dest.asmLabel}"
$asm.puts "nop"
else
emitSH4Branch("jmp", dest)
end
outlabel.lower("SH4")
end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment