Mercurial > projects > ldc
comparison gen/asm-x86-64.h @ 871:e70a0e7e2260
Apply duane's patch for align power-of-two checking in inline asm. Fixes #159
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Sun, 04 Jan 2009 15:39:34 +0100 |
parents | f6dd817060fc |
children | 545f54041d91 |
comparison
equal
deleted
inserted
replaced
870:af7a6faf9406 | 871:e70a0e7e2260 |
---|---|
1258 /* DMD offset usage: <parm>[<reg>] seems to always be relative to EBP+8 .. even | 1258 /* DMD offset usage: <parm>[<reg>] seems to always be relative to EBP+8 .. even |
1259 if naked.. */ | 1259 if naked.. */ |
1260 | 1260 |
1261 // mov eax, 4 | 1261 // mov eax, 4 |
1262 // mov eax, fs:4 | 1262 // mov eax, fs:4 |
1263 // -- have to assume we know wheter or not to use '$' | 1263 // -- have to assume we know whether or not to use '$' |
1264 | 1264 |
1265 static Token eof_tok; | 1265 static Token eof_tok; |
1266 static Expression * Handled; | 1266 static Expression * Handled; |
1267 static Identifier * ident_seg; | 1267 static Identifier * ident_seg; |
1268 | 1268 |
2636 // parse primary: DMD allows 'MyAlign' (const int) but not '2+2' | 2636 // parse primary: DMD allows 'MyAlign' (const int) but not '2+2' |
2637 // GAS is padding with NOPs last time I checked. | 2637 // GAS is padding with NOPs last time I checked. |
2638 Expression * e = parseAsmExp()->optimize(WANTvalue | WANTinterpret); | 2638 Expression * e = parseAsmExp()->optimize(WANTvalue | WANTinterpret); |
2639 integer_t align = e->toInteger(); | 2639 integer_t align = e->toInteger(); |
2640 | 2640 |
2641 if (align >= 0) { | 2641 if (align & align - 1 == 0) { |
2642 // %% is this printf portable? | 2642 //FIXME: This printf is not portable. The use of `align` varies from system to system; |
2643 // on i386 using a.out, .align `n` will align on a 2^`n` boundary instead of an `n` boundary | |
2643 #ifdef HAVE_GAS_BALIGN_AND_P2ALIGN | 2644 #ifdef HAVE_GAS_BALIGN_AND_P2ALIGN |
2644 insnTemplate->printf(".balign\t%u", (unsigned) align); | 2645 insnTemplate->printf(".balign\t%u", (unsigned) align); |
2645 #else | 2646 #else |
2646 insnTemplate->printf(".align\t%u", (unsigned) align); | 2647 insnTemplate->printf(".align\t%u", (unsigned) align); |
2647 #endif | 2648 #endif |