[llvm-commits] CVS: llvm/tools/llvm-upgrade/UpgradeLexer.cpp.cvs UpgradeLexer.l.cvs UpgradeParser.cpp.cvs UpgradeParser.h.cvs UpgradeParser.y.cvs

Reid Spencer reid at x10sys.com
Sun Jan 14 16:26:33 PST 2007



Changes in directory llvm/tools/llvm-upgrade:

UpgradeLexer.cpp.cvs updated: 1.14 -> 1.15
UpgradeLexer.l.cvs updated: 1.14 -> 1.15
UpgradeParser.cpp.cvs updated: 1.41 -> 1.42
UpgradeParser.h.cvs updated: 1.28 -> 1.29
UpgradeParser.y.cvs updated: 1.40 -> 1.41
---
Log message:

Regenerate


---
Diffs of the changes:  (+1477 -1030)

 UpgradeLexer.cpp.cvs  |  328 ++++++------
 UpgradeLexer.l.cvs    |    2 
 UpgradeParser.cpp.cvs | 1282 +++++++++++++++++++++++++++++---------------------
 UpgradeParser.h.cvs   |    6 
 UpgradeParser.y.cvs   |  889 +++++++++++++++++++++-------------
 5 files changed, 1477 insertions(+), 1030 deletions(-)


Index: llvm/tools/llvm-upgrade/UpgradeLexer.cpp.cvs
diff -u llvm/tools/llvm-upgrade/UpgradeLexer.cpp.cvs:1.14 llvm/tools/llvm-upgrade/UpgradeLexer.cpp.cvs:1.15
--- llvm/tools/llvm-upgrade/UpgradeLexer.cpp.cvs:1.14	Fri Jan 12 22:40:16 2007
+++ llvm/tools/llvm-upgrade/UpgradeLexer.cpp.cvs	Sun Jan 14 18:26:17 2007
@@ -20,7 +20,7 @@
 /* A lexical scanner generated by flex*/
 
 /* Scanner skeleton version:
- * $Header: /var/cvs/llvm/llvm/tools/llvm-upgrade/UpgradeLexer.cpp.cvs,v 1.14 2007/01/13 04:40:16 reid Exp $
+ * $Header: /var/cvs/llvm/llvm/tools/llvm-upgrade/UpgradeLexer.cpp.cvs,v 1.15 2007/01/15 00:26:17 reid Exp $
  */
 
 #define FLEX_SCANNER
@@ -923,7 +923,7 @@
 #define YY_MORE_ADJ 0
 #define YY_RESTORE_YY_MORE_OFFSET
 char *yytext;
-#line 1 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 1 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 #define INITIAL 0
 /*===-- UpgradeLexer.l - Scanner for 1.9 assembly files --------*- C++ -*--===//
 //
@@ -938,7 +938,7 @@
 //
 //===----------------------------------------------------------------------===*/
 #define YY_NEVER_INTERACTIVE 1
-#line 28 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 28 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 
 #include "UpgradeInternals.h"
 #include "UpgradeParser.h"
@@ -962,7 +962,7 @@
   return sym
 
 #define RET_TY(sym,OldTY,NewTY,sign) \
-  Upgradelval.Type = TypeInfo::get(NewTY, OldTY); \
+  Upgradelval.Type = getTypeInfo(NewTY, OldTY); \
   return sym
 
 #define YY_NEVER_INTERACTIVE 1
@@ -1133,7 +1133,7 @@
 	register char *yy_cp = NULL, *yy_bp = NULL;
 	register int yy_act;
 
-#line 97 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 97 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 
 
 #line 1140 "UpgradeLexer.cpp"
@@ -1229,776 +1229,776 @@
 	{ /* beginning of action switch */
 case 1:
 YY_RULE_SETUP
-#line 99 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 99 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { /* Ignore comments for now */ }
 	YY_BREAK
 case 2:
 YY_RULE_SETUP
-#line 101 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 101 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( BEGINTOK); }
 	YY_BREAK
 case 3:
 YY_RULE_SETUP
-#line 102 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 102 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( ENDTOK); }
 	YY_BREAK
 case 4:
 YY_RULE_SETUP
-#line 103 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 103 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( TRUETOK);  }
 	YY_BREAK
 case 5:
 YY_RULE_SETUP
-#line 104 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 104 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( FALSETOK); }
 	YY_BREAK
 case 6:
 YY_RULE_SETUP
-#line 105 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 105 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( DECLARE); }
 	YY_BREAK
 case 7:
 YY_RULE_SETUP
-#line 106 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 106 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( GLOBAL); }
 	YY_BREAK
 case 8:
 YY_RULE_SETUP
-#line 107 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 107 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( CONSTANT); }
 	YY_BREAK
 case 9:
 YY_RULE_SETUP
-#line 108 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 108 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( INTERNAL); }
 	YY_BREAK
 case 10:
 YY_RULE_SETUP
-#line 109 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 109 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( LINKONCE); }
 	YY_BREAK
 case 11:
 YY_RULE_SETUP
-#line 110 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 110 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( WEAK); }
 	YY_BREAK
 case 12:
 YY_RULE_SETUP
-#line 111 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 111 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( APPENDING); }
 	YY_BREAK
 case 13:
 YY_RULE_SETUP
-#line 112 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 112 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( DLLIMPORT); }
 	YY_BREAK
 case 14:
 YY_RULE_SETUP
-#line 113 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 113 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( DLLEXPORT); }
 	YY_BREAK
 case 15:
 YY_RULE_SETUP
-#line 114 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 114 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( EXTERN_WEAK); }
 	YY_BREAK
 case 16:
 YY_RULE_SETUP
-#line 115 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 115 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( EXTERNAL); }
 	YY_BREAK
 case 17:
 YY_RULE_SETUP
-#line 116 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 116 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( UNINITIALIZED); }  // alias for external
 	YY_BREAK
 case 18:
 YY_RULE_SETUP
-#line 117 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 117 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( IMPLEMENTATION); }
 	YY_BREAK
 case 19:
 YY_RULE_SETUP
-#line 118 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 118 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( ZEROINITIALIZER); }
 	YY_BREAK
 case 20:
 YY_RULE_SETUP
-#line 119 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 119 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( DOTDOTDOT); }
 	YY_BREAK
 case 21:
 YY_RULE_SETUP
-#line 120 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 120 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( UNDEF); }
 	YY_BREAK
 case 22:
 YY_RULE_SETUP
-#line 121 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 121 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( NULL_TOK); }
 	YY_BREAK
 case 23:
 YY_RULE_SETUP
-#line 122 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 122 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( TO); }
 	YY_BREAK
 case 24:
 YY_RULE_SETUP
-#line 123 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 123 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( TAIL); }
 	YY_BREAK
 case 25:
 YY_RULE_SETUP
-#line 124 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 124 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( TARGET); }
 	YY_BREAK
 case 26:
 YY_RULE_SETUP
-#line 125 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 125 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( TRIPLE); }
 	YY_BREAK
 case 27:
 YY_RULE_SETUP
-#line 126 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 126 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( DEPLIBS); }
 	YY_BREAK
 case 28:
 YY_RULE_SETUP
-#line 127 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 127 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( ENDIAN); }
 	YY_BREAK
 case 29:
 YY_RULE_SETUP
-#line 128 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 128 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( POINTERSIZE); }
 	YY_BREAK
 case 30:
 YY_RULE_SETUP
-#line 129 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 129 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( DATALAYOUT); }
 	YY_BREAK
 case 31:
 YY_RULE_SETUP
-#line 130 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 130 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( LITTLE); }
 	YY_BREAK
 case 32:
 YY_RULE_SETUP
-#line 131 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 131 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( BIG); }
 	YY_BREAK
 case 33:
 YY_RULE_SETUP
-#line 132 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 132 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( VOLATILE); }
 	YY_BREAK
 case 34:
 YY_RULE_SETUP
-#line 133 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 133 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( ALIGN);  }
 	YY_BREAK
 case 35:
 YY_RULE_SETUP
-#line 134 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 134 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( SECTION); }
 	YY_BREAK
 case 36:
 YY_RULE_SETUP
-#line 135 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 135 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( MODULE); }
 	YY_BREAK
 case 37:
 YY_RULE_SETUP
-#line 136 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 136 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( ASM_TOK); }
 	YY_BREAK
 case 38:
 YY_RULE_SETUP
-#line 137 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 137 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( SIDEEFFECT); }
 	YY_BREAK
 case 39:
 YY_RULE_SETUP
-#line 139 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 139 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( CC_TOK); }
 	YY_BREAK
 case 40:
 YY_RULE_SETUP
-#line 140 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 140 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( CCC_TOK); }
 	YY_BREAK
 case 41:
 YY_RULE_SETUP
-#line 141 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 141 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( CSRETCC_TOK); }
 	YY_BREAK
 case 42:
 YY_RULE_SETUP
-#line 142 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 142 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( FASTCC_TOK); }
 	YY_BREAK
 case 43:
 YY_RULE_SETUP
-#line 143 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 143 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( COLDCC_TOK); }
 	YY_BREAK
 case 44:
 YY_RULE_SETUP
-#line 144 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 144 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( X86_STDCALLCC_TOK); }
 	YY_BREAK
 case 45:
 YY_RULE_SETUP
-#line 145 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 145 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( X86_FASTCALLCC_TOK); }
 	YY_BREAK
 case 46:
 YY_RULE_SETUP
-#line 147 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 147 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TY(VOID,VoidTy,"void",false); }
 	YY_BREAK
 case 47:
 YY_RULE_SETUP
-#line 148 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 148 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TY(BOOL,BoolTy,"i1",false); }
 	YY_BREAK
 case 48:
 YY_RULE_SETUP
-#line 149 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 149 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TY(SBYTE,SByteTy,"i8",true); }
 	YY_BREAK
 case 49:
 YY_RULE_SETUP
-#line 150 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 150 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TY(UBYTE,UByteTy,"i8",false); }
 	YY_BREAK
 case 50:
 YY_RULE_SETUP
-#line 151 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 151 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TY(SHORT,ShortTy,"i16",true); }
 	YY_BREAK
 case 51:
 YY_RULE_SETUP
-#line 152 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 152 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TY(USHORT,UShortTy,"i16",false); }
 	YY_BREAK
 case 52:
 YY_RULE_SETUP
-#line 153 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 153 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TY(INT,IntTy,"i32",true);   }
 	YY_BREAK
 case 53:
 YY_RULE_SETUP
-#line 154 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 154 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TY(UINT,UIntTy,"i32",false);  }
 	YY_BREAK
 case 54:
 YY_RULE_SETUP
-#line 155 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 155 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TY(LONG,LongTy,"i64",true);  }
 	YY_BREAK
 case 55:
 YY_RULE_SETUP
-#line 156 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 156 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TY(ULONG,ULongTy,"i64",false); }
 	YY_BREAK
 case 56:
 YY_RULE_SETUP
-#line 157 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 157 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TY(UBYTE,UByteTy,"i8",false); }
 	YY_BREAK
 case 57:
 YY_RULE_SETUP
-#line 158 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 158 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TY(USHORT,UShortTy,"i16",false); }
 	YY_BREAK
 case 58:
 YY_RULE_SETUP
-#line 159 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 159 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TY(UINT,UIntTy,"i32",false); }
 	YY_BREAK
 case 59:
 YY_RULE_SETUP
-#line 160 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 160 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TY(ULONG,ULongTy,"i64",false); }
 	YY_BREAK
 case 60:
 YY_RULE_SETUP
-#line 161 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 161 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TY(FLOAT,FloatTy,"float",false); }
 	YY_BREAK
 case 61:
 YY_RULE_SETUP
-#line 162 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 162 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TY(DOUBLE,DoubleTy,"double",false); }
 	YY_BREAK
 case 62:
 YY_RULE_SETUP
-#line 163 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 163 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TY(LABEL,LabelTy,"label",false); }
 	YY_BREAK
 case 63:
 YY_RULE_SETUP
-#line 164 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 164 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK(OPAQUE); }
 	YY_BREAK
 case 64:
 YY_RULE_SETUP
-#line 165 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 165 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK(TYPE);   }
 	YY_BREAK
 case 65:
 YY_RULE_SETUP
-#line 167 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 167 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( ADD); }
 	YY_BREAK
 case 66:
 YY_RULE_SETUP
-#line 168 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 168 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( SUB); }
 	YY_BREAK
 case 67:
 YY_RULE_SETUP
-#line 169 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 169 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( MUL); }
 	YY_BREAK
 case 68:
 YY_RULE_SETUP
-#line 170 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 170 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( DIV); }
 	YY_BREAK
 case 69:
 YY_RULE_SETUP
-#line 171 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 171 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( UDIV); }
 	YY_BREAK
 case 70:
 YY_RULE_SETUP
-#line 172 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 172 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( SDIV); }
 	YY_BREAK
 case 71:
 YY_RULE_SETUP
-#line 173 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 173 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( FDIV); }
 	YY_BREAK
 case 72:
 YY_RULE_SETUP
-#line 174 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 174 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( REM);  }
 	YY_BREAK
 case 73:
 YY_RULE_SETUP
-#line 175 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 175 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( UREM); }
 	YY_BREAK
 case 74:
 YY_RULE_SETUP
-#line 176 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 176 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( SREM); }
 	YY_BREAK
 case 75:
 YY_RULE_SETUP
-#line 177 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 177 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( FREM); }
 	YY_BREAK
 case 76:
 YY_RULE_SETUP
-#line 178 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 178 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( AND); }
 	YY_BREAK
 case 77:
 YY_RULE_SETUP
-#line 179 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 179 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( OR); }
 	YY_BREAK
 case 78:
 YY_RULE_SETUP
-#line 180 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 180 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( XOR); }
 	YY_BREAK
 case 79:
 YY_RULE_SETUP
-#line 181 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 181 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( SETNE); }
 	YY_BREAK
 case 80:
 YY_RULE_SETUP
-#line 182 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 182 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( SETEQ); }
 	YY_BREAK
 case 81:
 YY_RULE_SETUP
-#line 183 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 183 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( SETLT); }
 	YY_BREAK
 case 82:
 YY_RULE_SETUP
-#line 184 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 184 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( SETGT); }
 	YY_BREAK
 case 83:
 YY_RULE_SETUP
-#line 185 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 185 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( SETLE); }
 	YY_BREAK
 case 84:
 YY_RULE_SETUP
-#line 186 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 186 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( SETGE); }
 	YY_BREAK
 case 85:
 YY_RULE_SETUP
-#line 187 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 187 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK(ICMP); }
 	YY_BREAK
 case 86:
 YY_RULE_SETUP
-#line 188 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 188 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK(FCMP); }
 	YY_BREAK
 case 87:
 YY_RULE_SETUP
-#line 189 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 189 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK(EQ); }
 	YY_BREAK
 case 88:
 YY_RULE_SETUP
-#line 190 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 190 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK(NE); }
 	YY_BREAK
 case 89:
 YY_RULE_SETUP
-#line 191 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 191 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK(SLT); }
 	YY_BREAK
 case 90:
 YY_RULE_SETUP
-#line 192 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 192 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK(SGT); }
 	YY_BREAK
 case 91:
 YY_RULE_SETUP
-#line 193 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 193 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK(SLE); }
 	YY_BREAK
 case 92:
 YY_RULE_SETUP
-#line 194 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 194 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK(SGE); }
 	YY_BREAK
 case 93:
 YY_RULE_SETUP
-#line 195 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 195 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK(OEQ); }
 	YY_BREAK
 case 94:
 YY_RULE_SETUP
-#line 196 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 196 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK(ONE); }
 	YY_BREAK
 case 95:
 YY_RULE_SETUP
-#line 197 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 197 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK(OLT); }
 	YY_BREAK
 case 96:
 YY_RULE_SETUP
-#line 198 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 198 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK(OGT); }
 	YY_BREAK
 case 97:
 YY_RULE_SETUP
-#line 199 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 199 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK(OLE); }
 	YY_BREAK
 case 98:
 YY_RULE_SETUP
-#line 200 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 200 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK(OGE); }
 	YY_BREAK
 case 99:
 YY_RULE_SETUP
-#line 201 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 201 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK(ORD); }
 	YY_BREAK
 case 100:
 YY_RULE_SETUP
-#line 202 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 202 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK(UNO); }
 	YY_BREAK
 case 101:
 YY_RULE_SETUP
-#line 203 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 203 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK(UEQ); }
 	YY_BREAK
 case 102:
 YY_RULE_SETUP
-#line 204 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 204 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK(UNE); }
 	YY_BREAK
 case 103:
 YY_RULE_SETUP
-#line 205 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 205 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK(ULT); }
 	YY_BREAK
 case 104:
 YY_RULE_SETUP
-#line 206 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 206 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK(UGT); }
 	YY_BREAK
 case 105:
 YY_RULE_SETUP
-#line 207 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 207 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK(ULE); }
 	YY_BREAK
 case 106:
 YY_RULE_SETUP
-#line 208 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 208 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK(UGE); }
 	YY_BREAK
 case 107:
 YY_RULE_SETUP
-#line 210 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 210 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( PHI_TOK); }
 	YY_BREAK
 case 108:
 YY_RULE_SETUP
-#line 211 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 211 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( CALL); }
 	YY_BREAK
 case 109:
 YY_RULE_SETUP
-#line 212 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 212 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( CAST); }
 	YY_BREAK
 case 110:
 YY_RULE_SETUP
-#line 213 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 213 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( TRUNC); }
 	YY_BREAK
 case 111:
 YY_RULE_SETUP
-#line 214 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 214 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( ZEXT); }
 	YY_BREAK
 case 112:
 YY_RULE_SETUP
-#line 215 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 215 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( SEXT); }
 	YY_BREAK
 case 113:
 YY_RULE_SETUP
-#line 216 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 216 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( FPTRUNC); }
 	YY_BREAK
 case 114:
 YY_RULE_SETUP
-#line 217 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 217 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( FPEXT); }
 	YY_BREAK
 case 115:
 YY_RULE_SETUP
-#line 218 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 218 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( FPTOUI); }
 	YY_BREAK
 case 116:
 YY_RULE_SETUP
-#line 219 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 219 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( FPTOSI); }
 	YY_BREAK
 case 117:
 YY_RULE_SETUP
-#line 220 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 220 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( UITOFP); }
 	YY_BREAK
 case 118:
 YY_RULE_SETUP
-#line 221 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 221 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( SITOFP); }
 	YY_BREAK
 case 119:
 YY_RULE_SETUP
-#line 222 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 222 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( PTRTOINT); }
 	YY_BREAK
 case 120:
 YY_RULE_SETUP
-#line 223 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 223 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( INTTOPTR); }
 	YY_BREAK
 case 121:
 YY_RULE_SETUP
-#line 224 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 224 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( BITCAST); }
 	YY_BREAK
 case 122:
 YY_RULE_SETUP
-#line 225 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 225 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( SELECT); }
 	YY_BREAK
 case 123:
 YY_RULE_SETUP
-#line 226 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 226 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( SHL); }
 	YY_BREAK
 case 124:
 YY_RULE_SETUP
-#line 227 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 227 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( SHR); }
 	YY_BREAK
 case 125:
 YY_RULE_SETUP
-#line 228 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 228 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( ASHR); }
 	YY_BREAK
 case 126:
 YY_RULE_SETUP
-#line 229 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 229 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( LSHR); }
 	YY_BREAK
 case 127:
 YY_RULE_SETUP
-#line 230 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 230 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( VAARG); }
 	YY_BREAK
 case 128:
 YY_RULE_SETUP
-#line 231 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 231 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( RET); }
 	YY_BREAK
 case 129:
 YY_RULE_SETUP
-#line 232 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 232 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( BR); }
 	YY_BREAK
 case 130:
 YY_RULE_SETUP
-#line 233 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 233 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( SWITCH); }
 	YY_BREAK
 case 131:
 YY_RULE_SETUP
-#line 234 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 234 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( INVOKE); }
 	YY_BREAK
 case 132:
 YY_RULE_SETUP
-#line 235 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 235 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( UNWIND); }
 	YY_BREAK
 case 133:
 YY_RULE_SETUP
-#line 236 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 236 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( EXCEPT); } // alias for unwind
 	YY_BREAK
 case 134:
 YY_RULE_SETUP
-#line 237 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 237 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( UNREACHABLE); }
 	YY_BREAK
 case 135:
 YY_RULE_SETUP
-#line 239 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 239 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( MALLOC); }
 	YY_BREAK
 case 136:
 YY_RULE_SETUP
-#line 240 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 240 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( ALLOCA); }
 	YY_BREAK
 case 137:
 YY_RULE_SETUP
-#line 241 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 241 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( FREE); }
 	YY_BREAK
 case 138:
 YY_RULE_SETUP
-#line 242 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 242 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( LOAD); }
 	YY_BREAK
 case 139:
 YY_RULE_SETUP
-#line 243 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 243 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( STORE); }
 	YY_BREAK
 case 140:
 YY_RULE_SETUP
-#line 244 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 244 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( GETELEMENTPTR); }
 	YY_BREAK
 case 141:
 YY_RULE_SETUP
-#line 246 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 246 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( EXTRACTELEMENT); }
 	YY_BREAK
 case 142:
 YY_RULE_SETUP
-#line 247 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 247 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( INSERTELEMENT); }
 	YY_BREAK
 case 143:
 YY_RULE_SETUP
-#line 248 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 248 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( SHUFFLEVECTOR); }
 	YY_BREAK
 case 144:
 YY_RULE_SETUP
-#line 251 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 251 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( VAR_ID); }
 	YY_BREAK
 case 145:
 YY_RULE_SETUP
-#line 252 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 252 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( LABELSTR); }
 	YY_BREAK
 case 146:
 YY_RULE_SETUP
-#line 253 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 253 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( LABELSTR); }
 	YY_BREAK
 case 147:
 YY_RULE_SETUP
-#line 254 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 254 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( STRINGCONSTANT ); }
 	YY_BREAK
 case 148:
 YY_RULE_SETUP
-#line 255 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 255 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( EUINT64VAL ); }
 	YY_BREAK
 case 149:
 YY_RULE_SETUP
-#line 256 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 256 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( ESINT64VAL ); }
 	YY_BREAK
 case 150:
 YY_RULE_SETUP
-#line 257 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 257 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( yytext[0] == 's' ? ESINT64VAL : EUINT64VAL ); }
 	YY_BREAK
 case 151:
 YY_RULE_SETUP
-#line 258 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 258 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( UINTVAL); }
 	YY_BREAK
 case 152:
 YY_RULE_SETUP
-#line 259 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 259 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( SINTVAL); }
 	YY_BREAK
 case 153:
 YY_RULE_SETUP
-#line 260 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 260 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( FPVAL); }
 	YY_BREAK
 case 154:
 YY_RULE_SETUP
-#line 261 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 261 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { RET_TOK( FPVAL); }
 	YY_BREAK
 case YY_STATE_EOF(INITIAL):
-#line 262 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 262 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 {
                   /* Make sure to free the internal buffers for flex when we are
                    * done reading our input!
@@ -2009,17 +2009,17 @@
 	YY_BREAK
 case 155:
 YY_RULE_SETUP
-#line 270 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 270 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { /* Ignore whitespace */ }
 	YY_BREAK
 case 156:
 YY_RULE_SETUP
-#line 271 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 271 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 { return yytext[0]; }
 	YY_BREAK
 case 157:
 YY_RULE_SETUP
-#line 273 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 273 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 YY_FATAL_ERROR( "flex scanner jammed" );
 	YY_BREAK
 #line 2026 "UpgradeLexer.cpp"
@@ -2900,5 +2900,5 @@
 	return 0;
 	}
 #endif
-#line 273 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l"
+#line 273 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeLexer.l"
 


Index: llvm/tools/llvm-upgrade/UpgradeLexer.l.cvs
diff -u llvm/tools/llvm-upgrade/UpgradeLexer.l.cvs:1.14 llvm/tools/llvm-upgrade/UpgradeLexer.l.cvs:1.15
--- llvm/tools/llvm-upgrade/UpgradeLexer.l.cvs:1.14	Fri Jan 12 22:40:16 2007
+++ llvm/tools/llvm-upgrade/UpgradeLexer.l.cvs	Sun Jan 14 18:26:17 2007
@@ -48,7 +48,7 @@
   return sym
 
 #define RET_TY(sym,OldTY,NewTY,sign) \
