Re-order the member.  (variables first method later)
diff --git a/lib/bcc/CodeEmitter.h b/lib/bcc/CodeEmitter.h
index 90e95ca..7096bcf 100644
--- a/lib/bcc/CodeEmitter.h
+++ b/lib/bcc/CodeEmitter.h
@@ -63,11 +63,22 @@
   class EmittedFuncEntry;
 
   class CodeEmitter : public llvm::JITCodeEmitter {
+  private:
+    typedef llvm::DenseMap<const llvm::GlobalValue *, void *>
+      GlobalAddressMapTy;
+
+    typedef std::map<const std::string, EmittedFuncEntry *>
+      EmittedFunctionsMapTy;
+
+    typedef llvm::DenseMap<const llvm::Function *, void*>
+      FunctionToLazyStubMapTy;
+
+    typedef std::map<llvm::AssertingVH<llvm::GlobalValue>, void *>
+      GlobalToIndirectSymMapTy;
+
   public:
-    typedef llvm::DenseMap<const llvm::GlobalValue*, void*> GlobalAddressMapTy;
     typedef GlobalAddressMapTy::const_iterator global_addresses_const_iterator;
 
-    GlobalAddressMapTy mGlobalAddressMap;
 
   private:
     CodeMemoryManager *mpMemMgr;
@@ -79,12 +90,13 @@
 
     const llvm::TargetData *mpTD;
 
+
     EmittedFuncEntry *mpCurEmitFunction;
 
-    typedef std::map<const std::string,
-                     EmittedFuncEntry *> EmittedFunctionsMapTy;
     EmittedFunctionsMapTy mEmittedFunctions;
 
+    GlobalAddressMapTy mGlobalAddressMap;
+
     // This vector is a mapping from MBB ID's to their address. It is filled in
     // by the StartMachineBasicBlock callback and queried by the
     // getMachineBasicBlockAddress callback.
@@ -120,6 +132,145 @@
     // Machine module info for exception informations
     llvm::MachineModuleInfo *mpMMI;
 
+
+    FunctionToLazyStubMapTy mFunctionToLazyStubMap;
+
+    std::set<const llvm::Function*> PendingFunctions;
+
+    GlobalToIndirectSymMapTy GlobalToIndirectSymMap;
+
+    std::map<void*, void*> ExternalFnToStubMap;
+
+#if defined(USE_DISASSEMBLER)
+    const llvm::MCAsmInfo *mpAsmInfo;
+    const llvm::MCDisassembler *mpDisassmbler;
+    llvm::MCInstPrinter *mpIP;
+#endif
+
+    // Resolver to undefined symbol in CodeEmitter
+    BCCSymbolLookupFn mpSymbolLookupFn;
+    void *mpSymbolLookupContext;
+
+  public:
+    // Will take the ownership of @MemMgr
+    explicit CodeEmitter(CodeMemoryManager *pMemMgr);
+
+    virtual ~CodeEmitter();
+
+    void Disassemble(const llvm::StringRef &Name, uint8_t *Start,
+                     size_t Length, bool IsStub);
+
+    global_addresses_const_iterator global_address_begin() const {
+      return mGlobalAddressMap.begin();
+    }
+
+    global_addresses_const_iterator global_address_end() const {
+      return mGlobalAddressMap.end();
+    }
+
+    std::vector<oBCCRelocEntry> const &getCachingRelocations() const {
+      return mCachingRelocations;
+    }
+
+    void registerSymbolCallback(BCCSymbolLookupFn pFn, BCCvoid *pContext) {
+      mpSymbolLookupFn = pFn;
+      mpSymbolLookupContext = pContext;
+    }
+
+    void setTargetMachine(llvm::TargetMachine &TM);
+
+    // This callback is invoked when the specified function is about to be code
+    // generated.  This initializes the BufferBegin/End/Ptr fields.
+    virtual void startFunction(llvm::MachineFunction &F);
+
+    // This callback is invoked when the specified function has finished code
+    // generation. If a buffer overflow has occurred, this method returns true
+    // (the callee is required to try again).
+    virtual bool finishFunction(llvm::MachineFunction &F);
+
+    // Allocates and fills storage for an indirect GlobalValue, and returns the
+    // address.
+    virtual void *allocIndirectGV(const llvm::GlobalValue *GV,
+                                  const uint8_t *Buffer, size_t Size,
+                                  unsigned Alignment);
+
+    // Emits a label
+    virtual void emitLabel(llvm::MCSymbol *Label) {
+      mLabelLocations[Label] = getCurrentPCValue();
+    }
+
+    // Allocate memory for a global. Unlike allocateSpace, this method does not
+    // allocate memory in the current output buffer, because a global may live
+    // longer than the current function.
+    virtual void *allocateGlobal(uintptr_t Size, unsigned Alignment);
+
+    // This should be called by the target when a new basic block is about to be
+    // emitted. This way the MCE knows where the start of the block is, and can
+    // implement getMachineBasicBlockAddress.
+    virtual void StartMachineBasicBlock(llvm::MachineBasicBlock *MBB);
+
+    // Whenever a relocatable address is needed, it should be noted with this
+    // interface.
+    virtual void addRelocation(const llvm::MachineRelocation &MR) {
+      mRelocations.push_back(MR);
+    }
+
+    // Return the address of the @Index entry in the constant pool that was
+    // last emitted with the emitConstantPool method.
+    virtual uintptr_t getConstantPoolEntryAddress(unsigned Index) const {
+      assert(Index < mpConstantPool->getConstants().size() &&
+             "Invalid constant pool index!");
+      return mConstPoolAddresses[Index];
+    }
+
+    // Return the address of the jump table with index @Index in the function
+    // that last called initJumpTableInfo.
+    virtual uintptr_t getJumpTableEntryAddress(unsigned Index) const;
+
+    // Return the address of the specified MachineBasicBlock, only usable after
+    // the label for the MBB has been emitted.
+    virtual uintptr_t getMachineBasicBlockAddress(
+                                        llvm::MachineBasicBlock *MBB) const;
+
+    // Return the address of the specified LabelID, only usable after the
+    // LabelID has been emitted.
+    virtual uintptr_t getLabelAddress(llvm::MCSymbol *Label) const {
+      assert(mLabelLocations.count(Label) && "Label not emitted!");
+      return mLabelLocations.find(Label)->second;
+    }
+
+    // Specifies the MachineModuleInfo object. This is used for exception
+    // handling purposes.
+    virtual void setModuleInfo(llvm::MachineModuleInfo *Info) {
+      mpMMI = Info;
+    }
+
+    void releaseUnnecessary();
+
+    void reset();
+
+    void *lookup(const char *Name) {
+      return lookup( llvm::StringRef(Name) );
+    }
+
+    void *lookup(const llvm::StringRef &Name);
+
+    void getFunctionNames(BCCsizei *actualFunctionCount,
+                          BCCsizei maxFunctionCount,
+                          BCCchar **functions);
+
+    void getFunctionBinary(BCCchar *label,
+                           BCCvoid **base,
+                           BCCsizei *length);
+
+  private:
+    void startGVStub(const llvm::GlobalValue *GV, unsigned StubSize,
+                     unsigned Alignment);
+
+    void startGVStub(void *Buffer, unsigned StubSize);
+
+    void finishGVStub();
+
     // Replace an existing mapping for GV with a new address. This updates both
     // maps as required. If Addr is null, the entry for the global is removed
     // from the mappings.
@@ -170,17 +321,14 @@
     // if available.
     void *GetPointerToFunctionOrStub(llvm::Function *F);
 
-    typedef llvm::DenseMap<const llvm::Function*,
-                           void*> FunctionToLazyStubMapTy;
-    FunctionToLazyStubMapTy mFunctionToLazyStubMap;
-
     void *GetLazyFunctionStubIfAvailable(llvm::Function *F) {
       return mFunctionToLazyStubMap.lookup(F);
     }
 
-    std::set<const llvm::Function*> PendingFunctions;
     void *GetLazyFunctionStub(llvm::Function *F);
 
+    void updateFunctionStub(const llvm::Function *F);
+
     void *GetPointerToFunction(const llvm::Function *F, bool AbortOnFailure);
 
     void *GetPointerToNamedSymbol(const std::string &Name,
@@ -196,11 +344,6 @@
 
     void EmitGlobalVariable(const llvm::GlobalVariable *GV);
 
-    typedef std::map<llvm::AssertingVH<llvm::GlobalValue>,
-                     void *> GlobalToIndirectSymMapTy;
-
-    GlobalToIndirectSymMapTy GlobalToIndirectSymMap;
-
     void *GetPointerToGVIndirectSym(llvm::GlobalValue *V, void *Reference);
 
     // This is the equivalent of FunctionToLazyStubMap for external functions.
@@ -210,143 +353,10 @@
     //                 succeed, but no single stub can guarantee that. I'll
     //                 remove this in a subsequent checkin when I actually fix
     //                 far calls.
-    std::map<void*, void*> ExternalFnToStubMap;
 
     // Return a stub for the function at the specified address.
     void *GetExternalFunctionStub(void *FnAddr);
 
-#if defined(USE_DISASSEMBLER)
-    const llvm::MCAsmInfo *mpAsmInfo;
-    const llvm::MCDisassembler *mpDisassmbler;
-    llvm::MCInstPrinter *mpIP;
-#endif
-
-  public:
-    void Disassemble(const llvm::StringRef &Name, uint8_t *Start,
-                     size_t Length, bool IsStub);
-
-  private:
-    // Resolver to undefined symbol in CodeEmitter
-    BCCSymbolLookupFn mpSymbolLookupFn;
-    void *mpSymbolLookupContext;
-
-  public:
-    // Will take the ownership of @MemMgr
-    explicit CodeEmitter(CodeMemoryManager *pMemMgr);
-
-    virtual ~CodeEmitter();
-
-    global_addresses_const_iterator global_address_begin() const {
-      return mGlobalAddressMap.begin();
-    }
-
-    global_addresses_const_iterator global_address_end() const {
-      return mGlobalAddressMap.end();
-    }
-
-    std::vector<oBCCRelocEntry> const &getCachingRelocations() const {
-      return mCachingRelocations;
-    }
-
-    void registerSymbolCallback(BCCSymbolLookupFn pFn, BCCvoid *pContext) {
-      mpSymbolLookupFn = pFn;
-      mpSymbolLookupContext = pContext;
-    }
-
-    void setTargetMachine(llvm::TargetMachine &TM);
-
-    // This callback is invoked when the specified function is about to be code
-    // generated.  This initializes the BufferBegin/End/Ptr fields.
-    virtual void startFunction(llvm::MachineFunction &F);
-
-    // This callback is invoked when the specified function has finished code
-    // generation. If a buffer overflow has occurred, this method returns true
-    // (the callee is required to try again).
-    virtual bool finishFunction(llvm::MachineFunction &F);
-
-    void startGVStub(const llvm::GlobalValue *GV, unsigned StubSize,
-                     unsigned Alignment);
-
-    void startGVStub(void *Buffer, unsigned StubSize);
-
-    void finishGVStub();
-
-    // Allocates and fills storage for an indirect GlobalValue, and returns the
-    // address.
-    virtual void *allocIndirectGV(const llvm::GlobalValue *GV,
-                                  const uint8_t *Buffer, size_t Size,
-                                  unsigned Alignment);
-
-    // Emits a label
-    void emitLabel(llvm::MCSymbol *Label) {
-      mLabelLocations[Label] = getCurrentPCValue();
-    }
-
-    // Allocate memory for a global. Unlike allocateSpace, this method does not
-    // allocate memory in the current output buffer, because a global may live
-    // longer than the current function.
-    virtual void *allocateGlobal(uintptr_t Size, unsigned Alignment);
-
-    // This should be called by the target when a new basic block is about to be
-    // emitted. This way the MCE knows where the start of the block is, and can
-    // implement getMachineBasicBlockAddress.
-    virtual void StartMachineBasicBlock(llvm::MachineBasicBlock *MBB);
-
-    // Whenever a relocatable address is needed, it should be noted with this
-    // interface.
-    virtual void addRelocation(const llvm::MachineRelocation &MR) {
-      mRelocations.push_back(MR);
-    }
-
-    // Return the address of the @Index entry in the constant pool that was
-    // last emitted with the emitConstantPool method.
-    virtual uintptr_t getConstantPoolEntryAddress(unsigned Index) const {
-      assert(Index < mpConstantPool->getConstants().size() &&
-             "Invalid constant pool index!");
-      return mConstPoolAddresses[Index];
-    }
-
-    // Return the address of the jump table with index @Index in the function
-    // that last called initJumpTableInfo.
-    virtual uintptr_t getJumpTableEntryAddress(unsigned Index) const;
-
-    // Return the address of the specified MachineBasicBlock, only usable after
-    // the label for the MBB has been emitted.
-    virtual uintptr_t getMachineBasicBlockAddress(
-                                        llvm::MachineBasicBlock *MBB) const;
-
-    // Return the address of the specified LabelID, only usable after the
-    // LabelID has been emitted.
-    virtual uintptr_t getLabelAddress(llvm::MCSymbol *Label) const {
-      assert(mLabelLocations.count(Label) && "Label not emitted!");
-      return mLabelLocations.find(Label)->second;
-    }
-
-    // Specifies the MachineModuleInfo object. This is used for exception
-    // handling purposes.
-    virtual void setModuleInfo(llvm::MachineModuleInfo *Info) {
-      mpMMI = Info;
-    }
-
-    void updateFunctionStub(const llvm::Function *F);
-
-    void releaseUnnecessary();
-
-    void reset();
-
-    void *lookup(const char *Name) {
-      return lookup( llvm::StringRef(Name) );
-    }
-
-    void *lookup(const llvm::StringRef &Name);
-
-    void getFunctionNames(BCCsizei *actualFunctionCount,
-                          BCCsizei maxFunctionCount,
-                          BCCchar **functions);
-
-    void getFunctionBinary(BCCchar *label,
-                           BCCvoid **base,
-                           BCCsizei *length);
   };
 
 } // namespace bcc
