Add BCCContext.
Convention:
* namespace bcc {
/* no space here */class [ClassName] {
...
};
} // end namespace bcc
* Instance variables are prefixed with "m";
* Class variable/method are captialized;
* Local variables in the function are in lower case with underscore;
* Parameters to the function are prefixed with "p";
* Include guard in the header will look like
#ifndef BCC_<sub folder>_<class>_H
* The order of implementation in .cpp is in the order of their
declaration with the following constraints:
i. Class methods go first
ii. Recursively apply this rule to the sub-class
iii. Then the constructor and destructor of the class
iv. And then the instance methods
* The order of includes in Foo.cpp should be:
i. Foo.h should always go first
ii. C headers
iii. C++ headers
iv. LLVM headers
iv. Other headers from the project other than libbcc and Android
frameworks (i.e., f/b/include/utils/)
v. Header files defined in libbcc
vi. Header files from Android frameworks (f/b/include/utils/)
Android frameworks should be included in the last since it
implicitly includes cutils/log.h which may cause LOG_TAG be
defined to NULL if no LOG_TAG hasn't been defined ever before
include it.
* Avoid including STL and LLVM headers in the BCC headers. Some
clients (e.g., RenderScript) may prefer not include the C++ STL
support and don't want to associate with LLVM directly.
BCCContext manages the global data across the libbcc infrastructure.
This includes LLVMContext object required by materialize bitcode into
llvm::Module and LLVM compilation infrastructure.
Furthermore, BCCContext is escalated to be managed in Script instead
of in the SourceInfo.
Change-Id: I60b9da7b5c61f6c684dcf981ba5abaf066e3c883
diff --git a/lib/ExecutionEngine/Script.cpp b/lib/ExecutionEngine/Script.cpp
index 11ef0e1..2dbdf40 100644
--- a/lib/ExecutionEngine/Script.cpp
+++ b/lib/ExecutionEngine/Script.cpp
@@ -23,6 +23,7 @@
#include "MCCacheWriter.h"
#include "CompilerOption.h"
+#include "BCCContextImpl.h"
#include "DebugHelper.h"
#include "FileHandle.h"
#include "GDBJITRegistrar.h"
@@ -347,14 +348,14 @@
}
// Parse Source bitcode file (if necessary)
- if (mSourceList[0]->prepareModule() != 0) {
+ if (mSourceList[0]->prepareModule(mContext.mImpl->mLLVMContext) != 0) {
ALOGE("Unable to setup source module\n");
return 1;
}
// Parse Library bitcode file (if necessary)
if (mSourceList[1]) {
- if (mSourceList[1]->prepareModule(mSourceList[0]->getContext()) != 0) {
+ if (mSourceList[1]->prepareModule(mContext.mImpl->mLLVMContext) != 0) {
ALOGE("Unable to setup library module\n");
return 1;
}