-  Upgradelval.Type = TypeInfo::get(NewTY, OldTY); \
+  Upgradelval.Type = getTypeInfo(NewTY, OldTY); \
   return sym
 
 #define YY_NEVER_INTERACTIVE 1


Index: llvm/tools/llvm-upgrade/UpgradeParser.cpp.cvs
diff -u llvm/tools/llvm-upgrade/UpgradeParser.cpp.cvs:1.41 llvm/tools/llvm-upgrade/UpgradeParser.cpp.cvs:1.42
--- llvm/tools/llvm-upgrade/UpgradeParser.cpp.cvs:1.41	Fri Jan 12 22:40:16 2007
+++ llvm/tools/llvm-upgrade/UpgradeParser.cpp.cvs	Sun Jan 14 18:26:17 2007
@@ -366,7 +366,7 @@
 
 
 /* Copy the first part of user declarations.  */
-#line 14 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 14 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
 
 #include "UpgradeInternals.h"
 #include <algorithm>
@@ -386,44 +386,14 @@
 static std::ostream *O = 0;
 std::istream* LexInput = 0;
 unsigned SizeOfPointer = 32;
-static uint64_t unique = 1;
+
 
 // This bool controls whether attributes are ever added to function declarations
 // definitions and calls.
 static bool AddAttributes = false;
 
-// This is set when a DECLARE keyword is recognized so that subsequent parsing
-// of a function prototype can know if its a declaration or definition.
-static bool isDeclare = false;
-
-// This bool is used to communicate between the InstVal and Inst rules about
-// whether or not a cast should be deleted. When the flag is set, InstVal has
-// determined that the cast is a candidate. However, it can only be deleted if
-// the value being casted is the same value name as the instruction. The Inst
-// rule makes that comparison if the flag is set and comments out the
-// instruction if they match.
-static bool deleteUselessCastFlag = false;
-static std::string* deleteUselessCastName = 0;
-
-typedef std::vector<const TypeInfo*> TypeVector;
-static TypeVector EnumeratedTypes;
-typedef std::map<std::string,const TypeInfo*> TypeMap;
-static TypeMap NamedTypes;
-typedef std::map<const TypeInfo*,std::string> TypePlaneMap;
-typedef std::map<std::string,TypePlaneMap> GlobalsTypeMap;
-static GlobalsTypeMap Globals;
-
 static void warning(const std::string& msg);
 
-void destroy(ValueList* VL) {
-  while (!VL->empty()) {
-    ValueInfo& VI = VL->back();
-    VI.destroy();
-    VL->pop_back();
-  }
-  delete VL;
-}
-
 void UpgradeAssembly(const std::string &infile, std::istream& in, 
                      std::ostream &out, bool debug, bool addAttrs)
 {
@@ -435,13 +405,176 @@
   O = &out;
 
   if (yyparse()) {
-    std::cerr << "Parse failed.\n";
-    out << "llvm-upgrade parse failed.\n";
+    std::cerr << "llvm-upgrade: parse failed.\n";
+    out << "llvm-upgrade: parse failed.\n";
     exit(1);
   }
 }
 
-TypeInfo::TypeRegMap TypeInfo::registry;
+namespace { // Anonymous namespace to keep our implementation local
+
+
+/// This type is used to keep track of the signedness of values. Instead
+/// of creating llvm::Value directly, the parser will create ValueInfo which
+/// associates a Value* with a Signedness indication.
+struct ValueInfo {
+  std::string* val;
+  const TypeInfo* type;
+  bool constant;
+  bool isConstant() const { return constant; }
+  ~ValueInfo() { delete val; }
+};
+
+
+/// This type is used to keep track of the signedness of the obsolete
+/// integer types. Instead of creating an llvm::Type directly, the Lexer will
+/// create instances of TypeInfo which retains the signedness indication so
+/// it can be used by the parser for upgrade decisions.
+/// For example if "uint" is encountered then the "first" field will be set 
+/// to "int32" and the "second" field will be set to "isUnsigned".  If the 
+/// type is not obsolete then "second" will be set to "isSignless".
+class TypeInfo {
+public:
+  static const TypeInfo* get(const std::string &newType, Types oldType);
+  static const TypeInfo* get(const std::string& newType, Types oldType, 
+                             const TypeInfo* eTy, const TypeInfo* rTy);
+
+  static const TypeInfo* get(const std::string& newType, Types oldType, 
+                             const TypeInfo *eTy, uint64_t elems);
+
+  static const TypeInfo* get(const std::string& newType, Types oldType, 
+                             TypeList* TL);
+
+  static const TypeInfo* get(const std::string& newType, const TypeInfo* resTy, 
+                             TypeList* TL);
+
+  const TypeInfo* resolve() const;
+  bool operator<(const TypeInfo& that) const;
+
+  bool sameNewTyAs(const TypeInfo* that) const {
+    return this->newTy == that->newTy;
+  }
+
+  bool sameOldTyAs(const TypeInfo* that) const;
+
+  Types getElementTy() const {
+    if (elemTy) {
+      return elemTy->oldTy;
+    }
+    return UnresolvedTy;
+  }
+
+  unsigned getUpRefNum() const {
+    assert(oldTy == UpRefTy && "Can't getUpRefNum on non upreference");
+    return atoi(&((getNewTy().c_str())[1])); // skip the slash
+  }
+
+  typedef std::vector<const TypeInfo*> UpRefStack;
+  void getSignedness(unsigned &sNum, unsigned &uNum, UpRefStack& stk) const;
+  std::string makeUniqueName(const std::string& BaseName) const;
+
+  const std::string& getNewTy() const { return newTy; }
+  const TypeInfo* getResultType() const { return resultTy; }
+  const TypeInfo* getElementType() const { return elemTy; }
+
+  const TypeInfo* getPointerType() const {
+    return get(newTy + "*", PointerTy, this, (TypeInfo*)0);
+  }
+
+  bool isUnresolved() const { return oldTy == UnresolvedTy; }
+  bool isUpReference() const { return oldTy == UpRefTy; }
+  bool isVoid() const { return oldTy == VoidTy; }
+  bool isBool() const { return oldTy == BoolTy; }
+  bool isSigned() const {
+    return oldTy == SByteTy || oldTy == ShortTy || 
+           oldTy == IntTy || oldTy == LongTy;
+  }
+
+  bool isUnsigned() const {
+    return oldTy == UByteTy || oldTy == UShortTy || 
+           oldTy == UIntTy || oldTy == ULongTy;
+  }
+  bool isSignless() const { return !isSigned() && !isUnsigned(); }
+  bool isInteger() const { return isSigned() || isUnsigned(); }
+  bool isIntegral() const { return oldTy == BoolTy || isInteger(); }
+  bool isFloatingPoint() const { return oldTy == DoubleTy || oldTy == FloatTy; }
+  bool isPacked() const { return oldTy == PackedTy; }
+  bool isPointer() const { return oldTy == PointerTy; }
+  bool isStruct() const { return oldTy == StructTy || oldTy == PackedStructTy; }
+  bool isArray() const { return oldTy == ArrayTy; }
+  bool isOther() const { 
+    return !isPacked() && !isPointer() && !isFloatingPoint() && !isIntegral(); }
+  bool isFunction() const { return oldTy == FunctionTy; }
+  bool isComposite() const {
+    return isStruct() || isPointer() || isArray() || isPacked();
+  }
+
+  bool isAttributeCandidate() const {
+    return isIntegral() && getBitWidth() < 32;
+  }
+
+  bool isUnresolvedDeep() const;
+
+  unsigned getBitWidth() const;
+
+  const TypeInfo* getIndexedType(const ValueInfo*  VI) const;
+
+  unsigned getNumStructElements() const { 
+    return (elements ? elements->size() : 0);
+  }
+
+  const TypeInfo* getElement(unsigned idx) const {
+    if (elements)
+      if (idx < elements->size())
+        return (*elements)[idx];
+    return 0;
+  }
+
+private:
+  TypeInfo() 
+    : newTy(), oldTy(UnresolvedTy), elemTy(0), resultTy(0), elements(0),
+      nelems(0) {
+  }
+
+  TypeInfo(const TypeInfo& that); // do not implement
+  TypeInfo& operator=(const TypeInfo& that); // do not implement
+
+  ~TypeInfo() { delete elements; }
+
+  struct ltfunctor
+  {
+    bool operator()(const TypeInfo* X, const TypeInfo* Y) const {
+      assert(X && "Can't compare null pointer");
+      assert(Y && "Can't compare null pointer");
+      return *X < *Y;
+    }
+  };
+
+  typedef std::set<const TypeInfo*, ltfunctor> TypeRegMap;
+
+  static const TypeInfo* add_new_type(TypeInfo* existing);
+
+  std::string newTy;
+  Types oldTy;
+  TypeInfo *elemTy;
+  TypeInfo *resultTy;
+  TypeList *elements;
+  uint64_t nelems;
+  static TypeRegMap registry;
+public:
+  typedef std::vector<const TypeInfo*> TypeVector;
+  typedef std::map<std::string,const TypeInfo*> TypeMap;
+  typedef std::map<const TypeInfo*,std::string> TypePlaneMap;
+  typedef std::map<std::string,TypePlaneMap> GlobalsTypeMap;
+  static TypeVector EnumeratedTypes;
+  static TypeMap NamedTypes;
+  static GlobalsTypeMap Globals;
+};
+
+TypeInfo::TypeRegMap     TypeInfo::registry;
+TypeInfo::TypeVector     TypeInfo::EnumeratedTypes;
+TypeInfo::TypeMap        TypeInfo::NamedTypes;
+TypeInfo::GlobalsTypeMap TypeInfo::Globals;
 
 const TypeInfo* TypeInfo::get(const std::string &newType, Types oldType) {
   TypeInfo* Ty = new TypeInfo();
@@ -501,7 +634,7 @@
         yyerror(msg.c_str());
       }
     } else {
-      TypeMap::iterator I = NamedTypes.find(newTy);
+      TypeInfo::TypeMap::iterator I = NamedTypes.find(newTy);
       if (I != NamedTypes.end()) {
         return I->second;
       } else {
@@ -651,12 +784,12 @@
   }
 }
 
