* Add real support for global variable addresses initializing constants
* Add minor optimization to BytecodeParser::refineAbstractType
* MethodType::get now take an explicit isVarArg parameter
* Fix encoding/decoding of VarArgs calls
* Support the Invoke instruction


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@760 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Bytecode/Reader/ReaderInternals.h b/lib/Bytecode/Reader/ReaderInternals.h
index ec486d8..a5b01c2 100644
--- a/lib/Bytecode/Reader/ReaderInternals.h
+++ b/lib/Bytecode/Reader/ReaderInternals.h
@@ -29,6 +29,7 @@
 class Method;
 class Module;
 class Type;
+class PointerType;
 
 typedef unsigned char uchar;
 
@@ -52,11 +53,22 @@
 
   Module *ParseBytecode(const uchar *Buf, const uchar *EndBuf);
 private:          // All of this data is transient across calls to ParseBytecode
+  Module *TheModule;   // Current Module being read into...
+  
   typedef vector<Value *> ValueList;
   typedef vector<ValueList> ValueTable;
   ValueTable Values, LateResolveValues;
   ValueTable ModuleValues, LateResolveModuleValues;
 
+  // GlobalRefs - This maintains a mapping between <Type, Slot #>'s and forward
+  // references to global values.  Global values may be referenced before they
+  // are defined, and if so, the temporary object that they represent is held
+  // here.
+  //
+  typedef map<pair<const PointerType *, unsigned>, GlobalVariable*>
+                                                               GlobalRefsType;
+  GlobalRefsType GlobalRefs;
+
   // TypesLoaded - This vector mirrors the Values[TypeTyID] plane.  It is used
   // to deal with forward references to types.
   //
@@ -94,11 +106,15 @@
   Value      *getValue(const Type *Ty, unsigned num, bool Create = true);
   const Type *getType(unsigned ID);
 
-  bool insertValue(Value *D, vector<ValueList> &D);
+  int insertValue(Value *D, vector<ValueList> &D);  // -1 = Failure
   bool postResolveValues(ValueTable &ValTab);
 
   bool getTypeSlot(const Type *Ty, unsigned &Slot);
 
+  // DeclareNewGlobalValue - Patch up forward references to global values in the
+  // form of ConstPoolPointerReferences.
+  //
+  void DeclareNewGlobalValue(GlobalValue *GV, unsigned Slot);
 
   // refineAbstractType - The callback method is invoked when one of the
   // elements of TypeValues becomes more concrete...