Changeset 154025 in webkit for trunk/Source/JavaScriptCore/offlineasm/sh4.rb
- Timestamp:
- Aug 13, 2013, 3:15:13 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/offlineasm/sh4.rb
r153317 r154025 213 213 # will become: 214 214 # 215 # addi foo, bar , tmp216 # bs tmp, baz215 # addi foo, bar 216 # bs bar, baz 217 217 # 218 218 … … 406 406 if address.is_a? Address 407 407 case node.opcode 408 when "btbz", "btbnz", "cbeq", "bbeq", "bbneq", "bbb", "loadb" 408 when "btbz", "btbnz", "cbeq", "bbeq", "bbneq", "bbb", "loadb", "storeb" 409 409 (0..15).include? address.offset.value and 410 410 ((node.operands[0].is_a? RegisterID and node.operands[0].sh4Operand == "r0") or … … 442 442 end 443 443 444 def emitSH4Load32(constant, dest) 445 outlabel = LocalLabel.unique("load32out") 446 constlabel = LocalLabel.unique("load32const") 447 $asm.puts "mov.l #{LocalLabelReference.new(codeOrigin, constlabel).asmLabel}, #{dest.sh4Operand}" 448 $asm.puts "bra #{LocalLabelReference.new(codeOrigin, outlabel).asmLabel}" 444 def emitSH4Load32AndJump(constant, scratch) 445 $asm.puts "mov.l 2f, #{scratch.sh4Operand}" 446 $asm.puts "braf #{scratch.sh4Operand}" 449 447 $asm.puts "nop" 450 $asm.puts ".balign 4" 451 constlabel.lower("SH4") 452 $asm.puts ".long #{constant}" 453 outlabel.lower("SH4") 454 end 455 456 def emitSH4Load32AndJump(constant, scratch) 457 constlabel = LocalLabel.unique("load32const") 458 $asm.puts "mov.l #{LocalLabelReference.new(codeOrigin, constlabel).asmLabel}, #{scratch.sh4Operand}" 459 $asm.puts "jmp @#{scratch.sh4Operand}" 460 $asm.puts "nop" 461 $asm.puts ".balign 4" 462 constlabel.lower("SH4") 463 $asm.puts ".long #{constant}" 448 $asm.puts "1: .balign 4" 449 $asm.puts "2: .long #{constant}-1b" 464 450 end 465 451 … … 481 467 constlabel.lower("SH4") 482 468 else 483 emitSH4Load32(operands[0].value, operands[1]) 469 outlabel = LocalLabel.unique("load32out") 470 constlabel = LocalLabel.unique("load32const") 471 $asm.puts "mov.l #{LocalLabelReference.new(codeOrigin, constlabel).asmLabel}, #{operands[1].sh4Operand}" 472 $asm.puts "bra #{LocalLabelReference.new(codeOrigin, outlabel).asmLabel}" 473 $asm.puts "nop" 474 $asm.puts ".balign 4" 475 constlabel.lower("SH4") 476 $asm.puts ".long #{operands[0].value}" 477 outlabel.lower("SH4") 484 478 end 485 479 end … … 657 651 $asm.puts "dmuls.l #{sh4Operands([operands[2], operands[3]])}" 658 652 $asm.puts "sts macl, #{operands[3].sh4Operand}" 659 $asm.puts "sts mach, #{operands[0].sh4Operand}"660 653 $asm.puts "cmp/pz #{operands[3].sh4Operand}" 661 654 $asm.puts "movt #{operands[1].sh4Operand}" 662 $asm.puts "dt #{operands[1].sh4Operand}" 655 $asm.puts "add #-1, #{operands[1].sh4Operand}" 656 $asm.puts "sts mach, #{operands[0].sh4Operand}" 663 657 $asm.puts "cmp/eq #{sh4Operands([operands[0], operands[1]])}" 664 658 $asm.puts "bf #{operands[4].asmLabel}" … … 716 710 $asm.puts "lds r0, pr" 717 711 $asm.puts "mov.l @(6, PC), #{operands[1].sh4Operand}" 718 $asm.puts " jmp @#{operands[1].sh4Operand}"712 $asm.puts "braf #{operands[1].sh4Operand}" 719 713 $asm.puts "mov #{operands[0].sh4Operand}, r0" 720 $asm.puts ".long #{operands[2].asmLabel} "714 $asm.puts ".long #{operands[2].asmLabel}-." 721 715 when "jmp" 722 716 if operands[0].is_a? LocalLabelReference … … 736 730 $asm.puts "mov.b #{sh4Operands(operands)}" 737 731 $asm.puts "extu.b #{sh4Operands([operands[1], operands[1]])}" 732 when "storeb" 733 $asm.puts "mov.b #{sh4Operands(operands)}" 738 734 when "loadh" 739 735 $asm.puts "mov.w #{sh4Operands(operands)}" … … 742 738 $asm.puts "mov.l #{sh4Operands(operands)}" 743 739 when "move" 744 if operands[0].is_a? LabelReference 745 emitSH4Load32(operands[0].asmLabel, operands[1]) 746 elsif operands[0].is_a? Immediate 740 if operands[0].is_a? Immediate 747 741 emitSH4LoadImm(operands) 748 742 else … … 752 746 if operands[0].is_a? BaseIndex 753 747 biop = operands[0] 754 if biop.scale > 0 755 $asm.puts "mov #{sh4Operands([biop.index, operands[1]])}" 756 if biop.scaleShift > 0 757 emitSH4ShiftImm(biop.scaleShift, operands[1], "l") 758 end 759 $asm.puts "add #{sh4Operands([biop.base, operands[1]])}" 760 else 761 $asm.puts "mov #{sh4Operands([biop.base, operands[1]])}" 762 end 748 $asm.puts "mov #{sh4Operands([biop.index, operands[1]])}" 749 if biop.scaleShift > 0 750 emitSH4ShiftImm(biop.scaleShift, operands[1], "l") 751 end 752 $asm.puts "add #{sh4Operands([biop.base, operands[1]])}" 763 753 if biop.offset.value != 0 764 754 $asm.puts "add #{sh4Operands([biop.offset, operands[1]])}"
Note:
See TracChangeset
for help on using the changeset viewer.