go.tools/ssa: unexport Register.

R=gri
CC=golang-dev
https://golang.org/cl/14672043
This commit is contained in:
Alan Donovan 2013-10-14 13:48:34 -04:00
parent 1e6b0db4b9
commit 1ff3452afa
1 changed files with 37 additions and 39 deletions

View File

@ -443,7 +443,7 @@ type Builtin struct {
// t1 = new int // t1 = new int
// //
type Alloc struct { type Alloc struct {
Register register
Comment string Comment string
Heap bool Heap bool
index int // dense numbering; for lifting index int // dense numbering; for lifting
@ -462,7 +462,7 @@ type Alloc struct {
// t2 = phi [0.start: t0, 1.if.then: t1, ...] // t2 = phi [0.start: t0, 1.if.then: t1, ...]
// //
type Phi struct { type Phi struct {
Register register
Comment string // a hint as to its purpose Comment string // a hint as to its purpose
Edges []Value // Edges[i] is value for Block().Preds[i] Edges []Value // Edges[i] is value for Block().Preds[i]
} }
@ -483,7 +483,7 @@ type Phi struct {
// t7 = invoke t5.Println(...t6) // t7 = invoke t5.Println(...t6)
// //
type Call struct { type Call struct {
Register register
Call CallCommon Call CallCommon
} }
@ -495,7 +495,7 @@ type Call struct {
// t1 = t0 + 1:int // t1 = t0 + 1:int
// //
type BinOp struct { type BinOp struct {
Register register
// One of: // One of:
// ADD SUB MUL QUO REM + - * / % // ADD SUB MUL QUO REM + - * / %
// AND OR XOR SHL SHR AND_NOT & | ^ << >> &~ // AND OR XOR SHL SHR AND_NOT & | ^ << >> &~
@ -522,7 +522,7 @@ type BinOp struct {
// t2 = <-t1,ok // t2 = <-t1,ok
// //
type UnOp struct { type UnOp struct {
Register register
Op token.Token // One of: NOT SUB ARROW MUL XOR ! - <- * ^ Op token.Token // One of: NOT SUB ARROW MUL XOR ! - <- * ^
X Value X Value
CommaOk bool CommaOk bool
@ -548,7 +548,7 @@ type UnOp struct {
// t1 = changetype *int <- IntPtr (t0) // t1 = changetype *int <- IntPtr (t0)
// //
type ChangeType struct { type ChangeType struct {
Register register
X Value X Value
} }
@ -577,7 +577,7 @@ type ChangeType struct {
// t1 = convert []byte <- string (t0) // t1 = convert []byte <- string (t0)
// //
type Convert struct { type Convert struct {
Register register
X Value X Value
} }
@ -594,7 +594,7 @@ type Convert struct {
// t1 = change interface interface{} <- I (t0) // t1 = change interface interface{} <- I (t0)
// //
type ChangeInterface struct { type ChangeInterface struct {
Register register
X Value X Value
} }
@ -615,7 +615,7 @@ type ChangeInterface struct {
// t2 = make Stringer <- t0 // t2 = make Stringer <- t0
// //
type MakeInterface struct { type MakeInterface struct {
Register register
X Value X Value
} }
@ -632,7 +632,7 @@ type MakeInterface struct {
// t1 = make closure bound$(main.I).add [i] // t1 = make closure bound$(main.I).add [i]
// //
type MakeClosure struct { type MakeClosure struct {
Register register
Fn Value // always a *Function Fn Value // always a *Function
Bindings []Value // values for each free variable in Fn.FreeVars Bindings []Value // values for each free variable in Fn.FreeVars
} }
@ -650,7 +650,7 @@ type MakeClosure struct {
// t1 = make StringIntMap t0 // t1 = make StringIntMap t0
// //
type MakeMap struct { type MakeMap struct {
Register register
Reserve Value // initial space reservation; nil => default Reserve Value // initial space reservation; nil => default
} }
@ -667,7 +667,7 @@ type MakeMap struct {
// t0 = make IntChan 0 // t0 = make IntChan 0
// //
type MakeChan struct { type MakeChan struct {
Register register
Size Value // int; size of buffer; zero => synchronous. Size Value // int; size of buffer; zero => synchronous.
} }
@ -689,7 +689,7 @@ type MakeChan struct {
// t1 = make StringSlice 1:int t0 // t1 = make StringSlice 1:int t0
// //
type MakeSlice struct { type MakeSlice struct {
Register register
Len Value Len Value
Cap Value Cap Value
} }
@ -711,7 +711,7 @@ type MakeSlice struct {
// t1 = slice t0[1:] // t1 = slice t0[1:]
// //
type Slice struct { type Slice struct {
Register register
X Value // slice, string, or *array X Value // slice, string, or *array
Low, High Value // either may be nil Low, High Value // either may be nil
} }
@ -733,7 +733,7 @@ type Slice struct {
// t1 = &t0.name [#1] // t1 = &t0.name [#1]
// //
type FieldAddr struct { type FieldAddr struct {
Register register
X Value // *struct X Value // *struct
Field int // index into X.Type().Deref().(*types.Struct).Fields Field int // index into X.Type().Deref().(*types.Struct).Fields
} }
@ -751,7 +751,7 @@ type FieldAddr struct {
// t1 = t0.name [#1] // t1 = t0.name [#1]
// //
type Field struct { type Field struct {
Register register
X Value // struct X Value // struct
Field int // index into X.Type().(*types.Struct).Fields Field int // index into X.Type().(*types.Struct).Fields
} }
@ -774,7 +774,7 @@ type Field struct {
// t2 = &t0[t1] // t2 = &t0[t1]
// //
type IndexAddr struct { type IndexAddr struct {
Register register
X Value // slice or *array, X Value // slice or *array,
Index Value // numeric index Index Value // numeric index
} }
@ -788,7 +788,7 @@ type IndexAddr struct {
// t2 = t0[t1] // t2 = t0[t1]
// //
type Index struct { type Index struct {
Register register
X Value // array X Value // array
Index Value // integer index Index Value // integer index
} }
@ -808,7 +808,7 @@ type Index struct {
// t5 = t3[t4],ok // t5 = t3[t4],ok
// //
type Lookup struct { type Lookup struct {
Register register
X Value // string or map X Value // string or map
Index Value // numeric or key-typed index Index Value // numeric or key-typed index
CommaOk bool // return a value,ok pair CommaOk bool // return a value,ok pair
@ -861,7 +861,7 @@ type SelectState struct {
// t4 = select blocking [] // t4 = select blocking []
// //
type Select struct { type Select struct {
Register register
States []*SelectState States []*SelectState
Blocking bool Blocking bool
} }
@ -879,7 +879,7 @@ type Select struct {
// t0 = range "hello":string // t0 = range "hello":string
// //
type Range struct { type Range struct {
Register register
X Value // string or map X Value // string or map
} }
@ -902,7 +902,7 @@ type Range struct {
// t1 = next t0 // t1 = next t0
// //
type Next struct { type Next struct {
Register register
Iter Value Iter Value
IsString bool // true => string iterator; false => map iterator. IsString bool // true => string iterator; false => map iterator.
} }
@ -943,7 +943,7 @@ type Next struct {
// t3 = typeassert,ok t2.(T) // t3 = typeassert,ok t2.(T)
// //
type TypeAssert struct { type TypeAssert struct {
Register register
X Value X Value
AssertedType types.Type AssertedType types.Type
CommaOk bool CommaOk bool
@ -959,7 +959,7 @@ type TypeAssert struct {
// t1 = extract t0 #1 // t1 = extract t0 #1
// //
type Extract struct { type Extract struct {
Register register
Tuple Value Tuple Value
Index int Index int
} }
@ -1168,13 +1168,12 @@ type DebugRef struct {
// Embeddable mix-ins and helpers for common parts of other structs. ----------- // Embeddable mix-ins and helpers for common parts of other structs. -----------
// Register is a mix-in embedded by all SSA values that are also // register is a mix-in embedded by all SSA values that are also
// instructions, i.e. virtual registers, and provides implementations // instructions, i.e. virtual registers, and provides a uniform
// of the Value interface's Name() and Type() methods: the name is // implementation of most of the Value interface: Value.Name() is a
// simply a numbered register (e.g. "t0") and the type is the typ // numbered register (e.g. "t0"); the other methods are field accessors.
// field.
// //
// Temporary names are automatically assigned to each Register on // Temporary names are automatically assigned to each register on
// completion of building a function in SSA form. // completion of building a function in SSA form.
// //
// Clients must not assume that the 'id' value (and the Name() derived // Clients must not assume that the 'id' value (and the Name() derived
@ -1182,7 +1181,7 @@ type DebugRef struct {
// semantics are determined only by identity; names exist only to // semantics are determined only by identity; names exist only to
// facilitate debugging. // facilitate debugging.
// //
type Register struct { type register struct {
anInstruction anInstruction
num int // "name" of virtual register, e.g. "t0". Not guaranteed unique. num int // "name" of virtual register, e.g. "t0". Not guaranteed unique.
typ types.Type // type of virtual register typ types.Type // type of virtual register
@ -1365,14 +1364,13 @@ func (v *Alloc) Type() types.Type { return v.typ }
func (v *Alloc) Referrers() *[]Instruction { return &v.referrers } func (v *Alloc) Referrers() *[]Instruction { return &v.referrers }
func (v *Alloc) Pos() token.Pos { return v.pos } func (v *Alloc) Pos() token.Pos { return v.pos }
func (v *Register) Type() types.Type { return v.typ } func (v *register) Type() types.Type { return v.typ }
func (v *Register) setType(typ types.Type) { v.typ = typ } func (v *register) setType(typ types.Type) { v.typ = typ }
func (v *Register) Name() string { return fmt.Sprintf("t%d", v.num) } func (v *register) Name() string { return fmt.Sprintf("t%d", v.num) }
func (v *Register) setNum(num int) { v.num = num } func (v *register) setNum(num int) { v.num = num }
func (v *Register) Referrers() *[]Instruction { return &v.referrers } func (v *register) Referrers() *[]Instruction { return &v.referrers }
func (v *Register) asRegister() *Register { return v } func (v *register) Pos() token.Pos { return v.pos }
func (v *Register) Pos() token.Pos { return v.pos } func (v *register) setPos(pos token.Pos) { v.pos = pos }
func (v *Register) setPos(pos token.Pos) { v.pos = pos }
func (v *anInstruction) Parent() *Function { return v.block.parent } func (v *anInstruction) Parent() *Function { return v.block.parent }
func (v *anInstruction) Block() *BasicBlock { return v.block } func (v *anInstruction) Block() *BasicBlock { return v.block }