diff --git a/ispc.h b/ispc.h index 29f34183..0a542401 100644 --- a/ispc.h +++ b/ispc.h @@ -576,6 +576,7 @@ 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; + std::string PtxString; }; enum { diff --git a/module.cpp b/module.cpp index cf06750d..2aedc561 100644 --- a/module.cpp +++ b/module.cpp @@ -2325,7 +2325,7 @@ Module::CompileAndOutput(const char *srcFile, ++suffix_orig; assert(suffix_orig!=NULL); - std::string PtxString; + g->PtxString = std::string(); for (int itarget = 0; itarget < 2; itarget++) { @@ -2378,7 +2378,7 @@ Module::CompileAndOutput(const char *srcFile, pm.add(new llvm::DataLayout(*g->target->getDataLayout())); #endif - llvm::raw_string_ostream rso(PtxString); + llvm::raw_string_ostream rso(g->PtxString); llvm::formatted_raw_ostream fos(rso); llvm::TargetMachine::CodeGenFileType fileType = llvm::TargetMachine::CGFT_AssemblyFile; @@ -2391,9 +2391,9 @@ Module::CompileAndOutput(const char *srcFile, llvm::Module *module = m->module; pm.run(*module); fos.flush(); - assert(!PtxString.empty()); + assert(!g->PtxString.empty()); #if 0 - std::cout << PtxString << std::endl; + std::cout << g->PtxString << std::endl; #endif }