mirror of
https://github.com/golang/go
synced 2024-10-04 15:09:59 +00:00
genembedtramp for arm
R=rsc APPROVED=rsc DELTA=104 (0 added, 33 deleted, 71 changed) OCL=33531 CL=33535
This commit is contained in:
parent
22140a17a0
commit
8e96b45fd6
|
@ -570,110 +570,77 @@ dsymptr(Sym *s, int off, Sym *x, int xoff)
|
||||||
void
|
void
|
||||||
genembedtramp(Type *rcvr, Type *method, Sym *newnam)
|
genembedtramp(Type *rcvr, Type *method, Sym *newnam)
|
||||||
{
|
{
|
||||||
fatal("genembedtramp not implemented");
|
Sym *e;
|
||||||
// TODO(kaib): re-lift from 8g
|
int c, d, o;
|
||||||
// Sym *e;
|
Prog *p;
|
||||||
// int c, d, o, loaded;
|
Type *f;
|
||||||
// Prog *p;
|
|
||||||
// Type *f;
|
|
||||||
|
|
||||||
// e = lookup(b->name);
|
e = method->sym;
|
||||||
// for(d=0; d<nelem(dotlist); d++) {
|
for(d=0; d<nelem(dotlist); d++) {
|
||||||
// c = adddot1(e, t, d, nil);
|
c = adddot1(e, rcvr, d, nil);
|
||||||
// if(c == 1)
|
if(c == 1)
|
||||||
// goto out;
|
goto out;
|
||||||
// }
|
}
|
||||||
// fatal("genembedtramp %T.%s", t, b->name);
|
fatal("genembedtramp %T.%S", rcvr, method->sym);
|
||||||
|
|
||||||
// out:
|
out:
|
||||||
// // print("genembedtramp %d\n", d);
|
newplist()->name = newname(newnam);
|
||||||
// // print(" t = %lT\n", t);
|
|
||||||
// // print(" name = %s\n", b->name);
|
|
||||||
// // print(" sym = %S\n", b->sym);
|
|
||||||
// // print(" hash = 0x%ux\n", b->hash);
|
|
||||||
|
|
||||||
// newplist()->name = newname(b->sym);
|
//TEXT main·S_test2(SB),7,$0
|
||||||
|
p = pc;
|
||||||
|
gins(ATEXT, N, N);
|
||||||
|
p->from.type = D_OREG;
|
||||||
|
p->from.name = D_EXTERN;
|
||||||
|
p->from.sym = newnam;
|
||||||
|
p->to.type = D_CONST2;
|
||||||
|
p->reg = 7;
|
||||||
|
p->to.offset2 = 0;
|
||||||
|
p->to.reg = NREG;
|
||||||
|
print("1. %P\n", p);
|
||||||
|
|
||||||
// //TEXT main·S_test2(SB),7,$0
|
o = 0;
|
||||||
// p = pc;
|
for(c=d-1; c>=0; c--) {
|
||||||
// gins(ATEXT, N, N);
|
f = dotlist[c].field;
|
||||||
// p->from.type = D_EXTERN;
|
o += f->width;
|
||||||
// p->from.sym = b->sym;
|
if(!isptr[f->type->etype])
|
||||||
// p->to.type = D_CONST;
|
continue;
|
||||||
// p->to.offset = 0;
|
|
||||||
// p->reg = 7;
|
|
||||||
// //print("1. %P\n", p);
|
|
||||||
|
|
||||||
// loaded = 0;
|
//MOVW o(R0), R0
|
||||||
// o = 0;
|
p = pc;
|
||||||
// for(c=d-1; c>=0; c--) {
|
gins(AMOVW, N, N);
|
||||||
// f = dotlist[c].field;
|
p->from.type = D_OREG;
|
||||||
// o += f->width;
|
p->from.reg = REGARG;
|
||||||
// if(!isptr[f->type->etype])
|
p->from.offset = o;
|
||||||
// continue;
|
p->to.type = D_REG;
|
||||||
// if(!loaded) {
|
p->to.reg = REGARG;
|
||||||
// loaded = 1;
|
print("2. %P\n", p);
|
||||||
// //MOVQ 8(SP), AX
|
o = 0;
|
||||||
// p = pc;
|
}
|
||||||
// gins(AMOVQ, N, N);
|
if(o != 0) {
|
||||||
// p->from.type = D_INDIR+D_SP;
|
//MOVW $XX(R0), R0
|
||||||
// p->from.offset = 8;
|
p = pc;
|
||||||
// p->to.type = D_AX;
|
gins(AMOVW, N, N);
|
||||||
// //print("2. %P\n", p);
|
p->from.type = D_CONST;
|
||||||
// }
|
p->from.reg = REGARG;
|
||||||
|
p->from.offset = o;
|
||||||
|
p->to.type = D_REG;
|
||||||
|
p->to.reg = REGARG;
|
||||||
|
print("3. %P\n", p);
|
||||||
|
}
|
||||||
|
|
||||||
// //MOVQ o(AX), AX
|
f = dotlist[0].field;
|
||||||
// p = pc;
|
//B main·*Sub_test2(SB)
|
||||||
// gins(AMOVQ, N, N);
|
if(isptr[f->type->etype])
|
||||||
// p->from.type = D_INDIR+D_AX;
|
f = f->type;
|
||||||
// p->from.offset = o;
|
p = pc;
|
||||||
// p->to.type = D_AX;
|
gins(AB, N, N);
|
||||||
// //print("3. %P\n", p);
|
p->to.type = D_OREG;
|
||||||
// o = 0;
|
p->to.reg = NREG;
|
||||||
// }
|
p->to.name = D_EXTERN;
|
||||||
// if(o != 0) {
|
p->to.sym = methodsym(method->sym, ptrto(f->type));
|
||||||
// //ADDQ $XX, AX
|
print("4. %P\n", p);
|
||||||
// p = pc;
|
|
||||||
// gins(AADDQ, N, N);
|
|
||||||
// p->from.type = D_CONST;
|
|
||||||
// p->from.offset = o;
|
|
||||||
// if(loaded)
|
|
||||||
// p->to.type = D_AX;
|
|
||||||
// else {
|
|
||||||
// p->to.type = D_INDIR+D_SP;
|
|
||||||
// p->to.offset = 8;
|
|
||||||
// }
|
|
||||||
// //print("4. %P\n", p);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// //MOVQ AX, 8(SP)
|
pc->as = ARET; // overwrite AEND
|
||||||
// if(loaded) {
|
|
||||||
// p = pc;
|
|
||||||
// gins(AMOVQ, N, N);
|
|
||||||
// p->from.type = D_AX;
|
|
||||||
// p->to.type = D_INDIR+D_SP;
|
|
||||||
// p->to.offset = 8;
|
|
||||||
// //print("5. %P\n", p);
|
|
||||||
// } else {
|
|
||||||
// // TODO(rsc): obviously this is unnecessary,
|
|
||||||
// // but 6l has a bug, and it can't handle
|
|
||||||
// // JMP instructions too close to the top of
|
|
||||||
// // a new function.
|
|
||||||
// p = pc;
|
|
||||||
// gins(ANOP, N, N);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// f = dotlist[0].field;
|
|
||||||
// //JMP main·*Sub_test2(SB)
|
|
||||||
// if(isptr[f->type->etype])
|
|
||||||
// f = f->type;
|
|
||||||
// p = pc;
|
|
||||||
// gins(AJMP, N, N);
|
|
||||||
// p->to.type = D_EXTERN;
|
|
||||||
// p->to.sym = methodsym(lookup(b->name), ptrto(f->type));
|
|
||||||
// //print("6. %P\n", p);
|
|
||||||
|
|
||||||
// pc->as = ARET; // overwrite AEND
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in a new issue