Mercurial > projects > ldc
comparison gen/statements.cpp @ 1560:1d5c3354b3c2
getNullValue is in Constant again
Requires LLVM >= r77721
author | Benjamin Kramer <benny.kra@gmail.com> |
---|---|
date | Fri, 31 Jul 2009 23:01:29 +0200 |
parents | d6e8d5db259f |
children | 755abafbf25d |
comparison
equal
deleted
inserted
replaced
1559:06d5cc873350 | 1560:1d5c3354b3c2 |
---|---|
110 // and then contains a return (exp); statement. Since the actual | 110 // and then contains a return (exp); statement. Since the actual |
111 // return type remains i32, we just throw away the exp value | 111 // return type remains i32, we just throw away the exp value |
112 // and return 0 instead | 112 // and return 0 instead |
113 // if we're not in main, just bitcast | 113 // if we're not in main, just bitcast |
114 if (p->topfunc() == p->mainFunc) | 114 if (p->topfunc() == p->mainFunc) |
115 v = gIR->context().getNullValue(p->mainFunc->getReturnType()); | 115 v = LLConstant::getNullValue(p->mainFunc->getReturnType()); |
116 else | 116 else |
117 v = gIR->ir->CreateBitCast(v, p->topfunc()->getReturnType(), "tmp"); | 117 v = gIR->ir->CreateBitCast(v, p->topfunc()->getReturnType(), "tmp"); |
118 | 118 |
119 if (Logger::enabled()) | 119 if (Logger::enabled()) |
120 Logger::cout() << "return value after cast: " << *v << '\n'; | 120 Logger::cout() << "return value after cast: " << *v << '\n'; |
1376 ////////////////////////////////////////////////////////////////////////////// | 1376 ////////////////////////////////////////////////////////////////////////////// |
1377 | 1377 |
1378 static LLConstant* generate_unique_critical_section() | 1378 static LLConstant* generate_unique_critical_section() |
1379 { | 1379 { |
1380 const LLType* Mty = DtoMutexType(); | 1380 const LLType* Mty = DtoMutexType(); |
1381 return new llvm::GlobalVariable(*gIR->module, Mty, false, llvm::GlobalValue::InternalLinkage, gIR->context().getNullValue(Mty), ".uniqueCS"); | 1381 return new llvm::GlobalVariable(*gIR->module, Mty, false, llvm::GlobalValue::InternalLinkage, LLConstant::getNullValue(Mty), ".uniqueCS"); |
1382 } | 1382 } |
1383 | 1383 |
1384 void SynchronizedStatement::toIR(IRState* p) | 1384 void SynchronizedStatement::toIR(IRState* p) |
1385 { | 1385 { |
1386 Logger::println("SynchronizedStatement::toIR(): %s", loc.toChars()); | 1386 Logger::println("SynchronizedStatement::toIR(): %s", loc.toChars()); |