• Stephan Herhut's avatar
    [wasm] Improve register hinting for arguments · 7822145c
    Stephan Herhut authored
    When assigning a register to a value that is used as a function
    argument, we use a hint to suggest the corresponding register. However,
    if the argument is also used after the call, the register will not be
    free for the entire live range of the value. Hence we need to split the
    live range.
    To minimize the number of splits, we aim to choose a register with
    maxium availability. This heuristic was implemented based on lifetime
    positions with sub-instruction precision. In such a model, argument
    registers typically have a shorter available time, as they need to
    hold a value before a call, whereas all other registers are free until
    right after the call, where they have been overwritten by the called
    function. Hence, we typically chose a non-argument register, ignoring
    the hint and creating an extra move.
    This change moves the heuristic to instruction granularity, which
    gives argument and other registers the same free time. We also now
    prefer hinted registers if they have the same free time.
    
    Change-Id: Ia8dd73b6c086d28859a836c42ea9ff8afce4c371
    Reviewed-on: https://chromium-review.googlesource.com/1124852Reviewed-by: 's avatarSigurd Schneider <sigurds@chromium.org>
    Commit-Queue: Stephan Herhut <herhut@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#54255}
    7822145c
register-allocator.cc 144 KB