diff --git a/lib/bcc/CodeMemoryManager.h b/lib/bcc/CodeMemoryManager.h
index 4a25ee6..2c147df 100644
--- a/lib/bcc/CodeMemoryManager.h
+++ b/lib/bcc/CodeMemoryManager.h
@@ -66,6 +66,12 @@
 
   class CodeMemoryManager : public llvm::JITMemoryManager {
   private:
+    typedef std::map<const llvm::Function*,
+                     std::pair<void * /* start address */,
+                               void * /* end address */> > FunctionMapTy;
+
+
+  private:
     //
     // Our memory layout is as follows:
     //
@@ -103,30 +109,12 @@
     // GOT Base
     uint8_t *mpGOTBase;
 
-    typedef std::map<const llvm::Function*,
-                     std::pair<void * /* start address */,
-                               void * /* end address */> > FunctionMapTy;
-
     FunctionMapTy mFunctionMap;
 
-    intptr_t getFreeCodeMemSize() const {
-      return mCurSGMemIdx - mCurFuncMemIdx;
-    }
-
-    uint8_t *allocateSGMemory(uintptr_t Size,
-                              unsigned Alignment = 1 /* no alignment */);
-
-    uintptr_t getFreeGVMemSize() const {
-      return MaxGlobalVarSize - mCurGVMemIdx;
-    }
-
-    uint8_t *getGVMemBase() const {
-      return reinterpret_cast<uint8_t*>(mpGVMem);
-    }
 
   public:
-
     CodeMemoryManager();
+
     virtual ~CodeMemoryManager();
 
     uint8_t *getCodeMemBase() const {
@@ -233,6 +221,23 @@
     // Below are the methods we create
     void reset();
 
+
+  private:
+    intptr_t getFreeCodeMemSize() const {
+      return mCurSGMemIdx - mCurFuncMemIdx;
+    }
+
+    uint8_t *allocateSGMemory(uintptr_t Size,
+                              unsigned Alignment = 1 /* no alignment */);
+
+    uintptr_t getFreeGVMemSize() const {
+      return MaxGlobalVarSize - mCurGVMemIdx;
+    }
+
+    uint8_t *getGVMemBase() const {
+      return reinterpret_cast<uint8_t*>(mpGVMem);
+    }
+
   };
 
 } // namespace bcc
