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) ...@@ -124,10 +124,7 @@ xcom(Node *n)
break; break;
case ONAME: case ONAME:
if(flag_largemodel) n->addable = 9;
n->addable = 9;
else
n->addable = 10;
if(n->class == CPARAM || n->class == CAUTO) if(n->class == CPARAM || n->class == CAUTO)
n->addable = 11; n->addable = 11;
break; break;
......
...@@ -752,12 +752,7 @@ agenr(Node *n, Node *a, Node *res) ...@@ -752,12 +752,7 @@ agenr(Node *n, Node *a, Node *res)
regalloc(&n3, types[tptr], res); regalloc(&n3, types[tptr], res);
p1 = gins(ALEAQ, N, &n3); p1 = gins(ALEAQ, N, &n3);
datastring(nl->val.u.sval->s, nl->val.u.sval->len, &p1->from); datastring(nl->val.u.sval->s, nl->val.u.sval->len, &p1->from);
if(flag_largemodel) { gins(AADDQ, &n2, &n3);
gins(AADDQ, &n2, &n3);
} else {
p1->from.scale = 1;
p1->from.index = n2.val.u.reg;
}
goto indexdone; goto indexdone;
} }
......
...@@ -598,11 +598,8 @@ ismem(Node *n) ...@@ -598,11 +598,8 @@ ismem(Node *n)
case ONAME: case ONAME:
case OPARAM: case OPARAM:
case OCLOSUREVAR: case OCLOSUREVAR:
return 1;
case OADDR: case OADDR:
if(flag_largemodel) return 1;
return 1;
break;
} }
return 0; 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