-const TypeInfo* TypeInfo::getIndexedType(const ValueInfo&  VI) const {
+const TypeInfo* TypeInfo::getIndexedType(const ValueInfo*  VI) const {
   if (isStruct()) {
-    if (VI.isConstant() && VI.type->isInteger()) {
-      size_t pos = VI.val->find(' ') + 1;
-      if (pos < VI.val->size()) {
-        uint64_t idx = atoi(VI.val->substr(pos).c_str());
+    if (VI->isConstant() && VI->type->isInteger()) {
+      size_t pos = VI->val->find(' ') + 1;
+      if (pos < VI->val->size()) {
+        uint64_t idx = atoi(VI->val->substr(pos).c_str());
         return (*elements)[idx];
       } else {
         yyerror("Invalid value for constant integer");
@@ -802,9 +935,34 @@
   return newTy;
 }
 
-static const char* getCastOpcode(
-  std::string& Source, const TypeInfo* SrcTy, const TypeInfo* DstTy) 
-{
+/// This type is used to keep track of the signedness of constants.
+struct ConstInfo {
+  std::string *cnst;
+  const TypeInfo *type;
+  ~ConstInfo() { delete cnst; }
+};
+
+/// This variable provides a counter for unique names. It is used in various
+/// productions to ensure a unique name is generated.
+static uint64_t UniqueNameCounter = 1;
+
+// This is set when a DECLARE keyword is recognized so that subsequent parsing
+// of a function prototype can know if its a declaration or definition.
+static bool isDeclare = false;
+
+// This bool is used to communicate between the InstVal and Inst rules about
+// whether or not a cast should be deleted. When the flag is set, InstVal has
+// determined that the cast is a candidate. However, it can only be deleted if
+// the value being casted is the same value name as the instruction. The Inst
+// rule makes that comparison if the flag is set and comments out the
+// instruction if they match.
+static bool deleteUselessCastFlag = false;
+static std::string* deleteUselessCastName = 0;
+
+
+
+const char* getCastOpcode(std::string& Source, const TypeInfo* SrcTy, 
+                          const TypeInfo* DstTy) {
   unsigned SrcBits = SrcTy->getBitWidth();
   unsigned DstBits = DstTy->getBitWidth();
   const char* opcode = "bitcast";
@@ -880,9 +1038,8 @@
   return opcode;
 }
 
-static std::string getCastUpgrade(const std::string& Src, const TypeInfo* SrcTy,
-                                  const TypeInfo* DstTy, bool isConst)
-{
+std::string getCastUpgrade(const std::string& Src, const TypeInfo* SrcTy,
+                           const TypeInfo* DstTy, bool isConst) {
   std::string Result;
   std::string Source = Src;
   if (SrcTy->isFloatingPoint() && DstTy->isPointer()) {
@@ -891,9 +1048,9 @@
     if (isConst)
       Source = "i64 fptoui(" + Source + " to i64)";
     else {
-      *O << "    %cast_upgrade" << unique << " = fptoui " << Source 
-         << " to i64\n";
-      Source = "i64 %cast_upgrade" + llvm::utostr(unique);
+      *O << "    %cast_upgrade" << UniqueNameCounter++ << " = fptoui " 
+         << Source << " to i64\n";
+      Source = "i64 %cast_upgrade" + llvm::utostr(UniqueNameCounter);
     }
     // Update the SrcTy for the getCastOpcode call below
     SrcTy = TypeInfo::get("i64", ULongTy);
@@ -948,8 +1105,7 @@
   return op;
 }
 
-std::string 
-getCompareOp(const std::string& setcc, const TypeInfo* TI) {
+std::string getCompareOp(const std::string& setcc, const TypeInfo* TI) {
   assert(setcc.length() == 5);
   char cc1 = setcc[3];
   char cc2 = setcc[4];
@@ -979,7 +1135,7 @@
   return result;
 }
 
-static const TypeInfo* getFunctionReturnType(const TypeInfo* PFTy) {
+const TypeInfo* getFunctionReturnType(const TypeInfo* PFTy) {
   PFTy = PFTy->resolve();
   if (PFTy->isPointer()) {
     const TypeInfo* ElemTy = PFTy->getElementType();
@@ -992,15 +1148,15 @@
   return PFTy;
 }
 
-static const TypeInfo* ResolveUpReference(const TypeInfo* Ty, 
-                                          TypeInfo::UpRefStack* stack) {
+const TypeInfo* ResolveUpReference(const TypeInfo* Ty, 
+                                   TypeInfo::UpRefStack* stack) {
   assert(Ty->isUpReference() && "Can't resolve a non-upreference");
   unsigned upref = Ty->getUpRefNum();
   assert(upref < stack->size() && "Invalid up reference");
   return (*stack)[upref - stack->size() - 1];
 }
 
-static const TypeInfo* getGEPIndexedType(const TypeInfo* PTy, ValueList* idxs) {
+const TypeInfo* getGEPIndexedType(const TypeInfo* PTy, ValueList* idxs) {
   const TypeInfo* Result = PTy = PTy->resolve();
   assert(PTy->isPointer() && "GEP Operand is not a pointer?");
   TypeInfo::UpRefStack stack;
@@ -1024,13 +1180,12 @@
   return Result->getPointerType();
 }
 
-
 // This function handles appending .u or .s to integer value names that
 // were previously unsigned or signed, respectively. This avoids name
 // collisions since the unsigned and signed type planes have collapsed
 // into a single signless type plane.
-static std::string getUniqueName(const std::string *Name, const TypeInfo* Ty,
-                                 bool isGlobal = false, bool isDef = false) {
+std::string getUniqueName(const std::string *Name, const TypeInfo* Ty,
+                          bool isGlobal = false, bool isDef = false) {
 
   // If its not a symbolic name, don't modify it, probably a constant val.
   if ((*Name)[0] != '%' && (*Name)[0] != '"')
@@ -1044,10 +1199,10 @@
   Ty = Ty->resolve(); 
 
   // If its a global name, get its uniquified name, if any
-  GlobalsTypeMap::iterator GI = Globals.find(*Name);
-  if (GI != Globals.end()) {
-    TypePlaneMap::iterator TPI = GI->second.begin();
-    TypePlaneMap::iterator TPE = GI->second.end();
+  TypeInfo::GlobalsTypeMap::iterator GI = TypeInfo::Globals.find(*Name);
+  if (GI != TypeInfo::Globals.end()) {
+    TypeInfo::TypePlaneMap::iterator TPI = GI->second.begin();
+    TypeInfo::TypePlaneMap::iterator TPE = GI->second.end();
     for ( ; TPI != TPE ; ++TPI) {
       if (TPI->first->sameNewTyAs(Ty)) 
         return TPI->second;
@@ -1069,16 +1224,14 @@
   return Result;
 }
 
-static unsigned UniqueNameCounter = 0;
-
 std::string getGlobalName(const std::string* Name, const std::string Linkage,
                           const TypeInfo* Ty, bool isConstant) {
   // Default to given name
   std::string Result = *Name; 
   // Look up the name in the Globals Map
-  GlobalsTypeMap::iterator GI = Globals.find(*Name);
+  TypeInfo::GlobalsTypeMap::iterator GI = TypeInfo::Globals.find(*Name);
   // Did we see this global name before?
-  if (GI != Globals.end()) {
+  if (GI != TypeInfo::Globals.end()) {
     if (Ty->isUnresolvedDeep()) {
       // The Gval's type is unresolved. Consequently, we can't disambiguate it
       // by type. We'll just change its name and emit a warning.
@@ -1089,7 +1242,7 @@
       Result += llvm::utostr(UniqueNameCounter);
       return Result;
     } else {
-      TypePlaneMap::iterator TPI = GI->second.find(Ty);
+      TypeInfo::TypePlaneMap::iterator TPI = GI->second.find(Ty);
       if (TPI != GI->second.end()) {
         // We found an existing name of the same old type. This isn't allowed 
         // in LLVM 2.0. Consequently, we must alter the name of the global so it
@@ -1104,8 +1257,8 @@
         // There isn't an existing definition for this name according to the
         // old types. Now search the TypePlanMap for types with the same new
         // name. 
-        TypePlaneMap::iterator TPI = GI->second.begin();
-        TypePlaneMap::iterator TPE = GI->second.end();
+        TypeInfo::TypePlaneMap::iterator TPI = GI->second.begin();
+        TypeInfo::TypePlaneMap::iterator TPE = GI->second.end();
         for ( ; TPI != TPE; ++TPI) {
           if (TPI->first->sameNewTyAs(Ty)) {
             // The new types are the same but the old types are different so 
@@ -1145,17 +1298,26 @@
   // Its a new global name, if it is external we can't change it
   if (isConstant || Linkage == "external" || Linkage == "dllimport" || 
       Linkage == "extern_weak" || Linkage == "") {
-    Globals[Result][Ty] = Result;
+    TypeInfo::Globals[Result][Ty] = Result;
     return Result;
   }
 
   // Its a new global name, and it is internal, change the name to make it
   // unique for its type.
   // Result = getUniqueName(Name, Ty);
-  Globals[*Name][Ty] = Result;
+  TypeInfo::Globals[*Name][Ty] = Result;
   return Result;
 }
 
+} // End anonymous namespace
+
+// This function is used by the Lexer to create a TypeInfo. It can't be
+// in the anonymous namespace.
+const TypeInfo* getTypeInfo(const std::string& newTy, Types oldTy) {
+  return TypeInfo::get(newTy, oldTy);
+}
+
+
 
 /* Enabling traces.  */
 #ifndef YYDEBUG
@@ -1176,17 +1338,17 @@
 #endif
 
 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
-#line 806 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 968 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
 typedef union YYSTYPE {
   std::string*    String;
   const TypeInfo* Type;
-  ValueInfo       Value;
-  ConstInfo       Const;
+  ValueInfo*      Value;
+  ConstInfo*      Const;
   ValueList*      ValList;
   TypeList*       TypeVec;
 } YYSTYPE;
 /* Line 196 of yacc.c.  */
-#line 1190 "UpgradeParser.tab.c"
+#line 1352 "UpgradeParser.tab.c"
 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
 # define YYSTYPE_IS_DECLARED 1
 # define YYSTYPE_IS_TRIVIAL 1
@@ -1198,7 +1360,7 @@
 
 
 /* Line 219 of yacc.c.  */
-#line 1202 "UpgradeParser.tab.c"
+#line 1364 "UpgradeParser.tab.c"
 
 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
 # define YYSIZE_T __SIZE_TYPE__
@@ -1553,37 +1715,37 @@
 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
 static const unsigned short int yyrline[] =
 {
-       0,   871,   871,   871,   872,   872,   876,   876,   876,   876,
-     876,   876,   876,   877,   877,   877,   877,   878,   878,   878,
-     879,   879,   879,   879,   879,   879,   880,   880,   880,   880,
-     880,   880,   880,   880,   880,   880,   881,   881,   881,   881,
-     881,   881,   881,   881,   881,   881,   882,   882,   882,   882,
-     882,   882,   883,   883,   883,   883,   884,   884,   884,   884,
-     884,   884,   884,   885,   885,   885,   885,   885,   885,   890,
-     890,   890,   890,   891,   891,   891,   891,   892,   892,   893,
-     893,   896,   899,   904,   904,   904,   904,   904,   904,   905,
-     906,   909,   909,   909,   909,   909,   910,   911,   916,   921,
-     922,   925,   926,   934,   940,   941,   944,   945,   954,   955,
-     968,   968,   969,   969,   970,   974,   974,   974,   974,   974,
-     974,   974,   975,   975,   975,   975,   975,   977,   980,   983,
-     986,   990,  1003,  1009,  1015,  1025,  1028,  1038,  1041,  1049,
-    1053,  1060,  1061,  1066,  1071,  1081,  1087,  1092,  1098,  1104,
-    1110,  1115,  1121,  1127,  1134,  1140,  1146,  1152,  1158,  1164,
-    1170,  1178,  1192,  1204,  1209,  1215,  1220,  1226,  1231,  1236,
-    1244,  1249,  1254,  1264,  1269,  1274,  1274,  1284,  1289,  1292,
-    1297,  1301,  1305,  1307,  1307,  1310,  1320,  1325,  1330,  1340,
-    1350,  1360,  1370,  1375,  1380,  1385,  1387,  1387,  1390,  1395,
-    1402,  1407,  1414,  1421,  1426,  1427,  1435,  1435,  1436,  1436,
-    1438,  1447,  1451,  1455,  1458,  1463,  1466,  1469,  1492,  1493,
-    1496,  1507,  1508,  1510,  1519,  1520,  1521,  1525,  1525,  1539,
-    1540,  1543,  1543,  1543,  1543,  1543,  1543,  1543,  1544,  1545,
-    1550,  1551,  1560,  1560,  1564,  1569,  1579,  1588,  1591,  1599,
-    1603,  1608,  1611,  1617,  1617,  1619,  1624,  1629,  1634,  1642,
-    1650,  1657,  1679,  1684,  1690,  1696,  1704,  1722,  1730,  1739,
-    1743,  1750,  1751,  1755,  1760,  1763,  1772,  1780,  1789,  1797,
-    1805,  1814,  1842,  1848,  1854,  1861,  1867,  1873,  1879,  1928,
-    1933,  1934,  1938,  1939,  1942,  1950,  1959,  1967,  1976,  1982,
-    1991,  2000
+       0,  1033,  1033,  1033,  1034,  1034,  1038,  1038,  1038,  1038,
+    1038,  1038,  1038,  1039,  1039,  1039,  1039,  1040,  1040,  1040,
+    1041,  1041,  1041,  1041,  1041,  1041,  1042,  1042,  1042,  1042,
+    1042,  1042,  1042,  1042,  1042,  1042,  1043,  1043,  1043,  1043,
+    1043,  1043,  1043,  1043,  1043,  1043,  1044,  1044,  1044,  1044,
+    1044,  1044,  1045,  1045,  1045,  1045,  1046,  1046,  1046,  1046,
+    1046,  1046,  1046,  1047,  1047,  1047,  1047,  1047,  1047,  1052,
+    1052,  1052,  1052,  1053,  1053,  1053,  1053,  1054,  1054,  1055,
+    1055,  1058,  1061,  1066,  1066,  1066,  1066,  1066,  1066,  1067,
+    1068,  1071,  1071,  1071,  1071,  1071,  1072,  1073,  1078,  1083,
+    1084,  1087,  1088,  1096,  1102,  1103,  1106,  1107,  1116,  1117,
+    1130,  1130,  1131,  1131,  1132,  1136,  1136,  1136,  1136,  1136,
+    1136,  1136,  1137,  1137,  1137,  1137,  1137,  1139,  1142,  1145,
+    1148,  1152,  1165,  1171,  1177,  1187,  1190,  1200,  1203,  1211,
+    1215,  1222,  1223,  1228,  1233,  1243,  1250,  1256,  1263,  1270,
+    1277,  1283,  1290,  1297,  1305,  1312,  1319,  1326,  1333,  1340,
+    1347,  1355,  1369,  1381,  1386,  1392,  1397,  1403,  1408,  1413,
+    1421,  1426,  1431,  1441,  1446,  1451,  1451,  1461,  1466,  1469,
+    1474,  1478,  1482,  1484,  1484,  1487,  1497,  1502,  1507,  1517,
+    1527,  1537,  1547,  1552,  1557,  1562,  1564,  1564,  1567,  1572,
+    1579,  1584,  1591,  1598,  1603,  1604,  1612,  1612,  1613,  1613,
+    1615,  1624,  1628,  1632,  1635,  1640,  1643,  1646,  1669,  1670,
+    1673,  1684,  1685,  1687,  1696,  1697,  1698,  1702,  1702,  1716,
+    1717,  1720,  1720,  1720,  1720,  1720,  1720,  1720,  1721,  1722,
+    1727,  1728,  1737,  1737,  1741,  1747,  1758,  1767,  1770,  1778,
+    1782,  1787,  1790,  1796,  1796,  1798,  1803,  1808,  1813,  1821,
+    1831,  1840,  1862,  1867,  1873,  1879,  1887,  1905,  1914,  1924,
+    1928,  1935,  1936,  1940,  1945,  1948,  1959,  1969,  1980,  1990,
+    2000,  2011,  2041,  2050,  2057,  2066,  2073,  2080,  2086,  2137,
+    2142,  2143,  2147,  2148,  2151,  2160,  2170,  2179,  2190,  2197,
+    2208,  2219
 };
 #endif
 
@@ -2930,26 +3092,26 @@
   switch (yyn)
     {
         case 81:
-#line 896 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1058 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
     (yyval.String) = (yyvsp[-1].String);
   ;}
     break;
 
   case 82:
-#line 899 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1061 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
     (yyval.String) = new std::string(""); 
   ;}
     break;
 
   case 90:
-#line 906 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1068 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     { (yyval.String) = new std::string(""); ;}
     break;
 
   case 97:
-#line 911 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1073 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     { 
     *(yyvsp[-1].String) += *(yyvsp[0].String); 
     delete (yyvsp[0].String);
@@ -2958,27 +3120,27 @@
     break;
 
   case 98:
-#line 916 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1078 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     { (yyval.String) = new std::string(""); ;}
     break;
 
   case 99:
-#line 921 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1083 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     { (yyval.String) = new std::string(); ;}
     break;
 
   case 100:
-#line 922 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1084 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     { *(yyvsp[-1].String) += " " + *(yyvsp[0].String); delete (yyvsp[0].String); (yyval.String) = (yyvsp[-1].String); ;}
     break;
 
   case 101:
-#line 925 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1087 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     { (yyval.String) = new std::string(); ;}
     break;
 
   case 102:
-#line 926 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1088 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     { 
     (yyvsp[-1].String)->insert(0, ", "); 
     *(yyvsp[-1].String) += " " + *(yyvsp[0].String);
@@ -2988,7 +3150,7 @@
     break;
 
   case 103:
-#line 934 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1096 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     { 
     *(yyvsp[-1].String) += " " + *(yyvsp[0].String);
     delete (yyvsp[0].String);
@@ -2997,17 +3159,17 @@
     break;
 
   case 104:
-#line 940 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1102 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     { (yyval.String) = new std::string(); ;}
     break;
 
   case 106:
-#line 944 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1106 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     { (yyval.String) = new std::string(); ;}
     break;
 
   case 107:
-#line 945 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1107 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
       (yyvsp[-1].String)->insert(0, ", ");
       if (!(yyvsp[0].String)->empty())
@@ -3018,7 +3180,7 @@
     break;
 
   case 109:
-#line 955 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1117 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
       *(yyvsp[-1].String) += " " + *(yyvsp[0].String);
       delete (yyvsp[0].String);
@@ -3027,28 +3189,28 @@
     break;
 
   case 127:
-#line 977 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1139 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     { 
     (yyval.Type) = TypeInfo::get(*(yyvsp[0].String), OpaqueTy);
   ;}
     break;
 
   case 128:
-#line 980 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1142 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     { 
     (yyval.Type) = TypeInfo::get(*(yyvsp[0].String), UnresolvedTy);
   ;}
     break;
 
   case 129:
-#line 983 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1145 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     { 
     (yyval.Type) = (yyvsp[0].Type); 
   ;}
     break;
 
   case 130:
-#line 986 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1148 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {                   // Type UpReference
     (yyvsp[0].String)->insert(0, "\\");
     (yyval.Type) = TypeInfo::get(*(yyvsp[0].String), UpRefTy);
@@ -3056,7 +3218,7 @@
     break;
 
   case 131:
-#line 990 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1152 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {           // Function derived type?
     std::string newTy( (yyvsp[-3].Type)->getNewTy() + "(");
     for (unsigned i = 0; i < (yyvsp[-1].TypeVec)->size(); ++i) {
@@ -3073,7 +3235,7 @@
     break;
 
   case 132:
-#line 1003 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1165 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {          // Sized array type?
     uint64_t elems = atoi((yyvsp[-3].String)->c_str());
     (yyvsp[-3].String)->insert(0,"[ ");
@@ -3083,7 +3245,7 @@
     break;
 
   case 133:
-#line 1009 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1171 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {          // Packed array type?
     uint64_t elems = atoi((yyvsp[-3].String)->c_str());
     (yyvsp[-3].String)->insert(0,"< ");
@@ -3093,7 +3255,7 @@
     break;
 
   case 134:
-#line 1015 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1177 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {                        // Structure type?
     std::string newTy("{");
     for (unsigned i = 0; i < (yyvsp[-1].TypeVec)->size(); ++i) {
@@ -3107,14 +3269,14 @@
     break;
 
   case 135:
-#line 1025 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1187 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {                                  // Empty structure type?
     (yyval.Type) = TypeInfo::get("{}", StructTy, new TypeList());
   ;}
     break;
 
   case 136:
-#line 1028 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1190 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {                // Packed Structure type?
     std::string newTy("<{");
     for (unsigned i = 0; i < (yyvsp[-2].TypeVec)->size(); ++i) {
@@ -3128,21 +3290,21 @@
     break;
 
   case 137:
-#line 1038 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1200 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {                          // Empty packed structure type?
     (yyval.Type) = TypeInfo::get("<{}>", PackedStructTy, new TypeList());
   ;}
     break;
 
   case 138:
-#line 1041 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1203 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {                             // Pointer type?
     (yyval.Type) = (yyvsp[-1].Type)->getPointerType();
   ;}
     break;
 
   case 139:
-#line 1049 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1211 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
     (yyval.TypeVec) = new TypeList();
     (yyval.TypeVec)->push_back((yyvsp[0].Type));
@@ -3150,7 +3312,7 @@
     break;
 
   case 140:
-#line 1053 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1215 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
     (yyval.TypeVec) = (yyvsp[-2].TypeVec);
     (yyval.TypeVec)->push_back((yyvsp[0].Type));
@@ -3158,7 +3320,7 @@
     break;
 
   case 142:
-#line 1061 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1223 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
     (yyval.TypeVec) = (yyvsp[-2].TypeVec);
     (yyval.TypeVec)->push_back(TypeInfo::get("void",VoidTy));
@@ -3167,7 +3329,7 @@
     break;
 
   case 143:
-#line 1066 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1228 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
     (yyval.TypeVec) = new TypeList();
     (yyval.TypeVec)->push_back(TypeInfo::get("void",VoidTy));
@@ -3176,176 +3338,192 @@
     break;
 
   case 144:
-#line 1071 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1233 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
     (yyval.TypeVec) = new TypeList();
   ;}
     break;
 
   case 145:
-#line 1081 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1243 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     { // Nonempty unsized arr
-    (yyval.Const).type = (yyvsp[-3].Type);
-    (yyval.Const).cnst = new std::string((yyvsp[-3].Type)->getNewTy());
-    *(yyval.Const).cnst += " [ " + *(yyvsp[-1].String) + " ]";
+    (yyval.Const) = new ConstInfo;
+    (yyval.Const)->type = (yyvsp[-3].Type);
+    (yyval.Const)->cnst = new std::string((yyvsp[-3].Type)->getNewTy());
+    *(yyval.Const)->cnst += " [ " + *(yyvsp[-1].String) + " ]";
     delete (yyvsp[-1].String);
   ;}
     break;
 
   case 146:
-#line 1087 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1250 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
-    (yyval.Const).type = (yyvsp[-2].Type);
-    (yyval.Const).cnst = new std::string((yyvsp[-2].Type)->getNewTy());
-    *(yyval.Const).cnst += "[ ]";
+    (yyval.Const) = new ConstInfo;
+    (yyval.Const)->type = (yyvsp[-2].Type);
+    (yyval.Const)->cnst = new std::string((yyvsp[-2].Type)->getNewTy());
+    *(yyval.Const)->cnst += "[ ]";
   ;}
     break;
 
   case 147:
-#line 1092 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1256 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
-    (yyval.Const).type = (yyvsp[-2].Type);
-    (yyval.Const).cnst = new std::string((yyvsp[-2].Type)->getNewTy());
-    *(yyval.Const).cnst += " c" + *(yyvsp[0].String);
+    (yyval.Const) = new ConstInfo;
+    (yyval.Const)->type = (yyvsp[-2].Type);
+    (yyval.Const)->cnst = new std::string((yyvsp[-2].Type)->getNewTy());
+    *(yyval.Const)->cnst += " c" + *(yyvsp[0].String);
     delete (yyvsp[0].String);
   ;}
     break;
 
   case 148:
-#line 1098 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1263 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     { // Nonempty unsized arr
-    (yyval.Const).type = (yyvsp[-3].Type);
-    (yyval.Const).cnst = new std::string((yyvsp[-3].Type)->getNewTy());
-    *(yyval.Const).cnst += " < " + *(yyvsp[-1].String) + " >";
+    (yyval.Const) = new ConstInfo;
+    (yyval.Const)->type = (yyvsp[-3].Type);
+    (yyval.Const)->cnst = new std::string((yyvsp[-3].Type)->getNewTy());
+    *(yyval.Const)->cnst += " < " + *(yyvsp[-1].String) + " >";
     delete (yyvsp[-1].String);
   ;}
     break;
 
   case 149:
-#line 1104 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1270 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
-    (yyval.Const).type = (yyvsp[-3].Type);
-    (yyval.Const).cnst = new std::string((yyvsp[-3].Type)->getNewTy());
-    *(yyval.Const).cnst += " { " + *(yyvsp[-1].String) + " }";
+    (yyval.Const) = new ConstInfo;
+    (yyval.Const)->type = (yyvsp[-3].Type);
+    (yyval.Const)->cnst = new std::string((yyvsp[-3].Type)->getNewTy());
+    *(yyval.Const)->cnst += " { " + *(yyvsp[-1].String) + " }";
     delete (yyvsp[-1].String);
   ;}
     break;
 
   case 150:
-#line 1110 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1277 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
-    (yyval.Const).type = (yyvsp[-2].Type);
-    (yyval.Const).cnst = new std::string((yyvsp[-2].Type)->getNewTy());
-    *(yyval.Const).cnst += " {}";
+    (yyval.Const) = new ConstInfo;
+    (yyval.Const)->type = (yyvsp[-2].Type);
+    (yyval.Const)->cnst = new std::string((yyvsp[-2].Type)->getNewTy());
+    *(yyval.Const)->cnst += " {}";
   ;}
     break;
 
   case 151:
-#line 1115 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1283 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
-    (yyval.Const).type = (yyvsp[-1].Type);
-    (yyval.Const).cnst = new std::string((yyvsp[-1].Type)->getNewTy());
-    *(yyval.Const).cnst +=  " " + *(yyvsp[0].String);
+    (yyval.Const) = new ConstInfo;
+    (yyval.Const)->type = (yyvsp[-1].Type);
+    (yyval.Const)->cnst = new std::string((yyvsp[-1].Type)->getNewTy());
+    *(yyval.Const)->cnst +=  " " + *(yyvsp[0].String);
     delete (yyvsp[0].String);
   ;}
     break;
 
   case 152:
-#line 1121 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1290 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
-    (yyval.Const).type = (yyvsp[-1].Type);
-    (yyval.Const).cnst = new std::string((yyvsp[-1].Type)->getNewTy());
-    *(yyval.Const).cnst += " " + *(yyvsp[0].String);
+    (yyval.Const) = new ConstInfo;
+    (yyval.Const)->type = (yyvsp[-1].Type);
+    (yyval.Const)->cnst = new std::string((yyvsp[-1].Type)->getNewTy());
+    *(yyval.Const)->cnst += " " + *(yyvsp[0].String);
     delete (yyvsp[0].String);
   ;}
     break;
 
   case 153:
-#line 1127 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1297 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
+    (yyval.Const) = new ConstInfo;
     std::string Name = getUniqueName((yyvsp[0].String), (yyvsp[-1].Type)->resolve(), true);
-    (yyval.Const).type = (yyvsp[-1].Type);
-    (yyval.Const).cnst = new std::string((yyvsp[-1].Type)->getNewTy());
-    *(yyval.Const).cnst += " " + Name;
+    (yyval.Const)->type = (yyvsp[-1].Type);
+    (yyval.Const)->cnst = new std::string((yyvsp[-1].Type)->getNewTy());
+    *(yyval.Const)->cnst += " " + Name;
     delete (yyvsp[0].String);
   ;}
     break;
 
   case 154:
-#line 1134 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1305 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
-    (yyval.Const).type = (yyvsp[-1].Type);
-    (yyval.Const).cnst = new std::string((yyvsp[-1].Type)->getNewTy());
-    *(yyval.Const).cnst += " " + *(yyvsp[0].String);
+    (yyval.Const) = new ConstInfo;
+    (yyval.Const)->type = (yyvsp[-1].Type);
+    (yyval.Const)->cnst = new std::string((yyvsp[-1].Type)->getNewTy());
+    *(yyval.Const)->cnst += " " + *(yyvsp[0].String);
     delete (yyvsp[0].String);
   ;}
     break;
 
   case 155:
-#line 1140 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1312 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
-    (yyval.Const).type = (yyvsp[-1].Type);
-    (yyval.Const).cnst = new std::string((yyvsp[-1].Type)->getNewTy());
-    *(yyval.Const).cnst += " " + *(yyvsp[0].String);
+    (yyval.Const) = new ConstInfo;
+    (yyval.Const)->type = (yyvsp[-1].Type);
+    (yyval.Const)->cnst = new std::string((yyvsp[-1].Type)->getNewTy());
+    *(yyval.Const)->cnst += " " + *(yyvsp[0].String);
     delete (yyvsp[0].String);
   ;}
     break;
 
   case 156:
-#line 1146 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1319 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {      // integral constants
-    (yyval.Const).type = (yyvsp[-1].Type);
-    (yyval.Const).cnst = new std::string((yyvsp[-1].Type)->getNewTy());
-    *(yyval.Const).cnst += " " + *(yyvsp[0].String);
+    (yyval.Const) = new ConstInfo;
+    (yyval.Const)->type = (yyvsp[-1].Type);
+    (yyval.Const)->cnst = new std::string((yyvsp[-1].Type)->getNewTy());
+    *(yyval.Const)->cnst += " " + *(yyvsp[0].String);
     delete (yyvsp[0].String);
   ;}
     break;
 
   case 157:
-#line 1152 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1326 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {            // integral constants
-    (yyval.Const).type = (yyvsp[-1].Type);
-    (yyval.Const).cnst = new std::string((yyvsp[-1].Type)->getNewTy());
-    *(yyval.Const).cnst += " " + *(yyvsp[0].String);
+    (yyval.Const) = new ConstInfo;
+    (yyval.Const)->type = (yyvsp[-1].Type);
+    (yyval.Const)->cnst = new std::string((yyvsp[-1].Type)->getNewTy());
+    *(yyval.Const)->cnst += " " + *(yyvsp[0].String);
     delete (yyvsp[0].String);
   ;}
     break;
 
   case 158:
-#line 1158 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1333 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {                      // Boolean constants
-    (yyval.Const).type = (yyvsp[-1].Type);
-    (yyval.Const).cnst = new std::string((yyvsp[-1].Type)->getNewTy());
-    *(yyval.Const).cnst += " " + *(yyvsp[0].String);
+    (yyval.Const) = new ConstInfo;
+    (yyval.Const)->type = (yyvsp[-1].Type);
+    (yyval.Const)->cnst = new std::string((yyvsp[-1].Type)->getNewTy());
+    *(yyval.Const)->cnst += " " + *(yyvsp[0].String);
     delete (yyvsp[0].String);
   ;}
     break;
 
   case 159:
-#line 1164 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1340 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {                     // Boolean constants
-    (yyval.Const).type = (yyvsp[-1].Type);
-    (yyval.Const).cnst = new std::string((yyvsp[-1].Type)->getNewTy());
-    *(yyval.Const).cnst += " " + *(yyvsp[0].String);
+    (yyval.Const) = new ConstInfo;
+    (yyval.Const)->type = (yyvsp[-1].Type);
+    (yyval.Const)->cnst = new std::string((yyvsp[-1].Type)->getNewTy());
+    *(yyval.Const)->cnst += " " + *(yyvsp[0].String);
     delete (yyvsp[0].String);
   ;}
     break;
 
   case 160:
-#line 1170 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1347 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {                   // Float & Double constants
-    (yyval.Const).type = (yyvsp[-1].Type);
-    (yyval.Const).cnst = new std::string((yyvsp[-1].Type)->getNewTy());
-    *(yyval.Const).cnst += " " + *(yyvsp[0].String);
+    (yyval.Const) = new ConstInfo;
+    (yyval.Const)->type = (yyvsp[-1].Type);
+    (yyval.Const)->cnst = new std::string((yyvsp[-1].Type)->getNewTy());
+    *(yyval.Const)->cnst += " " + *(yyvsp[0].String);
     delete (yyvsp[0].String);
   ;}
     break;
 
   case 161:
-#line 1178 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1355 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
-    std::string source = *(yyvsp[-3].Const).cnst;
-    const TypeInfo* SrcTy = (yyvsp[-3].Const).type->resolve();
+    std::string source = *(yyvsp[-3].Const)->cnst;
+    const TypeInfo* SrcTy = (yyvsp[-3].Const)->type->resolve();
     const TypeInfo* DstTy = (yyvsp[-1].Type)->resolve(); 
     if (*(yyvsp[-5].String) == "cast") {
       // Call getCastUpgrade to upgrade the old cast
@@ -3355,150 +3533,150 @@
       (yyval.String) = new std::string(*(yyvsp[-5].String));
       *(yyval.String) += "( " + source + " to " + (yyvsp[-1].Type)->getNewTy() + ")";
     }
-    delete (yyvsp[-5].String); (yyvsp[-3].Const).destroy(); delete (yyvsp[-2].String);
+    delete (yyvsp[-5].String); delete (yyvsp[-3].Const); delete (yyvsp[-2].String);
   ;}
     break;
 
   case 162:
-#line 1192 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1369 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
-    *(yyvsp[-4].String) += "(" + *(yyvsp[-2].Const).cnst;
+    *(yyvsp[-4].String) += "(" + *(yyvsp[-2].Const)->cnst;
     for (unsigned i = 0; i < (yyvsp[-1].ValList)->size(); ++i) {
-      ValueInfo& VI = (*(yyvsp[-1].ValList))[i];
-      *(yyvsp[-4].String) += ", " + *VI.val;
-      VI.destroy();
+      ValueInfo* VI = (*(yyvsp[-1].ValList))[i];
+      *(yyvsp[-4].String) += ", " + *VI->val;
+      delete VI;
     }
     *(yyvsp[-4].String) += ")";
     (yyval.String) = (yyvsp[-4].String);
-    (yyvsp[-2].Const).destroy();
+    delete (yyvsp[-2].Const);
     delete (yyvsp[-1].ValList);
   ;}
     break;
 
   case 163:
-#line 1204 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1381 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
-    *(yyvsp[-7].String) += "(" + *(yyvsp[-5].Const).cnst + "," + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")";
-    (yyvsp[-5].Const).destroy(); (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy();
+    *(yyvsp[-7].String) += "(" + *(yyvsp[-5].Const)->cnst + "," + *(yyvsp[-3].Const)->cnst + "," + *(yyvsp[-1].Const)->cnst + ")";
+    delete (yyvsp[-5].Const); delete (yyvsp[-3].Const); delete (yyvsp[-1].Const);
     (yyval.String) = (yyvsp[-7].String);
   ;}
     break;
 
   case 164:
-#line 1209 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1386 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
-    const char* op = getDivRemOpcode(*(yyvsp[-5].String), (yyvsp[-3].Const).type); 
+    const char* op = getDivRemOpcode(*(yyvsp[-5].String), (yyvsp[-3].Const)->type); 
     (yyval.String) = new std::string(op);
-    *(yyval.String) += "(" + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")";
-    delete (yyvsp[-5].String); (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy();
+    *(yyval.String) += "(" + *(yyvsp[-3].Const)->cnst + "," + *(yyvsp[-1].Const)->cnst + ")";
+    delete (yyvsp[-5].String); delete (yyvsp[-3].Const); delete (yyvsp[-1].Const);
   ;}
     break;
 
   case 165:
-#line 1215 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1392 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
-    *(yyvsp[-5].String) += "(" + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")";
-    (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy();
+    *(yyvsp[-5].String) += "(" + *(yyvsp[-3].Const)->cnst + "," + *(yyvsp[-1].Const)->cnst + ")";
+    delete (yyvsp[-3].Const); delete (yyvsp[-1].Const);
     (yyval.String) = (yyvsp[-5].String);
   ;}
     break;
 
   case 166:
-#line 1220 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1397 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
-    *(yyvsp[-5].String) = getCompareOp(*(yyvsp[-5].String), (yyvsp[-3].Const).type);
-    *(yyvsp[-5].String) += "(" + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")";
-    (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy();
+    *(yyvsp[-5].String) = getCompareOp(*(yyvsp[-5].String), (yyvsp[-3].Const)->type);
+    *(yyvsp[-5].String) += "(" + *(yyvsp[-3].Const)->cnst + "," + *(yyvsp[-1].Const)->cnst + ")";
+    delete (yyvsp[-3].Const); delete (yyvsp[-1].Const);
     (yyval.String) = (yyvsp[-5].String);
   ;}
     break;
 
   case 167:
-#line 1226 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1403 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
-    *(yyvsp[-6].String) += " " + *(yyvsp[-5].String) + " (" +  *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")";
-    delete (yyvsp[-5].String); (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy();
+    *(yyvsp[-6].String) += " " + *(yyvsp[-5].String) + " (" +  *(yyvsp[-3].Const)->cnst + "," + *(yyvsp[-1].Const)->cnst + ")";
+    delete (yyvsp[-5].String); delete (yyvsp[-3].Const); delete (yyvsp[-1].Const);
     (yyval.String) = (yyvsp[-6].String);
   ;}
     break;
 
   case 168:
