Commit ce35994d authored by Russ Cox's avatar Russ Cox

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
parent 3763a395
......@@ -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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment