riscv: TLC of param passing
factor and cleanup the param passing code somewhat.
This commit is contained in:
parent
c505074a9f
commit
83cf5bf17f
2 changed files with 73 additions and 117 deletions
189
riscv64-gen.c
189
riscv64-gen.c
|
|
@ -433,20 +433,20 @@ static void gcall_or_jmp(int docall)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void reg_pass(CType *type, int *rc, int *fieldofs, int ofs)
|
static void reg_pass_rec(CType *type, int *rc, int *fieldofs, int ofs)
|
||||||
{
|
{
|
||||||
if ((type->t & VT_BTYPE) == VT_STRUCT) {
|
if ((type->t & VT_BTYPE) == VT_STRUCT) {
|
||||||
Sym *f;
|
Sym *f;
|
||||||
if (type->ref->type.t == VT_UNION)
|
if (type->ref->type.t == VT_UNION)
|
||||||
rc[0] = -1;
|
rc[0] = -1;
|
||||||
else for (f = type->ref->next; f; f = f->next)
|
else for (f = type->ref->next; f; f = f->next)
|
||||||
reg_pass(&f->type, rc, fieldofs, ofs + f->c);
|
reg_pass_rec(&f->type, rc, fieldofs, ofs + f->c);
|
||||||
} else if (type->t & VT_ARRAY) {
|
} else if (type->t & VT_ARRAY) {
|
||||||
if (type->ref->c < 0 || type->ref->c > 2)
|
if (type->ref->c < 0 || type->ref->c > 2)
|
||||||
rc[0] = -1;
|
rc[0] = -1;
|
||||||
else {
|
else {
|
||||||
int a, sz = type_size(&type->ref->type, &a);
|
int a, sz = type_size(&type->ref->type, &a);
|
||||||
reg_pass(&type->ref->type, rc, fieldofs, ofs);
|
reg_pass_rec(&type->ref->type, rc, fieldofs, ofs);
|
||||||
if (rc[0] > 2 || (rc[0] == 2 && type->ref->c > 1))
|
if (rc[0] > 2 || (rc[0] == 2 && type->ref->c > 1))
|
||||||
rc[0] = -1;
|
rc[0] = -1;
|
||||||
else if (type->ref->c == 2 && rc[0] && rc[1] == RC_FLOAT) {
|
else if (type->ref->c == 2 && rc[0] && rc[1] == RC_FLOAT) {
|
||||||
|
|
@ -465,20 +465,32 @@ static void reg_pass(CType *type, int *rc, int *fieldofs, int ofs)
|
||||||
rc[0] = -1;
|
rc[0] = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void reg_pass(CType *type, int *prc, int *fieldofs, int named)
|
||||||
|
{
|
||||||
|
prc[0] = 0;
|
||||||
|
reg_pass_rec(type, prc, fieldofs, 0);
|
||||||
|
if (prc[0] <= 0 || !named) {
|
||||||
|
int align, size = type_size(type, &align);
|
||||||
|
prc[0] = (size + 7) >> 3;
|
||||||
|
prc[1] = prc[2] = RC_INT;
|
||||||
|
fieldofs[1] = (0 << 4) | (size <= 1 ? VT_BYTE : size <= 2 ? VT_SHORT : size <= 4 ? VT_INT : VT_LLONG);
|
||||||
|
fieldofs[2] = (8 << 4) | (size <= 9 ? VT_BYTE : size <= 10 ? VT_SHORT : size <= 12 ? VT_INT : VT_LLONG);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ST_FUNC void gfunc_call(int nb_args)
|
ST_FUNC void gfunc_call(int nb_args)
|
||||||
{
|
{
|
||||||
int i, align, size, aireg, afreg;
|
int i, align, size, areg[2];
|
||||||
int info[nb_args ? nb_args : 1];
|
int info[nb_args ? nb_args : 1];
|
||||||
int stack_adj = 0, tempspace = 0, ofs, splitofs = 0;
|
int stack_adj = 0, tempspace = 0, ofs, splitofs = 0;
|
||||||
int force_stack = 0;
|
|
||||||
SValue *sv;
|
SValue *sv;
|
||||||
Sym *sa;
|
Sym *sa;
|
||||||
aireg = afreg = 0;
|
areg[0] = 0; /* int arg regs */
|
||||||
|
areg[1] = 8; /* float arg regs */
|
||||||
sa = vtop[-nb_args].type.ref->next;
|
sa = vtop[-nb_args].type.ref->next;
|
||||||
for (i = 0; i < nb_args; i++) {
|
for (i = 0; i < nb_args; i++) {
|
||||||
int *pareg, nregs, byref = 0, tempofs;
|
int nregs, byref = 0, tempofs;
|
||||||
int prc[3], fieldofs[3];
|
int prc[3], fieldofs[3];
|
||||||
prc[0] = 0;
|
|
||||||
sv = &vtop[1 + i - nb_args];
|
sv = &vtop[1 + i - nb_args];
|
||||||
sv->type.t &= ~VT_ARRAY; // XXX this should be done in tccgen.c
|
sv->type.t &= ~VT_ARRAY; // XXX this should be done in tccgen.c
|
||||||
size = type_size(&sv->type, &align);
|
size = type_size(&sv->type, &align);
|
||||||
|
|
@ -489,53 +501,43 @@ ST_FUNC void gfunc_call(int nb_args)
|
||||||
tempofs = tempspace;
|
tempofs = tempspace;
|
||||||
tempspace += size;
|
tempspace += size;
|
||||||
size = align = 8;
|
size = align = 8;
|
||||||
byref = 1;
|
byref = 64 | (tempofs << 7);
|
||||||
}
|
|
||||||
if (size > 8)
|
|
||||||
nregs = 2;
|
|
||||||
else
|
|
||||||
nregs = 1;
|
|
||||||
if (!sa) {
|
|
||||||
prc[0] = nregs, prc[1] = prc[2] = RC_INT;
|
|
||||||
} else {
|
|
||||||
reg_pass(&sv->type, prc, fieldofs, 0);
|
|
||||||
if (prc[0] < 0)
|
|
||||||
prc[0] = nregs, prc[1] = prc[2] = RC_INT;
|
|
||||||
}
|
}
|
||||||
|
reg_pass(&sv->type, prc, fieldofs, sa != 0);
|
||||||
if (!sa && align == 2*XLEN && size <= 2*XLEN)
|
if (!sa && align == 2*XLEN && size <= 2*XLEN)
|
||||||
aireg = (aireg + 1) & ~1;
|
areg[0] = (areg[0] + 1) & ~1;
|
||||||
nregs = prc[0];
|
nregs = prc[0];
|
||||||
assert(nregs);
|
if ((prc[1] == RC_INT && areg[0] >= 8)
|
||||||
if (!nregs
|
|| (prc[1] == RC_FLOAT && areg[1] >= 16)
|
||||||
|| (prc[1] == RC_INT && aireg >= 8)
|
|| (nregs == 2 && prc[1] == RC_FLOAT && prc[2] == RC_FLOAT
|
||||||
|| (prc[1] == RC_FLOAT && afreg >= 8)
|
&& areg[1] >= 15)
|
||||||
|| (nregs == 2 && prc[2] == RC_FLOAT && afreg >= 7)
|
|| (nregs == 2 && prc[1] != prc[2]
|
||||||
|| (nregs == 2 && prc[1] != prc[2] && (afreg >= 8 || aireg >= 8))
|
&& (areg[1] >= 16 || areg[0] >= 8))) {
|
||||||
|| force_stack) {
|
|
||||||
info[i] = 32;
|
info[i] = 32;
|
||||||
if (align < XLEN)
|
if (align < XLEN)
|
||||||
align = XLEN;
|
align = XLEN;
|
||||||
stack_adj += (size + align - 1) & -align;
|
stack_adj += (size + align - 1) & -align;
|
||||||
if (!sa)
|
if (!sa) /* one vararg on stack forces the rest on stack */
|
||||||
force_stack = 1;
|
areg[0] = 8, areg[1] = 16;
|
||||||
} else {
|
} else {
|
||||||
if (prc[1] == RC_FLOAT)
|
info[i] = areg[prc[1] - 1]++;
|
||||||
info[i] = 8 + afreg++;
|
if (!byref)
|
||||||
else
|
info[i] |= (fieldofs[1] & VT_BTYPE) << 12;
|
||||||
info[i] = aireg++;
|
assert(!(fieldofs[1] >> 4));
|
||||||
if (nregs == 2) {
|
if (nregs == 2) {
|
||||||
if (prc[2] == RC_FLOAT)
|
if (prc[2] == RC_FLOAT || areg[0] < 8)
|
||||||
info[i] |= (1 + 8 + afreg++) << 7;
|
info[i] |= (1 + areg[prc[2] - 1]++) << 7;
|
||||||
else if (aireg < 8)
|
|
||||||
info[i] |= (1 + aireg++) << 7;
|
|
||||||
else {
|
else {
|
||||||
info[i] |= 16;
|
info[i] |= 16;
|
||||||
stack_adj += 8;
|
stack_adj += 8;
|
||||||
}
|
}
|
||||||
|
if (!byref) {
|
||||||
|
assert((fieldofs[2] >> 4) < 2048);
|
||||||
|
info[i] |= fieldofs[2] << (12 + 4); // includes offset
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (byref)
|
}
|
||||||
info[i] |= 64 | (tempofs << 7);
|
info[i] |= byref;
|
||||||
if (sa)
|
if (sa)
|
||||||
sa = sa->next;
|
sa = sa->next;
|
||||||
}
|
}
|
||||||
|
|
@ -544,7 +546,7 @@ ST_FUNC void gfunc_call(int nb_args)
|
||||||
if (stack_adj + tempspace) {
|
if (stack_adj + tempspace) {
|
||||||
EI(0x13, 0, 2, 2, -(stack_adj + tempspace)); // addi sp, sp, -adj
|
EI(0x13, 0, 2, 2, -(stack_adj + tempspace)); // addi sp, sp, -adj
|
||||||
for (i = ofs = 0; i < nb_args; i++) {
|
for (i = ofs = 0; i < nb_args; i++) {
|
||||||
if (info[i] >= 32) {
|
if (info[i] & (64 | 32)) {
|
||||||
vrotb(nb_args - i);
|
vrotb(nb_args - i);
|
||||||
size = type_size(&vtop->type, &align);
|
size = type_size(&vtop->type, &align);
|
||||||
if (info[i] & 64) {
|
if (info[i] & 64) {
|
||||||
|
|
@ -587,26 +589,19 @@ ST_FUNC void gfunc_call(int nb_args)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (i = 0; i < nb_args; i++) {
|
for (i = 0; i < nb_args; i++) {
|
||||||
int r = info[nb_args - 1 - i], r2 = r;
|
int ii = info[nb_args - 1 - i], r = ii, r2 = r;
|
||||||
if (!(r & 32)) {
|
if (!(r & 32)) {
|
||||||
CType origtype;
|
CType origtype;
|
||||||
int prc[3], fieldofs[3], loadt;
|
int loadt;
|
||||||
prc[0] = 0;
|
|
||||||
r &= 15;
|
r &= 15;
|
||||||
r2 = r2 & 64 ? 0 : r2 >> 7;
|
r2 = r2 & 64 ? 0 : (r2 >> 7) & 31;
|
||||||
|
assert(r2 <= 16);
|
||||||
vrotb(i+1);
|
vrotb(i+1);
|
||||||
origtype = vtop->type;
|
origtype = vtop->type;
|
||||||
size = type_size(&vtop->type, &align);
|
size = type_size(&vtop->type, &align);
|
||||||
reg_pass(&vtop->type, prc, fieldofs, 0);
|
|
||||||
if (prc[0] <= 0 || (!r2 && prc[0] > 1)) {
|
|
||||||
prc[0] = (size + 7) >> 3;
|
|
||||||
prc[1] = prc[2] = RC_INT;
|
|
||||||
fieldofs[1] = (0 << 4) | (size <= 1 ? VT_BYTE : size <= 2 ? VT_SHORT : size <= 4 ? VT_INT : VT_LLONG);
|
|
||||||
fieldofs[2] = (8 << 4) | (size <= 9 ? VT_BYTE : size <= 10 ? VT_SHORT : size <= 12 ? VT_INT : VT_LLONG);
|
|
||||||
}
|
|
||||||
loadt = vtop->type.t & VT_BTYPE;
|
loadt = vtop->type.t & VT_BTYPE;
|
||||||
if (loadt == VT_STRUCT) {
|
if (loadt == VT_STRUCT) {
|
||||||
loadt = fieldofs[1] & VT_BTYPE;
|
loadt = (ii >> 12) & VT_BTYPE;
|
||||||
}
|
}
|
||||||
if (info[nb_args - 1 - i] & 16) {
|
if (info[nb_args - 1 - i] & 16) {
|
||||||
assert(!r2);
|
assert(!r2);
|
||||||
|
|
@ -629,13 +624,13 @@ ST_FUNC void gfunc_call(int nb_args)
|
||||||
vswap();
|
vswap();
|
||||||
gaddrof();
|
gaddrof();
|
||||||
vtop->type = char_pointer_type;
|
vtop->type = char_pointer_type;
|
||||||
vpushi(fieldofs[2] >> 4);
|
vpushi(ii >> 20);
|
||||||
gen_op('+');
|
gen_op('+');
|
||||||
indir();
|
indir();
|
||||||
vtop->type = origtype;
|
vtop->type = origtype;
|
||||||
loadt = vtop->type.t & VT_BTYPE;
|
loadt = vtop->type.t & VT_BTYPE;
|
||||||
if (loadt == VT_STRUCT) {
|
if (loadt == VT_STRUCT) {
|
||||||
loadt = fieldofs[2] & VT_BTYPE;
|
loadt = (ii >> 16) & VT_BTYPE;
|
||||||
}
|
}
|
||||||
save_reg_upstack(r2, 1);
|
save_reg_upstack(r2, 1);
|
||||||
vtop->type.t = loadt;
|
vtop->type.t = loadt;
|
||||||
|
|
@ -671,7 +666,7 @@ ST_FUNC void gfunc_prolog(CType *func_type)
|
||||||
{
|
{
|
||||||
int i, addr, align, size;
|
int i, addr, align, size;
|
||||||
int param_addr = 0;
|
int param_addr = 0;
|
||||||
int aireg, afreg;
|
int areg[2];
|
||||||
Sym *sym;
|
Sym *sym;
|
||||||
CType *type;
|
CType *type;
|
||||||
|
|
||||||
|
|
@ -681,69 +676,51 @@ ST_FUNC void gfunc_prolog(CType *func_type)
|
||||||
func_sub_sp_offset = ind;
|
func_sub_sp_offset = ind;
|
||||||
ind += 5 * 4;
|
ind += 5 * 4;
|
||||||
|
|
||||||
aireg = afreg = 0;
|
areg[0] = 0, areg[1] = 0;
|
||||||
addr = 0; // XXX not correct
|
addr = 0;
|
||||||
/* if the function returns by reference, then add an
|
/* if the function returns by reference, then add an
|
||||||
implicit pointer parameter */
|
implicit pointer parameter */
|
||||||
size = type_size(&func_vt, &align);
|
size = type_size(&func_vt, &align);
|
||||||
if (size > 2 * XLEN) {
|
if (size > 2 * XLEN) {
|
||||||
loc -= 8;
|
loc -= 8;
|
||||||
func_vc = loc;
|
func_vc = loc;
|
||||||
ES(0x23, 3, 8, 10 + aireg, loc); // sd a0, loc(s0)
|
ES(0x23, 3, 8, 10 + areg[0]++, loc); // sd a0, loc(s0)
|
||||||
aireg++;
|
|
||||||
}
|
}
|
||||||
/* define parameters */
|
/* define parameters */
|
||||||
while ((sym = sym->next) != NULL) {
|
while ((sym = sym->next) != NULL) {
|
||||||
int byref = 0;
|
int byref = 0;
|
||||||
|
int regcount;
|
||||||
|
int prc[3], fieldofs[3];
|
||||||
type = &sym->type;
|
type = &sym->type;
|
||||||
size = type_size(type, &align);
|
size = type_size(type, &align);
|
||||||
if (size > 2 * XLEN) {
|
if (size > 2 * XLEN) {
|
||||||
type = &char_pointer_type;
|
type = &char_pointer_type;
|
||||||
size = align = byref = 8;
|
size = align = byref = 8;
|
||||||
}
|
}
|
||||||
if (size > 2 * XLEN) {
|
reg_pass(type, prc, fieldofs, 1);
|
||||||
from_stack:
|
regcount = prc[0];
|
||||||
|
if (areg[prc[1] - 1] >= 8
|
||||||
|
|| (regcount == 2
|
||||||
|
&& ((prc[1] == RC_FLOAT && prc[2] == RC_FLOAT && areg[1] >= 7)
|
||||||
|
|| (prc[1] != prc[2] && (areg[1] >= 8 || areg[0] >= 8))))) {
|
||||||
if (align < XLEN)
|
if (align < XLEN)
|
||||||
align = XLEN;
|
align = XLEN;
|
||||||
addr = (addr + align - 1) & -align;
|
addr = (addr + align - 1) & -align;
|
||||||
param_addr = addr;
|
param_addr = addr;
|
||||||
addr += size;
|
addr += size;
|
||||||
} else {
|
} else {
|
||||||
int regcount, *pareg;
|
|
||||||
int prc[3], fieldofs[3];
|
|
||||||
prc[0] = 0;
|
|
||||||
reg_pass(type, prc, fieldofs, 0);
|
|
||||||
if (prc[0] <= 0) {
|
|
||||||
prc[0] = (size + 7) >> 3;
|
|
||||||
prc[1] = prc[2] = RC_INT;
|
|
||||||
fieldofs[1] = (0 << 4) | (size <= 1 ? VT_BYTE : size <= 2 ? VT_SHORT : size <= 4 ? VT_INT : VT_LLONG);
|
|
||||||
fieldofs[2] = (8 << 4) | (size <= 9 ? VT_BYTE : size <= 10 ? VT_SHORT : size <= 12 ? VT_INT : VT_LLONG);
|
|
||||||
}
|
|
||||||
regcount = prc[0];
|
|
||||||
if (!regcount
|
|
||||||
|| (prc[1] == RC_INT && aireg >= 8)
|
|
||||||
|| (prc[1] == RC_FLOAT && afreg >= 8)
|
|
||||||
|| (regcount == 2 && prc[2] == RC_FLOAT && afreg >= 7)
|
|
||||||
|| (regcount == 2 && prc[1] != prc[2] && (afreg >= 8 || aireg >= 8)))
|
|
||||||
goto from_stack;
|
|
||||||
if (size > XLEN)
|
|
||||||
assert(regcount == 2);
|
|
||||||
loc -= regcount * 8; // XXX could reserve only 'size' bytes
|
loc -= regcount * 8; // XXX could reserve only 'size' bytes
|
||||||
param_addr = loc;
|
param_addr = loc;
|
||||||
for (i = 0; i < regcount; i++) {
|
for (i = 0; i < regcount; i++) {
|
||||||
pareg = prc[1+i] == RC_INT ? &aireg : &afreg;
|
if (areg[prc[1+i] - 1] >= 8) {
|
||||||
if (*pareg >= 8) {
|
|
||||||
assert(i == 1 && regcount == 2 && !(addr & 7));
|
assert(i == 1 && regcount == 2 && !(addr & 7));
|
||||||
EI(0x03, 3, 5, 8, addr); // ld t0, addr(s0)
|
EI(0x03, 3, 5, 8, addr); // ld t0, addr(s0)
|
||||||
addr += 8;
|
addr += 8;
|
||||||
ES(0x23, 3, 8, 5, loc + i*8); // sd t0, loc(s0)
|
ES(0x23, 3, 8, 5, loc + i*8); // sd t0, loc(s0)
|
||||||
continue;
|
} else if (prc[1+i] == RC_FLOAT) {
|
||||||
}
|
ES(0x27, (size / regcount) == 4 ? 2 : 3, 8, 10 + areg[1]++, loc + (fieldofs[i+1] >> 4)); // fs[wd] FAi, loc(s0)
|
||||||
if (pareg == &afreg) {
|
|
||||||
//assert(type->t == VT_FLOAT || type->t == VT_DOUBLE);
|
|
||||||
ES(0x27, (size / regcount) == 4 ? 2 : 3, 8, 10 + afreg++, loc + (fieldofs[i+1] >> 4)); // fs[wd] FAi, loc(s0)
|
|
||||||
} else {
|
} else {
|
||||||
ES(0x23, 3, 8, 10 + aireg++, loc + i*8); // sd aX, loc(s0) // XXX
|
ES(0x23, 3, 8, 10 + areg[0]++, loc + i*8); // sd aX, loc(s0) // XXX
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -754,9 +731,9 @@ ST_FUNC void gfunc_prolog(CType *func_type)
|
||||||
func_va_list_ofs = addr;
|
func_va_list_ofs = addr;
|
||||||
num_va_regs = 0;
|
num_va_regs = 0;
|
||||||
if (func_type->ref->f.func_type == FUNC_ELLIPSIS) {
|
if (func_type->ref->f.func_type == FUNC_ELLIPSIS) {
|
||||||
for (; aireg < 8; aireg++) {
|
for (; areg[0] < 8; areg[0]++) {
|
||||||
num_va_regs++;
|
num_va_regs++;
|
||||||
ES(0x23, 3, 8, 10 + aireg, -8 + num_va_regs * 8); // sd aX, loc(s0)
|
ES(0x23, 3, 8, 10 + areg[0], -8 + num_va_regs * 8); // sd aX, loc(s0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -764,22 +741,14 @@ ST_FUNC void gfunc_prolog(CType *func_type)
|
||||||
ST_FUNC int gfunc_sret(CType *vt, int variadic, CType *ret,
|
ST_FUNC int gfunc_sret(CType *vt, int variadic, CType *ret,
|
||||||
int *ret_align, int *regsize)
|
int *ret_align, int *regsize)
|
||||||
{
|
{
|
||||||
int align, size = type_size(vt, &align), infreg, nregs;
|
int align, size = type_size(vt, &align), nregs;
|
||||||
int prc[3], fieldofs[3];
|
int prc[3], fieldofs[3];
|
||||||
*ret_align = 1;
|
*ret_align = 1;
|
||||||
*regsize = 8;
|
*regsize = 8;
|
||||||
if (size > 16)
|
if (size > 16)
|
||||||
return 0;
|
return 0;
|
||||||
prc[0] = 0;
|
reg_pass(vt, prc, fieldofs, 1);
|
||||||
reg_pass(vt, prc, fieldofs, 0);
|
|
||||||
if (prc[0] <= 0) {
|
|
||||||
prc[0] = (size + 7) >> 3;
|
|
||||||
prc[1] = prc[2] = RC_INT;
|
|
||||||
fieldofs[1] = (0 << 4) | (size <= 1 ? VT_BYTE : size <= 2 ? VT_SHORT : size <= 4 ? VT_INT : VT_LLONG);
|
|
||||||
fieldofs[2] = (8 << 4) | (size <= 9 ? VT_BYTE : size <= 10 ? VT_SHORT : size <= 12 ? VT_INT : VT_LLONG);
|
|
||||||
}
|
|
||||||
nregs = prc[0];
|
nregs = prc[0];
|
||||||
assert(nregs > 0);
|
|
||||||
if (nregs == 2 && prc[1] != prc[2])
|
if (nregs == 2 && prc[1] != prc[2])
|
||||||
return -1; /* generic code can't deal with this case */
|
return -1; /* generic code can't deal with this case */
|
||||||
if (prc[1] == RC_FLOAT) {
|
if (prc[1] == RC_FLOAT) {
|
||||||
|
|
@ -792,22 +761,15 @@ ST_FUNC int gfunc_sret(CType *vt, int variadic, CType *ret,
|
||||||
ST_FUNC void arch_transfer_ret_regs(int aftercall)
|
ST_FUNC void arch_transfer_ret_regs(int aftercall)
|
||||||
{
|
{
|
||||||
int prc[3], fieldofs[3];
|
int prc[3], fieldofs[3];
|
||||||
prc[0] = 0;
|
reg_pass(&vtop->type, prc, fieldofs, 1);
|
||||||
reg_pass(&vtop->type, prc, fieldofs, 0);
|
|
||||||
assert(prc[0] == 2 && prc[1] != prc[2] && !(fieldofs[1] >> 4));
|
assert(prc[0] == 2 && prc[1] != prc[2] && !(fieldofs[1] >> 4));
|
||||||
assert(vtop->r == (VT_LOCAL | VT_LVAL));
|
assert(vtop->r == (VT_LOCAL | VT_LVAL));
|
||||||
vpushv(vtop);
|
vpushv(vtop);
|
||||||
vtop->type.t = fieldofs[1] & VT_BTYPE;
|
vtop->type.t = fieldofs[1] & VT_BTYPE;
|
||||||
if (aftercall)
|
(aftercall ? store : load)(prc[1] == RC_INT ? REG_IRET : REG_FRET, vtop);
|
||||||
store(prc[1] == RC_INT ? REG_IRET : REG_FRET, vtop);
|
|
||||||
else
|
|
||||||
load(prc[1] == RC_INT ? REG_IRET : REG_FRET, vtop);
|
|
||||||
vtop->c.i += fieldofs[2] >> 4;
|
vtop->c.i += fieldofs[2] >> 4;
|
||||||
vtop->type.t = fieldofs[2] & VT_BTYPE;
|
vtop->type.t = fieldofs[2] & VT_BTYPE;
|
||||||
if (aftercall)
|
(aftercall ? store : load)(prc[2] == RC_INT ? REG_IRET : REG_FRET, vtop);
|
||||||
store(prc[2] == RC_INT ? REG_IRET : REG_FRET, vtop);
|
|
||||||
else
|
|
||||||
load(prc[2] == RC_INT ? REG_IRET : REG_FRET, vtop);
|
|
||||||
vtop--;
|
vtop--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -857,11 +819,6 @@ ST_FUNC void gen_va_start(void)
|
||||||
vset(&char_pointer_type, VT_LOCAL, func_va_list_ofs);
|
vset(&char_pointer_type, VT_LOCAL, func_va_list_ofs);
|
||||||
}
|
}
|
||||||
|
|
||||||
ST_FUNC void gen_va_arg(CType *t)
|
|
||||||
{
|
|
||||||
tcc_error("implement me: %s", __FUNCTION__);
|
|
||||||
}
|
|
||||||
|
|
||||||
ST_FUNC void gen_fill_nops(int bytes)
|
ST_FUNC void gen_fill_nops(int bytes)
|
||||||
{
|
{
|
||||||
if ((bytes & 3))
|
if ((bytes & 3))
|
||||||
|
|
|
||||||
1
tcc.h
1
tcc.h
|
|
@ -1606,7 +1606,6 @@ ST_FUNC void gen_cvt_sxtw(void);
|
||||||
ST_FUNC void gen_opl(int op);
|
ST_FUNC void gen_opl(int op);
|
||||||
//ST_FUNC void gfunc_return(CType *func_type);
|
//ST_FUNC void gfunc_return(CType *func_type);
|
||||||
ST_FUNC void gen_va_start(void);
|
ST_FUNC void gen_va_start(void);
|
||||||
ST_FUNC void gen_va_arg(CType *t);
|
|
||||||
ST_FUNC void arch_transfer_ret_regs(int);
|
ST_FUNC void arch_transfer_ret_regs(int);
|
||||||
#endif
|
#endif
|
||||||
/* ------------ c67-gen.c ------------ */
|
/* ------------ c67-gen.c ------------ */
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue