1
0
mirror of https://github.com/golang/go synced 2024-10-04 14:31:21 -06:00
Commit Graph

169 Commits

Author SHA1 Message Date
Luuk van Dijk
2ad42a8249 gc: frame compaction for arm.
Required moving some parts of gc/pgen.c to ?g/ggen.c

on linux tests pass for all 3 architectures, and
frames are actually compacted (diagnostic code for
that has been removed from the CL).

R=rsc
CC=golang-dev
https://golang.org/cl/4571071
2011-06-14 17:03:37 +02:00
Luuk van Dijk
2ac375b2df gc: compact stackframe
After allocparams and walk, remove unused auto variables
and re-layout the remaining in reverse alignment order.

R=rsc
CC=golang-dev
https://golang.org/cl/4568068
2011-06-10 00:02:34 +02:00
Russ Cox
84f291b1bd 8g: compute register liveness during regopt
Input code like

0000 (x.go:2) TEXT    main+0(SB),$36-0
0001 (x.go:3) MOVL    $5,i+-8(SP)
0002 (x.go:3) MOVL    $0,i+-4(SP)
0003 (x.go:4) MOVL    $1,BX
0004 (x.go:4) MOVL    i+-8(SP),AX
0005 (x.go:4) MOVL    i+-4(SP),DX
0006 (x.go:4) MOVL    AX,autotmp_0000+-20(SP)
0007 (x.go:4) MOVL    DX,autotmp_0000+-16(SP)
0008 (x.go:4) MOVL    autotmp_0000+-20(SP),CX
0009 (x.go:4) CMPL    autotmp_0000+-16(SP),$0
0010 (x.go:4) JNE     ,13
0011 (x.go:4) CMPL    CX,$32
0012 (x.go:4) JCS     ,14
0013 (x.go:4) MOVL    $0,BX
0014 (x.go:4) SHLL    CX,BX
0015 (x.go:4) MOVL    BX,x+-12(SP)
0016 (x.go:5) MOVL    x+-12(SP),AX
0017 (x.go:5) CDQ     ,
0018 (x.go:5) MOVL    AX,autotmp_0001+-28(SP)
0019 (x.go:5) MOVL    DX,autotmp_0001+-24(SP)
0020 (x.go:5) MOVL    autotmp_0001+-28(SP),AX
0021 (x.go:5) MOVL    autotmp_0001+-24(SP),DX
0022 (x.go:5) MOVL    AX,(SP)
0023 (x.go:5) MOVL    DX,4(SP)
0024 (x.go:5) CALL    ,runtime.printint+0(SB)
0025 (x.go:5) CALL    ,runtime.printnl+0(SB)
0026 (x.go:6) RET     ,

is problematic because the liveness range for
autotmp_0000 (0006-0009) is nested completely
inside a span where BX holds a live value (0003-0015).
Because the register allocator only looks at 0006-0009
to see which registers are used, it misses the fact that
BX is unavailable and uses it anyway.

The n->pun = anyregalloc() check in tempname is
a workaround for this bug, but I hit it again because
I did the tempname call before allocating BX, even
though I then used the temporary after storing in BX.
This should fix the real bug, and then we can remove
the workaround in tempname.

The code creates pseudo-variables for each register
and includes that information in the liveness propagation.
Then the regu fields can be populated using that more
complete information.  With that approach, BX is marked
as in use on every line in the whole span 0003-0015,
so that the decision about autotmp_0000
(using only 0006-0009) still has all the information
it needs.

This is not specific to the 386, but it only happens in
generated code of the form

        load R1
        ...
        load var into R2
        ...
        store R2 back into var
        ...
        use R1

and for the most part the other compilers generate
the loads for a given compiled line before any of
the stores.  Even so, this may not be the case everywhere,
so the change is worth making in all three.

R=ken2, ken, ken
CC=golang-dev
https://golang.org/cl/4529106
2011-06-03 14:10:39 -04:00
Luuk van Dijk
e59aa8ea4a gc: typecheck the whole tree before walking. preparation for some escape-analysis related changes.
R=rsc
CC=golang-dev
https://golang.org/cl/4528116
2011-06-02 18:48:17 +02:00
Russ Cox
2286471651 5g: alignment fixes
Makes all.bash work after echo 4 >/proc/cpu/alignment,
which means kill the process on an unaligned access.

