• Austin Clements's avatar
    cmd/compile: don't lower OpConvert · 8871c930
    Austin Clements authored
    Currently, each architecture lowers OpConvert to an arch-specific
    OpXXXconvert. This is silly because OpConvert means the same thing on
    all architectures and is logically a no-op that exists only to keep
    track of conversions to and from unsafe.Pointer. Furthermore, lowering
    it makes it harder to recognize in other analyses, particularly
    liveness analysis.
    
    This CL eliminates the lowering of OpConvert, leaving it as the
    generic op until code generation time.
    
    The main complexity here is that we still need to register-allocate
    OpConvert operations. Currently, each arch's lowered OpConvert
    specifies all GP registers in its register mask. Ideally, OpConvert
    wouldn't affect value homing at all, and we could just copy the home
    of OpConvert's source, but this can potentially home an OpConvert in a
    LocalSlot, which neither regalloc nor stackalloc expect. Rather than
    try to disentangle this assumption from regalloc and stackalloc, we
    continue to register-allocate OpConvert, but teach regalloc that
    OpConvert can be allocated to any allocatable GP register.
    
    For #24543.
    
    Change-Id: I795a6aee5fd94d4444a7bafac3838a400c9f7bb6
    Reviewed-on: https://go-review.googlesource.com/108496
    Run-TryBot: Austin Clements <austin@google.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarDavid Chase <drchase@google.com>
    8871c930
lower.go 1.22 KB