comparison gen/statements.cpp @ 945:03d7c4aac654

SWITCHED TO LLVM 2.5 ! Applied patch from ticket #129 to compile against latest LLVM. Thanks Frits van Bommel. Fixed implicit return by asm block at the end of a function on x86-32. Other architectures will produce an error at the moment. Adding support for new targets is fairly simple. Fixed return calling convention for complex numbers, ST and ST(1) were switched around. Added some testcases. I've run a dstress test and there are no regressions. However, the runtime does not seem to compile with symbolic debug information. -O3 -release -inline works well and is what I used for the dstress run. Tango does not compile, a small workaround is needed in tango.io.digest.Digest.Digest.hexDigest. See ticket #206 .
author Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
date Sun, 08 Feb 2009 05:26:54 +0100
parents 545f54041d91
children 815e1b8c6b00
comparison
equal deleted inserted replaced
944:eb310635d80e 945:03d7c4aac654
78 else { 78 else {
79 if (global.params.symdebug) DtoDwarfStopPoint(loc.linnum); 79 if (global.params.symdebug) DtoDwarfStopPoint(loc.linnum);
80 DValue* e = exp->toElem(p); 80 DValue* e = exp->toElem(p);
81 LLValue* v = e->getRVal(); 81 LLValue* v = e->getRVal();
82 delete e; 82 delete e;
83
84 // swap real/imag parts on a x87
85 if (global.params.cpu == ARCHx86 && exp->type->toBasetype()->iscomplex())
86 {
87 v = DtoAggrPairSwap(v);
88 }
83 89
84 if (Logger::enabled()) 90 if (Logger::enabled())
85 Logger::cout() << "return value is '" <<*v << "'\n"; 91 Logger::cout() << "return value is '" <<*v << "'\n";
86 92
87 // can happen for classes 93 // can happen for classes
1196 a->code += "_"; 1202 a->code += "_";
1197 a->code += ident->toChars(); 1203 a->code += ident->toChars();
1198 a->code += ":"; 1204 a->code += ":";
1199 p->asmBlock->s.push_back(a); 1205 p->asmBlock->s.push_back(a);
1200 p->asmBlock->internalLabels.push_back(ident); 1206 p->asmBlock->internalLabels.push_back(ident);
1207
1208 // disable inlining
1209 gIR->func()->setNeverInline();
1201 } 1210 }
1202 else 1211 else
1203 { 1212 {
1204 std::string labelname = p->func()->getScopedLabelName(ident->toChars()); 1213 std::string labelname = p->func()->getScopedLabelName(ident->toChars());
1205 llvm::BasicBlock*& labelBB = p->func()->labelToBB[labelname]; 1214 llvm::BasicBlock*& labelBB = p->func()->labelToBB[labelname];
1451 //STUBST(OnScopeStatement); 1460 //STUBST(OnScopeStatement);
1452 1461
1453 #if DMDV2 1462 #if DMDV2
1454 STUBST(PragmaStatement); 1463 STUBST(PragmaStatement);
1455 #endif 1464 #endif
1465
1466 //////////////////////////////////////////////////////////////////////////////
1467
1468 //////////////////////////////////////////////////////////////////////////////
1469
1470 AsmBlockStatement* Statement::endsWithAsm()
1471 {
1472 // does not end with inline asm
1473 return NULL;
1474 }
1475
1476 AsmBlockStatement* CompoundStatement::endsWithAsm()
1477 {
1478 // make the last inner statement decide
1479 if (statements && statements->dim)
1480 {
1481 unsigned last = statements->dim - 1;
1482 Statement* s = (Statement*)statements->data[last];
1483 if (s) return s->endsWithAsm();
1484 }
1485 return NULL;
1486 }
1487
1488 AsmBlockStatement* AsmBlockStatement::endsWithAsm()
1489 {
1490 // yes this is inline asm
1491 return this;
1492 }