Remove USE_MCJIT configuration flags, since MC is the only path.

BUG=6051742

This also removes references to MCJIT, since we use MC CodeGen, and not the
actual LLVM MCJIT path.

Change-Id: I3518ae7c91952251a3bd2fc4c3b2a418572a4998
diff --git a/lib/ExecutionEngine/Android.mk b/lib/ExecutionEngine/Android.mk
index ffc6088..1ffa056 100644
--- a/lib/ExecutionEngine/Android.mk
+++ b/lib/ExecutionEngine/Android.mk
@@ -34,13 +34,9 @@
   SourceInfo.cpp
 
 ifeq ($(libbcc_USE_CACHE),1)
-ifeq ($(libbcc_USE_MCJIT),1)
 libbcc_executionengine_SRC_FILES += \
   MCCacheWriter.cpp \
-  MCCacheReader.cpp
-endif
-
-libbcc_executionengine_SRC_FILES += \
+  MCCacheReader.cpp \
   ScriptCached.cpp \
   Sha1Helper.cpp
 endif
diff --git a/lib/ExecutionEngine/Compiler.cpp b/lib/ExecutionEngine/Compiler.cpp
index 8f29e27..c3ed9b5 100644
--- a/lib/ExecutionEngine/Compiler.cpp
+++ b/lib/ExecutionEngine/Compiler.cpp
@@ -30,9 +30,7 @@
 #include "Sha1Helper.h"
 #include "CompilerOption.h"
 
-#if USE_MCJIT
 #include "librsloader.h"
-#endif
 
 #include "Transforms/BCCTransforms.h"
 
@@ -227,9 +225,7 @@
 
 Compiler::Compiler(ScriptCompiled *result)
   : mpResult(result),
-#if USE_MCJIT
     mRSExecutable(NULL),
-#endif
     mpSymbolLookupFn(NULL),
     mpSymbolLookupContext(NULL),
     mModule(NULL),
@@ -393,7 +389,6 @@
   }
 
   // Perform code generation
-#if USE_MCJIT
   if (runMCCodeGen(new llvm::TargetData(*TD), TM) != 0) {
     goto on_bcc_compile_error;
   }
@@ -441,7 +436,7 @@
     }
   }
 
-#if DEBUG_MCJIT_DISASSEMBLER
+#if DEBUG_MC_DISASSEMBLER
   {
     // Get MC codegen emitted function name list
     size_t func_list_size = rsloaderGetFuncCount(mRSExecutable);
@@ -453,13 +448,12 @@
       void *func = rsloaderGetSymbolAddress(mRSExecutable, func_list[i]);
       if (func) {
         size_t size = rsloaderGetSymbolSize(mRSExecutable, func_list[i]);
-        Disassemble(DEBUG_MCJIT_DISASSEMBLER_FILE,
+        Disassemble(DEBUG_MC_DISASSEMBLER_FILE,
                     Target, TM, func_list[i], (unsigned char const *)func, size);
       }
     }
   }
 #endif
-#endif
 
 on_bcc_compile_error:
   // ALOGE("on_bcc_compiler_error");
@@ -480,7 +474,6 @@
 }
 
 
-#if USE_MCJIT
 int Compiler::runMCCodeGen(llvm::TargetData *TD, llvm::TargetMachine *TM) {
   // Decorate mEmittedELFExecutable with formatted ostream
   llvm::raw_svector_ostream OutSVOS(mEmittedELFExecutable);
@@ -505,7 +498,6 @@
   OutSVOS.flush();
   return 0;
 }
-#endif // USE_MCJIT
 
 int Compiler::runInternalPasses(std::vector<std::string>& Names,
                                 std::vector<uint32_t>& Signatures) {
@@ -651,14 +643,11 @@
 }
 
 
-#if USE_MCJIT
 void *Compiler::getSymbolAddress(char const *name) {
   return rsloaderGetSymbolAddress(mRSExecutable, name);
 }
