mirror of
git://c9x.me/qbe.git
synced 2026-05-26 15:34:41 +00:00
nits
This commit is contained in:
parent
fee64f4341
commit
5ac78c67c9
38
amd64/emit.c
38
amd64/emit.c
@ -196,10 +196,8 @@ emitcon(Con *con, E *e)
|
||||
l = str(con->sym.id);
|
||||
p = l[0] == '"' ? "" : T.assym;
|
||||
if (con->sym.type & SThr) {
|
||||
if (T.apple)
|
||||
fprintf(e->f, "%s%s@TLVP", p, l);
|
||||
else
|
||||
fprintf(e->f, "%%fs:%s%s@tpoff", p, l);
|
||||
assert(!T.apple);
|
||||
fprintf(e->f, "%%fs:%s%s@tpoff", p, l);
|
||||
} else
|
||||
fprintf(e->f, "%s%s", p, l);
|
||||
if (con->bits.i)
|
||||
@ -532,14 +530,14 @@ emitins(Ins i, E *e)
|
||||
emitf("mov%k %0, %=", &i, e);
|
||||
break;
|
||||
case Oaddr:
|
||||
if (!T.apple
|
||||
&& rtype(i.arg[0]) == RCon
|
||||
&& e->fn->con[i.arg[0].val].sym.type == SThr) {
|
||||
if (rtype(i.arg[0]) != RCon)
|
||||
goto Table;
|
||||
assert(isreg(i.to));
|
||||
con = &e->fn->con[i.arg[0].val];
|
||||
sym = str(con->sym.id);
|
||||
if (!T.apple && con->sym.type == SThr) {
|
||||
/* derive the symbol address from the TCB
|
||||
* address at offset 0 of %fs */
|
||||
assert(isreg(i.to));
|
||||
con = &e->fn->con[i.arg[0].val];
|
||||
sym = str(con->sym.id);
|
||||
emitf("movq %%fs:0, %L=", &i, e);
|
||||
fprintf(e->f, "\tleaq %s%s@tpoff",
|
||||
sym[0] == '"' ? "" : T.assym, sym);
|
||||
@ -551,14 +549,16 @@ emitins(Ins i, E *e)
|
||||
regtoa(i.to.val, SLong));
|
||||
break;
|
||||
}
|
||||
if (!T.apple
|
||||
&& rtype(i.arg[0]) == RCon
|
||||
&& e->fn->con[i.arg[0].val].sym.type == SExtThr) {
|
||||
if (T.apple && con->sym.type == SThr) {
|
||||
fprintf(e->f,
|
||||
"\tmovq %s%s@TLVP(%%rip), %%%s\n",
|
||||
sym[0] == '"' ? "" : T.assym, sym,
|
||||
regtoa(i.to.val, SLong));
|
||||
break;
|
||||
}
|
||||
if (!T.apple && con->sym.type == SExtThr) {
|
||||
/* initial-exec TLS: load offset from
|
||||
* GOT, add to thread-base register */
|
||||
assert(isreg(i.to));
|
||||
con = &e->fn->con[i.arg[0].val];
|
||||
sym = str(con->sym.id);
|
||||
assert(!con->bits.i);
|
||||
emitf("movq %%fs:0, %L=", &i, e);
|
||||
fprintf(e->f,
|
||||
@ -567,12 +567,8 @@ emitins(Ins i, E *e)
|
||||
regtoa(i.to.val, SLong));
|
||||
break;
|
||||
}
|
||||
if (rtype(i.arg[0]) == RCon
|
||||
&& e->fn->con[i.arg[0].val].sym.type == SExt) {
|
||||
if (con->sym.type == SExt) {
|
||||
/* load address from the GOT */
|
||||
assert(isreg(i.to));
|
||||
con = &e->fn->con[i.arg[0].val];
|
||||
sym = str(con->sym.id);
|
||||
assert(!con->bits.i);
|
||||
fprintf(e->f,
|
||||
"\tmovq %s%s@gotpcrel(%%rip), %%%s\n",
|
||||
|
||||
@ -143,10 +143,7 @@ fixarg(Ref *r, int k, Ins *i, Fn *fn)
|
||||
cc = *c;
|
||||
cc.bits.i = 0;
|
||||
r3 = newcon(&cc, fn);
|
||||
if (T.apple && (c->sym.type & SThr))
|
||||
emit(Oload, Kl, r2, r3, R);
|
||||
else
|
||||
emit(Oaddr, Kl, r2, r3, R);
|
||||
emit(Oaddr, Kl, r2, r3, R);
|
||||
if (rtype(r0) == RMem) {
|
||||
m = &fn->mem[r0.val];
|
||||
m->offset.type = CUndef;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user