]> Cypherpunks repositories - gostls13.git/commit
[dev.typeparams] cmd/compile: add and use ir.RawOrigExpr
authorMatthew Dempsky <mdempsky@google.com>
Thu, 27 May 2021 09:50:17 +0000 (02:50 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Thu, 27 May 2021 22:13:46 +0000 (22:13 +0000)
commitea522bc546bb9f66285ea00744de8b258368b3ed
treef7ad88506a7f8a9e9220bf830061a1f7b295430e
parentde5d1aca5e61e49e0704213961c68bcf14e288b8
[dev.typeparams] cmd/compile: add and use ir.RawOrigExpr

This CL adds ir.RawOrigExpr, which can be used to represent arbitrary
constant expressions without needing to build and carry around an
entire IR representation of the original expression. It also allows
distinguishing how the constant was originally written by the
user (e.g., "0xff" vs "255").

This CL then also updates irgen to make use of this functionality for
expressions that were constant folded by types2.

Change-Id: I41e04e228e715ae2735c357b75633a2d08ee7021
Reviewed-on: https://go-review.googlesource.com/c/go/+/323210
Trust: Matthew Dempsky <mdempsky@google.com>
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
src/cmd/compile/internal/ir/expr.go
src/cmd/compile/internal/ir/fmt.go
src/cmd/compile/internal/ir/node_gen.go
src/cmd/compile/internal/ir/val.go
src/cmd/compile/internal/noder/expr.go
src/cmd/compile/internal/noder/helpers.go