-#endif
 
 
-#if USE_MCJIT
 void *Compiler::resolveSymbolAdapter(void *context, char const *name) {
   Compiler *self = reinterpret_cast<Compiler *>(context);
 
@@ -675,13 +664,10 @@
   ALOGE("Unable to resolve symbol: %s\n", name);
   return NULL;
 }
-#endif
 
 
 Compiler::~Compiler() {
-#if USE_MCJIT
   rsloaderDisposeExec(mRSExecutable);
-#endif
 
   // llvm::llvm_shutdown();
 }
diff --git a/lib/ExecutionEngine/Compiler.h b/lib/ExecutionEngine/Compiler.h
index 301daed..863cda6 100644
--- a/lib/ExecutionEngine/Compiler.h
+++ b/lib/ExecutionEngine/Compiler.h
@@ -21,9 +21,7 @@
 
 #include <Config.h>
 
-#if USE_MCJIT
 #include "librsloader.h"
-#endif
 
 #include "llvm/ADT/OwningPtr.h"
 #include "llvm/ADT/StringRef.h"
@@ -84,13 +82,11 @@
 
     std::string mError;
 
-#if USE_MCJIT
-    // Compilation buffer for MCJIT
+    // Compilation buffer for MC
     llvm::SmallVector<char, 1024> mEmittedELFExecutable;
 
     // Loaded and relocated executable
     RSExecRef mRSExecutable;
-#endif
 
     BCCSymbolLookupFn mpSymbolLookupFn;
     void *mpSymbolLookupContext;
@@ -117,13 +113,11 @@
       mpSymbolLookupContext = pContext;
     }
 
-#if USE_MCJIT
     void *getSymbolAddress(char const *name);
 
     const llvm::SmallVector<char, 1024> &getELF() const {
       return mEmittedELFExecutable;
     }