-#line 1231 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1408 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
-    *(yyvsp[-6].String) += " " + *(yyvsp[-5].String) + " (" + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")";
-    delete (yyvsp[-5].String); (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy();
+    *(yyvsp[-6].String) += " " + *(yyvsp[-5].String) + " (" + *(yyvsp[-3].Const)->cnst + "," + *(yyvsp[-1].Const)->cnst + ")";
+    delete (yyvsp[-5].String); delete (yyvsp[-3].Const); delete (yyvsp[-1].Const);
     (yyval.String) = (yyvsp[-6].String);
   ;}
     break;
 
   case 169:
-#line 1236 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1413 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
     const char* shiftop = (yyvsp[-5].String)->c_str();
     if (*(yyvsp[-5].String) == "shr")
-      shiftop = ((yyvsp[-3].Const).type->isUnsigned()) ? "lshr" : "ashr";
+      shiftop = ((yyvsp[-3].Const)->type->isUnsigned()) ? "lshr" : "ashr";
     (yyval.String) = new std::string(shiftop);
-    *(yyval.String) += "(" + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")";
-    delete (yyvsp[-5].String); (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy();
+    *(yyval.String) += "(" + *(yyvsp[-3].Const)->cnst + "," + *(yyvsp[-1].Const)->cnst + ")";
+    delete (yyvsp[-5].String); delete (yyvsp[-3].Const); delete (yyvsp[-1].Const);
   ;}
     break;
 
   case 170:
-#line 1244 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1421 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
-    *(yyvsp[-5].String) += "(" + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")";
-    (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy();
+    *(yyvsp[-5].String) += "(" + *(yyvsp[-3].Const)->cnst + "," + *(yyvsp[-1].Const)->cnst + ")";
+    delete (yyvsp[-3].Const); delete (yyvsp[-1].Const);
     (yyval.String) = (yyvsp[-5].String);
   ;}
     break;
 
   case 171:
-#line 1249 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1426 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
-    *(yyvsp[-7].String) += "(" + *(yyvsp[-5].Const).cnst + "," + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")";
-    (yyvsp[-5].Const).destroy(); (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy();
+    *(yyvsp[-7].String) += "(" + *(yyvsp[-5].Const)->cnst + "," + *(yyvsp[-3].Const)->cnst + "," + *(yyvsp[-1].Const)->cnst + ")";
+    delete (yyvsp[-5].Const); delete (yyvsp[-3].Const); delete (yyvsp[-1].Const);
     (yyval.String) = (yyvsp[-7].String);
   ;}
     break;
 
   case 172:
-#line 1254 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1431 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
-    *(yyvsp[-7].String) += "(" + *(yyvsp[-5].Const).cnst + "," + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")";
-    (yyvsp[-5].Const).destroy(); (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy();
+    *(yyvsp[-7].String) += "(" + *(yyvsp[-5].Const)->cnst + "," + *(yyvsp[-3].Const)->cnst + "," + *(yyvsp[-1].Const)->cnst + ")";
+    delete (yyvsp[-5].Const); delete (yyvsp[-3].Const); delete (yyvsp[-1].Const);
     (yyval.String) = (yyvsp[-7].String);
   ;}
     break;
 
   case 173:
-#line 1264 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1441 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
-    *(yyvsp[-2].String) += ", " + *(yyvsp[0].Const).cnst;
-    (yyvsp[0].Const).destroy();
+    *(yyvsp[-2].String) += ", " + *(yyvsp[0].Const)->cnst;
+    delete (yyvsp[0].Const);
     (yyval.String) = (yyvsp[-2].String);
   ;}
     break;
 
   case 174:
-#line 1269 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
-    { (yyval.String) = new std::string(*(yyvsp[0].Const).cnst); (yyvsp[0].Const).destroy(); ;}
+#line 1446 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
+    { (yyval.String) = new std::string(*(yyvsp[0].Const)->cnst); delete (yyvsp[0].Const); ;}
     break;
 
   case 177:
-#line 1284 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1461 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
 ;}
     break;
 
   case 178:
-#line 1289 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1466 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
     (yyval.String) = 0;
   ;}
     break;
 
   case 179:
-#line 1292 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1469 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
     *O << *(yyvsp[0].String) << '\n';
     delete (yyvsp[0].String);
@@ -3507,7 +3685,7 @@
     break;
 
   case 180:
-#line 1297 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1474 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
     *O << "module asm " << ' ' << *(yyvsp[0].String) << '\n';
     (yyval.String) = 0;
@@ -3515,7 +3693,7 @@
     break;
 
   case 181:
-#line 1301 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1478 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
     *O << "implementation\n";
     (yyval.String) = 0;
@@ -3523,21 +3701,21 @@
     break;
 
   case 182:
-#line 1305 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1482 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     { (yyval.String) = 0; ;}
     break;
 
   case 184:
-#line 1307 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1484 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     { (yyval.String) = (yyvsp[0].String); *(yyval.String) = "external"; ;}
     break;
 
   case 185:
-#line 1310 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1487 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
-    EnumeratedTypes.push_back((yyvsp[0].Type));
+    TypeInfo::EnumeratedTypes.push_back((yyvsp[0].Type));
     if (!(yyvsp[-2].String)->empty()) {
-      NamedTypes[*(yyvsp[-2].String)] = (yyvsp[0].Type);
+      TypeInfo::NamedTypes[*(yyvsp[-2].String)] = (yyvsp[0].Type);
       *O << *(yyvsp[-2].String) << " = ";
     }
     *O << "type " << (yyvsp[0].Type)->getNewTy() << '\n';
@@ -3547,7 +3725,7 @@
     break;
 
   case 186:
-#line 1320 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1497 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {       // Function prototypes can be in const pool
     *O << *(yyvsp[0].String) << '\n';
     delete (yyvsp[0].String);
@@ -3556,7 +3734,7 @@
     break;
 
   case 187:
-#line 1325 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1502 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {  // Asm blocks can be in the const pool
     *O << *(yyvsp[-2].String) << ' ' << *(yyvsp[-1].String) << ' ' << *(yyvsp[0].String) << '\n';
     delete (yyvsp[-2].String); delete (yyvsp[-1].String); delete (yyvsp[0].String); 
@@ -3565,21 +3743,21 @@
     break;
 
   case 188:
-#line 1330 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1507 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
     if (!(yyvsp[-4].String)->empty()) {
-      std::string Name = getGlobalName((yyvsp[-4].String),*(yyvsp[-3].String), (yyvsp[-1].Const).type->getPointerType(),
+      std::string Name = getGlobalName((yyvsp[-4].String),*(yyvsp[-3].String), (yyvsp[-1].Const)->type->getPointerType(),
                                        *(yyvsp[-2].String) == "constant");
       *O << Name << " = ";
     }
-    *O << *(yyvsp[-3].String) << ' ' << *(yyvsp[-2].String) << ' ' << *(yyvsp[-1].Const).cnst << ' ' << *(yyvsp[0].String) << '\n';
+    *O << *(yyvsp[-3].String) << ' ' << *(yyvsp[-2].String) << ' ' << *(yyvsp[-1].Const)->cnst << ' ' << *(yyvsp[0].String) << '\n';
     delete (yyvsp[-4].String); delete (yyvsp[-3].String); delete (yyvsp[-2].String); delete (yyvsp[0].String); 
     (yyval.String) = 0;
   ;}
     break;
 
   case 189:
-#line 1340 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1517 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
     if (!(yyvsp[-4].String)->empty()) {
       std::string Name = getGlobalName((yyvsp[-4].String),*(yyvsp[-3].String),(yyvsp[-1].Type)->getPointerType(),
@@ -3593,7 +3771,7 @@
     break;
 
   case 190:
-#line 1350 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1527 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
     if (!(yyvsp[-4].String)->empty()) {
       std::string Name = getGlobalName((yyvsp[-4].String),*(yyvsp[-3].String),(yyvsp[-1].Type)->getPointerType(),
@@ -3607,7 +3785,7 @@
     break;
 
   case 191:
-#line 1360 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1537 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
     if (!(yyvsp[-4].String)->empty()) {
       std::string Name = getGlobalName((yyvsp[-4].String),*(yyvsp[-3].String),(yyvsp[-1].Type)->getPointerType(),
@@ -3621,7 +3799,7 @@
     break;
 
   case 192:
-#line 1370 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1547 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     { 
     *O << *(yyvsp[-1].String) << ' ' << *(yyvsp[0].String) << '\n';
     delete (yyvsp[-1].String); delete (yyvsp[0].String);
@@ -3630,7 +3808,7 @@
     break;
 
   case 193:
-#line 1375 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1552 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
     *O << *(yyvsp[-2].String) << " = " << *(yyvsp[0].String) << '\n';
     delete (yyvsp[-2].String); delete (yyvsp[0].String);
@@ -3639,14 +3817,14 @@
     break;
 
   case 194:
-#line 1380 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1557 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     { 
     (yyval.String) = 0;
   ;}
     break;
 
   case 198:
-#line 1390 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1567 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
     *(yyvsp[-2].String) += " = " + *(yyvsp[0].String);
     delete (yyvsp[0].String);
@@ -3655,7 +3833,7 @@
     break;
 
   case 199:
-#line 1395 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1572 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
     *(yyvsp[-2].String) += " = " + *(yyvsp[0].String);
     if (*(yyvsp[0].String) == "64")
@@ -3666,7 +3844,7 @@
     break;
 
   case 200:
-#line 1402 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1579 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
     *(yyvsp[-2].String) += " = " + *(yyvsp[0].String);
     delete (yyvsp[0].String);
@@ -3675,7 +3853,7 @@
     break;
 
   case 201:
-#line 1407 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1584 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
     *(yyvsp[-2].String) += " = " + *(yyvsp[0].String);
     delete (yyvsp[0].String);
@@ -3684,7 +3862,7 @@
     break;
 
   case 202:
-#line 1414 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1591 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
     (yyvsp[-1].String)->insert(0, "[ ");
     *(yyvsp[-1].String) += " ]";
@@ -3693,7 +3871,7 @@
     break;
 
   case 203:
-#line 1421 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1598 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
     *(yyvsp[-2].String) += ", " + *(yyvsp[0].String);
     delete (yyvsp[0].String);
@@ -3702,19 +3880,19 @@
     break;
 
   case 205:
-#line 1427 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1604 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
     (yyval.String) = new std::string();
   ;}
     break;
 
   case 209:
-#line 1436 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1613 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     { (yyval.String) = new std::string(); ;}
     break;
 
   case 210:
-#line 1438 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1615 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
   (yyval.String) = new std::string((yyvsp[-1].Type)->getNewTy());
   if (!(yyvsp[0].String)->empty()) {
@@ -3726,7 +3904,7 @@
     break;
 
   case 211:
-#line 1447 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1624 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
     *(yyvsp[-2].String) += ", " + *(yyvsp[0].String);
     delete (yyvsp[0].String);
@@ -3734,21 +3912,21 @@
     break;
 
   case 212:
-#line 1451 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1628 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
     (yyval.String) = (yyvsp[0].String);
   ;}
     break;
 
   case 213:
-#line 1455 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1632 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
     (yyval.String) = (yyvsp[0].String);
   ;}
     break;
 
   case 214:
-#line 1458 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1635 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
     *(yyvsp[-2].String) += ", ...";
     (yyval.String) = (yyvsp[-2].String);
@@ -3757,19 +3935,19 @@
     break;
 
   case 215:
-#line 1463 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1640 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
     (yyval.String) = (yyvsp[0].String);
   ;}
     break;
 
   case 216:
-#line 1466 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1643 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     { (yyval.String) = new std::string(); ;}
     break;
 
   case 217:
-#line 1469 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1646 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
     if (*(yyvsp[-5].String) == "%llvm.va_start" || *(yyvsp[-5].String) == "%llvm.va_end") {
       *(yyvsp[-3].String) = "i8*";
@@ -3795,17 +3973,17 @@
     break;
 
   case 218:
-#line 1492 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1669 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     { (yyval.String) = new std::string("{"); delete (yyvsp[0].String); ;}
     break;
 
   case 219:
-#line 1493 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1670 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     { (yyval.String) = new std::string ("{"); ;}
     break;
 
   case 220:
-#line 1496 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1673 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
     *O << "define ";
     if (!(yyvsp[-2].String)->empty()) {
@@ -3818,17 +3996,17 @@
     break;
 
   case 221:
-#line 1507 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1684 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     { (yyval.String) = new std::string("}"); delete (yyvsp[0].String); ;}
     break;
 
   case 222:
-#line 1508 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1685 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     { (yyval.String) = new std::string("}"); ;}
     break;
 
   case 223:
-#line 1510 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1687 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
   if ((yyvsp[-1].String))
     *O << *(yyvsp[-1].String);
@@ -3839,17 +4017,17 @@
     break;
 
   case 224:
-#line 1519 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1696 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     { (yyval.String) = new std::string(); ;}
     break;
 
   case 227:
-#line 1525 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1702 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     { isDeclare = true; ;}
     break;
 
   case 228:
-#line 1525 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1702 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     { 
     if (!(yyvsp[-1].String)->empty())
       *(yyvsp[-3].String) += " " + *(yyvsp[-1].String);
@@ -3862,12 +4040,12 @@
     break;
 
   case 229:
-#line 1539 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1716 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     { (yyval.String) = new std::string(); ;}
     break;
 
   case 239:
-#line 1545 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1722 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     { 
     (yyvsp[-1].String)->insert(0, "<");
     *(yyvsp[-1].String) += ">";
@@ -3876,7 +4054,7 @@
     break;
 
   case 241:
-#line 1551 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1728 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
     if (!(yyvsp[-3].String)->empty()) {
       *(yyvsp[-4].String) += " " + *(yyvsp[-3].String);
@@ -3888,58 +4066,60 @@
     break;
 
   case 244:
-#line 1564 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1741 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
-    (yyval.Value).val = (yyvsp[0].String);
-    (yyval.Value).constant = false;
-    (yyval.Value).type = 0;
+    (yyval.Value) = new ValueInfo;
+    (yyval.Value)->val = (yyvsp[0].String);
+    (yyval.Value)->constant = false;
+    (yyval.Value)->type = 0;
   ;}
     break;
 
   case 245:
-#line 1569 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1747 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
-    (yyval.Value).val = (yyvsp[0].String);
-    (yyval.Value).constant = true;
-    (yyval.Value).type = 0;
+    (yyval.Value) = new ValueInfo;
+    (yyval.Value)->val = (yyvsp[0].String);
+    (yyval.Value)->constant = true;
+    (yyval.Value)->type = 0;
   ;}
     break;
 
   case 246:
-#line 1579 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1758 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
     (yyvsp[-1].Type) = (yyvsp[-1].Type)->resolve();
-    std::string Name = getUniqueName((yyvsp[0].Value).val, (yyvsp[-1].Type));
+    std::string Name = getUniqueName((yyvsp[0].Value)->val, (yyvsp[-1].Type));
     (yyval.Value) = (yyvsp[0].Value);
-    delete (yyval.Value).val;
-    (yyval.Value).val = new std::string((yyvsp[-1].Type)->getNewTy() + " " + Name);
-    (yyval.Value).type = (yyvsp[-1].Type);
+    delete (yyval.Value)->val;
+    (yyval.Value)->val = new std::string((yyvsp[-1].Type)->getNewTy() + " " + Name);
+    (yyval.Value)->type = (yyvsp[-1].Type);
   ;}
     break;
 
   case 247:
-#line 1588 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1767 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
     (yyval.String) = 0;
   ;}
     break;
 
   case 248:
-#line 1591 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1770 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     { // Do not allow functions with 0 basic blocks   
     (yyval.String) = 0;
   ;}
     break;
 
   case 249:
-#line 1599 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1778 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
     (yyval.String) = 0;
   ;}
     break;
 
   case 250:
-#line 1603 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1782 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
     *O << "    " << *(yyvsp[0].String) << '\n';
     delete (yyvsp[0].String);
@@ -3948,14 +4128,14 @@
     break;
 
   case 251:
-#line 1608 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1787 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
     (yyval.String) = 0;
   ;}
     break;
 
   case 252:
-#line 1611 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1790 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
     *O << *(yyvsp[0].String) << '\n';
     delete (yyvsp[0].String);
@@ -3964,21 +4144,21 @@
     break;
 
   case 254:
-#line 1617 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1796 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     { (yyval.String) = (yyvsp[0].String); *(yyval.String) = "unwind"; ;}
     break;
 
   case 255:
-#line 1619 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1798 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {              // Return with a result...
-    *O << "    " << *(yyvsp[-1].String) << ' ' << *(yyvsp[0].Value).val << '\n';
-    delete (yyvsp[-1].String); (yyvsp[0].Value).destroy();
+    *O << "    " << *(yyvsp[-1].String) << ' ' << *(yyvsp[0].Value)->val << '\n';
+    delete (yyvsp[-1].String); delete (yyvsp[0].Value);
     (yyval.String) = 0;
   ;}
     break;
 
   case 256:
-#line 1624 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1803 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {                                       // Return with no result...
     *O << "    " << *(yyvsp[-1].String) << ' ' << (yyvsp[0].Type)->getNewTy() << '\n';
     delete (yyvsp[-1].String);
@@ -3987,51 +4167,55 @@
     break;
 
   case 257:
-#line 1629 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1808 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {                         // Unconditional Branch...
-    *O << "    " << *(yyvsp[-2].String) << ' ' << (yyvsp[-1].Type)->getNewTy() << ' ' << *(yyvsp[0].Value).val << '\n';
-    delete (yyvsp[-2].String); (yyvsp[0].Value).destroy();
+    *O << "    " << *(yyvsp[-2].String) << ' ' << (yyvsp[-1].Type)->getNewTy() << ' ' << *(yyvsp[0].Value)->val << '\n';
+    delete (yyvsp[-2].String); delete (yyvsp[0].Value);
     (yyval.String) = 0;
   ;}
     break;
 
   case 258:
-#line 1634 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1813 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {  
-    std::string Name = getUniqueName((yyvsp[-6].Value).val, (yyvsp[-7].Type));
+    std::string Name = getUniqueName((yyvsp[-6].Value)->val, (yyvsp[-7].Type));
     *O << "    " << *(yyvsp[-8].String) << ' ' << (yyvsp[-7].Type)->getNewTy() << ' ' << Name << ", " 
-       << (yyvsp[-4].Type)->getNewTy() << ' ' << *(yyvsp[-3].Value).val << ", " << (yyvsp[-1].Type)->getNewTy() << ' ' 
-       << *(yyvsp[0].Value).val << '\n';
-    delete (yyvsp[-8].String); (yyvsp[-6].Value).destroy(); (yyvsp[-3].Value).destroy(); (yyvsp[0].Value).destroy();
+       << (yyvsp[-4].Type)->getNewTy() << ' ' << *(yyvsp[-3].Value)->val << ", " << (yyvsp[-1].Type)->getNewTy() << ' ' 
+       << *(yyvsp[0].Value)->val << '\n';
+    delete (yyvsp[-8].String); delete (yyvsp[-6].Value); delete (yyvsp[-3].Value); delete (yyvsp[0].Value);
     (yyval.String) = 0;
   ;}
     break;
 
   case 259:
-#line 1642 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1821 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
-    std::string Name = getUniqueName((yyvsp[-6].Value).val, (yyvsp[-7].Type));
+    std::string Name = getUniqueName((yyvsp[-6].Value)->val, (yyvsp[-7].Type));
     *O << "    " << *(yyvsp[-8].String) << ' ' << (yyvsp[-7].Type)->getNewTy() << ' ' << Name << ", " 
-       << (yyvsp[-4].Type)->getNewTy() << ' ' << *(yyvsp[-3].Value).val << " [" << *(yyvsp[-1].String) << " ]\n";
-    delete (yyvsp[-8].String); (yyvsp[-6].Value).destroy(); (yyvsp[-3].Value).destroy(); 
+       << (yyvsp[-4].Type)->getNewTy() << ' ' << *(yyvsp[-3].Value)->val << " [" << *(yyvsp[-1].String) << " ]\n";
+    delete (yyvsp[-8].String); 
+    delete (yyvsp[-6].Value);
+    delete (yyvsp[-3].Value); 
     delete (yyvsp[-1].String);
     (yyval.String) = 0;
   ;}
     break;
 
   case 260:
-#line 1650 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1831 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
-    std::string Name = getUniqueName((yyvsp[-5].Value).val, (yyvsp[-6].Type));
+    std::string Name = getUniqueName((yyvsp[-5].Value)->val, (yyvsp[-6].Type));
     *O << "    " << *(yyvsp[-7].String) << ' ' << (yyvsp[-6].Type)->getNewTy() << ' ' << Name << ", " 
-       << (yyvsp[-3].Type)->getNewTy() << ' ' << *(yyvsp[-2].Value).val << "[]\n";
-    delete (yyvsp[-7].String); (yyvsp[-5].Value).destroy(); (yyvsp[-2].Value).destroy();
+       << (yyvsp[-3].Type)->getNewTy() << ' ' << *(yyvsp[-2].Value)->val << "[]\n";
+    delete (yyvsp[-7].String); 
+    delete (yyvsp[-5].Value); 
+    delete (yyvsp[-2].Value);
     (yyval.String) = 0;
   ;}
     break;
 
   case 261:
-#line 1658 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1841 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
     const TypeInfo* ResTy = getFunctionReturnType((yyvsp[-10].Type));
     *O << "    ";
@@ -4039,24 +4223,24 @@
       std::string Name = getUniqueName((yyvsp[-13].String), ResTy);
       *O << Name << " = ";
     }
-    *O << *(yyvsp[-12].String) << ' ' << *(yyvsp[-11].String) << ' ' << (yyvsp[-10].Type)->getNewTy() << ' ' << *(yyvsp[-9].Value).val << " (";
+    *O << *(yyvsp[-12].String) << ' ' << *(yyvsp[-11].String) << ' ' << (yyvsp[-10].Type)->getNewTy() << ' ' << *(yyvsp[-9].Value)->val << " (";
     for (unsigned i = 0; i < (yyvsp[-7].ValList)->size(); ++i) {
-      ValueInfo& VI = (*(yyvsp[-7].ValList))[i];
-      *O << *VI.val;
+      ValueInfo* VI = (*(yyvsp[-7].ValList))[i];
+      *O << *VI->val;
       if (i+1 < (yyvsp[-7].ValList)->size())
         *O << ", ";
-      VI.destroy();
+      delete VI;
     }
-    *O << ") " << *(yyvsp[-5].String) << ' ' << (yyvsp[-4].Type)->getNewTy() << ' ' << *(yyvsp[-3].Value).val << ' ' 
-       << *(yyvsp[-2].String) << ' ' << (yyvsp[-1].Type)->getNewTy() << ' ' << *(yyvsp[0].Value).val << '\n';
-    delete (yyvsp[-13].String); delete (yyvsp[-12].String); delete (yyvsp[-11].String); (yyvsp[-9].Value).destroy(); delete (yyvsp[-7].ValList); 
-    delete (yyvsp[-5].String); (yyvsp[-3].Value).destroy(); delete (yyvsp[-2].String); (yyvsp[0].Value).destroy(); 
+    *O << ") " << *(yyvsp[-5].String) << ' ' << (yyvsp[-4].Type)->getNewTy() << ' ' << *(yyvsp[-3].Value)->val << ' ' 
+       << *(yyvsp[-2].String) << ' ' << (yyvsp[-1].Type)->getNewTy() << ' ' << *(yyvsp[0].Value)->val << '\n';
+    delete (yyvsp[-13].String); delete (yyvsp[-12].String); delete (yyvsp[-11].String); delete (yyvsp[-9].Value); delete (yyvsp[-7].ValList); 
+    delete (yyvsp[-5].String); delete (yyvsp[-3].Value); delete (yyvsp[-2].String); delete (yyvsp[0].Value); 
     (yyval.String) = 0;
   ;}
     break;
 
   case 262:
