[svn r121] Finished ModuleInfo implementation.

Static ctors/dtors now work according to spec.
Changed class vtable types slightly in some cases. Overridden functions now always take the the type of the first class declaring the method as this parameter. This helps when using headers (w. implementation somewhere else)
This commit is contained in:
Tomas Lindquist Olsen
2007-11-26 04:49:23 +01:00
parent cb37aab93b
commit e0176785c7
11 changed files with 98 additions and 96 deletions

View File

@@ -123,6 +123,7 @@ Module::genobjfile()
if (!global.params.novalidate) {
std::string verifyErr;
Logger::println("Verifying module...");
LOG_SCOPE;
if (llvm::verifyModule(*ir.module,llvm::ReturnStatusAction,&verifyErr))
{
error("%s", verifyErr.c_str());
@@ -364,6 +365,14 @@ void Module::genmoduleinfo()
// declare
// flags will be modified at runtime so can't make it constant
llvm::GlobalVariable* gvar = new llvm::GlobalVariable(moduleinfoTy, false, llvm::GlobalValue::ExternalLinkage, constMI, MIname, gIR->module);
// declare the appending array
const llvm::ArrayType* appendArrTy = llvm::ArrayType::get(llvm::PointerType::get(llvm::Type::Int8Ty), 1);
std::vector<llvm::Constant*> appendInits;
appendInits.push_back(llvm::ConstantExpr::getBitCast(gvar, llvm::PointerType::get(llvm::Type::Int8Ty)));
llvm::Constant* 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);
}
/* ================================================================== */