-#endif
 
     int readModule(llvm::Module *module) {
       mModule = module;
@@ -152,9 +146,8 @@
 
     int runMCCodeGen(llvm::TargetData *TD, llvm::TargetMachine *TM);
 
-#if USE_MCJIT
     static void *resolveSymbolAdapter(void *context, char const *name);
-#endif
+
     int runInternalPasses(std::vector<std::string>& Names,
                           std::vector<uint32_t>& Signatures);
 
diff --git a/lib/ExecutionEngine/MCCacheReader.cpp b/lib/ExecutionEngine/MCCacheReader.cpp
index 5beff88..4232ba5 100644
--- a/lib/ExecutionEngine/MCCacheReader.cpp
+++ b/lib/ExecutionEngine/MCCacheReader.cpp
@@ -39,8 +39,6 @@
 
 using namespace std;
 
-
-#if USE_MCJIT
 namespace bcc {
 
 MCCacheReader::~MCCacheReader() {
@@ -352,7 +350,7 @@
   for (size_t i = 0; i < export_var_name_list_raw->count; ++i) {
     mpResult->mpExportVars->cached_addr_list[i] =
       rsloaderGetSymbolAddress(mpResult->mRSExecutable, strPool[export_var_name_list_raw->strp_indexs[i]]);
-#if DEBUG_MCJIT_REFLECT
+#if DEBUG_MC_REFLECT
     ALOGD("Get symbol address: %s -> %p",
       strPool[export_var_name_list_raw->strp_indexs[i]], mpResult->mpExportVars->cached_addr_list[i]);
 #endif
@@ -376,7 +374,7 @@
   for (size_t i = 0; i < export_func_name_list_raw->count; ++i) {
     mpResult->mpExportFuncs->cached_addr_list[i] =
       rsloaderGetSymbolAddress(mpResult->mRSExecutable, strPool[export_func_name_list_raw->strp_indexs[i]]);
-#if DEBUG_MCJIT_REFLECT
+#if DEBUG_MC_REFLECT
     ALOGD("Get function address: %s -> %p",
       strPool[export_func_name_list_raw->strp_indexs[i]], mpResult->mpExportFuncs->cached_addr_list[i]);
 #endif
@@ -400,7 +398,7 @@
   for (size_t i = 0; i < export_foreach_name_list_raw->count; ++i) {
     mpResult->mpExportForEach->cached_addr_list[i] =
       rsloaderGetSymbolAddress(mpResult->mRSExecutable, strPool[export_foreach_name_list_raw->strp_indexs[i]]);
-#if DEBUG_MCJIT_REFLECT
+#if DEBUG_MC_REFLECT
     ALOGE("Get foreach function address: %s -> %p",
       strPool[export_foreach_name_list_raw->strp_indexs[i]], mpResult->mpExportForEach->cached_addr_list[i]);
 #endif
@@ -484,4 +482,3 @@
 }
 
 } // namespace bcc
-#endif
diff --git a/lib/ExecutionEngine/MCCacheWriter.cpp b/lib/ExecutionEngine/MCCacheWriter.cpp
index cca724e..427f067 100644
--- a/lib/ExecutionEngine/MCCacheWriter.cpp
+++ b/lib/ExecutionEngine/MCCacheWriter.cpp
@@ -31,7 +31,6 @@
 
 using namespace std;
 
-#if USE_MCJIT
 namespace bcc {
 
 MCCacheWriter::~MCCacheWriter() {
@@ -387,4 +386,3 @@
 }
 
 } // namespace bcc
-#endif
diff --git a/lib/ExecutionEngine/Script.cpp b/lib/ExecutionEngine/Script.cpp
index 3b67e04..65f7dfb 100644
--- a/lib/ExecutionEngine/Script.cpp
+++ b/lib/ExecutionEngine/Script.cpp
@@ -285,7 +285,6 @@
     return 1;
   }
 
-#if USE_MCJIT
   MCCacheReader reader;
 
   // Register symbol lookup function
@@ -293,7 +292,6 @@
     reader.registerSymbolCallback(mpExtSymbolLookupFn,
                                       mpExtSymbolLookupFnContext);
   }
-#endif
 
   // Dependencies
   reader.addDependency(BCC_FILE_RESOURCE, pathLibBCC_SHA1, sha1LibBCC_SHA1);
@@ -412,9 +410,7 @@
     // to modify its contents.  (The same script may be running concurrently in
     // the same process or a different process!)
     ::unlink(objPath.c_str());
-#if USE_MCJIT
     ::unlink(infoPath.c_str());
-#endif
 
     FileHandle objFile;
     FileHandle infoFile;
@@ -422,9 +418,7 @@
     if (objFile.open(objPath.c_str(), OpenMode::Write) >= 0 &&
         infoFile.open(infoPath.c_str(), OpenMode::Write) >= 0) {
 
-#if USE_MCJIT
       MCCacheWriter writer;
-#endif
 
 #ifdef TARGET_BUILD
       // Dependencies
@@ -813,7 +807,6 @@
 #endif
 }
 
-#if USE_MCJIT
 size_t Script::getELFSize() const {
   switch (mStatus) {
     case ScriptStatus::Compiled: {
@@ -845,6 +838,5 @@
     }
   }
 }
-#endif
 
 } // namespace bcc
diff --git a/lib/ExecutionEngine/Script.h b/lib/ExecutionEngine/Script.h
index 9253871..f3e933d 100644
--- a/lib/ExecutionEngine/Script.h
+++ b/lib/ExecutionEngine/Script.h
@@ -81,15 +81,11 @@
     std::string mCacheName;
 
     inline std::string getCachedObjectPath() const {
-#if USE_MCJIT
       return std::string(mCacheDir + mCacheName + ".o");
-#endif
     }
 
     inline std::string getCacheInfoPath() const {
-#if USE_MCJIT
       return getCachedObjectPath().append(".info");
-#endif
     }
 #endif
 
diff --git a/lib/ExecutionEngine/ScriptCached.cpp b/lib/ExecutionEngine/ScriptCached.cpp
index 03a4f7a..1b08bc4 100644
--- a/lib/ExecutionEngine/ScriptCached.cpp
+++ b/lib/ExecutionEngine/ScriptCached.cpp
@@ -116,11 +116,7 @@
 
 
 void *ScriptCached::lookup(const char *name) {
-#if USE_MCJIT
   return rsloaderGetSymbolAddress(mRSExecutable, name);
-#endif
-  FuncTable::const_iterator I = mFunctions.find(name);
-  return (I == mFunctions.end()) ? NULL : I->second.first;
 }
 
 void ScriptCached::getFuncInfoList(size_t funcInfoListSize,
diff --git a/lib/ExecutionEngine/ScriptCached.h b/lib/ExecutionEngine/ScriptCached.h
index 338dbdb..750050f 100644
--- a/lib/ExecutionEngine/ScriptCached.h
+++ b/lib/ExecutionEngine/ScriptCached.h
@@ -24,9 +24,7 @@
 #include <bcc/bcc_mccache.h>
 #include "bcc_internal.h"
 
-#if USE_MCJIT
 #include "librsloader.h"
-#endif
 
 #include <llvm/ADT/SmallVector.h>
 
@@ -67,10 +65,8 @@
 
     FuncTable mFunctions;
 
-#if USE_MCJIT
     RSExecRef mRSExecutable;
     llvm::SmallVector<char, 1024> mCachedELFExecutable;
-#endif
 
     OBCC_StringPool *mpStringPoolRaw;
     std::vector<char const *> mStringPool;
@@ -132,7 +128,6 @@
     void getObjectSlotList(size_t objectSlotListSize,
                            uint32_t *objectSlotList);
 
-#if USE_MCJIT
     const char *getELF() const {
       return &*mCachedELFExecutable.begin();
     }
@@ -140,7 +135,7 @@
     size_t getELFSize() const {
       return mCachedELFExecutable.size();
     }
-#endif
+
     // Dirty hack for libRS.
     // TODO(all): This should be removed in the future.
     bool isLibRSThreadable() const {
diff --git a/lib/ExecutionEngine/ScriptCompiled.cpp b/lib/ExecutionEngine/ScriptCompiled.cpp
index 3de7a7f..4f2bb1b 100644
--- a/lib/ExecutionEngine/ScriptCompiled.cpp
+++ b/lib/ExecutionEngine/ScriptCompiled.cpp
@@ -109,11 +109,7 @@
 
 
 void *ScriptCompiled::lookup(const char *name) {
-#if USE_MCJIT
   return mCompiler.getSymbolAddress(name);
-#endif
-
-  return NULL;
 }
 
 
diff --git a/lib/ExecutionEngine/ScriptCompiled.h b/lib/ExecutionEngine/ScriptCompiled.h
index 36ef24d..d945024 100644
--- a/lib/ExecutionEngine/ScriptCompiled.h
+++ b/lib/ExecutionEngine/ScriptCompiled.h
@@ -142,7 +142,6 @@
       return mpOwner->getUserDefinedExternalSymbols();
     }
 
-#if USE_MCJIT
     const char *getELF() const {
       return &*mCompiler.getELF().begin();
     }
@@ -150,7 +149,6 @@
     size_t getELFSize() const {
       return mCompiler.getELF().size();
     }
-#endif
 
     void registerSymbolCallback(BCCSymbolLookupFn pFn, void *pContext) {
       mCompiler.registerSymbolCallback(pFn, pContext);
diff --git a/lib/ExecutionEngine/SourceInfo.cpp b/lib/ExecutionEngine/SourceInfo.cpp
index 6efdf7e..b937b05 100644
--- a/lib/ExecutionEngine/SourceInfo.cpp
+++ b/lib/ExecutionEngine/SourceInfo.cpp
@@ -17,11 +17,9 @@
 #include "SourceInfo.h"
 
 #if USE_CACHE
-#if USE_MCJIT
 #include "MCCacheWriter.h"
 #include "MCCacheReader.h"
 #endif
-#endif
 
 #include "DebugHelper.h"
 #include "ScriptCompiled.h"
@@ -212,10 +210,8 @@
   }
 }
 
-#if USE_MCJIT
 template void SourceInfo::introDependency<MCCacheWriter>(MCCacheWriter &);
 template void SourceInfo::introDependency<MCCacheReader>(MCCacheReader &);
-#endif
 #endif // USE_CACHE