Add Symbol::exportedFunction member to hold llvm::Function * for app-callable version of function.

This commit is contained in:
Matt Pharr
2011-10-04 15:46:17 -07:00
parent 9b7f55a28e
commit 686d9975b6
3 changed files with 10 additions and 2 deletions

View File

@@ -497,7 +497,6 @@ Module::AddGlobal(DeclSpecs *ds, Declarator *decl) {
}
LLVM_TYPE_CONST llvm::Type *llvmType = decl->sym->type->LLVMType(g->ctx);
llvm::GlobalValue::LinkageTypes linkage =
(ds->storageClass == SC_STATIC) ? llvm::GlobalValue::InternalLinkage :
llvm::GlobalValue::ExternalLinkage;
@@ -551,6 +550,9 @@ Module::AddGlobal(DeclSpecs *ds, Declarator *decl) {
}
bool isConst = (ds->typeQualifier & TYPEQUAL_CONST) != 0;
llvm::GlobalValue::LinkageTypes linkage =
(ds->storageClass == SC_STATIC) ? llvm::GlobalValue::InternalLinkage :
llvm::GlobalValue::ExternalLinkage;
decl->sym->storagePtr = new llvm::GlobalVariable(*module, llvmType, isConst,
linkage, llvmInitializer,
decl->sym->name.c_str());
@@ -843,6 +845,7 @@ Module::AddFunction(DeclSpecs *ds, Declarator *decl, Stmt *code) {
firstStmtPos);
lEmitFunctionCode(&ec, appFunction, functionType, funSym, decl, code);
if (errorCount == 0) {
funSym->exportedFunction = appFunction;
if (llvm::verifyFunction(*appFunction,
llvm::ReturnStatusAction) == true) {
if (g->debugPrint) {