Changeset 157474 in webkit for trunk/Source/JavaScriptCore/offlineasm
- Timestamp:
- Oct 15, 2013, 3:16:39 PM (12 years ago)
- Location:
- trunk/Source/JavaScriptCore/offlineasm
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/offlineasm/arm.rb
r148705 r157474 218 218 } 219 219 result = riscLowerMalformedAddressesDouble(result) 220 result = riscLowerMisplacedImmediates(result, ["storeb", "storei", "storep" ])220 result = riscLowerMisplacedImmediates(result, ["storeb", "storei", "storep", "storeq"]) 221 221 result = riscLowerMalformedImmediates(result, 0..0xff) 222 222 result = riscLowerMisplacedAddresses(result) -
trunk/Source/JavaScriptCore/offlineasm/backends.rb
r148474 r157474 24 24 require "config" 25 25 require "arm" 26 require "arm64" 26 27 require "ast" 27 28 require "x86" … … 37 38 "ARMv7", 38 39 "ARMv7_TRADITIONAL", 40 "ARM64", 39 41 "MIPS", 40 42 "SH4", … … 54 56 "ARMv7", 55 57 "ARMv7_TRADITIONAL", 58 "ARM64", 56 59 "MIPS", 57 60 "SH4", -
trunk/Source/JavaScriptCore/offlineasm/instructions.rb
r157452 r157474 258 258 ] 259 259 260 ARM_INSTRUCTIONS = 261 [ 262 "smulli", 263 "addis", 264 "subis", 265 "oris" 260 RISC_INSTRUCTIONS = 261 [ 262 "smulli", # Multiply two 32-bit words and produce a 64-bit word 263 "addis", # Add integers and set a flag. 264 "subis", # Same, but for subtraction. 265 "oris", # Same, but for bitwise or. 266 "addps" # addis but for pointers. 266 267 ] 267 268 … … 305 306 ] 306 307 307 INSTRUCTIONS = MACRO_INSTRUCTIONS + X86_INSTRUCTIONS + ARM_INSTRUCTIONS + MIPS_INSTRUCTIONS + SH4_INSTRUCTIONS + CXX_INSTRUCTIONS308 INSTRUCTIONS = MACRO_INSTRUCTIONS + X86_INSTRUCTIONS + RISC_INSTRUCTIONS + MIPS_INSTRUCTIONS + SH4_INSTRUCTIONS + CXX_INSTRUCTIONS 308 309 309 310 INSTRUCTION_PATTERN = Regexp.new('\\A((' + INSTRUCTIONS.join(')|(') + '))\\Z') -
trunk/Source/JavaScriptCore/offlineasm/risc.rb
r148474 r157474 372 372 when "move" 373 373 newList << node 374 when "addi", "addp", "add is", "subi", "subp", "subis"374 when "addi", "addp", "addq", "addis", "subi", "subp", "subq", "subis" 375 375 if node.operands[0].is_a? Immediate and 376 376 (not validImmediates.include? node.operands[0].value) and … … 388 388 newList << node.riscLowerMalformedImmediatesRecurse(newList, validImmediates) 389 389 end 390 when "muli", "mulp" 390 when "muli", "mulp", "mulq" 391 391 if node.operands[0].is_a? Immediate 392 392 tmp = Tmp.new(codeOrigin, :gpr) … … 466 466 node.opcode, 467 467 riscAsRegisters(newList, postInstructions, node.operands, "p"), 468 annotation) 469 when "addq", "andq", "lshiftq", "mulq", "negq", "orq", "rshiftq", "urshiftq", 470 "subq", "xorq", /^bq/, /^btq/, /^cq/ 471 newList << Instruction.new(node.codeOrigin, 472 node.opcode, 473 riscAsRegisters(newList, postInstructions, node.operands, "q"), 468 474 annotation) 469 475 when "bbeq", "bbneq", "bba", "bbaeq", "bbb", "bbbeq", "btbz", "btbnz", "tbz", "tbnz", … … 553 559 end 554 560 561 # 562 # Lowering of the not instruction. The following: 563 # 564 # noti t0 565 # 566 # becomes: 567 # 568 # xori -1, t0 569 # 570 571 def riscLowerNot(list) 572 newList = [] 573 list.each { 574 | node | 575 if node.is_a? Instruction 576 case node.opcode 577 when "noti", "notp" 578 raise "Wrong nubmer of operands at #{node.codeOriginString}" unless node.operands.size == 1 579 suffix = node.opcode[-1..-1] 580 newList << Instruction.new(node.codeOrigin, "xor" + suffix, 581 [Immediate.new(node.codeOrigin, -1), node.operands[0]]) 582 else 583 newList << node 584 end 585 else 586 newList << node 587 end 588 } 589 return newList 590 end 591 592 # 593 # Lowing of complex branch ops on 64-bit. For example: 594 # 595 # bmulio foo, bar, baz 596 # 597 # becomes: 598 # 599 # smulli foo, bar, bar 600 # rshiftp bar, 32, tmp1 601 # rshifti bar, 31, tmp2 602 # zxi2p bar, bar 603 # bineq tmp1, tmp2, baz 604 # 605 606 def riscLowerHardBranchOps64(list) 607 newList = [] 608 list.each { 609 | node | 610 if node.is_a? Instruction and node.opcode == "bmulio" 611 tmp1 = Tmp.new(node.codeOrigin, :gpr) 612 tmp2 = Tmp.new(node.codeOrigin, :gpr) 613 newList << Instruction.new(node.codeOrigin, "smulli", [node.operands[0], node.operands[1], node.operands[1]]) 614 newList << Instruction.new(node.codeOrigin, "rshiftp", [node.operands[1], Immediate.new(node.codeOrigin, 32), tmp1]) 615 newList << Instruction.new(node.codeOrigin, "rshifti", [node.operands[1], Immediate.new(node.codeOrigin, 31), tmp2]) 616 newList << Instruction.new(node.codeOrigin, "zxi2p", [node.operands[1], node.operands[1]]) 617 newList << Instruction.new(node.codeOrigin, "bineq", [tmp1, tmp2, node.operands[2]]) 618 else 619 newList << node 620 end 621 } 622 newList 623 end 624 625 # 626 # Lowering of test instructions. For example: 627 # 628 # btiz t0, t1, .foo 629 # 630 # becomes: 631 # 632 # andi t0, t1, tmp 633 # bieq tmp, 0, .foo 634 # 635 # and another example: 636 # 637 # tiz t0, t1, t2 638 # 639 # becomes: 640 # 641 # andi t0, t1, tmp 642 # cieq tmp, 0, t2 643 # 644 645 def riscLowerTest(list) 646 def emit(newList, andOpcode, branchOpcode, node) 647 if node.operands.size == 2 648 newList << Instruction.new(node.codeOrigin, branchOpcode, [node.operands[0], Immediate.new(node.codeOrigin, 0), node.operands[1]]) 649 return 650 end 651 652 raise "Incorrect number of operands at #{codeOriginString}" unless node.operands.size == 3 653 654 if node.operands[0].immediate? and node.operands[0].value == -1 655 newList << Instruction.new(node.codeOrigin, branchOpcode, [node.operands[1], Immediate.new(node.codeOrigin, 0), node.operands[2]]) 656 return 657 end 658 659 if node.operands[1].immediate? and node.operands[1].value == -1 660 newList << Instruction.new(node.codeOrigin, branchOpcode, [node.operands[0], Immediate.new(node.codeOrigin, 0), node.operands[2]]) 661 return 662 end 663 664 tmp = Tmp.new(node.codeOrigin, :gpr) 665 newList << Instruction.new(node.codeOrigin, andOpcode, [node.operands[0], node.operands[1], tmp]) 666 newList << Instruction.new(node.codeOrigin, branchOpcode, [tmp, Immediate.new(node.codeOrigin, 0), node.operands[2]]) 667 end 668 669 newList = [] 670 list.each { 671 | node | 672 if node.is_a? Instruction 673 case node.opcode 674 when "btis" 675 emit(newList, "andi", "bilt", node) 676 when "btiz" 677 emit(newList, "andi", "bieq", node) 678 when "btinz" 679 emit(newList, "andi", "bineq", node) 680 when "btps" 681 emit(newList, "andp", "bplt", node) 682 when "btpz" 683 emit(newList, "andp", "bpeq", node) 684 when "btpnz" 685 emit(newList, "andp", "bpneq", node) 686 when "btqs" 687 emit(newList, "andq", "bqlt", node) 688 when "btqz" 689 emit(newList, "andq", "bqeq", node) 690 when "btqnz" 691 emit(newList, "andq", "bqneq", node) 692 when "btbs" 693 emit(newList, "andi", "bblt", node) 694 when "btbz" 695 emit(newList, "andi", "bbeq", node) 696 when "btbnz" 697 emit(newList, "andi", "bbneq", node) 698 when "tis" 699 emit(newList, "andi", "cilt", node) 700 when "tiz" 701 emit(newList, "andi", "cieq", node) 702 when "tinz" 703 emit(newList, "andi", "cineq", node) 704 when "tps" 705 emit(newList, "andp", "cplt", node) 706 when "tpz" 707 emit(newList, "andp", "cpeq", node) 708 when "tpnz" 709 emit(newList, "andp", "cpneq", node) 710 when "tqs" 711 emit(newList, "andq", "cqlt", node) 712 when "tqz" 713 emit(newList, "andq", "cqeq", node) 714 when "tqnz" 715 emit(newList, "andq", "cqneq", node) 716 when "tbs" 717 emit(newList, "andi", "cblt", node) 718 when "tbz" 719 emit(newList, "andi", "cbeq", node) 720 when "tbnz" 721 emit(newList, "andi", "cbneq", node) 722 else 723 newList << node 724 end 725 else 726 newList << node 727 end 728 } 729 return newList 730 end -
trunk/Source/JavaScriptCore/offlineasm/transform.rb
r123147 r157474 405 405 def validate 406 406 validateChildren 407 408 # Further verify that this list contains only instructions, labels, and skips. 409 @list.each { 410 | node | 411 unless node.is_a? Instruction or 412 node.is_a? Label or 413 node.is_a? LocalLabel or 414 node.is_a? Skip 415 raise "Unexpected #{node.inspect} at #{node.codeOrigin}" 416 end 417 } 407 418 end 408 419 end
Note:
See TracChangeset
for help on using the changeset viewer.