The default behavior on DreamPlug/GuruPlug/SheevaPlug
is to simulate an ARMv3 and just let the unaligned accesses
stop at the word boundary, resulting in all kinds of surprises.

Fixes #1240.

R=ken2
CC=golang-dev
https://golang.org/cl/4551064
2011-05-25 10:18:49 -04:00
Russ Cox
2d310a0087 5c, 5g: another attempt at silencing gcc
R=ken2
CC=golang-dev
https://golang.org/cl/4535074
2011-05-16 16:15:13 -04:00
Russ Cox
2d174db6a6 5c, 5g: fix build with too-smart gcc
R=ken2
CC=golang-dev
https://golang.org/cl/4543049
2011-05-13 12:15:46 -04:00
Russ Cox
bac8f18035 gc: fix order of operations for f() < g().
Also, 6g was passing uninitialized
Node &n2 to regalloc, causing non-deterministic
register collisions (but only when both left and
right hand side of comparison had function calls).

Fixes #1728.

R=ken2
CC=golang-dev
https://golang.org/cl/4425070
2011-04-26 00:57:03 -04:00
Russ Cox
3a1fdc655e gc: fix import width bug
Fixes #1705.

R=ken2
CC=golang-dev
https://golang.org/cl/4443060
2011-04-25 12:08:48 -04:00
Ian Lance Taylor
4c137b6162 5g: correct size of reg array.
Found by gcc 4.5.2 -Werror build reported on IRC by niemeyer.

R=ken2, rsc, r2
CC=golang-dev
https://golang.org/cl/4438042
2011-04-15 13:09:57 -07:00
Dave Cheney
29cf90a4ef libmach: fix warnings.
Fixes #1706.

R=adg, rsc
CC=golang-dev
https://golang.org/cl/4413051
2011-04-14 23:58:08 -04:00
Russ Cox
1bc84b7e18 ld: 25% faster
The ld time was dominated by symbol table processing, so
  * increase hash table size
  * emit fewer symbols in gc (just 1 per string, 1 per type)
  * add read-only lookup to avoid creating spurious symbols
  * add linked list to speed whole-table traversals

Breaks dwarf generator (no idea why), so disable dwarf.

Reduces time for 6l to link godoc by 25%.

R=ken2
CC=golang-dev
https://golang.org/cl/4383047
2011-04-09 09:44:20 -04:00
Russ Cox
66f09fd459 gc: diagnose unused labels
R=ken2
CC=golang-dev
https://golang.org/cl/4287047
2011-03-15 14:05:37 -04:00
Russ Cox
63c24081a0 5g: fix optimizer bug
same as in issue below, never fixed on ARM

changeset:   5498:3fa1372ca694
user:        Ken Thompson <ken@golang.org>
date:        Thu May 20 17:31:28 2010 -0700

description:
fix issue 798
cannot allocate an audomatic temp
while real registers are allocated.
there is a chance that the automatic
will be allocated to one of the
allocated registers. the fix is to
not registerize such variables.

R=rsc
CC=golang-dev
https://golang.org/cl/1202042

R=ken2
CC=golang-dev
https://golang.org/cl/4226042
2011-02-23 13:21:39 -05:00
Ken Thompson
cc4d57abac peep: more bugs
R=r
CC=golang-dev
https://golang.org/cl/4176042
2011-02-09 16:03:02 -08:00
Ken Thompson
acc82ad721 peep: bug fix
R=r
CC=golang-dev
https://golang.org/cl/4173041
2011-02-09 13:13:17 -08:00
Ken Thompson
5080d7617a cgen64: dont use MVN instruction
R=r
CC=golang-dev
https://golang.org/cl/4154043
2011-02-08 17:30:23 -08:00
Ken Thompson
dc331e6565 peep: more optimization
R=r
CC=golang-dev
https://golang.org/cl/4149044
2011-02-08 16:55:59 -08:00
Ken Thompson
e26b741523 peep: fix optimization bug
R=r
CC=golang-dev
https://golang.org/cl/4105058
2011-02-07 17:21:04 -08:00
Ken Thompson
2799e0ecb9 peep: fix bug in peep optimizer.
reg: enable peep optimizer.
cgen64: better int64 code.

