Merge pull request #975 from jbrodman/windll

Change dll export feature to a switch.
This commit is contained in:
Dmitry Babokin
2015-03-06 23:56:45 +03:00
4 changed files with 8 additions and 1 deletions

View File

@@ -1316,6 +1316,7 @@ Globals::Globals() {
FATAL("Current directory path too long!");
#endif
forceAlignment = -1;
dllExport = false;
}
///////////////////////////////////////////////////////////////////////////

3
ispc.h
View File

@@ -612,6 +612,9 @@ struct Globals {
/** Indicates that alignment in memory allocation routines should be
forced to have given value. -1 value means natural alignment for the platforms. */
int forceAlignment;
/** When true, flag non-static functions with dllexport attribute on Windows. */
bool dllExport;
};
enum {

View File

@@ -153,6 +153,7 @@ devUsage(int ret) {
lPrintVersion();
printf("\nusage (developer options): ispc\n");
printf(" [--debug]\t\t\t\tPrint information useful for debugging ispc\n");
printf(" [--dllexport]\t\t\tMake non-static functions DLL exported. Windows only.\n");
printf(" [--fuzz-test]\t\t\tRandomly perturb program input to test error conditions\n");
printf(" [--fuzz-seed=<value>]\t\tSeed value for RNG for fuzz testing\n");
printf(" [--opt=<option>]\t\t\tSet optimization option\n");
@@ -379,6 +380,8 @@ int main(int Argc, char *Argv[]) {
}
else if (!strcmp(argv[i], "--debug"))
g->debugPrint = true;
else if (!strcmp(argv[i], "--dllexport"))
g->dllExport = true;
else if (!strcmp(argv[i], "--instrument"))
g->emitInstrumentation = true;
else if (!strcmp(argv[i], "-g")) {

View File

@@ -920,7 +920,7 @@ Module::AddFunctionDeclaration(const std::string &name,
#ifdef ISPC_IS_WINDOWS
// Make export functions callable from DLLS.
if (functionType->isExported) {
if ((g->dllExport) && (storageClass != SC_STATIC)) {
function->setDLLStorageClass(llvm::GlobalValue::DLLExportStorageClass);
}
#endif