-#line 1679 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1862 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
     *O << "    " << *(yyvsp[0].String) << '\n';
     delete (yyvsp[0].String);
@@ -4065,7 +4249,7 @@
     break;
 
   case 263:
-#line 1684 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1867 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
     *O << "    " << *(yyvsp[0].String) << '\n';
     delete (yyvsp[0].String);
@@ -4074,31 +4258,31 @@
     break;
 
   case 264:
-#line 1690 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1873 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
     *(yyvsp[-5].String) += " " + (yyvsp[-4].Type)->getNewTy() + " " + *(yyvsp[-3].String) + ", " + (yyvsp[-1].Type)->getNewTy() + " " + 
-           *(yyvsp[0].Value).val;
-    delete (yyvsp[-3].String); (yyvsp[0].Value).destroy();
+           *(yyvsp[0].Value)->val;
+    delete (yyvsp[-3].String); delete (yyvsp[0].Value);
     (yyval.String) = (yyvsp[-5].String);
   ;}
     break;
 
   case 265:
-#line 1696 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1879 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
     (yyvsp[-3].String)->insert(0, (yyvsp[-4].Type)->getNewTy() + " " );
-    *(yyvsp[-3].String) += ", " + (yyvsp[-1].Type)->getNewTy() + " " + *(yyvsp[0].Value).val;
-    (yyvsp[0].Value).destroy();
+    *(yyvsp[-3].String) += ", " + (yyvsp[-1].Type)->getNewTy() + " " + *(yyvsp[0].Value)->val;
+    delete (yyvsp[0].Value);
     (yyval.String) = (yyvsp[-3].String);
   ;}
     break;
 
   case 266:
-#line 1704 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1887 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
     if (!(yyvsp[-1].String)->empty()) {
       // Get a unique name for this value, based on its type.
-      std::string Name = getUniqueName((yyvsp[-1].String), (yyvsp[0].Value).type);
+      std::string Name = getUniqueName((yyvsp[-1].String), (yyvsp[0].Value)->type);
       *(yyvsp[-1].String) = Name + " = ";
       if (deleteUselessCastFlag && *deleteUselessCastName == Name) {
         // don't actually delete it, just comment it out
@@ -4106,37 +4290,39 @@
         delete deleteUselessCastName;
       }
     }
-    *(yyvsp[-1].String) += *(yyvsp[0].Value).val;
-    (yyvsp[0].Value).destroy();
+    *(yyvsp[-1].String) += *(yyvsp[0].Value)->val;
+    delete (yyvsp[0].Value);
     deleteUselessCastFlag = false;
     (yyval.String) = (yyvsp[-1].String); 
   ;}
     break;
 
   case 267:
-#line 1722 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1905 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {    // Used for PHI nodes
-    std::string Name = getUniqueName((yyvsp[-3].Value).val, (yyvsp[-5].Type));
+    std::string Name = getUniqueName((yyvsp[-3].Value)->val, (yyvsp[-5].Type));
     Name.insert(0, (yyvsp[-5].Type)->getNewTy() + "[");
-    Name += "," + *(yyvsp[-1].Value).val + "]";
-    (yyval.Value).val = new std::string(Name);
-    (yyval.Value).type = (yyvsp[-5].Type);
-    (yyvsp[-3].Value).destroy(); (yyvsp[-1].Value).destroy();
+    Name += "," + *(yyvsp[-1].Value)->val + "]";
+    (yyval.Value) = new ValueInfo;
+    (yyval.Value)->val = new std::string(Name);
+    (yyval.Value)->type = (yyvsp[-5].Type);
+    delete (yyvsp[-3].Value); delete (yyvsp[-1].Value);
   ;}
     break;
 
   case 268:
-#line 1730 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1914 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
-    std::string Name = getUniqueName((yyvsp[-3].Value).val, (yyvsp[-6].Value).type);
-    *(yyvsp[-6].Value).val += ", [" + Name + "," + *(yyvsp[-1].Value).val + "]";
-    (yyvsp[-3].Value).destroy(); (yyvsp[-1].Value).destroy();
+    std::string Name = getUniqueName((yyvsp[-3].Value)->val, (yyvsp[-6].Value)->type);
+    *(yyvsp[-6].Value)->val += ", [" + Name + "," + *(yyvsp[-1].Value)->val + "]";
+    delete (yyvsp[-3].Value); 
+    delete (yyvsp[-1].Value);
     (yyval.Value) = (yyvsp[-6].Value);
   ;}
     break;
 
   case 269:
-#line 1739 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1924 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
     (yyval.ValList) = new ValueList();
     (yyval.ValList)->push_back((yyvsp[0].Value));
@@ -4144,7 +4330,7 @@
     break;
 
   case 270:
-#line 1743 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1928 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
     (yyval.ValList) = (yyvsp[-2].ValList);
     (yyval.ValList)->push_back((yyvsp[0].Value));
@@ -4152,17 +4338,17 @@
     break;
 
   case 271:
-#line 1750 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1935 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     { (yyval.ValList) = (yyvsp[0].ValList); ;}
     break;
 
   case 272:
-#line 1751 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1936 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     { (yyval.ValList) = new ValueList(); ;}
     break;
 
   case 273:
-#line 1755 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1940 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
     *(yyvsp[-1].String) += " " + *(yyvsp[0].String);
     delete (yyvsp[0].String);
@@ -4171,92 +4357,106 @@
     break;
 
   case 275:
-#line 1763 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1948 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
     const char* op = getDivRemOpcode(*(yyvsp[-4].String), (yyvsp[-3].Type)); 
-    std::string Name1 = getUniqueName((yyvsp[-2].Value).val, (yyvsp[-3].Type));
-    std::string Name2 = getUniqueName((yyvsp[0].Value).val, (yyvsp[-3].Type));
-    (yyval.Value).val = new std::string(op);
-    *(yyval.Value).val += " " + (yyvsp[-3].Type)->getNewTy() + " " + Name1 + ", " + Name2;
-    (yyval.Value).type = (yyvsp[-3].Type);
-    delete (yyvsp[-4].String); (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
+    std::string Name1 = getUniqueName((yyvsp[-2].Value)->val, (yyvsp[-3].Type));
+    std::string Name2 = getUniqueName((yyvsp[0].Value)->val, (yyvsp[-3].Type));
+    (yyval.Value) = (yyvsp[-2].Value);
+    delete (yyval.Value)->val;
+    (yyval.Value)->val = new std::string(op);
+    *(yyval.Value)->val += " " + (yyvsp[-3].Type)->getNewTy() + " " + Name1 + ", " + Name2;
+    (yyval.Value)->type = (yyvsp[-3].Type);
+    delete (yyvsp[-4].String); delete (yyvsp[0].Value);
   ;}
     break;
 
   case 276:
-#line 1772 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1959 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
-    std::string Name1 = getUniqueName((yyvsp[-2].Value).val, (yyvsp[-3].Type));
-    std::string Name2 = getUniqueName((yyvsp[0].Value).val, (yyvsp[-3].Type));
+    std::string Name1 = getUniqueName((yyvsp[-2].Value)->val, (yyvsp[-3].Type));
+    std::string Name2 = getUniqueName((yyvsp[0].Value)->val, (yyvsp[-3].Type));
     *(yyvsp[-4].String) += " " + (yyvsp[-3].Type)->getNewTy() + " " + Name1 + ", " + Name2;
-    (yyval.Value).val = (yyvsp[-4].String);
-    (yyval.Value).type = (yyvsp[-3].Type);
-    (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
+    (yyval.Value) = (yyvsp[-2].Value);
+    delete (yyval.Value)->val;
+    (yyval.Value)->val = (yyvsp[-4].String);
+    (yyval.Value)->type = (yyvsp[-3].Type);
+    delete (yyvsp[0].Value);
   ;}
     break;
 
   case 277:
-#line 1780 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1969 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
-    std::string Name1 = getUniqueName((yyvsp[-2].Value).val, (yyvsp[-3].Type));
-    std::string Name2 = getUniqueName((yyvsp[0].Value).val, (yyvsp[-3].Type));
+    std::string Name1 = getUniqueName((yyvsp[-2].Value)->val, (yyvsp[-3].Type));
+    std::string Name2 = getUniqueName((yyvsp[0].Value)->val, (yyvsp[-3].Type));
     *(yyvsp[-4].String) = getCompareOp(*(yyvsp[-4].String), (yyvsp[-3].Type));
     *(yyvsp[-4].String) += " " + (yyvsp[-3].Type)->getNewTy() + " " + Name1 + ", " + Name2;
-    (yyval.Value).val = (yyvsp[-4].String);
-    (yyval.Value).type = TypeInfo::get("i1",BoolTy);
-    (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
+    (yyval.Value) = (yyvsp[-2].Value);
+    delete (yyval.Value)->val;
+    (yyval.Value)->val = (yyvsp[-4].String);
+    (yyval.Value)->type = TypeInfo::get("i1",BoolTy);
+    delete (yyvsp[0].Value);
   ;}
     break;
 
   case 278:
-#line 1789 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1980 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
-    std::string Name1 = getUniqueName((yyvsp[-2].Value).val, (yyvsp[-3].Type));
-    std::string Name2 = getUniqueName((yyvsp[0].Value).val, (yyvsp[-3].Type));
+    std::string Name1 = getUniqueName((yyvsp[-2].Value)->val, (yyvsp[-3].Type));
+    std::string Name2 = getUniqueName((yyvsp[0].Value)->val, (yyvsp[-3].Type));
     *(yyvsp[-5].String) += " " + *(yyvsp[-4].String) + " " + (yyvsp[-3].Type)->getNewTy() + " " + Name1 + "," + Name2;
-    (yyval.Value).val = (yyvsp[-5].String);
-    (yyval.Value).type = TypeInfo::get("i1",BoolTy);
-    delete (yyvsp[-4].String); (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
+    (yyval.Value) = (yyvsp[-2].Value);
+    delete (yyval.Value)->val;
+    (yyval.Value)->val = (yyvsp[-5].String);
+    (yyval.Value)->type = TypeInfo::get("i1",BoolTy);
+    delete (yyvsp[-4].String); delete (yyvsp[0].Value);
   ;}
     break;
 
   case 279:
-#line 1797 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 1990 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
-    std::string Name1 = getUniqueName((yyvsp[-2].Value).val, (yyvsp[-3].Type));
-    std::string Name2 = getUniqueName((yyvsp[0].Value).val, (yyvsp[-3].Type));
+    std::string Name1 = getUniqueName((yyvsp[-2].Value)->val, (yyvsp[-3].Type));
+    std::string Name2 = getUniqueName((yyvsp[0].Value)->val, (yyvsp[-3].Type));
     *(yyvsp[-5].String) += " " + *(yyvsp[-4].String) + " " + (yyvsp[-3].Type)->getNewTy() + " " + Name1 + "," + Name2;
-    (yyval.Value).val = (yyvsp[-5].String);
-    (yyval.Value).type = TypeInfo::get("i1",BoolTy);
-    delete (yyvsp[-4].String); (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
+    (yyval.Value) = (yyvsp[-2].Value);
+    delete (yyval.Value)->val;
+    (yyval.Value)->val = (yyvsp[-5].String);
+    (yyval.Value)->type = TypeInfo::get("i1",BoolTy);
+    delete (yyvsp[-4].String); delete (yyvsp[0].Value);
   ;}
     break;
 
   case 280:
-#line 1805 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 2000 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
     const char* shiftop = (yyvsp[-3].String)->c_str();
     if (*(yyvsp[-3].String) == "shr")
-      shiftop = ((yyvsp[-2].Value).type->isUnsigned()) ? "lshr" : "ashr";
-    (yyval.Value).val = new std::string(shiftop);
-    *(yyval.Value).val += " " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Value).val;
-    (yyval.Value).type = (yyvsp[-2].Value).type;
-    delete (yyvsp[-3].String); (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
+      shiftop = ((yyvsp[-2].Value)->type->isUnsigned()) ? "lshr" : "ashr";
+    std::string *val = new std::string(shiftop);
+    *val += " " + *(yyvsp[-2].Value)->val + ", " + *(yyvsp[0].Value)->val;
+    (yyval.Value) = (yyvsp[-2].Value);
+    delete (yyval.Value)->val;
+    (yyval.Value)->val = val;
+    delete (yyvsp[-3].String); delete (yyvsp[0].Value);
   ;}
     break;
 
   case 281:
-#line 1814 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 2011 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
-    std::string source = *(yyvsp[-2].Value).val;
-    const TypeInfo* SrcTy = (yyvsp[-2].Value).type->resolve();
+    std::string source = *(yyvsp[-2].Value)->val;
+    const TypeInfo* SrcTy = (yyvsp[-2].Value)->type->resolve();
     const TypeInfo* DstTy = (yyvsp[0].Type)->resolve();
-    (yyval.Value).val = new std::string();
-    (yyval.Value).type = DstTy;
+    (yyval.Value) = (yyvsp[-2].Value);
+    delete (yyval.Value)->val;
+    (yyval.Value)->val = new std::string();
+    (yyval.Value)->type = DstTy;
     if (*(yyvsp[-3].String) == "cast") {
-      *(yyval.Value).val += getCastUpgrade(source, SrcTy, DstTy, false);
+      *(yyval.Value)->val += getCastUpgrade(source, SrcTy, DstTy, false);
     } else {
-      *(yyval.Value).val += *(yyvsp[-3].String) + " " + source + " to " + DstTy->getNewTy();
+      *(yyval.Value)->val += *(yyvsp[-3].String) + " " + source + " to " + DstTy->getNewTy();
     }
     // Check to see if this is a useless cast of a value to the same name
     // and the same type. Such casts will probably cause redefinition errors
@@ -4265,256 +4465,280 @@
       if (SrcTy->isInteger() && DstTy->isInteger() &&
           SrcTy->getBitWidth() == DstTy->getBitWidth()) {
         deleteUselessCastFlag = true; // Flag the "Inst" rule
-        deleteUselessCastName = new std::string(*(yyvsp[-2].Value).val); // save the name
+        deleteUselessCastName = new std::string(*(yyvsp[-2].Value)->val); // save the name
         size_t pos = deleteUselessCastName->find_first_of("%\"",0);
         if (pos != std::string::npos) {
           // remove the type portion before val
           deleteUselessCastName->erase(0, pos);
         }
       }
-    delete (yyvsp[-3].String); (yyvsp[-2].Value).destroy();
+    delete (yyvsp[-3].String); 
     delete (yyvsp[-1].String);
   ;}
     break;
 
   case 282:
-#line 1842 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 2041 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
-    *(yyvsp[-5].String) += " " + *(yyvsp[-4].Value).val + ", " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Value).val;
-    (yyval.Value).val = (yyvsp[-5].String);
-    (yyval.Value).type = (yyvsp[-2].Value).type;
-    (yyvsp[-4].Value).destroy(); (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
+    *(yyvsp[-5].String) += " " + *(yyvsp[-4].Value)->val + ", " + *(yyvsp[-2].Value)->val + ", " + *(yyvsp[0].Value)->val;
+    (yyval.Value) = (yyvsp[-4].Value);
+    delete (yyval.Value)->val;
+    (yyval.Value)->val = (yyvsp[-5].String);
+    (yyval.Value)->type = (yyvsp[-2].Value)->type;
+    delete (yyvsp[-2].Value);
+    delete (yyvsp[0].Value);
   ;}
     break;
 
   case 283:
-#line 1848 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 2050 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
-    *(yyvsp[-3].String) += " " + *(yyvsp[-2].Value).val + ", " + (yyvsp[0].Type)->getNewTy();
-    (yyval.Value).val = (yyvsp[-3].String);
-    (yyval.Value).type = (yyvsp[0].Type);
-    (yyvsp[-2].Value).destroy();
+    *(yyvsp[-3].String) += " " + *(yyvsp[-2].Value)->val + ", " + (yyvsp[0].Type)->getNewTy();
+    (yyval.Value) = (yyvsp[-2].Value);
+    delete (yyval.Value)->val;
+    (yyval.Value)->val = (yyvsp[-3].String);
+    (yyval.Value)->type = (yyvsp[0].Type);
   ;}
     break;
 
   case 284:
-#line 1854 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 2057 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
-    *(yyvsp[-3].String) += " " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Value).val;
-    (yyval.Value).val = (yyvsp[-3].String);
-    (yyvsp[-2].Value).type = (yyvsp[-2].Value).type->resolve();;
-    (yyval.Value).type = (yyvsp[-2].Value).type->getElementType();
-    (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
+    *(yyvsp[-3].String) += " " + *(yyvsp[-2].Value)->val + ", " + *(yyvsp[0].Value)->val;
+    (yyval.Value) = (yyvsp[-2].Value);
+    delete (yyval.Value)->val;
+    (yyval.Value)->val = (yyvsp[-3].String);
+    (yyval.Value)->type = (yyval.Value)->type->resolve();
+    (yyval.Value)->type = (yyval.Value)->type->getElementType();
+    delete (yyvsp[0].Value);
   ;}
     break;
 
   case 285:
-#line 1861 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 2066 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
-    *(yyvsp[-5].String) += " " + *(yyvsp[-4].Value).val + ", " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Value).val;
-    (yyval.Value).val = (yyvsp[-5].String);
-    (yyval.Value).type = (yyvsp[-4].Value).type;
-    (yyvsp[-4].Value).destroy(); (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
+    *(yyvsp[-5].String) += " " + *(yyvsp[-4].Value)->val + ", " + *(yyvsp[-2].Value)->val + ", " + *(yyvsp[0].Value)->val;
+    (yyval.Value) = (yyvsp[-4].Value);
+    delete (yyval.Value)->val;
+    (yyval.Value)->val = (yyvsp[-5].String);
+    delete (yyvsp[-2].Value); delete (yyvsp[0].Value);
   ;}
     break;
 
   case 286:
-#line 1867 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 2073 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
-    *(yyvsp[-5].String) += " " + *(yyvsp[-4].Value).val + ", " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Value).val;
-    (yyval.Value).val = (yyvsp[-5].String);
-    (yyval.Value).type = (yyvsp[-4].Value).type;
-    (yyvsp[-4].Value).destroy(); (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
+    *(yyvsp[-5].String) += " " + *(yyvsp[-4].Value)->val + ", " + *(yyvsp[-2].Value)->val + ", " + *(yyvsp[0].Value)->val;
+    (yyval.Value) = (yyvsp[-4].Value);
+    delete (yyval.Value)->val;
+    (yyval.Value)->val = (yyvsp[-5].String);
+    delete (yyvsp[-2].Value); delete (yyvsp[0].Value);
   ;}
     break;
 
   case 287:
-#line 1873 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 2080 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
-    *(yyvsp[-1].String) += " " + *(yyvsp[0].Value).val;
-    (yyval.Value).val = (yyvsp[-1].String);
-    (yyval.Value).type = (yyvsp[0].Value).type;
-    delete (yyvsp[0].Value).val;
+    *(yyvsp[-1].String) += " " + *(yyvsp[0].Value)->val;
+    (yyval.Value) = (yyvsp[0].Value);
+    delete (yyvsp[0].Value)->val;
+    (yyval.Value)->val = (yyvsp[-1].String);
   ;}
     break;
 
   case 288:
-#line 1879 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 2086 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
     // map llvm.isunordered to "fcmp uno" 
-    if (*(yyvsp[-3].Value).val == "%llvm.isunordered.f32" ||
-        *(yyvsp[-3].Value).val == "%llvm.isunordered.f64") {
-      (yyval.Value).val = new std::string( "fcmp uno " + *(*(yyvsp[-1].ValList))[0].val + ", ");
-      size_t pos = (*(yyvsp[-1].ValList))[1].val->find(' ');
+    (yyval.Value) = new ValueInfo;
+    if (*(yyvsp[-3].Value)->val == "%llvm.isunordered.f32" ||
+        *(yyvsp[-3].Value)->val == "%llvm.isunordered.f64") {
+      (yyval.Value)->val = new std::string( "fcmp uno " + *(*(yyvsp[-1].ValList))[0]->val + ", ");
+      size_t pos = (*(yyvsp[-1].ValList))[1]->val->find(' ');
       assert(pos != std::string::npos && "no space?");
-      *(yyval.Value).val += (*(yyvsp[-1].ValList))[1].val->substr(pos+1);
-      (yyval.Value).type = TypeInfo::get("i1", BoolTy);
+      *(yyval.Value)->val += (*(yyvsp[-1].ValList))[1]->val->substr(pos+1);
+      (yyval.Value)->type = TypeInfo::get("i1", BoolTy);
     } else {
       static unsigned upgradeCount = 1;
-      if (*(yyvsp[-3].Value).val == "%llvm.va_start" || *(yyvsp[-3].Value).val == "%llvm.va_end") {
+      if (*(yyvsp[-3].Value)->val == "%llvm.va_start" || *(yyvsp[-3].Value)->val == "%llvm.va_end") {
         if (!(yyvsp[-1].ValList)->empty()) {
           std::string name("%va_upgrade");
           name += llvm::utostr(upgradeCount++);
-          (yyvsp[-6].String)->insert(0, name + " = bitcast " + *(*(yyvsp[-1].ValList))[0].val + " to i8*\n    ");
-          *(*(yyvsp[-1].ValList))[0].val = "i8* " + name;
-          (*(yyvsp[-1].ValList))[0].type = TypeInfo::get("i8", UByteTy)->getPointerType();
+          (yyvsp[-6].String)->insert(0, name + " = bitcast " + *(*(yyvsp[-1].ValList))[0]->val + " to i8*\n    ");
+          *(*(yyvsp[-1].ValList))[0]->val = "i8* " + name;
+          (*(yyvsp[-1].ValList))[0]->type = TypeInfo::get("i8", UByteTy)->getPointerType();
         }
-      } else if (*(yyvsp[-3].Value).val == "%llvm.va_copy") {
+      } else if (*(yyvsp[-3].Value)->val == "%llvm.va_copy") {
         std::string name0("%va_upgrade");
         name0 += llvm::utostr(upgradeCount++);
         std::string name1("%va_upgrade");
         name1 += llvm::utostr(upgradeCount++);
-        (yyvsp[-6].String)->insert(0, name0 + " = bitcast " + *(*(yyvsp[-1].ValList))[0].val + " to i8*\n    " +
-                      name1 + " = bitcast " + *(*(yyvsp[-1].ValList))[1].val + " to i8*\n    ");
-        *(*(yyvsp[-1].ValList))[0].val = "i8* " + name0;
-        (*(yyvsp[-1].ValList))[0].type = TypeInfo::get("i8", UByteTy)->getPointerType();
-        *(*(yyvsp[-1].ValList))[1].val = "i8* " + name1;
-        (*(yyvsp[-1].ValList))[0].type = TypeInfo::get("i8", UByteTy)->getPointerType();
+        (yyvsp[-6].String)->insert(0, name0 + " = bitcast " + *(*(yyvsp[-1].ValList))[0]->val + " to i8*\n    " +
+                      name1 + " = bitcast " + *(*(yyvsp[-1].ValList))[1]->val + " to i8*\n    ");
+        *(*(yyvsp[-1].ValList))[0]->val = "i8* " + name0;
+        (*(yyvsp[-1].ValList))[0]->type = TypeInfo::get("i8", UByteTy)->getPointerType();
+        *(*(yyvsp[-1].ValList))[1]->val = "i8* " + name1;
+        (*(yyvsp[-1].ValList))[0]->type = TypeInfo::get("i8", UByteTy)->getPointerType();
       }
       if (!(yyvsp[-5].String)->empty())
         *(yyvsp[-6].String) += " " + *(yyvsp[-5].String);
       if (!(yyvsp[-6].String)->empty())
         *(yyvsp[-6].String) += " ";
-      *(yyvsp[-6].String) += (yyvsp[-4].Type)->getNewTy() + " " + *(yyvsp[-3].Value).val + "(";
+      *(yyvsp[-6].String) += (yyvsp[-4].Type)->getNewTy() + " " + *(yyvsp[-3].Value)->val + "(";
       for (unsigned i = 0; i < (yyvsp[-1].ValList)->size(); ++i) {
-        ValueInfo& VI = (*(yyvsp[-1].ValList))[i];
-        *(yyvsp[-6].String) += *VI.val;
+        ValueInfo* VI = (*(yyvsp[-1].ValList))[i];
+        *(yyvsp[-6].String) += *VI->val;
         if (i+1 < (yyvsp[-1].ValList)->size())
           *(yyvsp[-6].String) += ", ";
-        VI.destroy();
+        delete VI;
       }
       *(yyvsp[-6].String) += ")";
-      (yyval.Value).val = (yyvsp[-6].String);
-      (yyval.Value).type = getFunctionReturnType((yyvsp[-4].Type));
+      (yyval.Value) = new ValueInfo;
+      (yyval.Value)->val = (yyvsp[-6].String);
+      (yyval.Value)->type = getFunctionReturnType((yyvsp[-4].Type));
     }
-    delete (yyvsp[-5].String); (yyvsp[-3].Value).destroy(); delete (yyvsp[-1].ValList);
+    delete (yyvsp[-5].String); delete (yyvsp[-3].Value); delete (yyvsp[-1].ValList);
   ;}
     break;
 
   case 290:
-#line 1933 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 2142 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     { (yyval.ValList) = (yyvsp[0].ValList); ;}
     break;
 
   case 291:
-#line 1934 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 2143 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {  (yyval.ValList) = new ValueList(); ;}
     break;
 
   case 293:
-#line 1939 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 2148 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     { (yyval.String) = new std::string(); ;}
     break;
 
   case 294:
-#line 1942 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 2151 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
     *(yyvsp[-2].String) += " " + (yyvsp[-1].Type)->getNewTy();
     if (!(yyvsp[0].String)->empty())
       *(yyvsp[-2].String) += " " + *(yyvsp[0].String);
-    (yyval.Value).val = (yyvsp[-2].String);
-    (yyval.Value).type = (yyvsp[-1].Type)->getPointerType();
+    (yyval.Value) = new ValueInfo;
+    (yyval.Value)->val = (yyvsp[-2].String);
+    (yyval.Value)->type = (yyvsp[-1].Type)->getPointerType();
     delete (yyvsp[0].String);
   ;}
     break;
 
   case 295:
