atomics.h
Change-Id: Iad1cf587770d21d2d7306fc661ee159901cc4d18
diff --git a/bcc.cpp b/bcc.cpp
index 091bd47..1a561c2 100644
--- a/bcc.cpp
+++ b/bcc.cpp
@@ -250,6 +250,8 @@
static std::string Triple;
static llvm::CodeGenOpt::Level CodeGenOptLevel;
+
+ static std::string mError;
/*
* End of section of GlobalInitializing variables
**********************************************/
@@ -271,6 +273,11 @@
static void GlobalInitialization() {
if(GlobalInitialized) return;
+ LOGE("INIT");
+
+ llvm::install_fatal_error_handler(LLVMErrorHandler, &mError);
+ // if (!llvm::llvm_is_multithreaded())
+ // llvm::llvm_start_multithreaded();
/* Set Triple, CPU and Features here */
Triple = TARGET_TRIPLE_STRING;
@@ -380,8 +387,6 @@
static const llvm::StringRef ExportFuncMetadataName;
private:
- std::string mError;
-
inline bool hasError() const {
return !mError.empty();
}
@@ -2548,8 +2553,6 @@
mContext(NULL),
mModule(NULL)
{
- llvm::remove_fatal_error_handler();
- llvm::install_fatal_error_handler(LLVMErrorHandler, &mError);
mContext = new llvm::LLVMContext();
return;
}
@@ -2566,7 +2569,7 @@
if(bitcode == NULL || bitcodeSize <= 0)
return 0;
-
+ LOGE("Before Init");
GlobalInitialization();
/* Package input to object MemoryBuffer */
@@ -2579,7 +2582,7 @@
/* Read the input Bitcode as a Module */
mModule = llvm::ParseBitcodeFile(SB, *mContext, &mError);
-
+ LOGE("FINISH LOAD");
on_bcc_load_module_error:
if (SB)
delete SB;
@@ -2601,6 +2604,7 @@
const llvm::NamedMDNode* ExportVarMetadata;
const llvm::NamedMDNode* ExportFuncMetadata;
+ LOGE("mModule=%x", mModule);
if(mModule == NULL) /* No module was loaded */
return 0;
@@ -2886,7 +2890,7 @@
~Compiler() {
delete mModule;
- llvm::llvm_shutdown();
+ //llvm::llvm_shutdown();
delete mContext;
return;
}
@@ -2903,6 +2907,8 @@
std::vector<std::string> Compiler::Features;
+std::string Compiler::mError;
+
/*
* The named of metadata node that pragma resides
* (should be synced with slang.cpp)