For PR540:
This patch completes the changes for making lli thread-safe. Here's the list
of changes:
* The Support/ThreadSupport* files were removed and replaced with the
  MutexGuard.h file since all ThreadSupport* declared was a Mutex Guard.
  The implementation of MutexGuard.h is now based on sys::Mutex which hides
  its implementation and makes it unnecessary to have the -NoSupport.h and
  -PThreads.h versions of ThreadSupport.

* All places in ExecutionEngine that previously referred to "Mutex" now
  refer to sys::Mutex

* All places in ExecutionEngine that previously referred to "MutexLocker"
  now refer to MutexGuard (this is frivolous but I believe the technically
  correct name for such a class is "Guard" not a "Locker").

These changes passed all of llvm-test. All we need now are some test cases
that actually use multiple threads.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22404 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/ExecutionEngine/JIT/JIT.h b/lib/ExecutionEngine/JIT/JIT.h
index 3c14cf7..4cce144 100644
--- a/lib/ExecutionEngine/JIT/JIT.h
+++ b/lib/ExecutionEngine/JIT/JIT.h
@@ -27,18 +27,35 @@
 class TargetJITInfo;
 class MachineCodeEmitter;
 
-class JIT : public ExecutionEngine {
-  TargetMachine &TM;       // The current target we are compiling to
-  TargetJITInfo &TJI;      // The JITInfo for the target we are compiling to
-
+class JITState {
+private:
   FunctionPassManager PM;  // Passes to compile a function
-  MachineCodeEmitter *MCE; // MCE object
 
   /// PendingGlobals - Global variables which have had memory allocated for them
   /// while a function was code generated, but which have not been initialized
   /// yet.
   std::vector<const GlobalVariable*> PendingGlobals;
 
+public:
+  JITState(ModuleProvider *MP) : PM(MP) {}
+
+  FunctionPassManager& getPM(const MutexGuard& locked) {
+    return PM;
+  }
+
+  std::vector<const GlobalVariable*>& getPendingGlobals(const MutexGuard& locked) {
+    return PendingGlobals;
+  }
+};
+
+
+class JIT : public ExecutionEngine {
+  TargetMachine &TM;       // The current target we are compiling to
+  TargetJITInfo &TJI;      // The JITInfo for the target we are compiling to
+  MachineCodeEmitter *MCE; // MCE object
+
+  JITState state;
+
   JIT(ModuleProvider *MP, TargetMachine &tm, TargetJITInfo &tji);
 public:
   ~JIT();