Revert "Switch to use RSCompilerDriver."

This reverts commit fef9a1b0b772034b4f0894d1e2b29d1115617be0.

Conflicts:

	lib/ExecutionEngine/RSCompiler.cpp

Change-Id: Ic6f3a3643e286a20799e1c7f03dee5d6c3683fef
diff --git a/lib/ExecutionEngine/MCCacheWriter.h b/lib/ExecutionEngine/MCCacheWriter.h
new file mode 100644
index 0000000..47f1e40
--- /dev/null
+++ b/lib/ExecutionEngine/MCCacheWriter.h
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2010-2012, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BCC_MCCACHEWRITER_H
+#define BCC_MCCACHEWRITER_H
+
+#include <bcc/bcc_mccache.h>
+
+#include <map>
+#include <string>
+#include <utility>
+#include <vector>
+
+namespace bcc {
+  class OutputFile;
+  class RSScript;
+
+  class MCCacheWriter {
+  private:
+    RSScript *mpOwner;
+
+    OutputFile *mObjFile, *mInfoFile;
+
+    std::vector<std::pair<char const *, size_t> > mStringPool;
+
+    std::map<std::string, unsigned char const *> mDependencies;
+
+    MCO_Header *mpHeaderSection;
+    MCO_StringPool *mpStringPoolSection;
+    MCO_DependencyTable *mpDependencyTableSection;
+    MCO_PragmaList *mpPragmaListSection;
+    MCO_ObjectSlotList *mpObjectSlotSection;
+
+    MCO_String_Ptr *mpExportVarNameListSection;
+    MCO_String_Ptr *mpExportFuncNameListSection;
+    MCO_String_Ptr *mpExportForEachNameListSection;
+
+    std::vector<std::string> varNameList;
+    std::vector<std::string> funcNameList;
+    std::vector<std::string> forEachNameList;
+
+  public:
+    MCCacheWriter()
+      : mpHeaderSection(NULL), mpStringPoolSection(NULL),
+        mpDependencyTableSection(NULL), mpPragmaListSection(NULL),
+        mpObjectSlotSection(NULL) {
+    }
+
+    ~MCCacheWriter();
+
+    bool writeCacheFile(OutputFile &objFile, OutputFile &infoFile,
+                        RSScript *S, uint32_t libRS_threadable);
+
+    void addDependency(std::string const &resName,
+                       unsigned char const *sha1) {
+      mDependencies.insert(std::make_pair(resName, sha1));
+    }
+
+  private:
+    bool prepareHeader(uint32_t libRS_threadable);
+    bool prepareStringPool();
+    bool prepareDependencyTable();
+    bool prepareRelocationTable();
+    bool preparePragmaList();
+    bool prepareObjectSlotList();
+
+    bool prepareExportVarNameList();
+    bool prepareExportFuncNameList();
+    bool prepareExportForEachNameList();
+
+    bool writeAll();
+
+    bool calcSectionOffset();
+
+    size_t addString(char const *str, size_t size) {
+      mStringPool.push_back(std::make_pair(str, size));
+      return mStringPool.size() - 1;
+    }
+
+  };
+
+} // namespace bcc
+
+#endif // BCC_MCCACHEWRITER_H