R=r
CC=golang-dev
https://golang.org/cl/3989065
2011-02-07 15:00:30 -08:00
Rob Pike
80f07cfbea arm: disable peep for release
R=ken2
CC=golang-dev
https://golang.org/cl/4001051
2011-02-01 15:02:07 -08:00
Ken Thompson
1f55105f66 enable arm peep.
one bug fixed,
probably more will be revealed

R=r
CC=golang-dev
https://golang.org/cl/4126044
2011-01-30 15:55:08 -08:00
Russ Cox
0849944694 gc: delete float, complex
rename cmplx -> complex

R=ken2
CC=golang-dev
https://golang.org/cl/4071041
2011-01-19 23:08:11 -05:00
Ken Thompson
7963b04a18 arm bug with stack adjust
R=r
CC=golang-dev
https://golang.org/cl/3980043
2011-01-19 16:30:13 -08:00
Ken Thompson
eead5e8879 arm register allocation/tempname allocation bug
R=r
CC=golang-dev
https://golang.org/cl/4008044
2011-01-18 20:45:17 -08:00
Ken Thompson
fa9befd777 arm reg bug with SP adjust
after call to deferproc

R=r
CC=golang-dev
https://golang.org/cl/4059041
2011-01-17 20:39:26 -08:00
Ken Thompson
3537b79329 arm bug address of a string
R=r
CC=golang-dev
https://golang.org/cl/4004042
2011-01-17 13:27:05 -08:00
Ken Thompson
3965519ae5 arm reg bug with address(variable)
R=r
CC=golang-dev
https://golang.org/cl/4047041
2011-01-16 15:25:13 -08:00
Ken Thompson
6432471497 disable reg - tar test failed
R=r
CC=golang-dev
https://golang.org/cl/3969042
2011-01-15 17:11:24 -08:00
Ken Thompson
2c35e548bb arm reg bug MOVW into bool variable
R=r
CC=golang-dev
https://golang.org/cl/4034042
2011-01-15 16:55:47 -08:00
Russ Cox
141a4a1759 runtime: fix arm reflect.call boundary case
The fault was lucky: when it wasn't faulting it was silently
copying a word from some other block and later putting
that same word back.  If some other goroutine had changed
that word of memory in the interim, too bad.

The ARM code was inconsistent about whether the
"argument frame" included the saved LR.  Including it made
some things more regular but mostly just caused confusion
in the places where the regularity broke.  Now the rule
reflects reality: argp is always a pointer to arguments,
never a saved link register.

Renamed struct fields to make meaning clearer.

Running ARM in QEMU, package time's gotest:
  * before: 27/58 failed
  * after: 0/50

R=r, r2
CC=golang-dev
https://golang.org/cl/3993041
2011-01-14 14:05:20 -05:00
Ken Thompson
a093f3d5a0 fix tst instruction on arm to set overflow bit
R=r
CC=golang-dev
https://golang.org/cl/4009041
2011-01-13 20:05:08 -08:00
Ken Thompson
2a74009675 add TST op code
R=r
CC=golang-dev
https://golang.org/cl/4000041
2011-01-13 15:34:52 -08:00
Rob Pike
d88f717da6 disable arm registifier for the moment
R=ken2, ken3
CC=golang-dev
https://golang.org/cl/3970041
2011-01-12 16:17:14 -08:00
Ken Thompson
1c99bdc8e5 turn off peep half of optimizer for release
R=r
CC=golang-dev
https://golang.org/cl/3919043
2011-01-11 17:30:25 -08:00
Ken Thompson
ab4d8bf16c arm optimizer bug fixes
R=rsc
CC=golang-dev
https://golang.org/cl/3913043
2011-01-10 13:15:52 -08:00
Ken Thompson
4ed17ceace add peep
R=rsc
CC=golang-dev
https://golang.org/cl/3902042
2011-01-07 18:20:26 -08:00
Ken Thompson
90ca4d75a4 initial cut at arm optimizer
R=rsc
CC=golang-dev
https://golang.org/cl/3921041
2011-01-07 18:04:48 -08:00
Russ Cox
e7a0f67603 gc: introduce explicit alignments
No semantic changes here, but working
toward being able to align structs based
on the maximum alignment of the fields
inside instead of having a fixed alignment
for all structs (issue 482).

