Quick compiler: reuse llvm context & ir builder

With this CL, we avoid setting up an llvm context, module and intrinsic
definitions for each method, and considerably speed up compilation time.
This does not represent a final form - we'll be reworking the compiler driver
to support Quick & Portable via the command line, and this code will likely
change at that time.

Change-Id: I19e298a011141c3bc35c4f28175b2b20653fd5e4
diff --git a/src/compiler/Compiler.h b/src/compiler/Compiler.h
index 659b5a6..9ac6016 100644
--- a/src/compiler/Compiler.h
+++ b/src/compiler/Compiler.h
@@ -20,7 +20,20 @@
 #include "dex_file.h"
 #include "dex_instruction.h"
 
+#if defined(ART_USE_QUICK_COMPILER)
+namespace llvm {
+  class Module;
+  class LLVMContext;
+}
+#endif
+
 namespace art {
+#if defined(ART_USE_QUICK_COMPILER)
+namespace greenland {
+  class IntrinsicHelper;
+  class IRBuilder;
+}
+#endif
 
 #define COMPILER_TRACED(X)
 #define COMPILER_TRACEE(X)
@@ -163,6 +176,41 @@
   kReversePostOrderTraversal, // Depth-First-Search / reverse Post-Order
 };
 
+#if defined(ART_USE_QUICK_COMPILER)
+class QuickCompiler {
+  public:
+    QuickCompiler(art::Compiler* compiler);
+    ~QuickCompiler();
+
+    const art::Compiler* GetCompiler() const {
+      return compiler_;
+    }
+
+    llvm::LLVMContext* GetLLVMContext() {
+      return llvm_context_.get();
+    }
+
+    llvm::Module* GetLLVMModule() {
+      return llvm_module_.get();
+    }
+
+    art::greenland::IntrinsicHelper* GetIntrinsicHelper() {
+      return intrinsic_helper_.get();
+    }
+
+    art::greenland::IRBuilder* GetIRBuilder() {
+      return ir_builder_.get();
+    }
+
+  private:
+    const art::Compiler* const compiler_;
+    UniquePtr<llvm::LLVMContext> llvm_context_;
+    UniquePtr<llvm::Module> llvm_module_;
+    UniquePtr<art::greenland::IntrinsicHelper> intrinsic_helper_;
+    UniquePtr<art::greenland::IRBuilder> ir_builder_;
+};
+#endif
+
 struct CompilationUnit;
 struct BasicBlock;
 struct SSARepresentation;