comparison gen/toobj.cpp @ 493:017ca8645a1f

Make llvmdc work with llvm 2.4svn revision 54614. Breaks compatibility with llvm 2.3.
author Christian Kamm <kamm incasoftware de>
date Sun, 10 Aug 2008 21:09:23 +0200
parents a34078905d01
children a3d6c9eedcb6
comparison
equal deleted inserted replaced
492:bebc6099fb89 493:017ca8645a1f
227 assert(gIR->module->getFunction(name) == NULL); 227 assert(gIR->module->getFunction(name) == NULL);
228 llvm::Function* fn = llvm::Function::Create(fnTy, llvm::GlobalValue::InternalLinkage, name, gIR->module); 228 llvm::Function* fn = llvm::Function::Create(fnTy, llvm::GlobalValue::InternalLinkage, name, gIR->module);
229 fn->setCallingConv(llvm::CallingConv::Fast); 229 fn->setCallingConv(llvm::CallingConv::Fast);
230 230
231 llvm::BasicBlock* bb = llvm::BasicBlock::Create("entry", fn); 231 llvm::BasicBlock* bb = llvm::BasicBlock::Create("entry", fn);
232 IRBuilder builder(bb); 232 IRBuilder<> builder(bb);
233 233
234 for (size_t i=0; i<n; i++) { 234 for (size_t i=0; i<n; i++) {
235 llvm::Function* f = gIR->ctors[i]->ir.irFunc->func; 235 llvm::Function* f = gIR->ctors[i]->ir.irFunc->func;
236 llvm::CallInst* call = builder.CreateCall(f,""); 236 llvm::CallInst* call = builder.CreateCall(f,"");
237 call->setCallingConv(llvm::CallingConv::Fast); 237 call->setCallingConv(llvm::CallingConv::Fast);
261 assert(gIR->module->getFunction(name) == NULL); 261 assert(gIR->module->getFunction(name) == NULL);
262 llvm::Function* fn = llvm::Function::Create(fnTy, llvm::GlobalValue::InternalLinkage, name, gIR->module); 262 llvm::Function* fn = llvm::Function::Create(fnTy, llvm::GlobalValue::InternalLinkage, name, gIR->module);
263 fn->setCallingConv(llvm::CallingConv::Fast); 263 fn->setCallingConv(llvm::CallingConv::Fast);
264 264
265 llvm::BasicBlock* bb = llvm::BasicBlock::Create("entry", fn); 265 llvm::BasicBlock* bb = llvm::BasicBlock::Create("entry", fn);
266 IRBuilder builder(bb); 266 IRBuilder<> builder(bb);
267 267
268 for (size_t i=0; i<n; i++) { 268 for (size_t i=0; i<n; i++) {
269 llvm::Function* f = gIR->dtors[i]->ir.irFunc->func; 269 llvm::Function* f = gIR->dtors[i]->ir.irFunc->func;
270 llvm::CallInst* call = builder.CreateCall(f,""); 270 llvm::CallInst* call = builder.CreateCall(f,"");
271 call->setCallingConv(llvm::CallingConv::Fast); 271 call->setCallingConv(llvm::CallingConv::Fast);
295 assert(gIR->module->getFunction(name) == NULL); 295 assert(gIR->module->getFunction(name) == NULL);
296 llvm::Function* fn = llvm::Function::Create(fnTy, llvm::GlobalValue::InternalLinkage, name, gIR->module); 296 llvm::Function* fn = llvm::Function::Create(fnTy, llvm::GlobalValue::InternalLinkage, name, gIR->module);
297 fn->setCallingConv(llvm::CallingConv::Fast); 297 fn->setCallingConv(llvm::CallingConv::Fast);
298 298
299 llvm::BasicBlock* bb = llvm::BasicBlock::Create("entry", fn); 299 llvm::BasicBlock* bb = llvm::BasicBlock::Create("entry", fn);
300 IRBuilder builder(bb); 300 IRBuilder<> builder(bb);
301 301
302 for (size_t i=0; i<n; i++) { 302 for (size_t i=0; i<n; i++) {
303 llvm::Function* f = gIR->unitTests[i]->ir.irFunc->func; 303 llvm::Function* f = gIR->unitTests[i]->ir.irFunc->func;
304 llvm::CallInst* call = builder.CreateCall(f,""); 304 llvm::CallInst* call = builder.CreateCall(f,"");
305 call->setCallingConv(llvm::CallingConv::Fast); 305 call->setCallingConv(llvm::CallingConv::Fast);
341 if (!mref) 341 if (!mref)
342 mref = new LLGlobalVariable(getPtrToType(modulerefTy), false, LLGlobalValue::ExternalLinkage, NULL, "_Dmodule_ref", gIR->module); 342 mref = new LLGlobalVariable(getPtrToType(modulerefTy), false, LLGlobalValue::ExternalLinkage, NULL, "_Dmodule_ref", gIR->module);
343 343
344 // make the function insert this moduleinfo as the beginning of the _Dmodule_ref linked list 344 // make the function insert this moduleinfo as the beginning of the _Dmodule_ref linked list
345 llvm::BasicBlock* bb = llvm::BasicBlock::Create("moduleinfoCtorEntry", ctor); 345 llvm::BasicBlock* bb = llvm::BasicBlock::Create("moduleinfoCtorEntry", ctor);
346 IRBuilder builder(bb); 346 IRBuilder<> builder(bb);
347 347
348 // get current beginning 348 // get current beginning
349 LLValue* curbeg = builder.CreateLoad(mref, "current"); 349 LLValue* curbeg = builder.CreateLoad(mref, "current");
350 350
351 // put current beginning as the next of this one 351 // put current beginning as the next of this one