aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/ir/expr.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/compile/internal/ir/expr.go')
-rw-r--r--src/cmd/compile/internal/ir/expr.go41
1 files changed, 36 insertions, 5 deletions
diff --git a/src/cmd/compile/internal/ir/expr.go b/src/cmd/compile/internal/ir/expr.go
index 8ac7e7f4f7..0058a98824 100644
--- a/src/cmd/compile/internal/ir/expr.go
+++ b/src/cmd/compile/internal/ir/expr.go
@@ -119,8 +119,9 @@ func (n *BasicLit) SetVal(val constant.Value) { n.val = val }
// or Op(X, Y) for builtin functions that do not become calls.
type BinaryExpr struct {
miniExpr
- X Node
- Y Node
+ X Node
+ Y Node
+ RType Node `mknode:"-"` // see reflectdata/helpers.go
}
func NewBinaryExpr(pos src.XPos, op Op, x, y Node) *BinaryExpr {
@@ -148,6 +149,7 @@ type CallExpr struct {
origNode
X Node
Args Nodes
+ RType Node `mknode:"-"` // see reflectdata/helpers.go
KeepAlive []*Name // vars to be kept alive until call returns
IsDDD bool
NoInline bool
@@ -192,6 +194,7 @@ type CompLitExpr struct {
miniExpr
origNode
List Nodes // initialized values
+ RType Node `mknode:"-"` // *runtime._type for OMAPLIT map types
Prealloc *Name
// For OSLICELIT, Len is the backing array length.
// For OMAPLIT, Len is the number of entries that we've removed from List and
@@ -246,6 +249,27 @@ func (n *ConstExpr) Val() constant.Value { return n.val }
type ConvExpr struct {
miniExpr
X Node
+
+ // For implementing OCONVIFACE expressions.
+ //
+ // TypeWord is an expression yielding a *runtime._type or
+ // *runtime.itab value to go in the type word of the iface/eface
+ // result. See reflectdata.ConvIfaceTypeWord for further details.
+ //
+ // SrcRType is an expression yielding a *runtime._type value for X,
+ // if it's not pointer-shaped and needs to be heap allocated.
+ TypeWord Node `mknode:"-"`
+ SrcRType Node `mknode:"-"`
+
+ // For -d=checkptr instrumentation of conversions from
+ // unsafe.Pointer to *Elem or *[Len]Elem.
+ //
+ // TODO(mdempsky): We only ever need one of these, but currently we
+ // don't decide which one until walk. Longer term, it probably makes
+ // sense to have a dedicated IR op for `(*[Len]Elem)(ptr)[:n:m]`
+ // expressions.
+ ElemRType Node `mknode:"-"`
+ ElemElemRType Node `mknode:"-"`
}
func NewConvExpr(pos src.XPos, op Op, typ *types.Type, x Node) *ConvExpr {
@@ -275,6 +299,7 @@ type IndexExpr struct {
miniExpr
X Node
Index Node
+ RType Node `mknode:"-"` // see reflectdata/helpers.go
Assigned bool
}
@@ -385,8 +410,9 @@ func (n *LogicalExpr) SetOp(op Op) {
// but *not* OMAKE (that's a pre-typechecking CallExpr).
type MakeExpr struct {
miniExpr
- Len Node
- Cap Node
+ RType Node `mknode:"-"` // see reflectdata/helpers.go
+ Len Node
+ Cap Node
}
func NewMakeExpr(pos src.XPos, op Op, len, cap Node) *MakeExpr {
@@ -623,7 +649,7 @@ type TypeAssertExpr struct {
// Runtime type information provided by walkDotType for
// assertions from non-empty interface to concrete type.
- ITab *AddrExpr `mknode:"-"` // *runtime.itab for Type implementing X's type
+ ITab Node `mknode:"-"` // *runtime.itab for Type implementing X's type
}
func NewTypeAssertExpr(pos src.XPos, x Node, typ *types.Type) *TypeAssertExpr {
@@ -650,6 +676,11 @@ type DynamicTypeAssertExpr struct {
miniExpr
X Node
+ // SrcRType is an expression that yields a *runtime._type value
+ // representing X's type. It's used in failed assertion panic
+ // messages.
+ SrcRType Node
+
// RType is an expression that yields a *runtime._type value
// representing the asserted type.
//