-#line 1950 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 2160 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
-    std::string Name = getUniqueName((yyvsp[-1].Value).val, (yyvsp[-2].Type));
+    std::string Name = getUniqueName((yyvsp[-1].Value)->val, (yyvsp[-2].Type));
     *(yyvsp[-5].String) += " " + (yyvsp[-4].Type)->getNewTy() + ", " + (yyvsp[-2].Type)->getNewTy() + " " + Name;
     if (!(yyvsp[0].String)->empty())
       *(yyvsp[-5].String) += " " + *(yyvsp[0].String);
-    (yyval.Value).val = (yyvsp[-5].String);
-    (yyval.Value).type = (yyvsp[-4].Type)->getPointerType();
-    (yyvsp[-1].Value).destroy(); delete (yyvsp[0].String);
+    (yyval.Value) = new ValueInfo;
+    (yyval.Value)->val = (yyvsp[-5].String);
+    (yyval.Value)->type = (yyvsp[-4].Type)->getPointerType();
+    delete (yyvsp[-1].Value); delete (yyvsp[0].String);
   ;}
     break;
 
   case 296:
-#line 1959 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 2170 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
     *(yyvsp[-2].String) += " " + (yyvsp[-1].Type)->getNewTy();
     if (!(yyvsp[0].String)->empty())
       *(yyvsp[-2].String) += " " + *(yyvsp[0].String);
-    (yyval.Value).val = (yyvsp[-2].String);
-    (yyval.Value).type = (yyvsp[-1].Type)->getPointerType();
+    (yyval.Value) = new ValueInfo;
+    (yyval.Value)->val = (yyvsp[-2].String);
+    (yyval.Value)->type = (yyvsp[-1].Type)->getPointerType();
     delete (yyvsp[0].String);
   ;}
     break;
 
   case 297:
-#line 1967 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 2179 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
-    std::string Name = getUniqueName((yyvsp[-1].Value).val, (yyvsp[-2].Type));
+    std::string Name = getUniqueName((yyvsp[-1].Value)->val, (yyvsp[-2].Type));
     *(yyvsp[-5].String) += " " + (yyvsp[-4].Type)->getNewTy() + ", " + (yyvsp[-2].Type)->getNewTy() + " " + Name;
     if (!(yyvsp[0].String)->empty())
       *(yyvsp[-5].String) += " " + *(yyvsp[0].String);
-    (yyval.Value).val = (yyvsp[-5].String);
-    (yyval.Value).type = (yyvsp[-4].Type)->getPointerType();
-    (yyvsp[-1].Value).destroy(); delete (yyvsp[0].String);
+    (yyval.Value) = (yyvsp[-1].Value);
+    delete (yyval.Value)->val;
+    (yyval.Value)->val = (yyvsp[-5].String);
+    (yyval.Value)->type = (yyvsp[-4].Type)->getPointerType();
+    delete (yyvsp[0].String);
   ;}
     break;
 
   case 298:
-#line 1976 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 2190 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
-    *(yyvsp[-1].String) += " " + *(yyvsp[0].Value).val;
-    (yyval.Value).val = (yyvsp[-1].String);
-    (yyval.Value).type = TypeInfo::get("void", VoidTy); 
-    (yyvsp[0].Value).destroy();
+    *(yyvsp[-1].String) += " " + *(yyvsp[0].Value)->val;
+    (yyval.Value) = (yyvsp[0].Value);
+    delete (yyvsp[0].Value)->val;
+    (yyval.Value)->val = (yyvsp[-1].String);
+    (yyval.Value)->type = TypeInfo::get("void", VoidTy); 
   ;}
     break;
 
   case 299:
-#line 1982 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 2197 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
-    std::string Name = getUniqueName((yyvsp[0].Value).val, (yyvsp[-1].Type));
+    std::string Name = getUniqueName((yyvsp[0].Value)->val, (yyvsp[-1].Type));
     if (!(yyvsp[-3].String)->empty())
       *(yyvsp[-3].String) += " ";
     *(yyvsp[-3].String) += *(yyvsp[-2].String) + " " + (yyvsp[-1].Type)->getNewTy() + " " + Name;
-    (yyval.Value).val = (yyvsp[-3].String);
-    (yyval.Value).type = (yyvsp[-1].Type)->getElementType();
-    delete (yyvsp[-2].String); (yyvsp[0].Value).destroy();
+    (yyval.Value) = (yyvsp[0].Value);
+    delete (yyval.Value)->val;
+    (yyval.Value)->val = (yyvsp[-3].String);
+    (yyval.Value)->type = (yyvsp[-1].Type)->getElementType();
+    delete (yyvsp[-2].String);
   ;}
     break;
 
   case 300:
-#line 1991 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 2208 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
-    std::string Name = getUniqueName((yyvsp[0].Value).val, (yyvsp[-1].Type));
+    std::string Name = getUniqueName((yyvsp[0].Value)->val, (yyvsp[-1].Type));
     if (!(yyvsp[-5].String)->empty())
       *(yyvsp[-5].String) += " ";
-    *(yyvsp[-5].String) += *(yyvsp[-4].String) + " " + *(yyvsp[-3].Value).val + ", " + (yyvsp[-1].Type)->getNewTy() + " " + Name;
-    (yyval.Value).val = (yyvsp[-5].String);
-    (yyval.Value).type = TypeInfo::get("void", VoidTy);
-    delete (yyvsp[-4].String); (yyvsp[-3].Value).destroy(); (yyvsp[0].Value).destroy();
+    *(yyvsp[-5].String) += *(yyvsp[-4].String) + " " + *(yyvsp[-3].Value)->val + ", " + (yyvsp[-1].Type)->getNewTy() + " " + Name;
+    (yyval.Value) = (yyvsp[-3].Value);
+    delete (yyval.Value)->val;
+    (yyval.Value)->val = (yyvsp[-5].String);
+    (yyval.Value)->type = TypeInfo::get("void", VoidTy);
+    delete (yyvsp[-4].String); delete (yyvsp[0].Value);
   ;}
     break;
 
   case 301:
-#line 2000 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 2219 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
     {
-    std::string Name = getUniqueName((yyvsp[-1].Value).val, (yyvsp[-2].Type));
+    std::string Name = getUniqueName((yyvsp[-1].Value)->val, (yyvsp[-2].Type));
     // Upgrade the indices
     for (unsigned i = 0; i < (yyvsp[0].ValList)->size(); ++i) {
-      ValueInfo& VI = (*(yyvsp[0].ValList))[i];
-      if (VI.type->isUnsigned() && !VI.isConstant() && 
-          VI.type->getBitWidth() < 64) {
-        *O << "    %gep_upgrade" << unique << " = zext " << *VI.val 
+      ValueInfo* VI = (*(yyvsp[0].ValList))[i];
+      if (VI->type->isUnsigned() && !VI->isConstant() && 
+          VI->type->getBitWidth() < 64) {
+        *O << "    %gep_upgrade" << UniqueNameCounter << " = zext " << *VI->val 
            << " to i64\n";
-        *VI.val = "i64 %gep_upgrade" + llvm::utostr(unique++);
-        VI.type = TypeInfo::get("i64",ULongTy);
+        *VI->val = "i64 %gep_upgrade" + llvm::utostr(UniqueNameCounter++);
+        VI->type = TypeInfo::get("i64",ULongTy);
       }
     }
     *(yyvsp[-3].String) += " " + (yyvsp[-2].Type)->getNewTy() + " " + Name;
     for (unsigned i = 0; i < (yyvsp[0].ValList)->size(); ++i) {
-      ValueInfo& VI = (*(yyvsp[0].ValList))[i];
-      *(yyvsp[-3].String) += ", " + *VI.val;
+      ValueInfo* VI = (*(yyvsp[0].ValList))[i];
+      *(yyvsp[-3].String) += ", " + *VI->val;
     }
-    (yyval.Value).val = (yyvsp[-3].String);
-    (yyval.Value).type = getGEPIndexedType((yyvsp[-2].Type),(yyvsp[0].ValList)); 
-    (yyvsp[-1].Value).destroy(); delete (yyvsp[0].ValList);
+    (yyval.Value) = (yyvsp[-1].Value);
+    delete (yyval.Value)->val;
+    (yyval.Value)->val = (yyvsp[-3].String);
+    (yyval.Value)->type = getGEPIndexedType((yyvsp[-2].Type),(yyvsp[0].ValList)); 
+    for (unsigned i = 0; i < (yyvsp[0].ValList)->size(); ++i)
+      delete (*(yyvsp[0].ValList))[i];
+    delete (yyvsp[0].ValList);
   ;}
     break;
 
@@ -4523,7 +4747,7 @@
     }
 
 /* Line 1126 of yacc.c.  */
-#line 4527 "UpgradeParser.tab.c"
+#line 4751 "UpgradeParser.tab.c"
 
   yyvsp -= yylen;
   yyssp -= yylen;
@@ -4791,7 +5015,7 @@
 }
 
 
-#line 2023 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 2246 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
 
 
 int yyerror(const char *ErrorMsg) {
@@ -4809,7 +5033,7 @@
   exit(1);
 }
 
