summaryrefslogtreecommitdiff
path: root/src/cmd/5g/opt.h
Commit message (Collapse)AuthorAgeFilesLines
* [dev.power64] 5g,6g,8g,9g: debug prints for regopt pass 6 and paint2Austin Clements2014-11-141-1/+1
| | | | | | | | | | | Theses were very helpful in understanding the regions and register selection when porting regopt to 9g. Add them to the other compilers (and improve 9g's successor debug print). LGTM=rsc R=rsc CC=golang-codereviews https://codereview.appspot.com/174130043
* [dev.power64] 5g,6g,8g: synchronize documentation for regopt structuresAustin Clements2014-11-141-6/+22
| | | | | | | | | | | I added several comments to the regopt-related structures when porting it to 9g. Synchronize those comments back in to the other compilers. LGTM=rsc R=rsc CC=golang-codereviews https://codereview.appspot.com/175720043
* [dev.power64] gc: convert Bits to a uint64 arrayAustin Clements2014-11-041-7/+7
| | | | | | | | | | | | | So far all of our architectures have had at most 32 registers, so we've been able to use entry 0 in the Bits uint32 array directly as a register mask. Power64 has 64 registers, so this converts Bits to a uint64 array so we can continue to use entry 0 directly as a register mask on Power64. LGTM=rsc R=rsc CC=golang-codereviews https://codereview.appspot.com/169060043
* build: annotations and modifications for c2goRuss Cox2014-07-021-0/+20
| | | | | | | | | | | | | | | | | | | | | | | The main changes fall into a few patterns: 1. Replace #define with enum. 2. Add /*c2go */ comment giving effect of #define. This is necessary for function-like #defines and non-enum-able #defined constants. (Not all compilers handle negative or large enums.) 3. Add extra braces in struct initializer. (c2go does not implement the full rules.) This is enough to let c2go typecheck the source tree. There may be more changes once it is doing other semantic analyses. LGTM=minux, iant R=minux, dave, iant CC=golang-codereviews https://codereview.appspot.com/106860045
* cmd/gc: fix liveness vs regopt mismatch for input variablesRuss Cox2014-05-121-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The inputs to a function are marked live at all times in the liveness bitmaps, so that the garbage collector will not free the things they point at and reuse the pointers, so that the pointers shown in stack traces are guaranteed not to have been recycled. Unfortunately, no one told the register optimizer that the inputs need to be preserved at all call sites. If a function is done with a particular input value, the optimizer will stop preserving it across calls. For single-word values this just means that the value recorded might be stale. For multi-word values like slices, the value recorded could be only partially stale: it can happen that, say, the cap was updated but not the len, or that the len was updated but not the base pointer. Either of these possibilities (and others) would make the garbage collector misinterpret memory, leading to memory corruption. This came up in a real program, in which the garbage collector's 'slice len ? slice cap' check caught the inconsistency. Fixes issue 7944. LGTM=iant R=golang-codereviews, iant CC=golang-codereviews, khr https://codereview.appspot.com/100370045
* cmd/gc: add temporary-merging optimization passRuss Cox2013-08-131-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The compilers assume they can generate temporary variables as needed to preserve the right semantics or simplify code generation and the back end will still generate good code. This turns out not to be true. The back ends will only track the first 128 variables per function and give up on the remainder. That needs to be fixed too, in a later CL. This CL merges temporary variables with equal types and non-overlapping lifetimes using the greedy algorithm in Poletto and Sarkar, "Linear Scan Register Allocation", ACM TOPLAS 1999. The result can be striking in the right functions. Top 20 frame size changes in a 6g godoc binary by bytes saved: 5464 1984 (-3480, -63.7%) go/build.(*Context).Import 4456 1824 (-2632, -59.1%) go/printer.(*printer).expr1 2560 80 (-2480, -96.9%) time.nextStdChunk 3496 1608 (-1888, -54.0%) go/printer.(*printer).stmt 1896 272 (-1624, -85.7%) net/http.init 2688 1400 (-1288, -47.9%) fmt.(*pp).printReflectValue 2800 1512 (-1288, -46.0%) main.main 3296 2016 (-1280, -38.8%) crypto/tls.(*Conn).clientHandshake 1664 488 (-1176, -70.7%) time.loadZoneZip 1760 608 (-1152, -65.5%) time.parse 4104 3072 (-1032, -25.1%) runtime/pprof.writeHeap 1680 712 ( -968, -57.6%) go/ast.Walk 2488 1560 ( -928, -37.3%) crypto/x509.parseCertificate 1128 392 ( -736, -65.2%) math/big.nat.divLarge 1528 864 ( -664, -43.5%) go/printer.(*printer).fieldList 1360 712 ( -648, -47.6%) regexp/syntax.(*parser).factor 2104 1528 ( -576, -27.4%) encoding/asn1.parseField 1064 504 ( -560, -52.6%) encoding/xml.(*Decoder).text 584 48 ( -536, -91.8%) html.init 1400 864 ( -536, -38.3%) go/doc.playExample In the same godoc build, cuts the number of functions with too many vars from 83 to 32. R=ken2 CC=golang-dev https://codereview.appspot.com/12829043
* cmd/gc: move flow graph into portable optRuss Cox2013-08-121-30/+4
| | | | | | | | | | Now there's only one copy of the flow graph construction and dominator computation, and different optimizations can attach different annotations to the instructions. R=ken2 CC=golang-dev https://codereview.appspot.com/12797045
* cmd/gc: support for "portable" optimization logicRuss Cox2013-08-121-2/+10
| | | | | | | | | | | | | | | Code in gc/popt.c is compiled as part of 5g, 6g, and 8g, meaning it can use arch-specific headers but there's just one copy of the code. This is the same arrangement we use for the portable code generation logic in gc/pgen.c. Move fixjmp and noreturn there to get the ball rolling. R=ken2 CC=golang-dev https://codereview.appspot.com/12789043
* cmd/5g: factor out prog informationRuss Cox2013-08-121-0/+52
| | | | | | | | Like CL 12637051, but for 5g instead of 6g. R=ken2 CC=golang-dev https://codereview.appspot.com/12779043
* cmd/{5g,6g,8g,6c}: remove unused macro, use %E to print etype.R?my Oudompheng2012-09-241-2/+0
| | | | | | R=golang-dev, rsc, dave CC=golang-dev http://codereview.appspot.com/6569044
* cmd/[568]g: explain the purpose of various Reg fields.R?my Oudompheng2012-09-241-8/+12
| | | | | | R=golang-dev, rsc CC=golang-dev, remy http://codereview.appspot.com/6554062
* arm bug with stack adjustKen Thompson2011-01-191-1/+0
| | | | | | R=r CC=golang-dev http://codereview.appspot.com/3980043
* arm reg bug with SP adjustKen Thompson2011-01-171-1/+2
| | | | | | | | after call to deferproc R=r CC=golang-dev http://codereview.appspot.com/4059041
* add hardware floating point.Ken Thompson2010-11-031-1/+1
| | | | | | | | | currently, softfloat does not work and there are some unsigned-to-float conversion errors. R=rsc CC=golang-dev http://codereview.appspot.com/2886041
* Rebooted 5g effort from 6g. Tons of minor fixes and tweaks toKai Backman2009-05-281-0/+165
get the code going. R=rsc APPROVED=rsc DELTA=4752 (1723 added, 948 deleted, 2081 changed) OCL=29403 CL=29530