Le mercredi 06 août 2014, 18:40:19 Roy Tam a écrit : > Hello, > > 2014-08-06 18:27 GMT+08:00 YX Hao <[email protected]>: > > Hi there, > > > > Here is what I found: > > > > ---------------------------------------- > > math.h:341: error: unknown constraint 't' > > ---------------------------------------- > > > > And more around this line. > > > > I know little about asm. Can somebody take a look at it? > > I have a little patch for that, someone please review it. > Thank you.
Note that i386-asm.c is probably one of the piece of tcc I know the least (I think it comes second after the Windows stuff). If you are still interested in my review, see below. > > diff --git a/i386-asm.c b/i386-asm.c > index 664aade..1a24e30 100644 > --- a/i386-asm.c > +++ b/i386-asm.c > @@ -1029,6 +1029,9 @@ static inline int constraint_priority(const char *str) > case 'i': > case 'm': > case 'g': > + case 'f': > + case 't': > + case 'u': > pr = 4; > break; > default: It would be nice if you take advantage of your patch to sort this block as with LC_COLLATE=C (f, i, g, m, t, u, I, N, M). I can't comment on the priority though, I didn't know about the priority between constraints. > @@ -1211,6 +1214,11 @@ ST_FUNC void asm_compute_constraints(ASMOperand > *operands, > if (!((op->vt->r & (VT_VALMASK | VT_LVAL | VT_SYM)) == > VT_CONST)) goto try_next; > break; > + case 'f': > + case 't': > + case 'u': > + /* float */ > + break; > case 'm': > case 'g': > /* nothing special to do because the operand is already in As I said I'm not a specialist of this code but it seems to me that 't' should do reg = TREG_ST0, then add something that says it's a float register and finally call goto alloc_reg. For 'u' it would be similar with TREG_ST1 but it doesn't exist so it probably needs to be declared. For 'f' it should be any float register so you should probably follow what is done for 'r' I guess. Right now no register is allocated so a random general register will be used (according to what's in the stack at the address &op->reg). Best regards, Thomas
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ Tinycc-devel mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/tinycc-devel
