Mercurial > projects > ldc
comparison gen/d-asm-i386.h @ 220:ccc2e6898a78 trunk
[svn r236] added initial codegen of inline asm, pretty buggy and incomplete still. see the tangotests/asm1.d test for a sample of what does
work!
author | lindquist |
---|---|
date | Fri, 06 Jun 2008 20:14:51 +0200 |
parents | 761c8352f494 |
children | 68687d8c3e9a |
comparison
equal
deleted
inserted
replaced
219:761c8352f494 | 220:ccc2e6898a78 |
---|---|
1728 asmcode->moreRegs |= (1 << (Reg_EFLAGS - 32)); | 1728 asmcode->moreRegs |= (1 << (Reg_EFLAGS - 32)); |
1729 if (op == Op_cpuid) | 1729 if (op == Op_cpuid) |
1730 stmt->regs |= (1 << Reg_EAX)| | 1730 stmt->regs |= (1 << Reg_EAX)| |
1731 (1 << Reg_ECX)|(1 << Reg_EDX); | 1731 (1 << Reg_ECX)|(1 << Reg_EDX); |
1732 | 1732 |
1733 insnTemplate->writebyte('\t'); | 1733 insnTemplate->writebyte(' '); |
1734 for (int i__ = 0; i__ < nOperands; i__++) { | 1734 for (int i__ = 0; i__ < nOperands; i__++) { |
1735 int i; | 1735 int i; |
1736 if (i__ != 0) | 1736 if (i__ != 0) |
1737 insnTemplate->writestring((char*) ", "); | 1737 insnTemplate->writestring((char*) ", "); |
1738 | 1738 |
1855 ((operand->baseReg == Reg_EBP && ! sc->func->naked ) || | 1855 ((operand->baseReg == Reg_EBP && ! sc->func->naked ) || |
1856 (operand->baseReg == Reg_ESP && sc->func->naked)) ) { | 1856 (operand->baseReg == Reg_ESP && sc->func->naked)) ) { |
1857 | 1857 |
1858 e = new AddrExp(0, e); | 1858 e = new AddrExp(0, e); |
1859 e->type = decl->type->pointerTo(); | 1859 e->type = decl->type->pointerTo(); |
1860 | 1860 #if !IN_LLVM |
1861 /* DMD uses the same frame offsets for naked functions. */ | 1861 /* DMD uses the same frame offsets for naked functions. */ |
1862 if (sc->func->naked) | 1862 if (sc->func->naked) |
1863 operand->constDisplacement += 4; | 1863 operand->constDisplacement += 4; |
1864 | 1864 |
1865 if (operand->constDisplacement) { | 1865 if (operand->constDisplacement) { |
1868 Type::tint32)); | 1868 Type::tint32)); |
1869 e->type = decl->type->pointerTo(); | 1869 e->type = decl->type->pointerTo(); |
1870 } | 1870 } |
1871 e = new PtrExp(0, e); | 1871 e = new PtrExp(0, e); |
1872 e->type = decl->type; | 1872 e->type = decl->type; |
1873 | 1873 #endif |
1874 operand->constDisplacement = 0; | 1874 operand->constDisplacement = 0; |
1875 operand->baseReg = Reg_Invalid; | 1875 operand->baseReg = Reg_Invalid; |
1876 | 1876 |
1877 addOperand(fmt, Arg_Memory, e, asmcode, mode); | 1877 addOperand(fmt, Arg_Memory, e, asmcode, mode); |
1878 | 1878 |
2540 // FIXME | 2540 // FIXME |
2541 /* | 2541 /* |
2542 machine_mode mode; | 2542 machine_mode mode; |
2543 | 2543 |
2544 insnTemplate->writestring((char*) directives[op - Op_db]); | 2544 insnTemplate->writestring((char*) directives[op - Op_db]); |
2545 insnTemplate->writebyte('\t'); | 2545 insnTemplate->writebyte(' '); |
2546 | 2546 |
2547 do { | 2547 do { |
2548 // DMD is pretty strict here, not even constant expressions are allowed.. | 2548 // DMD is pretty strict here, not even constant expressions are allowed.. |
2549 switch (op) { | 2549 switch (op) { |
2550 case Op_db: | 2550 case Op_db: |