Mercurial > projects > ldc
diff gen/toobj.cpp @ 1571:8d086d552909
IntegerType is now contextifed.
Requires llvm >= 78969. resistor says this will be the last context API change :)
author | Benjamin Kramer <benny.kra@gmail.com> |
---|---|
date | Fri, 14 Aug 2009 00:39:18 +0200 |
parents | 755abafbf25d |
children | 30bdcfb8299e |
line wrap: on
line diff
--- a/gen/toobj.cpp Thu Aug 06 16:02:14 2009 +0200 +++ b/gen/toobj.cpp Fri Aug 14 00:39:18 2009 +0200 @@ -424,12 +424,12 @@ name.append("6__ctorZ"); std::vector<const LLType*> argsTy; - const llvm::FunctionType* fnTy = llvm::FunctionType::get(LLType::VoidTy,argsTy,false); + const llvm::FunctionType* fnTy = llvm::FunctionType::get(LLType::getVoidTy(gIR->context()),argsTy,false); assert(gIR->module->getFunction(name) == NULL); llvm::Function* fn = llvm::Function::Create(fnTy, llvm::GlobalValue::InternalLinkage, name, gIR->module); fn->setCallingConv(DtoCallingConv(0, LINKd)); - llvm::BasicBlock* bb = llvm::BasicBlock::Create("entry", fn); + llvm::BasicBlock* bb = llvm::BasicBlock::Create(gIR->context(), "entry", fn); IRBuilder<> builder(bb); // debug info @@ -469,12 +469,12 @@ name.append("6__dtorZ"); std::vector<const LLType*> argsTy; - const llvm::FunctionType* fnTy = llvm::FunctionType::get(LLType::VoidTy,argsTy,false); + const llvm::FunctionType* fnTy = llvm::FunctionType::get(LLType::getVoidTy(gIR->context()),argsTy,false); assert(gIR->module->getFunction(name) == NULL); llvm::Function* fn = llvm::Function::Create(fnTy, llvm::GlobalValue::InternalLinkage, name, gIR->module); fn->setCallingConv(DtoCallingConv(0, LINKd)); - llvm::BasicBlock* bb = llvm::BasicBlock::Create("entry", fn); + llvm::BasicBlock* bb = llvm::BasicBlock::Create(gIR->context(), "entry", fn); IRBuilder<> builder(bb); // debug info @@ -514,12 +514,12 @@ name.append("10__unittestZ"); std::vector<const LLType*> argsTy; - const llvm::FunctionType* fnTy = llvm::FunctionType::get(LLType::VoidTy,argsTy,false); + const llvm::FunctionType* fnTy = llvm::FunctionType::get(LLType::getVoidTy(gIR->context()),argsTy,false); assert(gIR->module->getFunction(name) == NULL); llvm::Function* fn = llvm::Function::Create(fnTy, llvm::GlobalValue::InternalLinkage, name, gIR->module); fn->setCallingConv(DtoCallingConv(0, LINKd)); - llvm::BasicBlock* bb = llvm::BasicBlock::Create("entry", fn); + llvm::BasicBlock* bb = llvm::BasicBlock::Create(gIR->context(), "entry", fn); IRBuilder<> builder(bb); // debug info @@ -547,7 +547,7 @@ static LLFunction* build_module_reference_and_ctor(LLConstant* moduleinfo) { // build ctor type - const LLFunctionType* fty = LLFunctionType::get(LLType::VoidTy, std::vector<const LLType*>(), false); + const LLFunctionType* fty = LLFunctionType::get(LLType::getVoidTy(gIR->context()), std::vector<const LLType*>(), false); // build ctor name std::string fname = "_D"; @@ -576,7 +576,7 @@ mref = new LLGlobalVariable(*gIR->module, getPtrToType(modulerefTy), false, LLGlobalValue::ExternalLinkage, NULL, "_Dmodule_ref"); // make the function insert this moduleinfo as the beginning of the _Dmodule_ref linked list - llvm::BasicBlock* bb = llvm::BasicBlock::Create("moduleinfoCtorEntry", ctor); + llvm::BasicBlock* bb = llvm::BasicBlock::Create(gIR->context(), "moduleinfoCtorEntry", ctor); IRBuilder<> builder(bb); // debug info @@ -746,7 +746,7 @@ b.push_uint(mi_flags); // function pointer type for next three fields - const LLType* fnptrTy = getPtrToType(LLFunctionType::get(LLType::VoidTy, std::vector<const LLType*>(), false)); + const LLType* fnptrTy = getPtrToType(LLFunctionType::get(LLType::getVoidTy(gIR->context()), std::vector<const LLType*>(), false)); // ctor llvm::Function* fctor = build_module_ctor(); @@ -807,9 +807,9 @@ LLFunction* mictor = build_module_reference_and_ctor(gvar); // register this ctor in the magic llvm.global_ctors appending array - const LLFunctionType* magicfty = LLFunctionType::get(LLType::VoidTy, std::vector<const LLType*>(), false); + const LLFunctionType* magicfty = LLFunctionType::get(LLType::getVoidTy(gIR->context()), std::vector<const LLType*>(), false); std::vector<const LLType*> magictypes; - magictypes.push_back(LLType::Int32Ty); + magictypes.push_back(LLType::getInt32Ty(gIR->context())); magictypes.push_back(getPtrToType(magicfty)); const LLStructType* magicsty = LLStructType::get(gIR->context(), magictypes);