-static void warning(const std::string& ErrorMsg) {
+void warning(const std::string& ErrorMsg) {
   std::string where 
     = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
                   + ":" + llvm::utostr((unsigned) Upgradelineno) + ": ";


Index: llvm/tools/llvm-upgrade/UpgradeParser.h.cvs
diff -u llvm/tools/llvm-upgrade/UpgradeParser.h.cvs:1.28 llvm/tools/llvm-upgrade/UpgradeParser.h.cvs:1.29
--- llvm/tools/llvm-upgrade/UpgradeParser.h.cvs:1.28	Fri Jan 12 18:03:30 2007
+++ llvm/tools/llvm-upgrade/UpgradeParser.h.cvs	Sun Jan 14 18:26:18 2007
@@ -331,12 +331,12 @@
 
 
 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
-#line 806 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
+#line 968 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
 typedef union YYSTYPE {
   std::string*    String;
   const TypeInfo* Type;
-  ValueInfo       Value;
-  ConstInfo       Const;
+  ValueInfo*      Value;
+  ConstInfo*      Const;
   ValueList*      ValList;
   TypeList*       TypeVec;
 } YYSTYPE;


Index: llvm/tools/llvm-upgrade/UpgradeParser.y.cvs
diff -u llvm/tools/llvm-upgrade/UpgradeParser.y.cvs:1.40 llvm/tools/llvm-upgrade/UpgradeParser.y.cvs:1.41
--- llvm/tools/llvm-upgrade/UpgradeParser.y.cvs:1.40	Fri Jan 12 22:40:16 2007
+++ llvm/tools/llvm-upgrade/UpgradeParser.y.cvs	Sun Jan 14 18:26:18 2007
@@ -30,44 +30,14 @@
 static std::ostream *O = 0;
 std::istream* LexInput = 0;
 unsigned SizeOfPointer = 32;
-static uint64_t unique = 1;
+
 
 // This bool controls whether attributes are ever added to function declarations
 // definitions and calls.
 static bool AddAttributes = false;
 
-// This is set when a DECLARE keyword is recognized so that subsequent parsing
-// of a function prototype can know if its a declaration or definition.
-static bool isDeclare = false;
-
-// This bool is used to communicate between the InstVal and Inst rules about
-// whether or not a cast should be deleted. When the flag is set, InstVal has
-// determined that the cast is a candidate. However, it can only be deleted if
-// the value being casted is the same value name as the instruction. The Inst
-// rule makes that comparison if the flag is set and comments out the
-// instruction if they match.
-static bool deleteUselessCastFlag = false;
-static std::string* deleteUselessCastName = 0;
-
-typedef std::vector<const TypeInfo*> TypeVector;
-static TypeVector EnumeratedTypes;
-typedef std::map<std::string,const TypeInfo*> TypeMap;
-static TypeMap NamedTypes;
-typedef std::map<const TypeInfo*,std::string> TypePlaneMap;
-typedef std::map<std::string,TypePlaneMap> GlobalsTypeMap;
-static GlobalsTypeMap Globals;
-
 static void warning(const std::string& msg);
 
-void destroy(ValueList* VL) {
-  while (!VL->empty()) {
-    ValueInfo& VI = VL->back();
-    VI.destroy();
-    VL->pop_back();
-  }
-  delete VL;
-}
-
 void UpgradeAssembly(const std::string &infile, std::istream& in, 
                      std::ostream &out, bool debug, bool addAttrs)
 {
@@ -79,13 +49,176 @@
   O = &out;
 
   if (yyparse()) {
-    std::cerr << "Parse failed.\n";
-    out << "llvm-upgrade parse failed.\n";
+    std::cerr << "llvm-upgrade: parse failed.\n";
+    out << "llvm-upgrade: parse failed.\n";
     exit(1);
   }
 }
 
-TypeInfo::TypeRegMap TypeInfo::registry;
+namespace { // Anonymous namespace to keep our implementation local
+
+
+/// This type is used to keep track of the signedness of values. Instead
+/// of creating llvm::Value directly, the parser will create ValueInfo which
+/// associates a Value* with a Signedness indication.
+struct ValueInfo {
+  std::string* val;
+  const TypeInfo* type;
+  bool constant;
+  bool isConstant() const { return constant; }
+  ~ValueInfo() { delete val; }
+};
+
+
+/// This type is used to keep track of the signedness of the obsolete
+/// integer types. Instead of creating an llvm::Type directly, the Lexer will
+/// create instances of TypeInfo which retains the signedness indication so
+/// it can be used by the parser for upgrade decisions.
+/// For example if "uint" is encountered then the "first" field will be set 
+/// to "int32" and the "second" field will be set to "isUnsigned".  If the 
+/// type is not obsolete then "second" will be set to "isSignless".
+class TypeInfo {
+public:
+  static const TypeInfo* get(const std::string &newType, Types oldType);
+  static const TypeInfo* get(const std::string& newType, Types oldType, 
+                             const TypeInfo* eTy, const TypeInfo* rTy);
+
+  static const TypeInfo* get(const std::string& newType, Types oldType, 
+                             const TypeInfo *eTy, uint64_t elems);
+
+  static const TypeInfo* get(const std::string& newType, Types oldType, 
+                             TypeList* TL);
+
+  static const TypeInfo* get(const std::string& newType, const TypeInfo* resTy, 
+                             TypeList* TL);
+
+  const TypeInfo* resolve() const;
+  bool operator<(const TypeInfo& that) const;
+
+  bool sameNewTyAs(const TypeInfo* that) const {
+    return this->newTy == that->newTy;
+  }
+
+  bool sameOldTyAs(const TypeInfo* that) const;
+
+  Types getElementTy() const {
+    if (elemTy) {
+      return elemTy->oldTy;
+    }
+    return UnresolvedTy;
+  }
+
+  unsigned getUpRefNum() const {
+    assert(oldTy == UpRefTy && "Can't getUpRefNum on non upreference");
+    return atoi(&((getNewTy().c_str())[1])); // skip the slash
+  }
+
+  typedef std::vector<const TypeInfo*> UpRefStack;
+  void getSignedness(unsigned &sNum, unsigned &uNum, UpRefStack& stk) const;
+  std::string makeUniqueName(const std::string& BaseName) const;
+
+  const std::string& getNewTy() const { return newTy; }
+  const TypeInfo* getResultType() const { return resultTy; }
+  const TypeInfo* getElementType() const { return elemTy; }
+
+  const TypeInfo* getPointerType() const {
+    return get(newTy + "*", PointerTy, this, (TypeInfo*)0);
+  }
+
+  bool isUnresolved() const { return oldTy == UnresolvedTy; }
+  bool isUpReference() const { return oldTy == UpRefTy; }
+  bool isVoid() const { return oldTy == VoidTy; }
+  bool isBool() const { return oldTy == BoolTy; }
+  bool isSigned() const {
+    return oldTy == SByteTy || oldTy == ShortTy || 
+           oldTy == IntTy || oldTy == LongTy;
+  }
+
+  bool isUnsigned() const {
+    return oldTy == UByteTy || oldTy == UShortTy || 
+           oldTy == UIntTy || oldTy == ULongTy;
+  }
+  bool isSignless() const { return !isSigned() && !isUnsigned(); }
+  bool isInteger() const { return isSigned() || isUnsigned(); }
+  bool isIntegral() const { return oldTy == BoolTy || isInteger(); }
+  bool isFloatingPoint() const { return oldTy == DoubleTy || oldTy == FloatTy; }
+  bool isPacked() const { return oldTy == PackedTy; }
+  bool isPointer() const { return oldTy == PointerTy; }
+  bool isStruct() const { return oldTy == StructTy || oldTy == PackedStructTy; }
+  bool isArray() const { return oldTy == ArrayTy; }
+  bool isOther() const { 
+    return !isPacked() && !isPointer() && !isFloatingPoint() && !isIntegral(); }
+  bool isFunction() const { return oldTy == FunctionTy; }
+  bool isComposite() const {
+    return isStruct() || isPointer() || isArray() || isPacked();
+  }
+
+  bool isAttributeCandidate() const {
+    return isIntegral() && getBitWidth() < 32;
+  }
+
+  bool isUnresolvedDeep() const;
+
+  unsigned getBitWidth() const;
+
+  const TypeInfo* getIndexedType(const ValueInfo*  VI) const;
+
+  unsigned getNumStructElements() const { 
+    return (elements ? elements->size() : 0);
+  }
+
+  const TypeInfo* getElement(unsigned idx) const {
+    if (elements)
+      if (idx < elements->size())
+        return (*elements)[idx];
+    return 0;
+  }
+
+private:
+  TypeInfo() 
+    : newTy(), oldTy(UnresolvedTy), elemTy(0), resultTy(0), elements(0),
+      nelems(0) {
+  }
+
+  TypeInfo(const TypeInfo& that); // do not implement
+  TypeInfo& operator=(const TypeInfo& that); // do not implement
+
+  ~TypeInfo() { delete elements; }
+
+  struct ltfunctor
+  {
+    bool operator()(const TypeInfo* X, const TypeInfo* Y) const {
+      assert(X && "Can't compare null pointer");
+      assert(Y && "Can't compare null pointer");
+      return *X < *Y;
+    }
+  };
+
+  typedef std::set<const TypeInfo*, ltfunctor> TypeRegMap;
+
+  static const TypeInfo* add_new_type(TypeInfo* existing);
+
+  std::string newTy;
+  Types oldTy;
+  TypeInfo *elemTy;
+  TypeInfo *resultTy;
+  TypeList *elements;
+  uint64_t nelems;
+  static TypeRegMap registry;
+public:
+  typedef std::vector<const TypeInfo*> TypeVector;
+  typedef std::map<std::string,const TypeInfo*> TypeMap;
+  typedef std::map<const TypeInfo*,std::string> TypePlaneMap;
+  typedef std::map<std::string,TypePlaneMap> GlobalsTypeMap;
+  static TypeVector EnumeratedTypes;
+  static TypeMap NamedTypes;
+  static GlobalsTypeMap Globals;
+};
+
+TypeInfo::TypeRegMap     TypeInfo::registry;
+TypeInfo::TypeVector     TypeInfo::EnumeratedTypes;
+TypeInfo::TypeMap        TypeInfo::NamedTypes;
+TypeInfo::GlobalsTypeMap TypeInfo::Globals;
 
 const TypeInfo* TypeInfo::get(const std::string &newType, Types oldType) {
   TypeInfo* Ty = new TypeInfo();
@@ -145,7 +278,7 @@
         yyerror(msg.c_str());
       }
     } else {
-      TypeMap::iterator I = NamedTypes.find(newTy);
+      TypeInfo::TypeMap::iterator I = NamedTypes.find(newTy);
       if (I != NamedTypes.end()) {
         return I->second;
       } else {
@@ -295,12 +428,12 @@
   }
 }
 
-const TypeInfo* TypeInfo::getIndexedType(const ValueInfo&  VI) const {
+const TypeInfo* TypeInfo::getIndexedType(const ValueInfo*  VI) const {
   if (isStruct()) {
-    if (VI.isConstant() && VI.type->isInteger()) {
-      size_t pos = VI.val->find(' ') + 1;
-      if (pos < VI.val->size()) {
-        uint64_t idx = atoi(VI.val->substr(pos).c_str());
+    if (VI->isConstant() && VI->type->isInteger()) {
+      size_t pos = VI->val->find(' ') + 1;
+      if (pos < VI->val->size()) {
+        uint64_t idx = atoi(VI->val->substr(pos).c_str());
         return (*elements)[idx];
       } else {
         yyerror("Invalid value for constant integer");
@@ -446,9 +579,34 @@
   return newTy;
 }
 
-static const char* getCastOpcode(
-  std::string& Source, const TypeInfo* SrcTy, const TypeInfo* DstTy) 
-{
+/// This type is used to keep track of the signedness of constants.
+struct ConstInfo {
+  std::string *cnst;
+  const TypeInfo *type;
+  ~ConstInfo() { delete cnst; }
+};
+
+/// This variable provides a counter for unique names. It is used in various
+/// productions to ensure a unique name is generated.
+static uint64_t UniqueNameCounter = 1;
+
+// This is set when a DECLARE keyword is recognized so that subsequent parsing
+// of a function prototype can know if its a declaration or definition.
+static bool isDeclare = false;
+
+// This bool is used to communicate between the InstVal and Inst rules about
+// whether or not a cast should be deleted. When the flag is set, InstVal has
+// determined that the cast is a candidate. However, it can only be deleted if
+// the value being casted is the same value name as the instruction. The Inst
+// rule makes that comparison if the flag is set and comments out the
+// instruction if they match.
+static bool deleteUselessCastFlag = false;
+static std::string* deleteUselessCastName = 0;
+
+
+
+const char* getCastOpcode(std::string& Source, const TypeInfo* SrcTy, 
+                          const TypeInfo* DstTy) {
   unsigned SrcBits = SrcTy->getBitWidth();
   unsigned DstBits = DstTy->getBitWidth();
   const char* opcode = "bitcast";
@@ -524,9 +682,8 @@
   return opcode;
 }
 
-static std::string getCastUpgrade(const std::string& Src, const TypeInfo* SrcTy,
-                                  const TypeInfo* DstTy, bool isConst)
-{
+std::string getCastUpgrade(const std::string& Src, const TypeInfo* SrcTy,
+                           const TypeInfo* DstTy, bool isConst) {
   std::string Result;
   std::string Source = Src;
   if (SrcTy->isFloatingPoint() && DstTy->isPointer()) {
@@ -535,9 +692,9 @@
     if (isConst)
       Source = "i64 fptoui(" + Source + " to i64)";
     else {
-      *O << "    %cast_upgrade" << unique << " = fptoui " << Source 
-         << " to i64\n";
-      Source = "i64 %cast_upgrade" + llvm::utostr(unique);
+      *O << "    %cast_upgrade" << UniqueNameCounter++ << " = fptoui " 
+         << Source << " to i64\n";
+      Source = "i64 %cast_upgrade" + llvm::utostr(UniqueNameCounter);
     }
     // Update the SrcTy for the getCastOpcode call below
     SrcTy = TypeInfo::get("i64", ULongTy);
@@ -592,8 +749,7 @@
   return op;
 }
 
-std::string 
-getCompareOp(const std::string& setcc, const TypeInfo* TI) {
+std::string getCompareOp(const std::string& setcc, const TypeInfo* TI) {
   assert(setcc.length() == 5);
   char cc1 = setcc[3];
   char cc2 = setcc[4];
@@ -623,7 +779,7 @@
   return result;
 }
 
-static const TypeInfo* getFunctionReturnType(const TypeInfo* PFTy) {
+const TypeInfo* getFunctionReturnType(const TypeInfo* PFTy) {
   PFTy = PFTy->resolve();
   if (PFTy->isPointer()) {
     const TypeInfo* ElemTy = PFTy->getElementType();
@@ -636,15 +792,15 @@
   return PFTy;
 }
 
-static const TypeInfo* ResolveUpReference(const TypeInfo* Ty, 
-                                          TypeInfo::UpRefStack* stack) {
+const TypeInfo* ResolveUpReference(const TypeInfo* Ty, 
+                                   TypeInfo::UpRefStack* stack) {
   assert(Ty->isUpReference() && "Can't resolve a non-upreference");
   unsigned upref = Ty->getUpRefNum();
   assert(upref < stack->size() && "Invalid up reference");
   return (*stack)[upref - stack->size() - 1];
 }
 
-static const TypeInfo* getGEPIndexedType(const TypeInfo* PTy, ValueList* idxs) {
+const TypeInfo* getGEPIndexedType(const TypeInfo* PTy, ValueList* idxs) {
   const TypeInfo* Result = PTy = PTy->resolve();
   assert(PTy->isPointer() && "GEP Operand is not a pointer?");
   TypeInfo::UpRefStack stack;
@@ -668,13 +824,12 @@
   return Result->getPointerType();
 }
 
-
 // This function handles appending .u or .s to integer value names that
 // were previously unsigned or signed, respectively. This avoids name
 // collisions since the unsigned and signed type planes have collapsed
 // into a single signless type plane.
-static std::string getUniqueName(const std::string *Name, const TypeInfo* Ty,
-                                 bool isGlobal = false, bool isDef = false) {
+std::string getUniqueName(const std::string *Name, const TypeInfo* Ty,
+                          bool isGlobal = false, bool isDef = false) {
 
   // If its not a symbolic name, don't modify it, probably a constant val.
   if ((*Name)[0] != '%' && (*Name)[0] != '"')
@@ -688,10 +843,10 @@
   Ty = Ty->resolve(); 
 
   // If its a global name, get its uniquified name, if any
-  GlobalsTypeMap::iterator GI = Globals.find(*Name);
-  if (GI != Globals.end()) {
-    TypePlaneMap::iterator TPI = GI->second.begin();
-    TypePlaneMap::iterator TPE = GI->second.end();
+  TypeInfo::GlobalsTypeMap::iterator GI = TypeInfo::Globals.find(*Name);
+  if (GI != TypeInfo::Globals.end()) {
+    TypeInfo::TypePlaneMap::iterator TPI = GI->second.begin();
+    TypeInfo::TypePlaneMap::iterator TPE = GI->second.end();
     for ( ; TPI != TPE ; ++TPI) {
       if (TPI->first->sameNewTyAs(Ty)) 
         return TPI->second;
@@ -713,16 +868,14 @@
   return Result;
 }
 
-static unsigned UniqueNameCounter = 0;
-
 std::string getGlobalName(const std::string* Name, const std::string Linkage,
                           const TypeInfo* Ty, bool isConstant) {
   // Default to given name
   std::string Result = *Name; 
   // Look up the name in the Globals Map
-  GlobalsTypeMap::iterator GI = Globals.find(*Name);
+  TypeInfo::GlobalsTypeMap::iterator GI = TypeInfo::Globals.find(*Name);
   // Did we see this global name before?
-  if (GI != Globals.end()) {
+  if (GI != TypeInfo::Globals.end()) {
     if (Ty->isUnresolvedDeep()) {
       // The Gval's type is unresolved. Consequently, we can't disambiguate it
       // by type. We'll just change its name and emit a warning.
@@ -733,7 +886,7 @@
       Result += llvm::utostr(UniqueNameCounter);
       return Result;
     } else {
-      TypePlaneMap::iterator TPI = GI->second.find(Ty);
+      TypeInfo::TypePlaneMap::iterator TPI = GI->second.find(Ty);
       if (TPI != GI->second.end()) {
         // We found an existing name of the same old type. This isn't allowed 
         // in LLVM 2.0. Consequently, we must alter the name of the global so it
@@ -748,8 +901,8 @@
         // There isn't an existing definition for this name according to the
         // old types. Now search the TypePlanMap for types with the same new
         // name. 
-        TypePlaneMap::iterator TPI = GI->second.begin();
-        TypePlaneMap::iterator TPE = GI->second.end();
+        TypeInfo::TypePlaneMap::iterator TPI = GI->second.begin();
+        TypeInfo::TypePlaneMap::iterator TPE = GI->second.end();
         for ( ; TPI != TPE; ++TPI) {
           if (TPI->first->sameNewTyAs(Ty)) {
             // The new types are the same but the old types are different so 
@@ -789,16 +942,25 @@
   // Its a new global name, if it is external we can't change it
   if (isConstant || Linkage == "external" || Linkage == "dllimport" || 
       Linkage == "extern_weak" || Linkage == "") {
-    Globals[Result][Ty] = Result;
+    TypeInfo::Globals[Result][Ty] = Result;
     return Result;
   }
 
   // Its a new global name, and it is internal, change the name to make it
   // unique for its type.
   // Result = getUniqueName(Name, Ty);
-  Globals[*Name][Ty] = Result;
+  TypeInfo::Globals[*Name][Ty] = Result;
   return Result;
 }
+
+} // End anonymous namespace
+
+// This function is used by the Lexer to create a TypeInfo. It can't be
+// in the anonymous namespace.
+const TypeInfo* getTypeInfo(const std::string& newTy, Types oldTy) {
+  return TypeInfo::get(newTy, oldTy);
+}
+
 %}
 
 // %file-prefix="UpgradeParser"
@@ -806,8 +968,8 @@
 %union {
   std::string*    String;
   const TypeInfo* Type;
-  ValueInfo       Value;
-  ConstInfo       Const;
+  ValueInfo*      Value;
+  ConstInfo*      Const;
   ValueList*      ValList;
   TypeList*       TypeVec;
 }
@@ -1079,105 +1241,120 @@
 // ResolvedVal, ValueRef and ConstValueRef productions.
 //
 ConstVal: Types '[' ConstVector ']' { // Nonempty unsized arr
-    $$.type = $1;
-    $$.cnst = new std::string($1->getNewTy());
-    *$$.cnst += " [ " + *$3 + " ]";
+    $$ = new ConstInfo;
+    $$->type = $1;
+    $$->cnst = new std::string($1->getNewTy());
+    *$$->cnst += " [ " + *$3 + " ]";
     delete $3;
   }
   | Types '[' ']' {
-    $$.type = $1;
-    $$.cnst = new std::string($1->getNewTy());
-    *$$.cnst += "[ ]";
+    $$ = new ConstInfo;
+    $$->type = $1;
+    $$->cnst = new std::string($1->getNewTy());
+    *$$->cnst += "[ ]";
   }
   | Types 'c' STRINGCONSTANT {
-    $$.type = $1;
-    $$.cnst = new std::string($1->getNewTy());
-    *$$.cnst += " c" + *$3;
+    $$ = new ConstInfo;
+    $$->type = $1;
+    $$->cnst = new std::string($1->getNewTy());
+    *$$->cnst += " c" + *$3;
     delete $3;
   }
   | Types '<' ConstVector '>' { // Nonempty unsized arr
-    $$.type = $1;
-    $$.cnst = new std::string($1->getNewTy());
-    *$$.cnst += " < " + *$3 + " >";
+    $$ = new ConstInfo;
+    $$->type = $1;
+    $$->cnst = new std::string($1->getNewTy());
+    *$$->cnst += " < " + *$3 + " >";
     delete $3;
   }
   | Types '{' ConstVector '}' {
-    $$.type = $1;
-    $$.cnst = new std::string($1->getNewTy());
-    *$$.cnst += " { " + *$3 + " }";
+    $$ = new ConstInfo;
+    $$->type = $1;
+    $$->cnst = new std::string($1->getNewTy());
+    *$$->cnst += " { " + *$3 + " }";
     delete $3;
   }
   | Types '{' '}' {
-    $$.type = $1;
-    $$.cnst = new std::string($1->getNewTy());
-    *$$.cnst += " {}";
+    $$ = new ConstInfo;
+    $$->type = $1;
+    $$->cnst = new std::string($1->getNewTy());
+    *$$->cnst += " {}";
   }
   | Types NULL_TOK {
-    $$.type = $1;
-    $$.cnst = new std::string($1->getNewTy());
-    *$$.cnst +=  " " + *$2;
+    $$ = new ConstInfo;
+    $$->type = $1;
+    $$->cnst = new std::string($1->getNewTy());
+    *$$->cnst +=  " " + *$2;
     delete $2;
   }
   | Types UNDEF {
-    $$.type = $1;
-    $$.cnst = new std::string($1->getNewTy());
-    *$$.cnst += " " + *$2;
+    $$ = new ConstInfo;
+    $$->type = $1;
+    $$->cnst = new std::string($1->getNewTy());
+    *$$->cnst += " " + *$2;
     delete $2;
   }
   | Types SymbolicValueRef {
+    $$ = new ConstInfo;
     std::string Name = getUniqueName($2, $1->resolve(), true);
-    $$.type = $1;
-    $$.cnst = new std::string($1->getNewTy());
-    *$$.cnst += " " + Name;
+    $$->type = $1;
+    $$->cnst = new std::string($1->getNewTy());
+    *$$->cnst += " " + Name;
     delete $2;
   }
   | Types ConstExpr {
-    $$.type = $1;
-    $$.cnst = new std::string($1->getNewTy());
-    *$$.cnst += " " + *$2;
+    $$ = new ConstInfo;
+    $$->type = $1;
+    $$->cnst = new std::string($1->getNewTy());
+    *$$->cnst += " " + *$2;
     delete $2;
   }
   | Types ZEROINITIALIZER {
-    $$.type = $1;
-    $$.cnst = new std::string($1->getNewTy());
-    *$$.cnst += " " + *$2;
+    $$ = new ConstInfo;
+    $$->type = $1;
+    $$->cnst = new std::string($1->getNewTy());
+    *$$->cnst += " " + *$2;
     delete $2;
   }
   | SIntType EInt64Val {      // integral constants
-    $$.type = $1;
-    $$.cnst = new std::string($1->getNewTy());
-    *$$.cnst += " " + *$2;
+    $$ = new ConstInfo;
+    $$->type = $1;
+    $$->cnst = new std::string($1->getNewTy());
+    *$$->cnst += " " + *$2;
     delete $2;
   }
   | UIntType EInt64Val {            // integral constants
-    $$.type = $1;
-    $$.cnst = new std::string($1->getNewTy());
-    *$$.cnst += " " + *$2;
+    $$ = new ConstInfo;
+    $$->type = $1;
+    $$->cnst = new std::string($1->getNewTy());
+    *$$->cnst += " " + *$2;
     delete $2;
   }
   | BOOL TRUETOK {                      // Boolean constants
-    $$.type = $1;
-    $$.cnst = new std::string($1->getNewTy());
-    *$$.cnst += " " + *$2;
+    $$ = new ConstInfo;
+    $$->type = $1;
+    $$->cnst = new std::string($1->getNewTy());
+    *$$->cnst += " " + *$2;
     delete $2;
   }
   | BOOL FALSETOK {                     // Boolean constants
-    $$.type = $1;
-    $$.cnst = new std::string($1->getNewTy());
-    *$$.cnst += " " + *$2;
+    $$ = new ConstInfo;
+    $$->type = $1;
+    $$->cnst = new std::string($1->getNewTy());
+    *$$->cnst += " " + *$2;
     delete $2;
   }
   | FPType FPVAL {                   // Float & Double constants
-    $$.type = $1;
-    $$.cnst = new std::string($1->getNewTy());
-    *$$.cnst += " " + *$2;
+    $$ = new ConstInfo;
+    $$->type = $1;
+    $$->cnst = new std::string($1->getNewTy());
+    *$$->cnst += " " + *$2;
     delete $2;
   };
 
-
 ConstExpr: CastOps '(' ConstVal TO Types ')' {
-    std::string source = *$3.cnst;
-    const TypeInfo* SrcTy = $3.type->resolve();
+    std::string source = *$3->cnst;
+    const TypeInfo* SrcTy = $3->type->resolve();
     const TypeInfo* DstTy = $5->resolve(); 
     if (*$1 == "cast") {
       // Call getCastUpgrade to upgrade the old cast
@@ -1187,73 +1364,73 @@
       $$ = new std::string(*$1);
       *$$ += "( " + source + " to " + $5->getNewTy() + ")";
     }
-    delete $1; $3.destroy(); delete $4;
+    delete $1; delete $3; delete $4;
   }
   | GETELEMENTPTR '(' ConstVal IndexList ')' {
-    *$1 += "(" + *$3.cnst;
+    *$1 += "(" + *$3->cnst;
     for (unsigned i = 0; i < $4->size(); ++i) {
-      ValueInfo& VI = (*$4)[i];
-      *$1 += ", " + *VI.val;
-      VI.destroy();
+      ValueInfo* VI = (*$4)[i];
+      *$1 += ", " + *VI->val;
+      delete VI;
     }
     *$1 += ")";
     $$ = $1;
-    $3.destroy();
+    delete $3;
     delete $4;
   }
   | SELECT '(' ConstVal ',' ConstVal ',' ConstVal ')' {
-    *$1 += "(" + *$3.cnst + "," + *$5.cnst + "," + *$7.cnst + ")";
-    $3.destroy(); $5.destroy(); $7.destroy();
+    *$1 += "(" + *$3->cnst + "," + *$5->cnst + "," + *$7->cnst + ")";
+    delete $3; delete $5; delete $7;
     $$ = $1;
   }
   | ArithmeticOps '(' ConstVal ',' ConstVal ')' {
-    const char* op = getDivRemOpcode(*$1, $3.type); 
+    const char* op = getDivRemOpcode(*$1, $3->type); 
     $$ = new std::string(op);
-    *$$ += "(" + *$3.cnst + "," + *$5.cnst + ")";
-    delete $1; $3.destroy(); $5.destroy();
+    *$$ += "(" + *$3->cnst + "," + *$5->cnst + ")";
+    delete $1; delete $3; delete $5;
   }
   | LogicalOps '(' ConstVal ',' ConstVal ')' {
-    *$1 += "(" + *$3.cnst + "," + *$5.cnst + ")";
-    $3.destroy(); $5.destroy();
+    *$1 += "(" + *$3->cnst + "," + *$5->cnst + ")";
+    delete $3; delete $5;
     $$ = $1;
   }
   | SetCondOps '(' ConstVal ',' ConstVal ')' {
-    *$1 = getCompareOp(*$1, $3.type);
-    *$1 += "(" + *$3.cnst + "," + *$5.cnst + ")";
-    $3.destroy(); $5.destroy();
+    *$1 = getCompareOp(*$1, $3->type);
+    *$1 += "(" + *$3->cnst + "," + *$5->cnst + ")";
+    delete $3; delete $5;
     $$ = $1;
   }
   | ICMP IPredicates '(' ConstVal ',' ConstVal ')' {
-    *$1 += " " + *$2 + " (" +  *$4.cnst + "," + *$6.cnst + ")";
-    delete $2; $4.destroy(); $6.destroy();
+    *$1 += " " + *$2 + " (" +  *$4->cnst + "," + *$6->cnst + ")";
+    delete $2; delete $4; delete $6;
     $$ = $1;
   }
   | FCMP FPredicates '(' ConstVal ',' ConstVal ')' {
-    *$1 += " " + *$2 + " (" + *$4.cnst + "," + *$6.cnst + ")";
-    delete $2; $4.destroy(); $6.destroy();
+    *$1 += " " + *$2 + " (" + *$4->cnst + "," + *$6->cnst + ")";
+    delete $2; delete $4; delete $6;
     $$ = $1;
   }
   | ShiftOps '(' ConstVal ',' ConstVal ')' {
     const char* shiftop = $1->c_str();
     if (*$1 == "shr")
-      shiftop = ($3.type->isUnsigned()) ? "lshr" : "ashr";
+      shiftop = ($3->type->isUnsigned()) ? "lshr" : "ashr";
     $$ = new std::string(shiftop);
-    *$$ += "(" + *$3.cnst + "," + *$5.cnst + ")";
-    delete $1; $3.destroy(); $5.destroy();
+    *$$ += "(" + *$3->cnst + "," + *$5->cnst + ")";
+    delete $1; delete $3; delete $5;
   }
   | EXTRACTELEMENT '(' ConstVal ',' ConstVal ')' {
-    *$1 += "(" + *$3.cnst + "," + *$5.cnst + ")";
-    $3.destroy(); $5.destroy();
+    *$1 += "(" + *$3->cnst + "," + *$5->cnst + ")";
+    delete $3; delete $5;
     $$ = $1;
   }
   | INSERTELEMENT '(' ConstVal ',' ConstVal ',' ConstVal ')' {
-    *$1 += "(" + *$3.cnst + "," + *$5.cnst + "," + *$7.cnst + ")";
-    $3.destroy(); $5.destroy(); $7.destroy();
+    *$1 += "(" + *$3->cnst + "," + *$5->cnst + "," + *$7->cnst + ")";
+    delete $3; delete $5; delete $7;
     $$ = $1;
   }
   | SHUFFLEVECTOR '(' ConstVal ',' ConstVal ',' ConstVal ')' {
-    *$1 += "(" + *$3.cnst + "," + *$5.cnst + "," + *$7.cnst + ")";
-    $3.destroy(); $5.destroy(); $7.destroy();
+    *$1 += "(" + *$3->cnst + "," + *$5->cnst + "," + *$7->cnst + ")";
+    delete $3; delete $5; delete $7;
     $$ = $1;
   };
 
@@ -1262,11 +1439,11 @@
 
 ConstVector 
   : ConstVector ',' ConstVal {
-    *$1 += ", " + *$3.cnst;
-    $3.destroy();
+    *$1 += ", " + *$3->cnst;
+    delete $3;
     $$ = $1;
   }
-  | ConstVal { $$ = new std::string(*$1.cnst); $1.destroy(); }
+  | ConstVal { $$ = new std::string(*$1->cnst); delete $1; }
   ;
 
 
@@ -1308,9 +1485,9 @@
 
 // ConstPool - Constants with optional names assigned to them.
 ConstPool : ConstPool OptAssign TYPE TypesV {
-    EnumeratedTypes.push_back($4);
+    TypeInfo::EnumeratedTypes.push_back($4);
     if (!$2->empty()) {
-      NamedTypes[*$2] = $4;
+      TypeInfo::NamedTypes[*$2] = $4;
       *O << *$2 << " = ";
     }
     *O << "type " << $4->getNewTy() << '\n';
@@ -1329,11 +1506,11 @@
   }
   | ConstPool OptAssign OptLinkage GlobalType ConstVal  GlobalVarAttributes {
     if (!$2->empty()) {
-      std::string Name = getGlobalName($2,*$3, $5.type->getPointerType(),
+      std::string Name = getGlobalName($2,*$3, $5->type->getPointerType(),
                                        *$4 == "constant");
       *O << Name << " = ";
     }
-    *O << *$3 << ' ' << *$4 << ' ' << *$5.cnst << ' ' << *$6 << '\n';
+    *O << *$3 << ' ' << *$4 << ' ' << *$5->cnst << ' ' << *$6 << '\n';
     delete $2; delete $3; delete $4; delete $6; 
     $$ = 0;
   }
@@ -1562,14 +1739,16 @@
 // ValueRef - A reference to a definition... either constant or symbolic
 ValueRef 
   : SymbolicValueRef {
-    $$.val = $1;
-    $$.constant = false;
-    $$.type = 0;
+    $$ = new ValueInfo;
+    $$->val = $1;
+    $$->constant = false;
+    $$->type = 0;
   }
   | ConstValueRef {
-    $$.val = $1;
-    $$.constant = true;
-    $$.type = 0;
+    $$ = new ValueInfo;
+    $$->val = $1;
+    $$->constant = true;
+    $$->type = 0;
   }
   ;
 
@@ -1578,11 +1757,11 @@
 // pool references (for things like: 'ret [2 x int] [ int 12, int 42]')
 ResolvedVal : Types ValueRef {
     $1 = $1->resolve();
-    std::string Name = getUniqueName($2.val, $1);
+    std::string Name = getUniqueName($2->val, $1);
     $$ = $2;
-    delete $$.val;
-    $$.val = new std::string($1->getNewTy() + " " + Name);
-    $$.type = $1;
+    delete $$->val;
+    $$->val = new std::string($1->getNewTy() + " " + Name);
+    $$->type = $1;
   };
 
 BasicBlockList : BasicBlockList BasicBlock {
@@ -1617,8 +1796,8 @@
 Unwind : UNWIND | EXCEPT { $$ = $1; *$$ = "unwind"; }
 
 BBTerminatorInst : RET ResolvedVal {              // Return with a result...
-    *O << "    " << *$1 << ' ' << *$2.val << '\n';
-    delete $1; $2.destroy();
+    *O << "    " << *$1 << ' ' << *$2->val << '\n';
+    delete $1; delete $2;
     $$ = 0;
   }
   | RET VOID {                                       // Return with no result...
@@ -1627,31 +1806,35 @@
     $$ = 0;
   }
   | BR LABEL ValueRef {                         // Unconditional Branch...
-    *O << "    " << *$1 << ' ' << $2->getNewTy() << ' ' << *$3.val << '\n';
-    delete $1; $3.destroy();
+    *O << "    " << *$1 << ' ' << $2->getNewTy() << ' ' << *$3->val << '\n';
+    delete $1; delete $3;
     $$ = 0;
   }                                                  // Conditional Branch...
   | BR BOOL ValueRef ',' LABEL ValueRef ',' LABEL ValueRef {  
-    std::string Name = getUniqueName($3.val, $2);
+    std::string Name = getUniqueName($3->val, $2);
     *O << "    " << *$1 << ' ' << $2->getNewTy() << ' ' << Name << ", " 
-       << $5->getNewTy() << ' ' << *$6.val << ", " << $8->getNewTy() << ' ' 
-       << *$9.val << '\n';
-    delete $1; $3.destroy(); $6.destroy(); $9.destroy();
+       << $5->getNewTy() << ' ' << *$6->val << ", " << $8->getNewTy() << ' ' 
+       << *$9->val << '\n';
+    delete $1; delete $3; delete $6; delete $9;
     $$ = 0;
   }
   | SWITCH IntType ValueRef ',' LABEL ValueRef '[' JumpTable ']' {
-    std::string Name = getUniqueName($3.val, $2);
+    std::string Name = getUniqueName($3->val, $2);
     *O << "    " << *$1 << ' ' << $2->getNewTy() << ' ' << Name << ", " 
-       << $5->getNewTy() << ' ' << *$6.val << " [" << *$8 << " ]\n";
-    delete $1; $3.destroy(); $6.destroy(); 
+       << $5->getNewTy() << ' ' << *$6->val << " [" << *$8 << " ]\n";
+    delete $1; 
+    delete $3;
+    delete $6; 
     delete $8;
     $$ = 0;
   }
   | SWITCH IntType ValueRef ',' LABEL ValueRef '[' ']' {
-    std::string Name = getUniqueName($3.val, $2);
+    std::string Name = getUniqueName($3->val, $2);
     *O << "    " << *$1 << ' ' << $2->getNewTy() << ' ' << Name << ", " 
-       << $5->getNewTy() << ' ' << *$6.val << "[]\n";
-    delete $1; $3.destroy(); $6.destroy();
+       << $5->getNewTy() << ' ' << *$6->val << "[]\n";
+    delete $1; 
+    delete $3; 
+    delete $6;
     $$ = 0;
   }
   | OptAssign INVOKE OptCallingConv TypesV ValueRef '(' ValueRefListE ')'
@@ -1662,18 +1845,18 @@
       std::string Name = getUniqueName($1, ResTy);
       *O << Name << " = ";
     }
-    *O << *$2 << ' ' << *$3 << ' ' << $4->getNewTy() << ' ' << *$5.val << " (";
+    *O << *$2 << ' ' << *$3 << ' ' << $4->getNewTy() << ' ' << *$5->val << " (";
     for (unsigned i = 0; i < $7->size(); ++i) {
-      ValueInfo& VI = (*$7)[i];
-      *O << *VI.val;
+      ValueInfo* VI = (*$7)[i];
+      *O << *VI->val;
       if (i+1 < $7->size())
         *O << ", ";
-      VI.destroy();
+      delete VI;
     }
-    *O << ") " << *$9 << ' ' << $10->getNewTy() << ' ' << *$11.val << ' ' 
-       << *$12 << ' ' << $13->getNewTy() << ' ' << *$14.val << '\n';
-    delete $1; delete $2; delete $3; $5.destroy(); delete $7; 
-    delete $9; $11.destroy(); delete $12; $14.destroy(); 
+    *O << ") " << *$9 << ' ' << $10->getNewTy() << ' ' << *$11->val << ' ' 
+       << *$12 << ' ' << $13->getNewTy() << ' ' << *$14->val << '\n';
+    delete $1; delete $2; delete $3; delete $5; delete $7; 
+    delete $9; delete $11; delete $12; delete $14; 
     $$ = 0;
   }
   | Unwind {
@@ -1689,14 +1872,14 @@
 
 JumpTable : JumpTable IntType ConstValueRef ',' LABEL ValueRef {
     *$1 += " " + $2->getNewTy() + " " + *$3 + ", " + $5->getNewTy() + " " + 
-           *$6.val;
-    delete $3; $6.destroy();
+           *$6->val;
+    delete $3; delete $6;
     $$ = $1;
   }
   | IntType ConstValueRef ',' LABEL ValueRef {
     $2->insert(0, $1->getNewTy() + " " );
-    *$2 += ", " + $4->getNewTy() + " " + *$5.val;
-    $5.destroy();
+    *$2 += ", " + $4->getNewTy() + " " + *$5->val;
+    delete $5;
     $$ = $2;
   };
 
@@ -1704,7 +1887,7 @@
   : OptAssign InstVal {
     if (!$1->empty()) {
       // Get a unique name for this value, based on its type.
-      std::string Name = getUniqueName($1, $2.type);
+      std::string Name = getUniqueName($1, $2->type);
       *$1 = Name + " = ";
       if (deleteUselessCastFlag && *deleteUselessCastName == Name) {
         // don't actually delete it, just comment it out
@@ -1712,25 +1895,27 @@
         delete deleteUselessCastName;
       }
     }
-    *$1 += *$2.val;
-    $2.destroy();
+    *$1 += *$2->val;
+    delete $2;
     deleteUselessCastFlag = false;
     $$ = $1; 
   };
 
 PHIList 
   : Types '[' ValueRef ',' ValueRef ']' {    // Used for PHI nodes
-    std::string Name = getUniqueName($3.val, $1);
+    std::string Name = getUniqueName($3->val, $1);
     Name.insert(0, $1->getNewTy() + "[");
-    Name += "," + *$5.val + "]";
-    $$.val = new std::string(Name);
-    $$.type = $1;
-    $3.destroy(); $5.destroy();
+    Name += "," + *$5->val + "]";
+    $$ = new ValueInfo;
+    $$->val = new std::string(Name);
+    $$->type = $1;
+    delete $3; delete $5;
   }
   | PHIList ',' '[' ValueRef ',' ValueRef ']' {
-    std::string Name = getUniqueName($4.val, $1.type);
-    *$1.val += ", [" + Name + "," + *$6.val + "]";
-    $4.destroy(); $6.destroy();
+    std::string Name = getUniqueName($4->val, $1->type);
+    *$1->val += ", [" + Name + "," + *$6->val + "]";
+    delete $4; 
+    delete $6;
     $$ = $1;
   };
 
@@ -1762,65 +1947,79 @@
 
 InstVal : ArithmeticOps Types ValueRef ',' ValueRef {
     const char* op = getDivRemOpcode(*$1, $2); 
-    std::string Name1 = getUniqueName($3.val, $2);
-    std::string Name2 = getUniqueName($5.val, $2);
-    $$.val = new std::string(op);
-    *$$.val += " " + $2->getNewTy() + " " + Name1 + ", " + Name2;
-    $$.type = $2;
-    delete $1; $3.destroy(); $5.destroy();
+    std::string Name1 = getUniqueName($3->val, $2);
+    std::string Name2 = getUniqueName($5->val, $2);
+    $$ = $3;
+    delete $$->val;
+    $$->val = new std::string(op);
+    *$$->val += " " + $2->getNewTy() + " " + Name1 + ", " + Name2;
+    $$->type = $2;
+    delete $1; delete $5;
   }
   | LogicalOps Types ValueRef ',' ValueRef {
-    std::string Name1 = getUniqueName($3.val, $2);
-    std::string Name2 = getUniqueName($5.val, $2);
+    std::string Name1 = getUniqueName($3->val, $2);
+    std::string Name2 = getUniqueName($5->val, $2);
     *$1 += " " + $2->getNewTy() + " " + Name1 + ", " + Name2;
-    $$.val = $1;
-    $$.type = $2;
-    $3.destroy(); $5.destroy();
+    $$ = $3;
+    delete $$->val;
+    $$->val = $1;
+    $$->type = $2;
+    delete $5;
   }
   | SetCondOps Types ValueRef ',' ValueRef {
-    std::string Name1 = getUniqueName($3.val, $2);
-    std::string Name2 = getUniqueName($5.val, $2);
+    std::string Name1 = getUniqueName($3->val, $2);
+    std::string Name2 = getUniqueName($5->val, $2);
     *$1 = getCompareOp(*$1, $2);
     *$1 += " " + $2->getNewTy() + " " + Name1 + ", " + Name2;
-    $$.val = $1;
-    $$.type = TypeInfo::get("i1",BoolTy);
-    $3.destroy(); $5.destroy();
+    $$ = $3;
+    delete $$->val;
+    $$->val = $1;
+    $$->type = TypeInfo::get("i1",BoolTy);
+    delete $5;
   }
   | ICMP IPredicates Types ValueRef ',' ValueRef {
-    std::string Name1 = getUniqueName($4.val, $3);
-    std::string Name2 = getUniqueName($6.val, $3);
+    std::string Name1 = getUniqueName($4->val, $3);
+    std::string Name2 = getUniqueName($6->val, $3);
     *$1 += " " + *$2 + " " + $3->getNewTy() + " " + Name1 + "," + Name2;
-    $$.val = $1;
-    $$.type = TypeInfo::get("i1",BoolTy);
-    delete $2; $4.destroy(); $6.destroy();
+    $$ = $4;
+    delete $$->val;
+    $$->val = $1;
+    $$->type = TypeInfo::get("i1",BoolTy);
+    delete $2; delete $6;
   }
   | FCMP FPredicates Types ValueRef ',' ValueRef {
-    std::string Name1 = getUniqueName($4.val, $3);
-    std::string Name2 = getUniqueName($6.val, $3);
+    std::string Name1 = getUniqueName($4->val, $3);
+    std::string Name2 = getUniqueName($6->val, $3);
     *$1 += " " + *$2 + " " + $3->getNewTy() + " " + Name1 + "," + Name2;
-    $$.val = $1;
-    $$.type = TypeInfo::get("i1",BoolTy);
-    delete $2; $4.destroy(); $6.destroy();
+    $$ = $4;
+    delete $$->val;
+    $$->val = $1;
+    $$->type = TypeInfo::get("i1",BoolTy);
+    delete $2; delete $6;
   }
   | ShiftOps ResolvedVal ',' ResolvedVal {
     const char* shiftop = $1->c_str();
     if (*$1 == "shr")
-      shiftop = ($2.type->isUnsigned()) ? "lshr" : "ashr";
-    $$.val = new std::string(shiftop);
-    *$$.val += " " + *$2.val + ", " + *$4.val;
-    $$.type = $2.type;
-    delete $1; $2.destroy(); $4.destroy();
+      shiftop = ($2->type->isUnsigned()) ? "lshr" : "ashr";
+    std::string *val = new std::string(shiftop);
+    *val += " " + *$2->val + ", " + *$4->val;
+    $$ = $2;
+    delete $$->val;
+    $$->val = val;
+    delete $1; delete $4;
   }
   | CastOps ResolvedVal TO Types {
-    std::string source = *$2.val;
-    const TypeInfo* SrcTy = $2.type->resolve();
+    std::string source = *$2->val;
+    const TypeInfo* SrcTy = $2->type->resolve();
     const TypeInfo* DstTy = $4->resolve();
-    $$.val = new std::string();
-    $$.type = DstTy;
+    $$ = $2;
+    delete $$->val;
+    $$->val = new std::string();
+    $$->type = DstTy;
     if (*$1 == "cast") {
-      *$$.val += getCastUpgrade(source, SrcTy, DstTy, false);
+      *$$->val += getCastUpgrade(source, SrcTy, DstTy, false);
     } else {
-      *$$.val += *$1 + " " + source + " to " + DstTy->getNewTy();
+      *$$->val += *$1 + " " + source + " to " + DstTy->getNewTy();
     }
     // Check to see if this is a useless cast of a value to the same name
     // and the same type. Such casts will probably cause redefinition errors
@@ -1829,101 +2028,111 @@
       if (SrcTy->isInteger() && DstTy->isInteger() &&
           SrcTy->getBitWidth() == DstTy->getBitWidth()) {
         deleteUselessCastFlag = true; // Flag the "Inst" rule
-        deleteUselessCastName = new std::string(*$2.val); // save the name
+        deleteUselessCastName = new std::string(*$2->val); // save the name
         size_t pos = deleteUselessCastName->find_first_of("%\"",0);
         if (pos != std::string::npos) {
           // remove the type portion before val
           deleteUselessCastName->erase(0, pos);
         }
       }
-    delete $1; $2.destroy();
+    delete $1; 
     delete $3;
   }
   | SELECT ResolvedVal ',' ResolvedVal ',' ResolvedVal {
-    *$1 += " " + *$2.val + ", " + *$4.val + ", " + *$6.val;
-    $$.val = $1;
-    $$.type = $4.type;
-    $2.destroy(); $4.destroy(); $6.destroy();
+    *$1 += " " + *$2->val + ", " + *$4->val + ", " + *$6->val;
+    $$ = $2;
+    delete $$->val;
+    $$->val = $1;
+    $$->type = $4->type;
+    delete $4;
+    delete $6;
   }
   | VAARG ResolvedVal ',' Types {
-    *$1 += " " + *$2.val + ", " + $4->getNewTy();
-    $$.val = $1;
-    $$.type = $4;
-    $2.destroy();
+    *$1 += " " + *$2->val + ", " + $4->getNewTy();
+    $$ = $2;
+    delete $$->val;
+    $$->val = $1;
+    $$->type = $4;
   }
   | EXTRACTELEMENT ResolvedVal ',' ResolvedVal {
-    *$1 += " " + *$2.val + ", " + *$4.val;
-    $$.val = $1;
-    $2.type = $2.type->resolve();;
-    $$.type = $2.type->getElementType();
-    $2.destroy(); $4.destroy();
+    *$1 += " " + *$2->val + ", " + *$4->val;
+    $$ = $2;
+    delete $$->val;
+    $$->val = $1;
+    $$->type = $$->type->resolve();
+    $$->type = $$->type->getElementType();
+    delete $4;
   }
   | INSERTELEMENT ResolvedVal ',' ResolvedVal ',' ResolvedVal {
-    *$1 += " " + *$2.val + ", " + *$4.val + ", " + *$6.val;
-    $$.val = $1;
-    $$.type = $2.type;
-    $2.destroy(); $4.destroy(); $6.destroy();
+    *$1 += " " + *$2->val + ", " + *$4->val + ", " + *$6->val;
+    $$ = $2;
+    delete $$->val;
+    $$->val = $1;
+    delete $4; delete $6;
   }
   | SHUFFLEVECTOR ResolvedVal ',' ResolvedVal ',' ResolvedVal {
-    *$1 += " " + *$2.val + ", " + *$4.val + ", " + *$6.val;
-    $$.val = $1;
-    $$.type = $2.type;
-    $2.destroy(); $4.destroy(); $6.destroy();
+    *$1 += " " + *$2->val + ", " + *$4->val + ", " + *$6->val;
+    $$ = $2;
+    delete $$->val;
+    $$->val = $1;
+    delete $4; delete $6;
   }
   | PHI_TOK PHIList {
-    *$1 += " " + *$2.val;
-    $$.val = $1;
-    $$.type = $2.type;
-    delete $2.val;
+    *$1 += " " + *$2->val;
+    $$ = $2;
+    delete $2->val;
+    $$->val = $1;
   }
   | OptTailCall OptCallingConv TypesV ValueRef '(' ValueRefListE ')'  {
     // map llvm.isunordered to "fcmp uno" 
-    if (*$4.val == "%llvm.isunordered.f32" ||
-        *$4.val == "%llvm.isunordered.f64") {
-      $$.val = new std::string( "fcmp uno " + *(*$6)[0].val + ", ");
-      size_t pos = (*$6)[1].val->find(' ');
+    $$ = new ValueInfo;
+    if (*$4->val == "%llvm.isunordered.f32" ||
+        *$4->val == "%llvm.isunordered.f64") {
+      $$->val = new std::string( "fcmp uno " + *(*$6)[0]->val + ", ");
+      size_t pos = (*$6)[1]->val->find(' ');
       assert(pos != std::string::npos && "no space?");
-      *$$.val += (*$6)[1].val->substr(pos+1);
-      $$.type = TypeInfo::get("i1", BoolTy);
+      *$$->val += (*$6)[1]->val->substr(pos+1);
+      $$->type = TypeInfo::get("i1", BoolTy);
     } else {
       static unsigned upgradeCount = 1;
-      if (*$4.val == "%llvm.va_start" || *$4.val == "%llvm.va_end") {
+      if (*$4->val == "%llvm.va_start" || *$4->val == "%llvm.va_end") {
         if (!$6->empty()) {
           std::string name("%va_upgrade");
           name += llvm::utostr(upgradeCount++);
-          $1->insert(0, name + " = bitcast " + *(*$6)[0].val + " to i8*\n    ");
-          *(*$6)[0].val = "i8* " + name;
-          (*$6)[0].type = TypeInfo::get("i8", UByteTy)->getPointerType();
+          $1->insert(0, name + " = bitcast " + *(*$6)[0]->val + " to i8*\n    ");
+          *(*$6)[0]->val = "i8* " + name;
+          (*$6)[0]->type = TypeInfo::get("i8", UByteTy)->getPointerType();
         }
-      } else if (*$4.val == "%llvm.va_copy") {
+      } else if (*$4->val == "%llvm.va_copy") {
         std::string name0("%va_upgrade");
         name0 += llvm::utostr(upgradeCount++);
         std::string name1("%va_upgrade");
         name1 += llvm::utostr(upgradeCount++);
-        $1->insert(0, name0 + " = bitcast " + *(*$6)[0].val + " to i8*\n    " +
-                      name1 + " = bitcast " + *(*$6)[1].val + " to i8*\n    ");
-        *(*$6)[0].val = "i8* " + name0;
-        (*$6)[0].type = TypeInfo::get("i8", UByteTy)->getPointerType();
-        *(*$6)[1].val = "i8* " + name1;
-        (*$6)[0].type = TypeInfo::get("i8", UByteTy)->getPointerType();
+        $1->insert(0, name0 + " = bitcast " + *(*$6)[0]->val + " to i8*\n    " +
+                      name1 + " = bitcast " + *(*$6)[1]->val + " to i8*\n    ");
+        *(*$6)[0]->val = "i8* " + name0;
+        (*$6)[0]->type = TypeInfo::get("i8", UByteTy)->getPointerType();
+        *(*$6)[1]->val = "i8* " + name1;
+        (*$6)[0]->type = TypeInfo::get("i8", UByteTy)->getPointerType();
       }
       if (!$2->empty())
         *$1 += " " + *$2;
       if (!$1->empty())
         *$1 += " ";
-      *$1 += $3->getNewTy() + " " + *$4.val + "(";
+      *$1 += $3->getNewTy() + " " + *$4->val + "(";
       for (unsigned i = 0; i < $6->size(); ++i) {
-        ValueInfo& VI = (*$6)[i];
-        *$1 += *VI.val;
+        ValueInfo* VI = (*$6)[i];
+        *$1 += *VI->val;
         if (i+1 < $6->size())
           *$1 += ", ";
-        VI.destroy();
+        delete VI;
       }
       *$1 += ")";
-      $$.val = $1;
-      $$.type = getFunctionReturnType($3);
+      $$ = new ValueInfo;
+      $$->val = $1;
+      $$->type = getFunctionReturnType($3);
     }
-    delete $2; $4.destroy(); delete $6;
+    delete $2; delete $4; delete $6;
   }
   | MemoryInst ;
 
@@ -1943,81 +2152,95 @@
     *$1 += " " + $2->getNewTy();
     if (!$3->empty())
       *$1 += " " + *$3;
-    $$.val = $1;
-    $$.type = $2->getPointerType();
+    $$ = new ValueInfo;
+    $$->val = $1;
+    $$->type = $2->getPointerType();
     delete $3;
   }
   | MALLOC Types ',' UINT ValueRef OptCAlign {
-    std::string Name = getUniqueName($5.val, $4);
+    std::string Name = getUniqueName($5->val, $4);
     *$1 += " " + $2->getNewTy() + ", " + $4->getNewTy() + " " + Name;
     if (!$6->empty())
       *$1 += " " + *$6;
-    $$.val = $1;
-    $$.type = $2->getPointerType();
-    $5.destroy(); delete $6;
+    $$ = new ValueInfo;
+    $$->val = $1;
+    $$->type = $2->getPointerType();
+    delete $5; delete $6;
   }
   | ALLOCA Types OptCAlign {
     *$1 += " " + $2->getNewTy();
     if (!$3->empty())
       *$1 += " " + *$3;
-    $$.val = $1;
-    $$.type = $2->getPointerType();
+    $$ = new ValueInfo;
+    $$->val = $1;
+    $$->type = $2->getPointerType();
     delete $3;
   }
   | ALLOCA Types ',' UINT ValueRef OptCAlign {
-    std::string Name = getUniqueName($5.val, $4);
+    std::string Name = getUniqueName($5->val, $4);
     *$1 += " " + $2->getNewTy() + ", " + $4->getNewTy() + " " + Name;
     if (!$6->empty())
       *$1 += " " + *$6;
-    $$.val = $1;
-    $$.type = $2->getPointerType();
-    $5.destroy(); delete $6;
+    $$ = $5;
+    delete $$->val;
+    $$->val = $1;
+    $$->type = $2->getPointerType();
+    delete $6;
   }
   | FREE ResolvedVal {
-    *$1 += " " + *$2.val;
-    $$.val = $1;
-    $$.type = TypeInfo::get("void", VoidTy); 
-    $2.destroy();
+    *$1 += " " + *$2->val;
+    $$ = $2;
+    delete $2->val;
+    $$->val = $1;
+    $$->type = TypeInfo::get("void", VoidTy); 
   }
   | OptVolatile LOAD Types ValueRef {
-    std::string Name = getUniqueName($4.val, $3);
+    std::string Name = getUniqueName($4->val, $3);
     if (!$1->empty())
       *$1 += " ";
     *$1 += *$2 + " " + $3->getNewTy() + " " + Name;
-    $$.val = $1;
-    $$.type = $3->getElementType();
-    delete $2; $4.destroy();
+    $$ = $4;
+    delete $$->val;
+    $$->val = $1;
+    $$->type = $3->getElementType();
+    delete $2;
   }
   | OptVolatile STORE ResolvedVal ',' Types ValueRef {
-    std::string Name = getUniqueName($6.val, $5);
+    std::string Name = getUniqueName($6->val, $5);
     if (!$1->empty())
       *$1 += " ";
-    *$1 += *$2 + " " + *$3.val + ", " + $5->getNewTy() + " " + Name;
-    $$.val = $1;
-    $$.type = TypeInfo::get("void", VoidTy);
-    delete $2; $3.destroy(); $6.destroy();
+    *$1 += *$2 + " " + *$3->val + ", " + $5->getNewTy() + " " + Name;
+    $$ = $3;
+    delete $$->val;
+    $$->val = $1;
+    $$->type = TypeInfo::get("void", VoidTy);
+    delete $2; delete $6;
   }
   | GETELEMENTPTR Types ValueRef IndexList {
-    std::string Name = getUniqueName($3.val, $2);
+    std::string Name = getUniqueName($3->val, $2);
     // Upgrade the indices
     for (unsigned i = 0; i < $4->size(); ++i) {
-      ValueInfo& VI = (*$4)[i];
-      if (VI.type->isUnsigned() && !VI.isConstant() && 
-          VI.type->getBitWidth() < 64) {
-        *O << "    %gep_upgrade" << unique << " = zext " << *VI.val 
+      ValueInfo* VI = (*$4)[i];
+      if (VI->type->isUnsigned() && !VI->isConstant() && 
+          VI->type->getBitWidth() < 64) {
+        *O << "    %gep_upgrade" << UniqueNameCounter << " = zext " << *VI->val 
            << " to i64\n";
-        *VI.val = "i64 %gep_upgrade" + llvm::utostr(unique++);
-        VI.type = TypeInfo::get("i64",ULongTy);
+        *VI->val = "i64 %gep_upgrade" + llvm::utostr(UniqueNameCounter++);
+        VI->type = TypeInfo::get("i64",ULongTy);
       }
     }
     *$1 += " " + $2->getNewTy() + " " + Name;
     for (unsigned i = 0; i < $4->size(); ++i) {
-      ValueInfo& VI = (*$4)[i];
-      *$1 += ", " + *VI.val;
+      ValueInfo* VI = (*$4)[i];
+      *$1 += ", " + *VI->val;
     }
-    $$.val = $1;
-    $$.type = getGEPIndexedType($2,$4); 
-    $3.destroy(); delete $4;
+    $$ = $3;
+    delete $$->val;
+    $$->val = $1;
+    $$->type = getGEPIndexedType($2,$4); 
+    for (unsigned i = 0; i < $4->size(); ++i)
+      delete (*$4)[i];
+    delete $4;
   };
 
 %%
@@ -2037,7 +2260,7 @@
   exit(1);
 }
 
-static void warning(const std::string& ErrorMsg) {
+void warning(const std::string& ErrorMsg) {
   std::string where 
     = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
                   + ":" + llvm::utostr((unsigned) Upgradelineno) + ": ";






More information about the llvm-commits mailing list