• Alan Donovan's avatar
    exp/ssa: make invokation of deferred procedure calls explicit. · 5a09f1b3
    Alan Donovan authored
    The correct semantics of named result parameters and deferred
    procedures cannot be implemented with the existing Ret
    instruction alone, since the required sequence is:
    (1) evaluate return operands and parallel-assign them to
        named result parameters
    (2) invoke deferred procedures
    (3) load named result parameters to form result tuple.
    
    We introduce a new 'rundefers' instruction that explicitly
    invokes the deferred procedure calls, and we generate code
    that follows the sequence above.
    
    Most functions do not use deferred procedures but this cannot
    be known in a single pass.  So, we add an optimisation to
    eliminate redundant 'rundefers'; it is piggybacked on the
    existing pass done for "lifting".
    
    Added tests.
    
    R=gri
    CC=golang-dev
    https://golang.org/cl/7411043
    5a09f1b3
emit.go 6.94 KB