mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: minor comment improvements/corrections
Change-Id: Ie0934f1528d58d4971cdef726d3e2d23cf3935d3 Reviewed-on: https://go-review.googlesource.com/87475 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Alexandru Moșoi <alexandru@mosoi.ro>
This commit is contained in:
parent
b55eedd173
commit
491f409a32
2 changed files with 10 additions and 3 deletions
|
|
@ -28,7 +28,7 @@ type Func struct {
|
||||||
Cache *Cache // re-usable cache
|
Cache *Cache // re-usable cache
|
||||||
fe Frontend // frontend state associated with this Func, callbacks into compiler frontend
|
fe Frontend // frontend state associated with this Func, callbacks into compiler frontend
|
||||||
pass *pass // current pass information (name, options, etc.)
|
pass *pass // current pass information (name, options, etc.)
|
||||||
Name string // e.g. bytes·Compare
|
Name string // e.g. NewFunc or (*Func).NumBlocks (no package prefix)
|
||||||
Type *types.Type // type signature of the function.
|
Type *types.Type // type signature of the function.
|
||||||
Blocks []*Block // unordered set of all basic blocks (note: not indexable by ID)
|
Blocks []*Block // unordered set of all basic blocks (note: not indexable by ID)
|
||||||
Entry *Block // the entry basic block
|
Entry *Block // the entry basic block
|
||||||
|
|
|
||||||
|
|
@ -90,6 +90,12 @@ type limitFact struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// factsTable keeps track of relations between pairs of values.
|
// factsTable keeps track of relations between pairs of values.
|
||||||
|
//
|
||||||
|
// The fact table logic is sound, but incomplete. Outside of a few
|
||||||
|
// special cases, it performs no deduction or arithmetic. While there
|
||||||
|
// are known decision procedures for this, the ad hoc approach taken
|
||||||
|
// by the facts table is effective for real code while remaining very
|
||||||
|
// efficient.
|
||||||
type factsTable struct {
|
type factsTable struct {
|
||||||
facts map[pair]relation // current known set of relation
|
facts map[pair]relation // current known set of relation
|
||||||
stack []fact // previous sets of relations
|
stack []fact // previous sets of relations
|
||||||
|
|
@ -433,8 +439,8 @@ var (
|
||||||
// TODO: OpIsInBounds actually test 0 <= a < b. This means
|
// TODO: OpIsInBounds actually test 0 <= a < b. This means
|
||||||
// that the positive branch learns signed/LT and unsigned/LT
|
// that the positive branch learns signed/LT and unsigned/LT
|
||||||
// but the negative branch only learns unsigned/GE.
|
// but the negative branch only learns unsigned/GE.
|
||||||
OpIsInBounds: {unsigned, lt},
|
OpIsInBounds: {unsigned, lt}, // 0 <= arg0 < arg1
|
||||||
OpIsSliceInBounds: {unsigned, lt | eq},
|
OpIsSliceInBounds: {unsigned, lt | eq}, // 0 <= arg0 <= arg1
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -625,6 +631,7 @@ func updateRestrictions(parent *Block, ft *factsTable, t domain, v, w *Value, r
|
||||||
// simplifyBlock simplifies block known the restrictions in ft.
|
// simplifyBlock simplifies block known the restrictions in ft.
|
||||||
// Returns which branch must always be taken.
|
// Returns which branch must always be taken.
|
||||||
func simplifyBlock(ft *factsTable, b *Block) branch {
|
func simplifyBlock(ft *factsTable, b *Block) branch {
|
||||||
|
// Replace OpSlicemask operations in b with constants where possible.
|
||||||
for _, v := range b.Values {
|
for _, v := range b.Values {
|
||||||
if v.Op != OpSlicemask {
|
if v.Op != OpSlicemask {
|
||||||
continue
|
continue
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue