mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.ssa] cmd/compile: Do pointer arithmetic with int, not uintptr
Be more consistent about this. There's no reason to do the pointer arithmetic on a different type, as sizeof(int) >= sizeof(ptr) on all of our platforms. It simplifies our rewrite rules also, except for a few that need duplication. Add some more constant folding to get constant indexing and slicing to fold down to nothing. Change-Id: I3e56cdb14b3dc1a6a0514f0333e883f92c19e3c7 Reviewed-on: https://go-review.googlesource.com/16586 Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by: David Chase <drchase@google.com>
This commit is contained in:
parent
991873116e
commit
582baae22a
10 changed files with 448 additions and 199 deletions
|
|
@ -297,10 +297,6 @@ func (f *Func) ConstInt64(line int32, t Type, c int64) *Value {
|
|||
// TODO: cache?
|
||||
return f.Entry.NewValue0I(line, OpConst64, t, c)
|
||||
}
|
||||
func (f *Func) ConstIntPtr(line int32, t Type, c int64) *Value {
|
||||
// TODO: cache?
|
||||
return f.Entry.NewValue0I(line, OpConstPtr, t, c)
|
||||
}
|
||||
func (f *Func) ConstFloat32(line int32, t Type, c float64) *Value {
|
||||
// TODO: cache?
|
||||
return f.Entry.NewValue0I(line, OpConst32F, t, int64(math.Float64bits(c)))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue