Feature Request: enhanced inline ASM
Joel C. Salomon
JoelCSalomon at Gmail.com
Wed Apr 4 19:14:03 PDT 2007
Dan wrote:
> The thing that I'm sure Walter doesn't want to do though is trick assembler programmers into thinking they can access a ways down the "." chain all the time.
>
> Let me explain: If we have:
>
> struct b {
> char[] s;
> }
>
> struct a {
> void* x = b;
> union y {
> int z;
> }
> }
>
>
>
> You can access a.y.z, but not a.x.s.ptr The first just performs a structure offset while the second has to lea through x, and then again through b.s.ptr; more than one instruction ought to be illegal. It's asm after all.
I come at this from the Plan 9 perspective, where the assembler adds
LEAs to give the impression that the x86 instruction set is more regular
than it really is, or to implement convenient addressing modes we’d like
to pretend the CPU had. I’d vote to put the LEAs in transparently — but
on low priority; that’s a nice assembler feature, not so much for a
compiler.
--Joel
More information about the Digitalmars-d
mailing list