From 068f01709207fc87c62be6817e429a33c4dd34f9 Mon Sep 17 00:00:00 2001 From: Alan Donovan Date: Tue, 8 Oct 2013 12:31:39 -0400 Subject: [PATCH] go.tools/ssa: s/Ret/Return/g R=gri CC=golang-dev https://golang.org/cl/14526044 --- pointer/gen.go | 2 +- ssa/builder.go | 6 +++--- ssa/doc.go | 2 +- ssa/emit.go | 2 +- ssa/example_test.go | 4 ++-- ssa/func.go | 2 +- ssa/interp/interp.go | 2 +- ssa/interp/value.go | 2 +- ssa/print.go | 4 ++-- ssa/sanity.go | 6 +++--- ssa/ssa.go | 20 ++++++++++---------- ssa/testmain.go | 2 +- 12 files changed, 27 insertions(+), 27 deletions(-) diff --git a/pointer/gen.go b/pointer/gen.go index b4c19e24..154cde6b 100644 --- a/pointer/gen.go +++ b/pointer/gen.go @@ -989,7 +989,7 @@ func (a *analysis) genInstr(cgn *cgnode, instr ssa.Instruction) { } } - case *ssa.Ret: + case *ssa.Return: results := a.funcResults(cgn.obj) for _, r := range instr.Results { sz := a.sizeof(r.Type()) diff --git a/ssa/builder.go b/ssa/builder.go index 58eb0015..e6dc5539 100644 --- a/ssa/builder.go +++ b/ssa/builder.go @@ -2114,7 +2114,7 @@ start: results = append(results, emitLoad(fn, r)) } } - fn.emit(&Ret{Results: results, pos: s.Return}) + fn.emit(&Return{Results: results, pos: s.Return}) fn.currentBlock = fn.newBasicBlock("unreachable") case *ast.BranchStmt: @@ -2235,7 +2235,7 @@ func (b *builder) buildFunction(fn *Function) { // Run function calls deferred in this function when // falling off the end of the body block. fn.emit(new(RunDefers)) - fn.emit(new(Ret)) + fn.emit(new(Return)) } fn.finishBody() } @@ -2380,7 +2380,7 @@ func (p *Package) Build() { emitJump(init, done) init.currentBlock = done init.emit(new(RunDefers)) - init.emit(new(Ret)) + init.emit(new(Return)) init.finishBody() // Pass 2: build all remaining package-level functions and diff --git a/ssa/doc.go b/ssa/doc.go index 6fc48c51..42f12df8 100644 --- a/ssa/doc.go +++ b/ssa/doc.go @@ -88,7 +88,7 @@ // *Parameter ✔ // *Phi ✔ ✔ // *Range ✔ ✔ -// *Ret ✔ +// *Return ✔ // *RunDefers ✔ // *Select ✔ ✔ // *Send ✔ diff --git a/ssa/emit.go b/ssa/emit.go index e13a2046..b4902f31 100644 --- a/ssa/emit.go +++ b/ssa/emit.go @@ -317,7 +317,7 @@ func emitTailCall(f *Function, call *Call) { call.typ = tresults } tuple := f.emit(call) - var ret Ret + var ret Return switch nr { case 0: // no-op diff --git a/ssa/example_test.go b/ssa/example_test.go index 3f16e7e4..d4c44ffe 100644 --- a/ssa/example_test.go +++ b/ssa/example_test.go @@ -92,7 +92,7 @@ func main() { // t1 = fmt.init() () // jump 2.init.done // .2.init.done: P:2 S:0 - // ret + // return // // # Name: main.main // # Location: hello.go:8:6 @@ -104,5 +104,5 @@ func main() { // *t1 = t2 // t3 = slice t0[:] []interface{} // t4 = fmt.Println(t3) (n int, err error) - // ret + // return } diff --git a/ssa/func.go b/ssa/func.go index ce8eeaaa..84a732d3 100644 --- a/ssa/func.go +++ b/ssa/func.go @@ -457,7 +457,7 @@ func (f *Function) emit(instr Instruction) Value { // "math.IsNaN" // a package-level function // "IsNaN" // intra-package reference to same // "(*sync.WaitGroup).Add" // a declared method -// "(*exp/ssa.Ret).Block" // a promotion wrapper method +// "(*exp/ssa.Return).Block" // a promotion wrapper method // "(ssa.Instruction).Block" // an interface method wrapper // "func@5.32" // an anonymous function // "bound$(*T).f" // a bound method wrapper diff --git a/ssa/interp/interp.go b/ssa/interp/interp.go index 3c6a4255..8e740bc3 100644 --- a/ssa/interp/interp.go +++ b/ssa/interp/interp.go @@ -184,7 +184,7 @@ func visitInstr(fr *frame, instr ssa.Instruction) continuation { case *ssa.Slice: fr.env[instr] = slice(fr.get(instr.X), fr.get(instr.Low), fr.get(instr.High)) - case *ssa.Ret: + case *ssa.Return: switch len(instr.Results) { case 0: case 1: diff --git a/ssa/interp/value.go b/ssa/interp/value.go index 038fabc1..c4e25ebb 100644 --- a/ssa/interp/value.go +++ b/ssa/interp/value.go @@ -23,7 +23,7 @@ package interp // - *ssa.Function \ // *ssa.Builtin } --- functions. A nil 'func' is always of type *ssa.Function. // *closure / -// - tuple --- as returned by Ret, Next, "value,ok" modes, etc. +// - tuple --- as returned by Return, Next, "value,ok" modes, etc. // - iter --- iterators from 'range' over map or string. // - bad --- a poison pill for locals that have gone out of scope. // - rtype -- the interpreter's concrete implementation of reflect.Type diff --git a/ssa/print.go b/ssa/print.go index 16a5be8a..49b5d5d3 100644 --- a/ssa/print.go +++ b/ssa/print.go @@ -330,9 +330,9 @@ func (s *Panic) String() string { return "panic " + relName(s.X, s) } -func (s *Ret) String() string { +func (s *Return) String() string { var b bytes.Buffer - b.WriteString("ret") + b.WriteString("return") for i, r := range s.Results { if i == 0 { b.WriteString(" ") diff --git a/ssa/sanity.go b/ssa/sanity.go index 4b3eb11f..0148b052 100644 --- a/ssa/sanity.go +++ b/ssa/sanity.go @@ -89,7 +89,7 @@ func findDuplicate(blocks []*BasicBlock) *BasicBlock { func (s *sanity) checkInstr(idx int, instr Instruction) { switch instr := instr.(type) { - case *If, *Jump, *Ret, *Panic: + case *If, *Jump, *Return, *Panic: s.errorf("control flow instruction not at end of block") case *Phi: if idx == 0 { @@ -215,9 +215,9 @@ func (s *sanity) checkFinalInstr(idx int, instr Instruction) { return } - case *Ret: + case *Return: if nsuccs := len(s.block.Succs); nsuccs != 0 { - s.errorf("Ret-terminated block has %d successors; expected none", nsuccs) + s.errorf("Return-terminated block has %d successors; expected none", nsuccs) return } // TODO(adonovan): check number and types of results diff --git a/ssa/ssa.go b/ssa/ssa.go index d80098a6..ab60732f 100644 --- a/ssa/ssa.go +++ b/ssa/ssa.go @@ -164,7 +164,7 @@ type Instruction interface { // Note that the name of the Value is not printed. // // Examples of Instructions that do define (are) Values: - // e.g. "ret x" (Ret) + // e.g. "return x" (Return) // "*y = x" (Store) // // (This separation is useful for some analyses which @@ -282,7 +282,7 @@ type Function struct { // An SSA basic block. // // The final element of Instrs is always an explicit transfer of -// control (If, Jump, Ret or Panic). +// control (If, Jump, Return or Panic). // // A block may contain no Instructions only if it is unreachable, // i.e. Preds is nil. Empty blocks are typically pruned. @@ -997,29 +997,29 @@ type If struct { Cond Value } -// The Ret instruction returns values and control back to the calling +// The Return instruction returns values and control back to the calling // function. // // len(Results) is always equal to the number of results in the // function's signature. // -// If len(Results) > 1, Ret returns a tuple value with the specified +// If len(Results) > 1, Return returns a tuple value with the specified // components which the caller must access using Extract instructions. // // There is no instruction to return a ready-made tuple like those // returned by a "value,ok"-mode TypeAssert, Lookup or UnOp(ARROW) or // a tail-call to a function with multiple result parameters. // -// Ret must be the last instruction of its containing BasicBlock. +// Return must be the last instruction of its containing BasicBlock. // Such a block has no successors. // // Pos() returns the ast.ReturnStmt.Return, if explicit in the source. // // Example printed form: -// ret -// ret nil:I, 2:int +// return +// return nil:I, 2:int // -type Ret struct { +type Return struct { anInstruction Results []Value pos token.Pos @@ -1431,7 +1431,7 @@ func (s *Defer) Pos() token.Pos { return s.pos } func (s *Go) Pos() token.Pos { return s.pos } func (s *MapUpdate) Pos() token.Pos { return s.pos } func (s *Panic) Pos() token.Pos { return s.pos } -func (s *Ret) Pos() token.Pos { return s.pos } +func (s *Return) Pos() token.Pos { return s.pos } func (s *Send) Pos() token.Pos { return s.pos } func (s *Store) Pos() token.Pos { return s.pos } func (s *If) Pos() token.Pos { return token.NoPos } @@ -1564,7 +1564,7 @@ func (v *Range) Operands(rands []*Value) []*Value { return append(rands, &v.X) } -func (s *Ret) Operands(rands []*Value) []*Value { +func (s *Return) Operands(rands []*Value) []*Value { for i := range s.Results { rands = append(rands, &s.Results[i]) } diff --git a/ssa/testmain.go b/ssa/testmain.go index e9ab5716..0941790d 100644 --- a/ssa/testmain.go +++ b/ssa/testmain.go @@ -68,7 +68,7 @@ func (pkg *Package) CreateTestMainFunction() *Function { } fn.AnonFuncs = append(fn.AnonFuncs, matcher) matcher.startBody() - matcher.emit(&Ret{Results: []Value{vTrue, nilConst(types.Universe.Lookup("error").Type())}}) + matcher.emit(&Return{Results: []Value{vTrue, nilConst(types.Universe.Lookup("error").Type())}}) matcher.finishBody() fn.startBody()