[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Lightning] About _ASM_SAFETY
From: |
Paolo Bonzini |
Subject: |
Re: [Lightning] About _ASM_SAFETY |
Date: |
Sun, 29 Aug 2010 12:06:07 +0200 |
2010/8/28 Paulo César Pereira de Andrade
<address@hidden>:
> Hi,
>
> I made a somewhat experimental commit yesterday,
> what should be ok for a "playground" repository :-), but
> I would like to comment about it.
I liked it and pulled it already.
As long as there's no confusion between MMX/XMM vs. general purpose
registers, I think the improvement is good enough.
> Possible way to simplify:
> 1. Define registers with only a class modifier, example:
> #define _RA 0x10
> ...
> #define _R15 0x1f
> ...
> #define _RAH 0x20 /* %ah and other top 8 bits of a 16 bit register */
> ...
> #define _RX0 0x40 /* mmx, sse, sse2 first register */
>
> after, that, do not use names like _AL, _AH, _AX, _EAX, and _RAX,
> but just the _RA, and let the _ASM_SAFETY check ensure it is a valid
> argument.
I think this is too complicated.
> 2. Add support for inline functions, to have compiler support
> for strict type checking, and use enums. This is tricky as
> it requires maintaining two implementations. But should
> allow the compiler to generate significantly better code for
> macro/inline function invocations with values not known at
> compile time.
Changing all of lightning to inline functions may make sense, but it's
a big chunk of work.
> /* more strict patch, possibly only accepting 64 bit registers where
> 32 bit ones are required
> * (explaining better :-) 64 bit registers actually mean an abstract
> type/value check, and
> * is a bitmask removed before generating code, so, effectively a 32
> bit and a 64 bit register
> * specification in lightning macros generate the same jit code) */
_ASM_STRONG_SAFETY or something like that. I thought about it too
while reviewing your patch, but I think _ASM_SAFETY as you defined it
is good enough for lightning. It was not "safe enough" for the ccg
project on which asm*.h was based, but for lightning the assemblers
are an implementation detail and the register sizes are not visible to
the user.
Paolo