Ignore:
Timestamp:
Sep 10, 2014, 4:57:34 PM (11 years ago)
Author:
[email protected]
Message:

Apply ARM64-specific lowering to load/store instructions in offlineasm
https://bugs.webkit.org/show_bug.cgi?id=136569

Patch by Akos Kiss <[email protected]> on 2014-09-10
Reviewed by Michael Saboff.

The standard risc lowering of load/store instructions with base +
immediate offset addresses is to move the offset to a temporary, add the
base to the temporary, and then change the load/store to use the
temporary + 0 immediate offset address. However, on ARM64, base +
register offset addressing mode is available, so it is unnecessary to
perform explicit register additions but it is enough to change load/store
to use base + temporary as the address.

  • offlineasm/arm64.rb: Added arm64LowerMalformedLoadStoreAddresses
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/offlineasm/arm64.rb

    r173205 r173497  
    11# Copyright (C) 2011, 2012, 2014 Apple Inc. All rights reserved.
     2# Copyright (C) 2014 University of Szeged. All rights reserved.
    23#
    34# Redistribution and use in source and binary forms, with or without
     
    198199#
    199200
     201def arm64LowerMalformedLoadStoreAddresses(list)
     202    newList = []
     203
     204    def isAddressMalformed(operand)
     205        operand.is_a? Address and not (-255..4095).include? operand.offset.value
     206    end
     207
     208    list.each {
     209        | node |
     210        if node.is_a? Instruction
     211            if node.opcode =~ /^store/ and isAddressMalformed(node.operands[1])
     212                address = node.operands[1]
     213                tmp = Tmp.new(codeOrigin, :gpr)
     214                newList << Instruction.new(node.codeOrigin, "move", [address.offset, tmp])
     215                newList << Instruction.new(node.codeOrigin, node.opcode, [node.operands[0], BaseIndex.new(node.codeOrigin, address.base, tmp, 1, Immediate.new(codeOrigin, 0))], node.annotation)
     216            elsif node.opcode =~ /^load/ and isAddressMalformed(node.operands[0])
     217                address = node.operands[0]
     218                tmp = Tmp.new(codeOrigin, :gpr)
     219                newList << Instruction.new(node.codeOrigin, "move", [address.offset, tmp])
     220                newList << Instruction.new(node.codeOrigin, node.opcode, [BaseIndex.new(node.codeOrigin, address.base, tmp, 1, Immediate.new(codeOrigin, 0)), node.operands[1]], node.annotation)
     221            else
     222                newList << node
     223            end
     224        else
     225            newList << node
     226        end
     227    }
     228    newList
     229end
     230
    200231class Sequence
    201232    def getModifiedListARM64
     
    205236        result = riscLowerHardBranchOps64(result)
    206237        result = riscLowerShiftOps(result)
     238        result = arm64LowerMalformedLoadStoreAddresses(result)
    207239        result = riscLowerMalformedAddresses(result) {
    208240            | node, address |
Note: See TracChangeset for help on using the changeset viewer.