ref: ded3b7ca9b2ea1612b714b6b5d31579f73c63dd1
parent: e7cdf11aa8b4f3bd6f0b6fbda975b38c93cc3d99
author: Ori Bernstein <[email protected]>
date: Thu Jun 14 22:25:50 EDT 2012
Move values in/out of fixed regs We want to be able to use these regs!
--- a/8/isel.c
+++ b/8/isel.c
@@ -374,7 +374,7 @@
Loc *selexpr(Isel *s, Node *n)
{
- Loc *a, *b, *c, *r;
+ Loc *a, *b, *c, *d, *r;
Loc *eax, *edx, *cl; /* x86 wanst some hard-coded regs */
Node **args;
@@ -395,9 +395,10 @@
b = selexpr(s, args[1]);
b = inr(s, b);
c = coreg(Reax, mode(n));
+ r = locreg(a->mode);
g(s, Imov, a, c, NULL);
g(s, Imul, b, NULL);
- r = eax;
+ g(s, Imov, eax, r, NULL);
break;
case Odiv:
case Omod:
@@ -406,13 +407,15 @@
b = selexpr(s, args[1]);
b = inr(s, b);
c = coreg(Reax, mode(n));
+ r = locreg(a->mode);
g(s, Imov, a, c, NULL);
g(s, Ixor, edx, edx, NULL);
g(s, Idiv, b, NULL);
if (exprop(n) == Odiv)
- r = eax;
+ d = eax;
else
- r = edx;
+ d = edx;
+ g(s, Imov, d, r, NULL);
break;
case Oneg:
r = selexpr(s, args[0]);