Mercurial > projects > ldc
diff gen/toobj.cpp @ 213:7816aafeea3c trunk
[svn r229] Updated the object.d implementation to the latest Tango.
Fixed a bunch of the built-in typeinfos for arrays, they did not inherit TypeInfo_Array.
Applied patch to tango/text/convert/Layout.d by fvbommel, closes #47 .
Cleaned up some type code.
Replaced uses of llvm::Type with LLType (a typedef), same for Value and Constant.
Fixed a few cases where typeinfo for user structs could be emitted multiple times, seems to still be some cases of this :/
author | lindquist |
---|---|
date | Fri, 30 May 2008 19:32:04 +0200 |
parents | 9d44ec83acd1 |
children | 0806379a5eca |
line wrap: on
line diff
--- a/gen/toobj.cpp Tue May 27 22:14:24 2008 +0200 +++ b/gen/toobj.cpp Fri May 30 19:32:04 2008 +0200 @@ -187,7 +187,7 @@ name.append(gIR->dmodule->mangle()); name.append("6__ctorZ"); - std::vector<const llvm::Type*> argsTy; + std::vector<const LLType*> argsTy; const llvm::FunctionType* fnTy = llvm::FunctionType::get(llvm::Type::VoidTy,argsTy,false); assert(gIR->module->getFunction(name) == NULL); llvm::Function* fn = llvm::Function::Create(fnTy, llvm::GlobalValue::InternalLinkage, name, gIR->module); @@ -221,7 +221,7 @@ name.append(gIR->dmodule->mangle()); name.append("6__dtorZ"); - std::vector<const llvm::Type*> argsTy; + std::vector<const LLType*> argsTy; const llvm::FunctionType* fnTy = llvm::FunctionType::get(llvm::Type::VoidTy,argsTy,false); assert(gIR->module->getFunction(name) == NULL); llvm::Function* fn = llvm::Function::Create(fnTy, llvm::GlobalValue::InternalLinkage, name, gIR->module); @@ -255,7 +255,7 @@ name.append(gIR->dmodule->mangle()); name.append("10__unittestZ"); - std::vector<const llvm::Type*> argsTy; + std::vector<const LLType*> argsTy; const llvm::FunctionType* fnTy = llvm::FunctionType::get(llvm::Type::VoidTy,argsTy,false); assert(gIR->module->getFunction(name) == NULL); llvm::Function* fn = llvm::Function::Create(fnTy, llvm::GlobalValue::InternalLinkage, name, gIR->module); @@ -302,8 +302,8 @@ const llvm::StructType* classinfoTy = isaStruct(ClassDeclaration::classinfo->type->ir.type->get()); // initializer vector - std::vector<llvm::Constant*> initVec; - llvm::Constant* c = 0; + std::vector<LLConstant*> initVec; + LLConstant* c = 0; // vtable c = moduleinfo->ir.irStruct->vtbl; @@ -320,7 +320,7 @@ // importedModules[] int aimports_dim = aimports.dim; - std::vector<llvm::Constant*> importInits; + std::vector<LLConstant*> importInits; for (size_t i = 0; i < aimports.dim; i++) { Module *m = (Module *)aimports.data[i]; @@ -365,7 +365,7 @@ member->addLocalClass(&aclasses); } // fill inits - std::vector<llvm::Constant*> classInits; + std::vector<LLConstant*> classInits; for (size_t i = 0; i < aclasses.dim; i++) { ClassDeclaration* cd = (ClassDeclaration*)aclasses.data[i]; @@ -433,7 +433,7 @@ }*/ // create initializer - llvm::Constant* constMI = llvm::ConstantStruct::get(moduleinfoTy, initVec); + LLConstant* constMI = llvm::ConstantStruct::get(moduleinfoTy, initVec); // create name std::string MIname("_D"); @@ -449,9 +449,9 @@ // declare the appending array const llvm::ArrayType* appendArrTy = llvm::ArrayType::get(getPtrToType(llvm::Type::Int8Ty), 1); - std::vector<llvm::Constant*> appendInits; + std::vector<LLConstant*> appendInits; appendInits.push_back(llvm::ConstantExpr::getBitCast(gvar, getPtrToType(llvm::Type::Int8Ty))); - llvm::Constant* appendInit = llvm::ConstantArray::get(appendArrTy, appendInits); + LLConstant* appendInit = llvm::ConstantArray::get(appendArrTy, appendInits); std::string appendName("_d_moduleinfo_array"); llvm::GlobalVariable* appendVar = new llvm::GlobalVariable(appendArrTy, true, llvm::GlobalValue::AppendingLinkage, appendInit, appendName, gIR->module); } @@ -545,7 +545,7 @@ Logger::println("Creating global variable"); - const llvm::Type* _type = this->ir.irGlobal->type.get(); + const LLType* _type = this->ir.irGlobal->type.get(); llvm::GlobalValue::LinkageTypes _linkage = DtoLinkage(this); std::string _name(mangle()); @@ -565,7 +565,7 @@ { Logger::println("Aggregate var declaration: '%s' offset=%d", toChars(), offset); - const llvm::Type* _type = DtoType(type); + const LLType* _type = DtoType(type); this->ir.irField = new IrField(this); // add the field in the IRStruct