mirror of
https://github.com/golang/go
synced 2024-11-23 20:30:04 -07:00
cmd/6c, cmd/6g: avoid address-as-constant in amd64 instructions
This allows implementing address-of-global as a pc-relative address instead of as a 32-bit integer constant. LGTM=rminnich, iant R=golang-codereviews, rminnich, iant CC=golang-codereviews https://golang.org/cl/128070045
This commit is contained in:
parent
3763a395b2
commit
ce35994d4e
@ -124,10 +124,7 @@ xcom(Node *n)
|
||||
break;
|
||||
|
||||
case ONAME:
|
||||
if(flag_largemodel)
|
||||
n->addable = 9;
|
||||
else
|
||||
n->addable = 10;
|
||||
n->addable = 9;
|
||||
if(n->class == CPARAM || n->class == CAUTO)
|
||||
n->addable = 11;
|
||||
break;
|
||||
|
@ -752,12 +752,7 @@ agenr(Node *n, Node *a, Node *res)
|
||||
regalloc(&n3, types[tptr], res);
|
||||
p1 = gins(ALEAQ, N, &n3);
|
||||
datastring(nl->val.u.sval->s, nl->val.u.sval->len, &p1->from);
|
||||
if(flag_largemodel) {
|
||||
gins(AADDQ, &n2, &n3);
|
||||
} else {
|
||||
p1->from.scale = 1;
|
||||
p1->from.index = n2.val.u.reg;
|
||||
}
|
||||
gins(AADDQ, &n2, &n3);
|
||||
goto indexdone;
|
||||
}
|
||||
|
||||
|
@ -598,11 +598,8 @@ ismem(Node *n)
|
||||
case ONAME:
|
||||
case OPARAM:
|
||||
case OCLOSUREVAR:
|
||||
return 1;
|
||||
case OADDR:
|
||||
if(flag_largemodel)
|
||||
return 1;
|
||||
break;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user