diff --git a/lib/bcc/Compiler.h b/lib/bcc/Compiler.h
index 08c92c5..0d5f7bf 100644
--- a/lib/bcc/Compiler.h
+++ b/lib/bcc/Compiler.h
@@ -51,6 +51,13 @@
 namespace bcc {
 
   class Compiler {
+  private:
+    typedef std::list< std::pair<std::string, std::string> > PragmaList;
+    typedef std::list<void*> ExportVarList;
+    typedef std::list<void*> ExportFuncList;
+
+
+  private:
     // This part is designed to be orthogonal to those exported bcc*() functions
     // implementation and internal struct BCCscript.
 
@@ -88,22 +95,10 @@
     friend class CodeEmitter;
     friend class CodeMemoryManager;
 
+
   private:
     std::string mError;
 
-    bool hasError() const {
-      return !mError.empty();
-    }
-
-    void setError(const char *Error) {
-      mError.assign(Error);  // Copying
-    }
-
-    void setError(const std::string &Error) {
-      mError = Error;
-    }
-
-  private:
     bool mUseCache;         // Set by readBC()
     bool mCacheNew;         // Set by readBC()
     int mCacheFd;           // Set by readBC()
@@ -112,24 +107,19 @@
     size_t mCacheSize;      // Set by loadCacheFile()
     ptrdiff_t mCacheDiff;   // Set by loadCacheFile()
     char *mCodeDataAddr;    // Set by CodeMemoryManager if mCacheNew is true.
-    // Used by genCacheFile() for dumping
+                            // Used by genCacheFile() for dumping
 
-    typedef std::list< std::pair<std::string, std::string> > PragmaList;
     PragmaList mPragmas;
 
-    typedef std::list<void*> ExportVarList;
     ExportVarList mExportVars;
 
-    typedef std::list<void*> ExportFuncList;
     ExportFuncList mExportFuncs;
 
     // The memory manager for code emitter
     llvm::OwningPtr<CodeMemoryManager> mCodeMemMgr;
-    CodeMemoryManager *createCodeMemoryManager();
 
     // The CodeEmitter
     llvm::OwningPtr<CodeEmitter> mCodeEmitter;
-    CodeEmitter *createCodeEmitter();
 
     BCCSymbolLookupFn mpSymbolLookupFn;
     void *mpSymbolLookupContext;
@@ -148,6 +138,10 @@
       mpSymbolLookupContext = pContext;
     }
 
+    CodeMemoryManager *createCodeMemoryManager();
+
+    CodeEmitter *createCodeEmitter();
+
     int readModule(llvm::Module *module) {
       GlobalInitialization();
       mModule = module;
@@ -234,6 +228,20 @@
                                     uint32_t libRSWhen,
                                     uint32_t libbccWhen);
 
+  private:
+
+    bool hasError() const {
+      return !mError.empty();
+    }
+
+    void setError(const char *Error) {
+      mError.assign(Error);  // Copying
+    }
+
+    void setError(const std::string &Error) {
+      mError = Error;
+    }
+
   };