go.tools/ssa: s/Ret/Return/g

R=gri
CC=golang-dev
https://golang.org/cl/14526044
This commit is contained in:
Alan Donovan 2013-10-08 12:31:39 -04:00
parent 8ae5d36d2a
commit 068f017092
12 changed files with 27 additions and 27 deletions

View File

@ -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())

View File

@ -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

View File

@ -88,7 +88,7 @@
// *Parameter ✔
// *Phi ✔ ✔
// *Range ✔ ✔
// *Ret
// *Return
// *RunDefers ✔
// *Select ✔ ✔
// *Send ✔

View File

@ -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

View File

@ -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
}

View File

@ -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

View File

@ -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:

View File

@ -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

View File

@ -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(" ")

View File

@ -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

View File

@ -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])
}

View File

@ -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()