1
0
mirror of https://github.com/golang/go synced 2024-10-01 15:58:33 -06:00
Commit Graph

10 Commits

Author SHA1 Message Date
Alan Donovan
e590cdbdf8 go.tools/ssa: doc tweaks + a sanity check.
R=gri
CC=golang-dev
https://golang.org/cl/14454053
2013-10-09 12:47:30 -04:00
Alan Donovan
068f017092 go.tools/ssa: s/Ret/Return/g
R=gri
CC=golang-dev
https://golang.org/cl/14526044
2013-10-08 12:31:39 -04:00
Alan Donovan
713699d8ad go.tools: add copyright messages to source files.
R=r
CC=golang-dev
https://golang.org/cl/13305043
2013-08-27 18:49:13 -04:00
Alan Donovan
c28bf6e069 go.tools/ssa: extend debug information to arbitrary ast.Exprs.
CanonicalPos was inadequate since many pairs of instruction share the same pos (e.g. Allocs and Phis).  Instead, we generalize the DebugRef instruction to associate not just Idents but Exprs with ssa.Values.

We no longer store any DebugRefs for constant expressions, to save space.  (The type and value of such expressions can be obtained by other means, at a cost in complexity.)

Function.ValueForExpr queries the DebugRef info to return the ssa.Value of a given Expr.

Added tests.

Also:
- the DebugInfo flag is now per package, not global.
   It must be set between Create and Build phases if desired.
- {Value,Instruction}.Pos() documentation updated: we still maintain
  this information in the instruction stream even in non-debug mode,
  but we make fewer claims about its invariants.
- Go and Defer instructions can now use their respective go/defer
   token positions (not the call's lparen), so they do.
- SelectState:
     Posn token.Pos indicates the <- position
     DebugNode ast.Expr is the send stmt or receive expr.
- In building SelectStmt, we introduce extra temporaries in debug
   mode to hold the result of the receive in 'case <-ch' even though
   this value isn't ordinarily needed.
- Use *SelectState (indirectly) since the struct is getting bigger.
- Document some missing instructions in doc.go.

R=gri
CC=golang-dev
https://golang.org/cl/12147043
2013-07-31 13:13:05 -04:00
Alan Donovan
732dbe9ff8 go.tools/ssa: s/Literal/Const/g, s/Constant/NamedConst/g
(Motivation: "Literal" is a syntactic property, not a semantic one.)

Also: delete a "TODO: opt" that the lifting pass already does for us.

R=gri
CC=golang-dev
https://golang.org/cl/11351043
2013-07-16 13:50:08 -04:00
Alan Donovan
1fa3f78146 go.tools/ssa: Function.Synthetic documents provenance of synthetic functions.
We use the new field to determine whether or not a function is
synthetic, not Pos() == 0, so synthetic functions can have
positions too.

R=gri
CC=golang-dev
https://golang.org/cl/10916044
2013-07-03 17:57:20 -04:00
Alan Donovan
6c7ce1c2d3 go.tools/ssa: Value.Pos() method + remaining source position plumbing.
Implement Pos() method for
  Values:       Parameter, Capture, Phi.  (Not Literal, Builtin.)
  Instructions: UnOp, BinOp, Store.

'address' (an lvalue) now needs position of '*' in "*addr".

Also:
- Un-export fields Pos_ Type_ Name_ Block_ from various values/instructions.
  Define NewFunction() as a temporary measure.
  Will try to eliminate calls from clients...
- Remove Implements{Value,Member,Interface} marker methods.
  I've decided I don't like them.
- Func.addParamObj helper.
- Various comment fixes.

R=gri
CC=golang-dev
https://golang.org/cl/9740046
2013-05-30 09:59:17 -04:00
Alan Donovan
113d6d30b1 code.google.com/p/go.tools/ssa: include ssa.Package and init() function in example output.
Also:
- remove redundant text in doc.go.
- fix (yet more) cases of missing parens in Printf, fallout from
  go/types accessors refactoring.
- don't mix spaces and tabs within lines printed by ssa.Function.DumpTo:
  it makes it too hard to constructed expected outputs for tests.
  (Tabs may appear at line start though.)

Sadly godoc -play won't run this program; it complains it
can't import "code.google.com/p/go.exp/ssa".  Any idea why?

R=gri
CC=golang-dev
https://golang.org/cl/9481044
2013-05-17 17:33:09 -04:00
Rob Pike
87334f402b go.tools: bring up to date
Repo was copied from old point.  Bad r.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/9504043
2013-05-17 14:02:47 -07:00
Rob Pike
83f21b9226 go.tools: add missing files ssa/*.go
R=golang-dev, adonovan
CC=golang-dev
https://golang.org/cl/9500043
2013-05-17 13:25:48 -07:00