R=ken2
CC=golang-dev
https://golang.org/cl/3617041
2010-12-13 11:57:41 -05:00
Eoghan Sherry
40ff071e9b 5g/8g, 8l, ld, prof: fix output of 32-bit values
If an %lld argument can be 32 or 64 bits wide, cast to vlong.
If always 32 bits, drop the ll.
Fixes #1336.

R=brainman, rsc
CC=golang-dev
https://golang.org/cl/3580041
2010-12-12 14:40:19 -05:00
Ken Thompson
8613eb56b2 last of the arm conversions
R=rsc
CC=golang-dev
https://golang.org/cl/3053041
2010-11-11 19:54:35 -08:00
Ken Thompson
9c6df3ca13 add hardware floating point.
currently, softfloat does not work and
there are some unsigned-to-float conversion errors.

R=rsc
CC=golang-dev
https://golang.org/cl/2886041
2010-11-03 17:31:07 -07:00
Russ Cox
e48c0fb562 5g, 6g, 8g: generate code for string index
instead of calling function.

R=ken2
CC=golang-dev
https://golang.org/cl/2762041
2010-10-26 21:11:17 -07:00
Russ Cox
b0ad7a4268 5g: complex "regalloc"
R=ken2
CC=golang-dev
https://golang.org/cl/2727041
2010-10-26 01:26:33 +02:00
Russ Cox
45c48d51f7 5g: missed one case last night
R=ken2
CC=golang-dev
https://golang.org/cl/2658042
2010-10-22 05:50:45 +02:00
Ken Thompson
e5bd12ea90 bug right shifting 64 bits
by a variable that equals 32

R=rsc
CC=golang-dev
https://golang.org/cl/2645042
2010-10-21 18:15:00 -07:00
Russ Cox
69188ad9bb arm: prop up software floating point
Just enough to make mov instructions work,
which in turn is enough to make strconv work
when it avoids any floating point calculations.
That makes a bunch of other packages pass
their tests.

Should suffice until hardware floating point
is available.

Enable package tests that now pass
(some due to earlier fixes).

Looks like there is a new integer math bug
exposed in the fmt and json tests.

R=ken2
CC=golang-dev
https://golang.org/cl/2638041
2010-10-21 06:56:20 +02:00
Ken Thompson
6096fc83cd code gen error for *(complex)++
includes array[i]++ and slice[i]++

R=rsc
CC=golang-dev
https://golang.org/cl/2614041
2010-10-20 13:18:00 -07:00
Russ Cox
d9c989fa25 various: avoid %ld etc
The Plan 9 tools assume that long is 32 bits.
We converted all instances of long to int32 when
importing the code but missed the print formats.
Because int32 is always int on the compilers we use,
it is never correct to use %lux, %ld, etc.  Convert to %ux, %d, etc.

(It matters because on 64-bit gcc, long is 64 bits,
so we were printing 32-bit quantities with 64-bit formats.)

R=ken2
CC=golang-dev
https://golang.org/cl/2491041
2010-10-13 16:20:22 -04:00
Russ Cox
085be1740a 5l, 6l, 8l: first pass cleanup
* Maintain Sym* list for text with individual
  prog lists instead of using one huge list and
  overloading p->pcond.
* Comment what each file is for.
* Move some output code from span.c to asm.c.
* Move profiling into prof.c, symbol table into symtab.c.
* Move mkfwd to ld/lib.c.
* Throw away dhog dynamic loading code.
* Throw away Alef become.
* Fix printing of WORD instructions in 5l -a.

Goal here is to be able to handle each piece of text or data
as a separate piece, both to make it easier to load the
occasional .o file and also to make it possible to split the
work across multiple threads.

R=ken2, r, ken3
CC=golang-dev
https://golang.org/cl/2335043
2010-10-13 15:51:21 -04:00