Assembly Integration into Compiler

Walter Bright newshound2 at digitalmars.com
Thu Jul 7 12:30:37 PDT 2011


On 7/7/2011 12:14 PM, Andrej Mitrovic wrote:
> There's nothing stopping you from using an external assembler? You can
> hook up NASM and D code pretty easily.

I abandoned using third party assemblers years ago because:

1. Poor (i.e. zero) integration with the compiler.

2. You have to rewrite your data structure & manifest constant declarations in 
the assembler, and of course these always get out of sync with the ones in your 
C/D source.

3. Having the compiler set up the call/return sequences and parameter addressing 
is so darned convenient.

4. The compiler will keep track of register usage for you.

5. There are lots of 3rd party assemblers, all different. Even the same 
assembler will have multiple versions. The chances of the asm source you ship 
assembling on all of them, and avoiding all the various bugs in them, is zero. 
It was a major tech support issue.

6. It really hurts my brain to have gas swap the operands.

7. gas (gnu assembler) doesn't follow the Intel syntax so you have to do a 
mental translation from the Intel datasheets to the gas source. gas doesn't even 
use the same instruction names. Bah.

8. External assemblers don't do name mangling. You've got to do it all manually. 
This is a horror.

9. Symbolic debug formats differ.

10. Having to manage a separate source file for just two instructions was highly 
annoying.


Getting the assembler integrated into the compiler made me much more productive 
and my life much easier. It was a giant win, no doubt about it.


More information about the Digitalmars-d mailing list