summaryrefslogtreecommitdiff
path: root/src/cmd/6c/cgen.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/6c/cgen.c')
-rw-r--r--src/cmd/6c/cgen.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/cmd/6c/cgen.c b/src/cmd/6c/cgen.c
index 95400c445..bdef76ff0 100644
--- a/src/cmd/6c/cgen.c
+++ b/src/cmd/6c/cgen.c
@@ -29,6 +29,7 @@
// THE SOFTWARE.
#include "gc.h"
+#include "../../pkg/runtime/funcdata.h"
/* ,x/^(print|prtree)\(/i/\/\/ */
int castup(Type*, Type*);
@@ -392,13 +393,13 @@ cgen(Node *n, Node *nn)
}
}
- if(o == OMUL) {
+ if(o == OMUL || o == OLMUL) {
if(l->addable >= INDEXED) {
t = l;
l = r;
r = t;
}
- /* should favour AX */
+ reg[D_DX]++; // for gopcode case OMUL
regalloc(&nod, l, nn);
cgen(l, &nod);
if(r->addable < INDEXED || hardconst(r)) {
@@ -410,6 +411,7 @@ cgen(Node *n, Node *nn)
gopcode(OMUL, n->type, r, &nod); /* addressible */
gmove(&nod, nn);
regfree(&nod);
+ reg[D_DX]--;
break;
}
@@ -943,6 +945,7 @@ cgen(Node *n, Node *nn)
return;
}
gargs(r, &nod, &nod1);
+ gpcdata(PCDATA_ArgSize, curarg);
if(l->addable < INDEXED) {
reglcgen(&nod, l, nn);
nod.op = OREGISTER;
@@ -950,6 +953,7 @@ cgen(Node *n, Node *nn)
regfree(&nod);
} else
gopcode(OFUNC, n->type, Z, l);
+ gpcdata(PCDATA_ArgSize, -1);
if(REGARG >= 0 && reg[REGARG])
reg[REGARG]--;
if(nn != Z) {
@@ -1678,7 +1682,7 @@ copy:
if(n->complex >= FNX && nn != nil && nn->complex >= FNX) {
t = nn->type;
- nn->type = types[TLONG];
+ nn->type = types[TIND];
regialloc(&nod1, nn, Z);
lcgen(nn, &nod1);
regsalloc(&nod2, nn);
@@ -1785,7 +1789,7 @@ copy:
c = 0;
if(n->complex > nn->complex) {
t = n->type;
- n->type = types[TLONG];
+ n->type = types[TIND];
nodreg(&nod1, n, D_SI);
if(reg[D_SI]) {
gins(APUSHQ, &nod1, Z);
@@ -1796,7 +1800,7 @@ copy:
n->type = t;
t = nn->type;
- nn->type = types[TLONG];
+ nn->type = types[TIND];
nodreg(&nod2, nn, D_DI);
if(reg[D_DI]) {
warn(Z, "DI botch");
@@ -1808,7 +1812,7 @@ warn(Z, "DI botch");
nn->type = t;
} else {
t = nn->type;
- nn->type = types[TLONG];
+ nn->type = types[TIND];
nodreg(&nod2, nn, D_DI);
if(reg[D_DI]) {
warn(Z, "DI botch");
@@ -1820,7 +1824,7 @@ warn(Z, "DI botch");
nn->type = t;
t = n->type;
- n->type = types[TLONG];
+ n->type = types[TIND];
nodreg(&nod1, n, D_SI);
if(reg[D_SI]) {
gins(APUSHQ, &nod1, Z);