Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(94)

Unified Diff: src/cmd/6g/reg.c

Issue 176061: more on the optimizer (Closed)
Patch Set: code review 176061: more on the optimizer Created 15 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/cmd/8g/reg.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/cmd/6g/reg.c
===================================================================
--- a/src/cmd/6g/reg.c
+++ b/src/cmd/6g/reg.c
@@ -94,8 +94,24 @@
static void
setaddrs(Bits bit)
{
- if(bany(&bit))
- var[bnum(bit)].addr = 1;
+ int i, n;
+ Var *v;
+ Sym *s;
+
+ while(bany(&bit)) {
+ // convert each bit to a variable
+ i = bnum(bit);
+ s = var[i].sym;
+ n = var[i].name;
+ bit.b[i/32] &= ~(1L<<(i%32));
+
+ // disable all pieces of that variable
+ for(i=0; i<nvar; i++) {
+ v = var+i;
+ if(v->sym == s && v->name == n)
+ v->addr = 2;
+ }
+ }
}
void
@@ -851,15 +867,12 @@
for(i=0; i<nvar; i++) {
v = var+i;
if(v->sym == s && v->name == n) {
- if(v->offset == o) {
- // if it is the same, use it
- if(v->etype != et||
- v->width != w)
- v->addr = 1;
+ if(v->offset == o)
+ if(v->etype == et)
+ if(v->width == w)
return blsh(i);
- }
- // if it overlaps, disable bothj
+ // if they overlaps, disable both
if(overlap(v->offset, v->width, o, w)) {
v->addr = 1;
flag = 1;
@@ -888,6 +901,8 @@
v->gotype = a->gotype;
v->etype = et;
v->width = w;
+ v->addr = flag; // funny punning
+
if(debug['R'])
print("bit=%2d et=%2d w=%d %S %D\n", i, et, w, s, a);
ostats.nvar++;
@@ -900,10 +915,6 @@
for(z=0; z<BITS; z++)
params.b[z] |= bit.b[z];
- // funny punning
- if(flag)
- v->addr = 1;
-
return bit;
none:
« no previous file with comments | « no previous file | src/cmd/8g/reg.c » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b