mirror of
git://c9x.me/qbe.git
synced 2026-04-05 09:59:47 +00:00
arm64: use IP1 as scratch register
On Apple platforms x18 is not guaranteed to be preserved across context switches. So we now use IP1 as scratch register. En passant, one dubious use of IP0 in arm64/emit.c fixarg() was transitioned to IP1. I believe the previous code could clobber a user value if IP0 was live.
This commit is contained in:
parent
ec5502645f
commit
86d13b93e8
10
arm64/emit.c
10
arm64/emit.c
@ -195,7 +195,7 @@ emitf(char *s, Ins *i, E *e)
|
||||
goto Switch;
|
||||
case '?':
|
||||
if (KBASE(k) == 0)
|
||||
fputs(rname(R18, k), e->f);
|
||||
fputs(rname(IP1, k), e->f);
|
||||
else
|
||||
fputs(k==Ks ? "s31" : "d31", e->f);
|
||||
break;
|
||||
@ -346,9 +346,9 @@ fixarg(Ref *pr, int sz, E *e)
|
||||
if (rtype(r) == RSlot) {
|
||||
s = slot(r, e);
|
||||
if (s > sz * 4095u) {
|
||||
i = &(Ins){Oaddr, Kl, TMP(IP0), {r}};
|
||||
i = &(Ins){Oaddr, Kl, TMP(IP1), {r}};
|
||||
emitins(i, e);
|
||||
*pr = TMP(IP0);
|
||||
*pr = TMP(IP1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -393,7 +393,7 @@ emitins(Ins *i, E *e)
|
||||
if (rtype(i->to) == RSlot) {
|
||||
r = i->to;
|
||||
if (!isreg(i->arg[0])) {
|
||||
i->to = TMP(R18);
|
||||
i->to = TMP(IP1);
|
||||
emitins(i, e);
|
||||
i->arg[0] = i->to;
|
||||
}
|
||||
@ -414,7 +414,7 @@ emitins(Ins *i, E *e)
|
||||
emitins(i, e);
|
||||
break;
|
||||
default:
|
||||
assert(i->to.val != R18);
|
||||
assert(i->to.val != IP1);
|
||||
goto Table;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -16,7 +16,7 @@ int arm64_rclob[] = {
|
||||
-1
|
||||
};
|
||||
|
||||
#define RGLOB (BIT(FP) | BIT(SP) | BIT(R18))
|
||||
#define RGLOB (BIT(FP) | BIT(SP) | BIT(IP1) | BIT(R18))
|
||||
|
||||
static int
|
||||
arm64_memargs(int op)
|
||||
@ -31,7 +31,7 @@ arm64_memargs(int op)
|
||||
.fpr0 = V0, \
|
||||
.nfpr = NFPR, \
|
||||
.rglob = RGLOB, \
|
||||
.nrglob = 3, \
|
||||
.nrglob = 4, \
|
||||
.rsave = arm64_rsave, \
|
||||
.nrsave = {NGPS, NFPS}, \
|
||||
.retregs = arm64_retregs, \
|
||||
|
||||
Loading…
Reference in New Issue
Block a user