[llvm-commits] CVS: llvm/tools/llvm-upgrade/UpgradeLexer.cpp UpgradeLexer.cpp.cvs UpgradeLexer.l.cvs UpgradeParser.cpp UpgradeParser.cpp.cvs UpgradeParser.h UpgradeParser.h.cvs UpgradeParser.y.cvs
Reid Spencer
reid at x10sys.com
Mon Jan 1 21:45:26 PST 2007
Changes in directory llvm/tools/llvm-upgrade:
UpgradeLexer.cpp updated: 1.12 -> 1.13
UpgradeLexer.cpp.cvs updated: 1.11 -> 1.12
UpgradeLexer.l.cvs updated: 1.11 -> 1.12
UpgradeParser.cpp updated: 1.30 -> 1.31
UpgradeParser.cpp.cvs updated: 1.28 -> 1.29
UpgradeParser.h updated: 1.23 -> 1.24
UpgradeParser.h.cvs updated: 1.21 -> 1.22
UpgradeParser.y.cvs updated: 1.27 -> 1.28
---
Log message:
Regenerate.
---
Diffs of the changes: (+1969 -1576)
UpgradeLexer.cpp | 332 +++++++--------
UpgradeLexer.cpp.cvs | 332 +++++++--------
UpgradeLexer.l.cvs | 4
UpgradeParser.cpp | 1082 ++++++++++++++++++++++++++++----------------------
UpgradeParser.cpp.cvs | 1082 ++++++++++++++++++++++++++++----------------------
UpgradeParser.h | 7
UpgradeParser.h.cvs | 7
UpgradeParser.y.cvs | 699 +++++++++++++++++++-------------
8 files changed, 1969 insertions(+), 1576 deletions(-)
Index: llvm/tools/llvm-upgrade/UpgradeLexer.cpp
diff -u llvm/tools/llvm-upgrade/UpgradeLexer.cpp:1.12 llvm/tools/llvm-upgrade/UpgradeLexer.cpp:1.13
--- llvm/tools/llvm-upgrade/UpgradeLexer.cpp:1.12 Sun Dec 31 00:02:26 2006
+++ llvm/tools/llvm-upgrade/UpgradeLexer.cpp Mon Jan 1 23:45:11 2007
@@ -20,7 +20,7 @@
/* A lexical scanner generated by flex*/
/* Scanner skeleton version:
- * $Header: /var/cvs/llvm/llvm/tools/llvm-upgrade/UpgradeLexer.cpp,v 1.12 2006/12/31 06:02:26 reid Exp $
+ * $Header: /var/cvs/llvm/llvm/tools/llvm-upgrade/UpgradeLexer.cpp,v 1.13 2007/01/02 05:45:11 reid Exp $
*/
#define FLEX_SCANNER
@@ -962,9 +962,7 @@
return sym
#define RET_TY(sym,OldTY,NewTY,sign) \
- Upgradelval.Type.newTy = new std::string(NewTY); \
- Upgradelval.Type.oldTy = OldTY; \
- Upgradelval.Type.elemTy = VoidTy; \
+ Upgradelval.Type = new TypeInfo(NewTY, OldTY); \
return sym
#define YY_NEVER_INTERACTIVE 1
@@ -984,7 +982,7 @@
/* HexIntConstant - Hexadecimal constant generated by the CFE to avoid forcing
* it to deal with 64 bit numbers.
*/
-#line 988 "UpgradeLexer.cpp"
+#line 986 "UpgradeLexer.cpp"
/* Macros after this point can all be overridden by user definitions in
* section 1.
@@ -1135,10 +1133,10 @@
register char *yy_cp = NULL, *yy_bp = NULL;
register int yy_act;
-#line 99 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 97 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
-#line 1142 "UpgradeLexer.cpp"
+#line 1140 "UpgradeLexer.cpp"
if ( yy_init )
{
@@ -1231,776 +1229,776 @@
{ /* beginning of action switch */
case 1:
YY_RULE_SETUP
-#line 101 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 99 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ /* Ignore comments for now */ }
YY_BREAK
case 2:
YY_RULE_SETUP
-#line 103 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 101 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( BEGINTOK); }
YY_BREAK
case 3:
YY_RULE_SETUP
-#line 104 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 102 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( ENDTOK); }
YY_BREAK
case 4:
YY_RULE_SETUP
-#line 105 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 103 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( TRUETOK); }
YY_BREAK
case 5:
YY_RULE_SETUP
-#line 106 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 104 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( FALSETOK); }
YY_BREAK
case 6:
YY_RULE_SETUP
-#line 107 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 105 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( DECLARE); }
YY_BREAK
case 7:
YY_RULE_SETUP
-#line 108 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 106 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( GLOBAL); }
YY_BREAK
case 8:
YY_RULE_SETUP
-#line 109 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 107 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( CONSTANT); }
YY_BREAK
case 9:
YY_RULE_SETUP
-#line 110 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 108 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( INTERNAL); }
YY_BREAK
case 10:
YY_RULE_SETUP
-#line 111 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 109 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( LINKONCE); }
YY_BREAK
case 11:
YY_RULE_SETUP
-#line 112 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 110 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( WEAK); }
YY_BREAK
case 12:
YY_RULE_SETUP
-#line 113 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 111 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( APPENDING); }
YY_BREAK
case 13:
YY_RULE_SETUP
-#line 114 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 112 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( DLLIMPORT); }
YY_BREAK
case 14:
YY_RULE_SETUP
-#line 115 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 113 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( DLLEXPORT); }
YY_BREAK
case 15:
YY_RULE_SETUP
-#line 116 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 114 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( EXTERN_WEAK); }
YY_BREAK
case 16:
YY_RULE_SETUP
-#line 117 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 115 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( EXTERNAL); }
YY_BREAK
case 17:
YY_RULE_SETUP
-#line 118 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 116 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( UNINITIALIZED); } // alias for external
YY_BREAK
case 18:
YY_RULE_SETUP
-#line 119 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 117 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( IMPLEMENTATION); }
YY_BREAK
case 19:
YY_RULE_SETUP
-#line 120 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 118 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( ZEROINITIALIZER); }
YY_BREAK
case 20:
YY_RULE_SETUP
-#line 121 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 119 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( DOTDOTDOT); }
YY_BREAK
case 21:
YY_RULE_SETUP
-#line 122 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 120 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( UNDEF); }
YY_BREAK
case 22:
YY_RULE_SETUP
-#line 123 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 121 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( NULL_TOK); }
YY_BREAK
case 23:
YY_RULE_SETUP
-#line 124 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 122 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( TO); }
YY_BREAK
case 24:
YY_RULE_SETUP
-#line 125 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 123 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( TAIL); }
YY_BREAK
case 25:
YY_RULE_SETUP
-#line 126 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 124 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( TARGET); }
YY_BREAK
case 26:
YY_RULE_SETUP
-#line 127 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 125 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( TRIPLE); }
YY_BREAK
case 27:
YY_RULE_SETUP
-#line 128 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 126 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( DEPLIBS); }
YY_BREAK
case 28:
YY_RULE_SETUP
-#line 129 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 127 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( ENDIAN); }
YY_BREAK
case 29:
YY_RULE_SETUP
-#line 130 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 128 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( POINTERSIZE); }
YY_BREAK
case 30:
YY_RULE_SETUP
-#line 131 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 129 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( DATALAYOUT); }
YY_BREAK
case 31:
YY_RULE_SETUP
-#line 132 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 130 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( LITTLE); }
YY_BREAK
case 32:
YY_RULE_SETUP
-#line 133 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 131 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( BIG); }
YY_BREAK
case 33:
YY_RULE_SETUP
-#line 134 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 132 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( VOLATILE); }
YY_BREAK
case 34:
YY_RULE_SETUP
-#line 135 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 133 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( ALIGN); }
YY_BREAK
case 35:
YY_RULE_SETUP
-#line 136 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 134 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( SECTION); }
YY_BREAK
case 36:
YY_RULE_SETUP
-#line 137 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 135 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( MODULE); }
YY_BREAK
case 37:
YY_RULE_SETUP
-#line 138 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 136 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( ASM_TOK); }
YY_BREAK
case 38:
YY_RULE_SETUP
-#line 139 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 137 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( SIDEEFFECT); }
YY_BREAK
case 39:
YY_RULE_SETUP
-#line 141 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 139 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( CC_TOK); }
YY_BREAK
case 40:
YY_RULE_SETUP
-#line 142 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 140 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( CCC_TOK); }
YY_BREAK
case 41:
YY_RULE_SETUP
-#line 143 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 141 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( CSRETCC_TOK); }
YY_BREAK
case 42:
YY_RULE_SETUP
-#line 144 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 142 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( FASTCC_TOK); }
YY_BREAK
case 43:
YY_RULE_SETUP
-#line 145 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 143 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( COLDCC_TOK); }
YY_BREAK
case 44:
YY_RULE_SETUP
-#line 146 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 144 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( X86_STDCALLCC_TOK); }
YY_BREAK
case 45:
YY_RULE_SETUP
-#line 147 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 145 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( X86_FASTCALLCC_TOK); }
YY_BREAK
case 46:
YY_RULE_SETUP
-#line 149 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 147 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TY(VOID,VoidTy,"void",false); }
YY_BREAK
case 47:
YY_RULE_SETUP
-#line 150 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 148 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TY(BOOL,BoolTy,"bool",false); }
YY_BREAK
case 48:
YY_RULE_SETUP
-#line 151 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 149 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TY(SBYTE,SByteTy,"i8",true); }
YY_BREAK
case 49:
YY_RULE_SETUP
-#line 152 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 150 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TY(UBYTE,UByteTy,"i8",false); }
YY_BREAK
case 50:
YY_RULE_SETUP
-#line 153 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 151 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TY(SHORT,ShortTy,"i16",true); }
YY_BREAK
case 51:
YY_RULE_SETUP
-#line 154 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 152 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TY(USHORT,UShortTy,"i16",false); }
YY_BREAK
case 52:
YY_RULE_SETUP
-#line 155 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 153 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TY(INT,IntTy,"i32",true); }
YY_BREAK
case 53:
YY_RULE_SETUP
-#line 156 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 154 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TY(UINT,UIntTy,"i32",false); }
YY_BREAK
case 54:
YY_RULE_SETUP
-#line 157 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 155 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TY(LONG,LongTy,"i64",true); }
YY_BREAK
case 55:
YY_RULE_SETUP
-#line 158 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 156 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TY(ULONG,ULongTy,"i64",false); }
YY_BREAK
case 56:
YY_RULE_SETUP
-#line 159 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 157 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TY(UBYTE,UByteTy,"i8",false); }
YY_BREAK
case 57:
YY_RULE_SETUP
-#line 160 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 158 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TY(USHORT,UShortTy,"i16",false); }
YY_BREAK
case 58:
YY_RULE_SETUP
-#line 161 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 159 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TY(UINT,UIntTy,"i32",false); }
YY_BREAK
case 59:
YY_RULE_SETUP
-#line 162 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 160 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TY(ULONG,ULongTy,"i64",false); }
YY_BREAK
case 60:
YY_RULE_SETUP
-#line 163 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 161 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TY(FLOAT,FloatTy,"float",false); }
YY_BREAK
case 61:
YY_RULE_SETUP
-#line 164 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 162 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TY(DOUBLE,DoubleTy,"double",false); }
YY_BREAK
case 62:
YY_RULE_SETUP
-#line 165 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 163 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TY(LABEL,LabelTy,"label",false); }
YY_BREAK
case 63:
YY_RULE_SETUP
-#line 166 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 164 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK(OPAQUE); }
YY_BREAK
case 64:
YY_RULE_SETUP
-#line 167 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 165 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK(TYPE); }
YY_BREAK
case 65:
YY_RULE_SETUP
-#line 169 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 167 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( ADD); }
YY_BREAK
case 66:
YY_RULE_SETUP
-#line 170 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 168 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( SUB); }
YY_BREAK
case 67:
YY_RULE_SETUP
-#line 171 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 169 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( MUL); }
YY_BREAK
case 68:
YY_RULE_SETUP
-#line 172 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 170 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( DIV); }
YY_BREAK
case 69:
YY_RULE_SETUP
-#line 173 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 171 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( UDIV); }
YY_BREAK
case 70:
YY_RULE_SETUP
-#line 174 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 172 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( SDIV); }
YY_BREAK
case 71:
YY_RULE_SETUP
-#line 175 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 173 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( FDIV); }
YY_BREAK
case 72:
YY_RULE_SETUP
-#line 176 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 174 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( REM); }
YY_BREAK
case 73:
YY_RULE_SETUP
-#line 177 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 175 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( UREM); }
YY_BREAK
case 74:
YY_RULE_SETUP
-#line 178 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 176 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( SREM); }
YY_BREAK
case 75:
YY_RULE_SETUP
-#line 179 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 177 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( FREM); }
YY_BREAK
case 76:
YY_RULE_SETUP
-#line 180 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 178 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( AND); }
YY_BREAK
case 77:
YY_RULE_SETUP
-#line 181 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 179 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( OR); }
YY_BREAK
case 78:
YY_RULE_SETUP
-#line 182 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 180 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( XOR); }
YY_BREAK
case 79:
YY_RULE_SETUP
-#line 183 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 181 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( SETNE); }
YY_BREAK
case 80:
YY_RULE_SETUP
-#line 184 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 182 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( SETEQ); }
YY_BREAK
case 81:
YY_RULE_SETUP
-#line 185 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 183 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( SETLT); }
YY_BREAK
case 82:
YY_RULE_SETUP
-#line 186 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 184 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( SETGT); }
YY_BREAK
case 83:
YY_RULE_SETUP
-#line 187 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 185 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( SETLE); }
YY_BREAK
case 84:
YY_RULE_SETUP
-#line 188 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 186 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( SETGE); }
YY_BREAK
case 85:
YY_RULE_SETUP
-#line 189 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 187 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK(ICMP); }
YY_BREAK
case 86:
YY_RULE_SETUP
-#line 190 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 188 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK(FCMP); }
YY_BREAK
case 87:
YY_RULE_SETUP
-#line 191 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 189 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK(EQ); }
YY_BREAK
case 88:
YY_RULE_SETUP
-#line 192 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 190 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK(NE); }
YY_BREAK
case 89:
YY_RULE_SETUP
-#line 193 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 191 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK(SLT); }
YY_BREAK
case 90:
YY_RULE_SETUP
-#line 194 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 192 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK(SGT); }
YY_BREAK
case 91:
YY_RULE_SETUP
-#line 195 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 193 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK(SLE); }
YY_BREAK
case 92:
YY_RULE_SETUP
-#line 196 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 194 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK(SGE); }
YY_BREAK
case 93:
YY_RULE_SETUP
-#line 197 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 195 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK(OEQ); }
YY_BREAK
case 94:
YY_RULE_SETUP
-#line 198 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 196 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK(ONE); }
YY_BREAK
case 95:
YY_RULE_SETUP
-#line 199 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 197 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK(OLT); }
YY_BREAK
case 96:
YY_RULE_SETUP
-#line 200 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 198 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK(OGT); }
YY_BREAK
case 97:
YY_RULE_SETUP
-#line 201 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 199 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK(OLE); }
YY_BREAK
case 98:
YY_RULE_SETUP
-#line 202 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 200 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK(OGE); }
YY_BREAK
case 99:
YY_RULE_SETUP
-#line 203 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 201 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK(ORD); }
YY_BREAK
case 100:
YY_RULE_SETUP
-#line 204 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 202 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK(UNO); }
YY_BREAK
case 101:
YY_RULE_SETUP
-#line 205 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 203 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK(UEQ); }
YY_BREAK
case 102:
YY_RULE_SETUP
-#line 206 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 204 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK(UNE); }
YY_BREAK
case 103:
YY_RULE_SETUP
-#line 207 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 205 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK(ULT); }
YY_BREAK
case 104:
YY_RULE_SETUP
-#line 208 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 206 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK(UGT); }
YY_BREAK
case 105:
YY_RULE_SETUP
-#line 209 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 207 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK(ULE); }
YY_BREAK
case 106:
YY_RULE_SETUP
-#line 210 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 208 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK(UGE); }
YY_BREAK
case 107:
YY_RULE_SETUP
-#line 212 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 210 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( PHI_TOK); }
YY_BREAK
case 108:
YY_RULE_SETUP
-#line 213 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 211 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( CALL); }
YY_BREAK
case 109:
YY_RULE_SETUP
-#line 214 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 212 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( CAST); }
YY_BREAK
case 110:
YY_RULE_SETUP
-#line 215 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 213 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( TRUNC); }
YY_BREAK
case 111:
YY_RULE_SETUP
-#line 216 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 214 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( ZEXT); }
YY_BREAK
case 112:
YY_RULE_SETUP
-#line 217 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 215 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( SEXT); }
YY_BREAK
case 113:
YY_RULE_SETUP
-#line 218 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 216 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( FPTRUNC); }
YY_BREAK
case 114:
YY_RULE_SETUP
-#line 219 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 217 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( FPEXT); }
YY_BREAK
case 115:
YY_RULE_SETUP
-#line 220 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 218 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( FPTOUI); }
YY_BREAK
case 116:
YY_RULE_SETUP
-#line 221 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 219 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( FPTOSI); }
YY_BREAK
case 117:
YY_RULE_SETUP
-#line 222 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 220 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( UITOFP); }
YY_BREAK
case 118:
YY_RULE_SETUP
-#line 223 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 221 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( SITOFP); }
YY_BREAK
case 119:
YY_RULE_SETUP
-#line 224 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 222 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( PTRTOINT); }
YY_BREAK
case 120:
YY_RULE_SETUP
-#line 225 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 223 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( INTTOPTR); }
YY_BREAK
case 121:
YY_RULE_SETUP
-#line 226 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 224 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( BITCAST); }
YY_BREAK
case 122:
YY_RULE_SETUP
-#line 227 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 225 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( SELECT); }
YY_BREAK
case 123:
YY_RULE_SETUP
-#line 228 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 226 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( SHL); }
YY_BREAK
case 124:
YY_RULE_SETUP
-#line 229 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 227 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( SHR); }
YY_BREAK
case 125:
YY_RULE_SETUP
-#line 230 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 228 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( ASHR); }
YY_BREAK
case 126:
YY_RULE_SETUP
-#line 231 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 229 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( LSHR); }
YY_BREAK
case 127:
YY_RULE_SETUP
-#line 232 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 230 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( VAARG); }
YY_BREAK
case 128:
YY_RULE_SETUP
-#line 233 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 231 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( RET); }
YY_BREAK
case 129:
YY_RULE_SETUP
-#line 234 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 232 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( BR); }
YY_BREAK
case 130:
YY_RULE_SETUP
-#line 235 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 233 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( SWITCH); }
YY_BREAK
case 131:
YY_RULE_SETUP
-#line 236 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 234 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( INVOKE); }
YY_BREAK
case 132:
YY_RULE_SETUP
-#line 237 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 235 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( UNWIND); }
YY_BREAK
case 133:
YY_RULE_SETUP
-#line 238 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 236 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( EXCEPT); } // alias for unwind
YY_BREAK
case 134:
YY_RULE_SETUP
-#line 239 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 237 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( UNREACHABLE); }
YY_BREAK
case 135:
YY_RULE_SETUP
-#line 241 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 239 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( MALLOC); }
YY_BREAK
case 136:
YY_RULE_SETUP
-#line 242 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 240 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( ALLOCA); }
YY_BREAK
case 137:
YY_RULE_SETUP
-#line 243 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 241 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( FREE); }
YY_BREAK
case 138:
YY_RULE_SETUP
-#line 244 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 242 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( LOAD); }
YY_BREAK
case 139:
YY_RULE_SETUP
-#line 245 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 243 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( STORE); }
YY_BREAK
case 140:
YY_RULE_SETUP
-#line 246 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 244 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( GETELEMENTPTR); }
YY_BREAK
case 141:
YY_RULE_SETUP
-#line 248 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 246 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( EXTRACTELEMENT); }
YY_BREAK
case 142:
YY_RULE_SETUP
-#line 249 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 247 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( INSERTELEMENT); }
YY_BREAK
case 143:
YY_RULE_SETUP
-#line 250 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 248 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( SHUFFLEVECTOR); }
YY_BREAK
case 144:
YY_RULE_SETUP
-#line 253 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 251 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( VAR_ID); }
YY_BREAK
case 145:
YY_RULE_SETUP
-#line 254 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 252 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( LABELSTR); }
YY_BREAK
case 146:
YY_RULE_SETUP
-#line 255 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 253 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( LABELSTR); }
YY_BREAK
case 147:
YY_RULE_SETUP
-#line 256 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 254 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( STRINGCONSTANT ); }
YY_BREAK
case 148:
YY_RULE_SETUP
-#line 257 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 255 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( EUINT64VAL ); }
YY_BREAK
case 149:
YY_RULE_SETUP
-#line 258 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 256 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( ESINT64VAL ); }
YY_BREAK
case 150:
YY_RULE_SETUP
-#line 259 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 257 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( yytext[0] == 's' ? ESINT64VAL : EUINT64VAL ); }
YY_BREAK
case 151:
YY_RULE_SETUP
-#line 260 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 258 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( UINTVAL); }
YY_BREAK
case 152:
YY_RULE_SETUP
-#line 261 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 259 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( SINTVAL); }
YY_BREAK
case 153:
YY_RULE_SETUP
-#line 262 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 260 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( FPVAL); }
YY_BREAK
case 154:
YY_RULE_SETUP
-#line 263 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 261 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( FPVAL); }
YY_BREAK
case YY_STATE_EOF(INITIAL):
-#line 264 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 262 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{
/* Make sure to free the internal buffers for flex when we are
* done reading our input!
@@ -2011,20 +2009,20 @@
YY_BREAK
case 155:
YY_RULE_SETUP
-#line 272 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 270 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ /* Ignore whitespace */ }
YY_BREAK
case 156:
YY_RULE_SETUP
-#line 273 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 271 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ return yytext[0]; }
YY_BREAK
case 157:
YY_RULE_SETUP
-#line 275 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 273 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
YY_FATAL_ERROR( "flex scanner jammed" );
YY_BREAK
-#line 2028 "UpgradeLexer.cpp"
+#line 2026 "UpgradeLexer.cpp"
case YY_END_OF_BUFFER:
{
@@ -2902,5 +2900,5 @@
return 0;
}
#endif
-#line 275 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 273 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
Index: llvm/tools/llvm-upgrade/UpgradeLexer.cpp.cvs
diff -u llvm/tools/llvm-upgrade/UpgradeLexer.cpp.cvs:1.11 llvm/tools/llvm-upgrade/UpgradeLexer.cpp.cvs:1.12
--- llvm/tools/llvm-upgrade/UpgradeLexer.cpp.cvs:1.11 Sun Dec 31 00:02:26 2006
+++ llvm/tools/llvm-upgrade/UpgradeLexer.cpp.cvs Mon Jan 1 23:45:11 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.11 2006/12/31 06:02:26 reid Exp $
+ * $Header: /var/cvs/llvm/llvm/tools/llvm-upgrade/UpgradeLexer.cpp.cvs,v 1.12 2007/01/02 05:45:11 reid Exp $
*/
#define FLEX_SCANNER
@@ -962,9 +962,7 @@
return sym
#define RET_TY(sym,OldTY,NewTY,sign) \
- Upgradelval.Type.newTy = new std::string(NewTY); \
- Upgradelval.Type.oldTy = OldTY; \
- Upgradelval.Type.elemTy = VoidTy; \
+ Upgradelval.Type = new TypeInfo(NewTY, OldTY); \
return sym
#define YY_NEVER_INTERACTIVE 1
@@ -984,7 +982,7 @@
/* HexIntConstant - Hexadecimal constant generated by the CFE to avoid forcing
* it to deal with 64 bit numbers.
*/
-#line 988 "UpgradeLexer.cpp"
+#line 986 "UpgradeLexer.cpp"
/* Macros after this point can all be overridden by user definitions in
* section 1.
@@ -1135,10 +1133,10 @@
register char *yy_cp = NULL, *yy_bp = NULL;
register int yy_act;
-#line 99 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 97 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
-#line 1142 "UpgradeLexer.cpp"
+#line 1140 "UpgradeLexer.cpp"
if ( yy_init )
{
@@ -1231,776 +1229,776 @@
{ /* beginning of action switch */
case 1:
YY_RULE_SETUP
-#line 101 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 99 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ /* Ignore comments for now */ }
YY_BREAK
case 2:
YY_RULE_SETUP
-#line 103 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 101 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( BEGINTOK); }
YY_BREAK
case 3:
YY_RULE_SETUP
-#line 104 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 102 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( ENDTOK); }
YY_BREAK
case 4:
YY_RULE_SETUP
-#line 105 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 103 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( TRUETOK); }
YY_BREAK
case 5:
YY_RULE_SETUP
-#line 106 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 104 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( FALSETOK); }
YY_BREAK
case 6:
YY_RULE_SETUP
-#line 107 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 105 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( DECLARE); }
YY_BREAK
case 7:
YY_RULE_SETUP
-#line 108 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 106 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( GLOBAL); }
YY_BREAK
case 8:
YY_RULE_SETUP
-#line 109 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 107 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( CONSTANT); }
YY_BREAK
case 9:
YY_RULE_SETUP
-#line 110 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 108 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( INTERNAL); }
YY_BREAK
case 10:
YY_RULE_SETUP
-#line 111 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 109 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( LINKONCE); }
YY_BREAK
case 11:
YY_RULE_SETUP
-#line 112 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 110 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( WEAK); }
YY_BREAK
case 12:
YY_RULE_SETUP
-#line 113 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 111 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( APPENDING); }
YY_BREAK
case 13:
YY_RULE_SETUP
-#line 114 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 112 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( DLLIMPORT); }
YY_BREAK
case 14:
YY_RULE_SETUP
-#line 115 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 113 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( DLLEXPORT); }
YY_BREAK
case 15:
YY_RULE_SETUP
-#line 116 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 114 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( EXTERN_WEAK); }
YY_BREAK
case 16:
YY_RULE_SETUP
-#line 117 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 115 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( EXTERNAL); }
YY_BREAK
case 17:
YY_RULE_SETUP
-#line 118 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 116 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( UNINITIALIZED); } // alias for external
YY_BREAK
case 18:
YY_RULE_SETUP
-#line 119 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 117 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( IMPLEMENTATION); }
YY_BREAK
case 19:
YY_RULE_SETUP
-#line 120 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 118 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( ZEROINITIALIZER); }
YY_BREAK
case 20:
YY_RULE_SETUP
-#line 121 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 119 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( DOTDOTDOT); }
YY_BREAK
case 21:
YY_RULE_SETUP
-#line 122 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 120 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( UNDEF); }
YY_BREAK
case 22:
YY_RULE_SETUP
-#line 123 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 121 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( NULL_TOK); }
YY_BREAK
case 23:
YY_RULE_SETUP
-#line 124 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 122 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( TO); }
YY_BREAK
case 24:
YY_RULE_SETUP
-#line 125 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 123 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( TAIL); }
YY_BREAK
case 25:
YY_RULE_SETUP
-#line 126 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 124 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( TARGET); }
YY_BREAK
case 26:
YY_RULE_SETUP
-#line 127 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 125 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( TRIPLE); }
YY_BREAK
case 27:
YY_RULE_SETUP
-#line 128 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 126 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( DEPLIBS); }
YY_BREAK
case 28:
YY_RULE_SETUP
-#line 129 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 127 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( ENDIAN); }
YY_BREAK
case 29:
YY_RULE_SETUP
-#line 130 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 128 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( POINTERSIZE); }
YY_BREAK
case 30:
YY_RULE_SETUP
-#line 131 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 129 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( DATALAYOUT); }
YY_BREAK
case 31:
YY_RULE_SETUP
-#line 132 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 130 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( LITTLE); }
YY_BREAK
case 32:
YY_RULE_SETUP
-#line 133 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 131 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( BIG); }
YY_BREAK
case 33:
YY_RULE_SETUP
-#line 134 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 132 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( VOLATILE); }
YY_BREAK
case 34:
YY_RULE_SETUP
-#line 135 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 133 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( ALIGN); }
YY_BREAK
case 35:
YY_RULE_SETUP
-#line 136 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 134 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( SECTION); }
YY_BREAK
case 36:
YY_RULE_SETUP
-#line 137 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 135 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( MODULE); }
YY_BREAK
case 37:
YY_RULE_SETUP
-#line 138 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 136 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( ASM_TOK); }
YY_BREAK
case 38:
YY_RULE_SETUP
-#line 139 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 137 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( SIDEEFFECT); }
YY_BREAK
case 39:
YY_RULE_SETUP
-#line 141 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 139 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( CC_TOK); }
YY_BREAK
case 40:
YY_RULE_SETUP
-#line 142 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 140 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( CCC_TOK); }
YY_BREAK
case 41:
YY_RULE_SETUP
-#line 143 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 141 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( CSRETCC_TOK); }
YY_BREAK
case 42:
YY_RULE_SETUP
-#line 144 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 142 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( FASTCC_TOK); }
YY_BREAK
case 43:
YY_RULE_SETUP
-#line 145 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 143 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( COLDCC_TOK); }
YY_BREAK
case 44:
YY_RULE_SETUP
-#line 146 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 144 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( X86_STDCALLCC_TOK); }
YY_BREAK
case 45:
YY_RULE_SETUP
-#line 147 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 145 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( X86_FASTCALLCC_TOK); }
YY_BREAK
case 46:
YY_RULE_SETUP
-#line 149 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 147 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TY(VOID,VoidTy,"void",false); }
YY_BREAK
case 47:
YY_RULE_SETUP
-#line 150 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 148 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TY(BOOL,BoolTy,"bool",false); }
YY_BREAK
case 48:
YY_RULE_SETUP
-#line 151 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 149 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TY(SBYTE,SByteTy,"i8",true); }
YY_BREAK
case 49:
YY_RULE_SETUP
-#line 152 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 150 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TY(UBYTE,UByteTy,"i8",false); }
YY_BREAK
case 50:
YY_RULE_SETUP
-#line 153 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 151 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TY(SHORT,ShortTy,"i16",true); }
YY_BREAK
case 51:
YY_RULE_SETUP
-#line 154 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 152 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TY(USHORT,UShortTy,"i16",false); }
YY_BREAK
case 52:
YY_RULE_SETUP
-#line 155 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 153 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TY(INT,IntTy,"i32",true); }
YY_BREAK
case 53:
YY_RULE_SETUP
-#line 156 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 154 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TY(UINT,UIntTy,"i32",false); }
YY_BREAK
case 54:
YY_RULE_SETUP
-#line 157 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 155 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TY(LONG,LongTy,"i64",true); }
YY_BREAK
case 55:
YY_RULE_SETUP
-#line 158 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 156 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TY(ULONG,ULongTy,"i64",false); }
YY_BREAK
case 56:
YY_RULE_SETUP
-#line 159 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 157 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TY(UBYTE,UByteTy,"i8",false); }
YY_BREAK
case 57:
YY_RULE_SETUP
-#line 160 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 158 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TY(USHORT,UShortTy,"i16",false); }
YY_BREAK
case 58:
YY_RULE_SETUP
-#line 161 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 159 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TY(UINT,UIntTy,"i32",false); }
YY_BREAK
case 59:
YY_RULE_SETUP
-#line 162 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 160 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TY(ULONG,ULongTy,"i64",false); }
YY_BREAK
case 60:
YY_RULE_SETUP
-#line 163 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 161 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TY(FLOAT,FloatTy,"float",false); }
YY_BREAK
case 61:
YY_RULE_SETUP
-#line 164 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 162 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TY(DOUBLE,DoubleTy,"double",false); }
YY_BREAK
case 62:
YY_RULE_SETUP
-#line 165 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 163 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TY(LABEL,LabelTy,"label",false); }
YY_BREAK
case 63:
YY_RULE_SETUP
-#line 166 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 164 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK(OPAQUE); }
YY_BREAK
case 64:
YY_RULE_SETUP
-#line 167 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 165 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK(TYPE); }
YY_BREAK
case 65:
YY_RULE_SETUP
-#line 169 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 167 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( ADD); }
YY_BREAK
case 66:
YY_RULE_SETUP
-#line 170 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 168 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( SUB); }
YY_BREAK
case 67:
YY_RULE_SETUP
-#line 171 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 169 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( MUL); }
YY_BREAK
case 68:
YY_RULE_SETUP
-#line 172 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 170 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( DIV); }
YY_BREAK
case 69:
YY_RULE_SETUP
-#line 173 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 171 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( UDIV); }
YY_BREAK
case 70:
YY_RULE_SETUP
-#line 174 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 172 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( SDIV); }
YY_BREAK
case 71:
YY_RULE_SETUP
-#line 175 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 173 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( FDIV); }
YY_BREAK
case 72:
YY_RULE_SETUP
-#line 176 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 174 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( REM); }
YY_BREAK
case 73:
YY_RULE_SETUP
-#line 177 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 175 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( UREM); }
YY_BREAK
case 74:
YY_RULE_SETUP
-#line 178 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 176 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( SREM); }
YY_BREAK
case 75:
YY_RULE_SETUP
-#line 179 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 177 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( FREM); }
YY_BREAK
case 76:
YY_RULE_SETUP
-#line 180 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 178 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( AND); }
YY_BREAK
case 77:
YY_RULE_SETUP
-#line 181 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 179 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( OR); }
YY_BREAK
case 78:
YY_RULE_SETUP
-#line 182 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 180 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( XOR); }
YY_BREAK
case 79:
YY_RULE_SETUP
-#line 183 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 181 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( SETNE); }
YY_BREAK
case 80:
YY_RULE_SETUP
-#line 184 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 182 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( SETEQ); }
YY_BREAK
case 81:
YY_RULE_SETUP
-#line 185 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 183 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( SETLT); }
YY_BREAK
case 82:
YY_RULE_SETUP
-#line 186 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 184 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( SETGT); }
YY_BREAK
case 83:
YY_RULE_SETUP
-#line 187 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 185 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( SETLE); }
YY_BREAK
case 84:
YY_RULE_SETUP
-#line 188 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 186 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( SETGE); }
YY_BREAK
case 85:
YY_RULE_SETUP
-#line 189 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 187 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK(ICMP); }
YY_BREAK
case 86:
YY_RULE_SETUP
-#line 190 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 188 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK(FCMP); }
YY_BREAK
case 87:
YY_RULE_SETUP
-#line 191 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 189 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK(EQ); }
YY_BREAK
case 88:
YY_RULE_SETUP
-#line 192 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 190 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK(NE); }
YY_BREAK
case 89:
YY_RULE_SETUP
-#line 193 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 191 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK(SLT); }
YY_BREAK
case 90:
YY_RULE_SETUP
-#line 194 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 192 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK(SGT); }
YY_BREAK
case 91:
YY_RULE_SETUP
-#line 195 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 193 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK(SLE); }
YY_BREAK
case 92:
YY_RULE_SETUP
-#line 196 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 194 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK(SGE); }
YY_BREAK
case 93:
YY_RULE_SETUP
-#line 197 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 195 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK(OEQ); }
YY_BREAK
case 94:
YY_RULE_SETUP
-#line 198 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 196 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK(ONE); }
YY_BREAK
case 95:
YY_RULE_SETUP
-#line 199 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 197 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK(OLT); }
YY_BREAK
case 96:
YY_RULE_SETUP
-#line 200 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 198 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK(OGT); }
YY_BREAK
case 97:
YY_RULE_SETUP
-#line 201 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 199 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK(OLE); }
YY_BREAK
case 98:
YY_RULE_SETUP
-#line 202 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 200 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK(OGE); }
YY_BREAK
case 99:
YY_RULE_SETUP
-#line 203 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 201 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK(ORD); }
YY_BREAK
case 100:
YY_RULE_SETUP
-#line 204 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 202 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK(UNO); }
YY_BREAK
case 101:
YY_RULE_SETUP
-#line 205 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 203 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK(UEQ); }
YY_BREAK
case 102:
YY_RULE_SETUP
-#line 206 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 204 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK(UNE); }
YY_BREAK
case 103:
YY_RULE_SETUP
-#line 207 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 205 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK(ULT); }
YY_BREAK
case 104:
YY_RULE_SETUP
-#line 208 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 206 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK(UGT); }
YY_BREAK
case 105:
YY_RULE_SETUP
-#line 209 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 207 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK(ULE); }
YY_BREAK
case 106:
YY_RULE_SETUP
-#line 210 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 208 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK(UGE); }
YY_BREAK
case 107:
YY_RULE_SETUP
-#line 212 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 210 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( PHI_TOK); }
YY_BREAK
case 108:
YY_RULE_SETUP
-#line 213 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 211 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( CALL); }
YY_BREAK
case 109:
YY_RULE_SETUP
-#line 214 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 212 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( CAST); }
YY_BREAK
case 110:
YY_RULE_SETUP
-#line 215 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 213 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( TRUNC); }
YY_BREAK
case 111:
YY_RULE_SETUP
-#line 216 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 214 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( ZEXT); }
YY_BREAK
case 112:
YY_RULE_SETUP
-#line 217 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 215 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( SEXT); }
YY_BREAK
case 113:
YY_RULE_SETUP
-#line 218 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 216 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( FPTRUNC); }
YY_BREAK
case 114:
YY_RULE_SETUP
-#line 219 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 217 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( FPEXT); }
YY_BREAK
case 115:
YY_RULE_SETUP
-#line 220 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 218 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( FPTOUI); }
YY_BREAK
case 116:
YY_RULE_SETUP
-#line 221 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 219 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( FPTOSI); }
YY_BREAK
case 117:
YY_RULE_SETUP
-#line 222 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 220 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( UITOFP); }
YY_BREAK
case 118:
YY_RULE_SETUP
-#line 223 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 221 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( SITOFP); }
YY_BREAK
case 119:
YY_RULE_SETUP
-#line 224 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 222 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( PTRTOINT); }
YY_BREAK
case 120:
YY_RULE_SETUP
-#line 225 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 223 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( INTTOPTR); }
YY_BREAK
case 121:
YY_RULE_SETUP
-#line 226 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 224 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( BITCAST); }
YY_BREAK
case 122:
YY_RULE_SETUP
-#line 227 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 225 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( SELECT); }
YY_BREAK
case 123:
YY_RULE_SETUP
-#line 228 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 226 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( SHL); }
YY_BREAK
case 124:
YY_RULE_SETUP
-#line 229 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 227 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( SHR); }
YY_BREAK
case 125:
YY_RULE_SETUP
-#line 230 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 228 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( ASHR); }
YY_BREAK
case 126:
YY_RULE_SETUP
-#line 231 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 229 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( LSHR); }
YY_BREAK
case 127:
YY_RULE_SETUP
-#line 232 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 230 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( VAARG); }
YY_BREAK
case 128:
YY_RULE_SETUP
-#line 233 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 231 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( RET); }
YY_BREAK
case 129:
YY_RULE_SETUP
-#line 234 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 232 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( BR); }
YY_BREAK
case 130:
YY_RULE_SETUP
-#line 235 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 233 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( SWITCH); }
YY_BREAK
case 131:
YY_RULE_SETUP
-#line 236 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 234 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( INVOKE); }
YY_BREAK
case 132:
YY_RULE_SETUP
-#line 237 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 235 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( UNWIND); }
YY_BREAK
case 133:
YY_RULE_SETUP
-#line 238 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 236 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( EXCEPT); } // alias for unwind
YY_BREAK
case 134:
YY_RULE_SETUP
-#line 239 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 237 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( UNREACHABLE); }
YY_BREAK
case 135:
YY_RULE_SETUP
-#line 241 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 239 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( MALLOC); }
YY_BREAK
case 136:
YY_RULE_SETUP
-#line 242 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 240 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( ALLOCA); }
YY_BREAK
case 137:
YY_RULE_SETUP
-#line 243 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 241 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( FREE); }
YY_BREAK
case 138:
YY_RULE_SETUP
-#line 244 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 242 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( LOAD); }
YY_BREAK
case 139:
YY_RULE_SETUP
-#line 245 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 243 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( STORE); }
YY_BREAK
case 140:
YY_RULE_SETUP
-#line 246 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 244 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( GETELEMENTPTR); }
YY_BREAK
case 141:
YY_RULE_SETUP
-#line 248 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 246 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( EXTRACTELEMENT); }
YY_BREAK
case 142:
YY_RULE_SETUP
-#line 249 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 247 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( INSERTELEMENT); }
YY_BREAK
case 143:
YY_RULE_SETUP
-#line 250 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 248 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( SHUFFLEVECTOR); }
YY_BREAK
case 144:
YY_RULE_SETUP
-#line 253 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 251 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( VAR_ID); }
YY_BREAK
case 145:
YY_RULE_SETUP
-#line 254 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 252 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( LABELSTR); }
YY_BREAK
case 146:
YY_RULE_SETUP
-#line 255 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 253 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( LABELSTR); }
YY_BREAK
case 147:
YY_RULE_SETUP
-#line 256 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 254 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( STRINGCONSTANT ); }
YY_BREAK
case 148:
YY_RULE_SETUP
-#line 257 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 255 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( EUINT64VAL ); }
YY_BREAK
case 149:
YY_RULE_SETUP
-#line 258 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 256 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( ESINT64VAL ); }
YY_BREAK
case 150:
YY_RULE_SETUP
-#line 259 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 257 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( yytext[0] == 's' ? ESINT64VAL : EUINT64VAL ); }
YY_BREAK
case 151:
YY_RULE_SETUP
-#line 260 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 258 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( UINTVAL); }
YY_BREAK
case 152:
YY_RULE_SETUP
-#line 261 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 259 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( SINTVAL); }
YY_BREAK
case 153:
YY_RULE_SETUP
-#line 262 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 260 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( FPVAL); }
YY_BREAK
case 154:
YY_RULE_SETUP
-#line 263 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 261 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ RET_TOK( FPVAL); }
YY_BREAK
case YY_STATE_EOF(INITIAL):
-#line 264 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 262 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{
/* Make sure to free the internal buffers for flex when we are
* done reading our input!
@@ -2011,20 +2009,20 @@
YY_BREAK
case 155:
YY_RULE_SETUP
-#line 272 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 270 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ /* Ignore whitespace */ }
YY_BREAK
case 156:
YY_RULE_SETUP
-#line 273 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 271 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
{ return yytext[0]; }
YY_BREAK
case 157:
YY_RULE_SETUP
-#line 275 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 273 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
YY_FATAL_ERROR( "flex scanner jammed" );
YY_BREAK
-#line 2028 "UpgradeLexer.cpp"
+#line 2026 "UpgradeLexer.cpp"
case YY_END_OF_BUFFER:
{
@@ -2902,5 +2900,5 @@
return 0;
}
#endif
-#line 275 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
+#line 273 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l"
Index: llvm/tools/llvm-upgrade/UpgradeLexer.l.cvs
diff -u llvm/tools/llvm-upgrade/UpgradeLexer.l.cvs:1.11 llvm/tools/llvm-upgrade/UpgradeLexer.l.cvs:1.12
--- llvm/tools/llvm-upgrade/UpgradeLexer.l.cvs:1.11 Sun Dec 31 00:02:26 2006
+++ llvm/tools/llvm-upgrade/UpgradeLexer.l.cvs Mon Jan 1 23:45:11 2007
@@ -48,9 +48,7 @@
return sym
#define RET_TY(sym,OldTY,NewTY,sign) \
- Upgradelval.Type.newTy = new std::string(NewTY); \
- Upgradelval.Type.oldTy = OldTY; \
- Upgradelval.Type.elemTy = VoidTy; \
+ Upgradelval.Type = new TypeInfo(NewTY, OldTY); \
return sym
#define YY_NEVER_INTERACTIVE 1
Index: llvm/tools/llvm-upgrade/UpgradeParser.cpp
diff -u llvm/tools/llvm-upgrade/UpgradeParser.cpp:1.30 llvm/tools/llvm-upgrade/UpgradeParser.cpp:1.31
--- llvm/tools/llvm-upgrade/UpgradeParser.cpp:1.30 Sun Dec 31 19:20:41 2006
+++ llvm/tools/llvm-upgrade/UpgradeParser.cpp Mon Jan 1 23:45:11 2007
@@ -371,12 +371,10 @@
#line 14 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
#include "ParserInternals.h"
-#include <llvm/ADT/StringExtras.h>
#include <algorithm>
#include <map>
#include <utility>
#include <iostream>
-#include <cassert>
#define YYERROR_VERBOSE 1
#define YYINCLUDED_STDLIB_H
@@ -436,71 +434,72 @@
}
}
-static void ResolveType(TypeInfo& Ty) {
- if (Ty.oldTy == UnresolvedTy) {
- TypeMap::iterator I = NamedTypes.find(*Ty.newTy);
+TypeInfo* ResolveType(TypeInfo*& Ty) {
+ if (Ty->isUnresolved()) {
+ TypeMap::iterator I = NamedTypes.find(Ty->getNewTy());
if (I != NamedTypes.end()) {
- Ty.oldTy = I->second.oldTy;
- Ty.elemTy = I->second.elemTy;
+ Ty = I->second.clone();
+ return Ty;
} else {
- std::string msg("Can't resolve type: ");
- msg += *Ty.newTy;
+ std::string msg("Cannot resolve type: ");
+ msg += Ty->getNewTy();
yyerror(msg.c_str());
}
- } else if (Ty.oldTy == NumericTy) {
- unsigned ref = atoi(&((Ty.newTy->c_str())[1])); // Skip the '\\'
+ } else if (Ty->isNumeric()) {
+ unsigned ref = atoi(&((Ty->getNewTy().c_str())[1])); // Skip the '\\'
if (ref < EnumeratedTypes.size()) {
- Ty.oldTy = EnumeratedTypes[ref].oldTy;
- Ty.elemTy = EnumeratedTypes[ref].elemTy;
+ Ty = EnumeratedTypes[ref].clone();
+ return Ty;
} else {
std::string msg("Can't resolve type: ");
- msg += *Ty.newTy;
+ msg += Ty->getNewTy();
yyerror(msg.c_str());
}
}
// otherwise its already resolved.
+ return Ty;
}
static const char* getCastOpcode(
- std::string& Source, const TypeInfo& SrcTy, const TypeInfo& DstTy)
+ std::string& Source, const TypeInfo* SrcTy, const TypeInfo* DstTy)
{
- unsigned SrcBits = SrcTy.getBitWidth();
- unsigned DstBits = DstTy.getBitWidth();
+ unsigned SrcBits = SrcTy->getBitWidth();
+ unsigned DstBits = DstTy->getBitWidth();
const char* opcode = "bitcast";
// Run through the possibilities ...
- if (DstTy.isIntegral()) { // Casting to integral
- if (SrcTy.isIntegral()) { // Casting from integral
+ if (DstTy->isIntegral()) { // Casting to integral
+ if (SrcTy->isIntegral()) { // Casting from integral
if (DstBits < SrcBits)
opcode = "trunc";
else if (DstBits > SrcBits) { // its an extension
- if (SrcTy.isSigned())
+ if (SrcTy->isSigned())
opcode ="sext"; // signed -> SEXT
else
opcode = "zext"; // unsigned -> ZEXT
} else {
opcode = "bitcast"; // Same size, No-op cast
}
- } else if (SrcTy.isFloatingPoint()) { // Casting from floating pt
- if (DstTy.isSigned())
+ } else if (SrcTy->isFloatingPoint()) { // Casting from floating pt
+ if (DstTy->isSigned())
opcode = "fptosi"; // FP -> sint
else
opcode = "fptoui"; // FP -> uint
- } else if (SrcTy.isPacked()) {
- assert(DstBits == SrcTy.getBitWidth() &&
+ } else if (SrcTy->isPacked()) {
+ assert(DstBits == SrcTy->getBitWidth() &&
"Casting packed to integer of different width");
opcode = "bitcast"; // same size, no-op cast
} else {
- assert(SrcTy.isPointer() &&
+ assert(SrcTy->isPointer() &&
"Casting from a value that is not first-class type");
opcode = "ptrtoint"; // ptr -> int
}
- } else if (DstTy.isFloatingPoint()) { // Casting to floating pt
- if (SrcTy.isIntegral()) { // Casting from integral
- if (SrcTy.isSigned())
+ } else if (DstTy->isFloatingPoint()) { // Casting to floating pt
+ if (SrcTy->isIntegral()) { // Casting from integral
+ if (SrcTy->isSigned())
opcode = "sitofp"; // sint -> FP
else
opcode = "uitofp"; // uint -> FP
- } else if (SrcTy.isFloatingPoint()) { // Casting from floating pt
+ } else if (SrcTy->isFloatingPoint()) { // Casting from floating pt
if (DstBits < SrcBits) {
opcode = "fptrunc"; // FP -> smaller FP
} else if (DstBits > SrcBits) {
@@ -508,27 +507,27 @@
} else {
opcode ="bitcast"; // same size, no-op cast
}
- } else if (SrcTy.isPacked()) {
- assert(DstBits == SrcTy.getBitWidth() &&
+ } else if (SrcTy->isPacked()) {
+ assert(DstBits == SrcTy->getBitWidth() &&
"Casting packed to floating point of different width");
opcode = "bitcast"; // same size, no-op cast
} else {
assert(0 && "Casting pointer or non-first class to float");
}
- } else if (DstTy.isPacked()) {
- if (SrcTy.isPacked()) {
- assert(DstTy.getBitWidth() == SrcTy.getBitWidth() &&
+ } else if (DstTy->isPacked()) {
+ if (SrcTy->isPacked()) {
+ assert(DstTy->getBitWidth() == SrcTy->getBitWidth() &&
"Casting packed to packed of different widths");
opcode = "bitcast"; // packed -> packed
- } else if (DstTy.getBitWidth() == SrcBits) {
+ } else if (DstTy->getBitWidth() == SrcBits) {
opcode = "bitcast"; // float/int -> packed
} else {
assert(!"Illegal cast to packed (wrong type or size)");
}
- } else if (DstTy.isPointer()) {
- if (SrcTy.isPointer()) {
+ } else if (DstTy->isPointer()) {
+ if (SrcTy->isPointer()) {
opcode = "bitcast"; // ptr -> ptr
- } else if (SrcTy.isIntegral()) {
+ } else if (SrcTy->isIntegral()) {
opcode = "inttoptr"; // int -> ptr
} else {
assert(!"Casting invalid type to pointer");
@@ -539,12 +538,12 @@
return opcode;
}
-static std::string getCastUpgrade(
- const std::string& Src, TypeInfo& SrcTy, TypeInfo& DstTy, bool isConst)
+static std::string getCastUpgrade(const std::string& Src, TypeInfo* SrcTy,
+ TypeInfo* DstTy, bool isConst)
{
std::string Result;
std::string Source = Src;
- if (SrcTy.isFloatingPoint() && DstTy.isPointer()) {
+ if (SrcTy->isFloatingPoint() && DstTy->isPointer()) {
// fp -> ptr cast is no longer supported but we must upgrade this
// by doing a double cast: fp -> int -> ptr
if (isConst)
@@ -555,16 +554,16 @@
Source = "i64 %cast_upgrade" + llvm::utostr(unique);
}
// Update the SrcTy for the getCastOpcode call below
- SrcTy.destroy();
- SrcTy.newTy = new std::string("i64");
- SrcTy.oldTy = ULongTy;
- } else if (DstTy.oldTy == BoolTy && SrcTy.oldTy != BoolTy) {
- // cast ptr %x to bool was previously defined as setne ptr %x, null
- // The ptrtoint semantic is to truncate, not compare so we must retain
- // the original intent by replace the cast with a setne
- const char* comparator = SrcTy.isPointer() ? ", null" :
- (SrcTy.isFloatingPoint() ? ", 0.0" : ", 0");
- const char* compareOp = SrcTy.isFloatingPoint() ? "fcmp one " : "icmp ne ";
+ delete SrcTy;
+ SrcTy = new TypeInfo("i64", ULongTy);
+ } else if (DstTy->isBool()) {
+ // cast type %x to bool was previously defined as setne type %x, null
+ // The cast semantic is now to truncate, not compare so we must retain
+ // the original intent by replacing the cast with a setne
+ const char* comparator = SrcTy->isPointer() ? ", null" :
+ (SrcTy->isFloatingPoint() ? ", 0.0" :
+ (SrcTy->isBool() ? ", false" : ", 0"));
+ const char* compareOp = SrcTy->isFloatingPoint() ? "fcmp one " : "icmp ne ";
if (isConst) {
Result = "(" + Source + comparator + ")";
Result = compareOp + Result;
@@ -576,33 +575,32 @@
ResolveType(DstTy);
std::string Opcode(getCastOpcode(Source, SrcTy, DstTy));
if (isConst)
- Result += Opcode + "( " + Source + " to " + *DstTy.newTy + ")";
+ Result += Opcode + "( " + Source + " to " + DstTy->getNewTy() + ")";
else
- Result += Opcode + " " + Source + " to " + *DstTy.newTy;
+ Result += Opcode + " " + Source + " to " + DstTy->getNewTy();
return Result;
}
-const char* getDivRemOpcode(const std::string& opcode, const TypeInfo& TI) {
+const char* getDivRemOpcode(const std::string& opcode, TypeInfo* TI) {
const char* op = opcode.c_str();
- TypeInfo Ty = TI;
- ResolveType(Ty);
- if (Ty.isPacked())
- Ty.oldTy = Ty.getElementType();
+ const TypeInfo* Ty = ResolveType(TI);
+ if (Ty->isPacked())
+ Ty = Ty->getElementType();
if (opcode == "div")
- if (Ty.isFloatingPoint())
+ if (Ty->isFloatingPoint())
op = "fdiv";
- else if (Ty.isUnsigned())
+ else if (Ty->isUnsigned())
op = "udiv";
- else if (Ty.isSigned())
+ else if (Ty->isSigned())
op = "sdiv";
else
yyerror("Invalid type for div instruction");
else if (opcode == "rem")
- if (Ty.isFloatingPoint())
+ if (Ty->isFloatingPoint())
op = "frem";
- else if (Ty.isUnsigned())
+ else if (Ty->isUnsigned())
op = "urem";
- else if (Ty.isSigned())
+ else if (Ty->isSigned())
op = "srem";
else
yyerror("Invalid type for rem instruction");
@@ -610,7 +608,7 @@
}
std::string
-getCompareOp(const std::string& setcc, const TypeInfo& TI) {
+getCompareOp(const std::string& setcc, const TypeInfo* TI) {
assert(setcc.length() == 5);
char cc1 = setcc[3];
char cc2 = setcc[4];
@@ -619,20 +617,20 @@
std::string result("xcmp xxx");
result[6] = cc1;
result[7] = cc2;
- if (TI.isFloatingPoint()) {
+ if (TI->isFloatingPoint()) {
result[0] = 'f';
result[5] = 'o';
if (cc1 == 'n')
result[5] = 'u'; // NE maps to unordered
else
result[5] = 'o'; // everything else maps to ordered
- } else if (TI.isIntegral() || TI.isPointer()) {
+ } else if (TI->isIntegral() || TI->isPointer()) {
result[0] = 'i';
if ((cc1 == 'e' && cc2 == 'q') || (cc1 == 'n' && cc2 == 'e'))
result.erase(5,1);
- else if (TI.isSigned())
+ else if (TI->isSigned())
result[5] = 's';
- else if (TI.isUnsigned() || TI.isPointer() || TI.isBool())
+ else if (TI->isUnsigned() || TI->isPointer() || TI->isBool())
result[5] = 'u';
else
yyerror("Invalid integral type for setcc");
@@ -640,6 +638,76 @@
return result;
}
+static TypeInfo* getFunctionReturnType(TypeInfo* PFTy) {
+ ResolveType(PFTy);
+ if (PFTy->isPointer()) {
+ TypeInfo* ElemTy = PFTy->getElementType();
+ ResolveType(ElemTy);
+ if (ElemTy->isFunction())
+ return ElemTy->getResultType()->clone();
+ } else if (PFTy->isFunction()) {
+ return PFTy->getResultType()->clone();
+ }
+ return PFTy->clone();
+}
+
+static TypeInfo* getGEPIndexedType(TypeInfo* PTy, ValueList* idxs) {
+ ResolveType(PTy);
+ assert(PTy->isPointer() && "GEP Operand is not a pointer?");
+ TypeInfo* Result = PTy->getElementType(); // just skip first index
+ ResolveType(Result);
+ for (unsigned i = 1; i < idxs->size(); ++i) {
+ if (Result->isComposite()) {
+ Result = Result->getIndexedType((*idxs)[i]);
+ ResolveType(Result);
+ } else
+ yyerror("Invalid type for index");
+ }
+ return Result->getPointerType();
+}
+
+static std::string makeUniqueName(const std::string *Name, bool isSigned) {
+ const char *suffix = ".u";
+ if (isSigned)
+ suffix = ".s";
+ if ((*Name)[Name->size()-1] == '"') {
+ std::string Result(*Name);
+ Result.insert(Name->size()-1, suffix);
+ return Result;
+ }
+ return *Name + suffix;
+}
+
+// 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, TypeInfo* Ty) {
+ // If its not a symbolic name, don't modify it, probably a constant val.
+ if ((*Name)[0] != '%' && (*Name)[0] != '"')
+ return *Name;
+ // If its a numeric reference, just leave it alone.
+ if (isdigit((*Name)[1]))
+ return *Name;
+
+ // Resolve the type
+ ResolveType(Ty);
+
+ // Default the result to the current name
+ std::string Result = *Name;
+
+ if (Ty->isInteger()) {
+ // If its an integer type, make the name unique
+ Result = makeUniqueName(Name, Ty->isSigned());
+ } else if (Ty->isPointer()) {
+ while (Ty->isPointer())
+ Ty = Ty->getElementType();
+ if (Ty->isInteger())
+ Result = makeUniqueName(Name, Ty->isSigned());
+ }
+ return Result;
+}
+
/* Enabling traces. */
@@ -661,16 +729,17 @@
#endif
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
-#line 289 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 357 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
typedef union YYSTYPE {
std::string* String;
- TypeInfo Type;
+ TypeInfo* Type;
ValueInfo Value;
ConstInfo Const;
ValueList* ValList;
+ TypeList* TypeVec;
} YYSTYPE;
/* Line 196 of yacc.c. */
-#line 674 "UpgradeParser.tab.c"
+#line 743 "UpgradeParser.tab.c"
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1
@@ -682,7 +751,7 @@
/* Line 219 of yacc.c. */
-#line 686 "UpgradeParser.tab.c"
+#line 755 "UpgradeParser.tab.c"
#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
# define YYSIZE_T __SIZE_TYPE__
@@ -1038,37 +1107,37 @@
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const unsigned short int yyrline[] =
{
- 0, 352, 352, 352, 353, 353, 357, 357, 357, 357,
- 357, 357, 357, 358, 358, 358, 358, 359, 359, 359,
- 360, 360, 360, 360, 360, 360, 361, 361, 361, 361,
- 361, 361, 361, 361, 361, 361, 362, 362, 362, 362,
- 362, 362, 362, 362, 362, 362, 363, 363, 363, 363,
- 363, 363, 364, 364, 364, 364, 365, 365, 365, 365,
- 365, 365, 365, 366, 366, 366, 366, 366, 366, 371,
- 371, 371, 371, 372, 372, 372, 372, 373, 373, 374,
- 374, 377, 380, 385, 385, 385, 385, 385, 385, 386,
- 387, 390, 390, 390, 390, 390, 391, 392, 397, 402,
- 403, 406, 407, 415, 421, 422, 425, 426, 435, 436,
- 449, 449, 450, 450, 451, 455, 455, 455, 455, 455,
- 455, 455, 456, 456, 456, 456, 456, 458, 462, 466,
- 469, 474, 480, 488, 496, 502, 506, 512, 516, 527,
- 530, 538, 539, 544, 547, 557, 563, 568, 574, 580,
- 586, 591, 597, 603, 609, 615, 621, 627, 633, 639,
- 645, 653, 667, 679, 684, 690, 695, 701, 706, 711,
- 719, 724, 729, 739, 744, 749, 749, 759, 764, 767,
- 772, 776, 780, 782, 782, 785, 797, 802, 807, 816,
- 825, 834, 843, 848, 853, 858, 860, 860, 863, 868,
- 875, 880, 887, 894, 899, 900, 908, 908, 909, 909,
- 911, 918, 922, 926, 929, 934, 937, 940, 959, 960,
- 963, 974, 975, 977, 985, 986, 987, 991, 1004, 1005,
- 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1009, 1010, 1015,
- 1016, 1025, 1025, 1029, 1035, 1046, 1052, 1055, 1063, 1067,
- 1072, 1075, 1081, 1081, 1083, 1088, 1093, 1098, 1106, 1113,
- 1119, 1139, 1144, 1150, 1155, 1163, 1180, 1187, 1195, 1199,
- 1206, 1207, 1211, 1216, 1219, 1225, 1230, 1236, 1241, 1246,
- 1251, 1259, 1287, 1292, 1297, 1302, 1307, 1312, 1317, 1334,
- 1339, 1340, 1344, 1345, 1348, 1355, 1362, 1369, 1376, 1381,
- 1388, 1395
+ 0, 422, 422, 422, 423, 423, 427, 427, 427, 427,
+ 427, 427, 427, 428, 428, 428, 428, 429, 429, 429,
+ 430, 430, 430, 430, 430, 430, 431, 431, 431, 431,
+ 431, 431, 431, 431, 431, 431, 432, 432, 432, 432,
+ 432, 432, 432, 432, 432, 432, 433, 433, 433, 433,
+ 433, 433, 434, 434, 434, 434, 435, 435, 435, 435,
+ 435, 435, 435, 436, 436, 436, 436, 436, 436, 441,
+ 441, 441, 441, 442, 442, 442, 442, 443, 443, 444,
+ 444, 447, 450, 455, 455, 455, 455, 455, 455, 456,
+ 457, 460, 460, 460, 460, 460, 461, 462, 467, 472,
+ 473, 476, 477, 485, 491, 492, 495, 496, 505, 506,
+ 519, 519, 520, 520, 521, 525, 525, 525, 525, 525,
+ 525, 525, 526, 526, 526, 526, 526, 528, 531, 534,
+ 537, 541, 555, 562, 569, 580, 584, 595, 599, 608,
+ 612, 619, 620, 625, 630, 640, 646, 651, 657, 663,
+ 669, 674, 680, 686, 693, 699, 705, 711, 717, 723,
+ 729, 737, 750, 762, 767, 773, 778, 784, 789, 794,
+ 802, 807, 812, 822, 827, 832, 832, 842, 847, 850,
+ 855, 859, 863, 865, 865, 868, 878, 883, 888, 898,
+ 908, 918, 928, 933, 938, 943, 945, 945, 948, 953,
+ 960, 965, 972, 979, 984, 985, 993, 993, 994, 994,
+ 996, 1005, 1009, 1013, 1016, 1021, 1024, 1027, 1045, 1046,
+ 1049, 1060, 1061, 1063, 1072, 1073, 1074, 1078, 1091, 1092,
+ 1095, 1095, 1095, 1095, 1095, 1095, 1095, 1096, 1097, 1102,
+ 1103, 1112, 1112, 1116, 1121, 1131, 1140, 1143, 1151, 1155,
+ 1160, 1163, 1169, 1169, 1171, 1176, 1181, 1186, 1195, 1203,
+ 1210, 1233, 1238, 1244, 1250, 1258, 1276, 1284, 1293, 1297,
+ 1304, 1305, 1309, 1314, 1317, 1326, 1334, 1343, 1351, 1359,
+ 1364, 1373, 1401, 1407, 1413, 1420, 1426, 1432, 1438, 1456,
+ 1461, 1462, 1466, 1467, 1470, 1478, 1487, 1495, 1504, 1510,
+ 1519, 1528
};
#endif
@@ -2417,26 +2486,26 @@
switch (yyn)
{
case 81:
-#line 377 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 447 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.String) = (yyvsp[-1].String);
;}
break;
case 82:
-#line 380 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 450 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.String) = new std::string("");
;}
break;
case 90:
-#line 387 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 457 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string(""); ;}
break;
case 97:
-#line 392 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 462 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-1].String) += *(yyvsp[0].String);
delete (yyvsp[0].String);
@@ -2445,27 +2514,27 @@
break;
case 98:
-#line 397 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 467 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string(""); ;}
break;
case 99:
-#line 402 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 472 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string(); ;}
break;
case 100:
-#line 403 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 473 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ *(yyvsp[-1].String) += " " + *(yyvsp[0].String); delete (yyvsp[0].String); (yyval.String) = (yyvsp[-1].String); ;}
break;
case 101:
-#line 406 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 476 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string(); ;}
break;
case 102:
-#line 407 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 477 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyvsp[-1].String)->insert(0, ", ");
*(yyvsp[-1].String) += " " + *(yyvsp[0].String);
@@ -2475,7 +2544,7 @@
break;
case 103:
-#line 415 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 485 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-1].String) += " " + *(yyvsp[0].String);
delete (yyvsp[0].String);
@@ -2484,17 +2553,17 @@
break;
case 104:
-#line 421 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 491 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string(); ;}
break;
case 106:
-#line 425 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 495 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string(); ;}
break;
case 107:
-#line 426 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 496 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyvsp[-1].String)->insert(0, ", ");
if (!(yyvsp[0].String)->empty())
@@ -2505,7 +2574,7 @@
break;
case 109:
-#line 436 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 506 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-1].String) += " " + *(yyvsp[0].String);
delete (yyvsp[0].String);
@@ -2514,334 +2583,347 @@
break;
case 127:
-#line 458 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 528 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
- (yyval.Type).newTy = (yyvsp[0].String);
- (yyval.Type).oldTy = OpaqueTy;
+ (yyval.Type) = new TypeInfo((yyvsp[0].String), OpaqueTy);
;}
break;
case 128:
-#line 462 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 531 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
- (yyval.Type).newTy = (yyvsp[0].String);
- (yyval.Type).oldTy = UnresolvedTy;
+ (yyval.Type) = new TypeInfo((yyvsp[0].String), UnresolvedTy);
;}
break;
case 129:
-#line 466 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 534 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.Type) = (yyvsp[0].Type);
;}
break;
case 130:
-#line 469 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 537 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Type UpReference
(yyvsp[0].String)->insert(0, "\\");
- (yyval.Type).newTy = (yyvsp[0].String);
- (yyval.Type).oldTy = NumericTy;
+ (yyval.Type) = new TypeInfo((yyvsp[0].String), NumericTy);
;}
break;
case 131:
-#line 474 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 541 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Function derived type?
- *(yyvsp[-3].Type).newTy += "( " + *(yyvsp[-1].String) + " )";
- delete (yyvsp[-1].String);
- (yyval.Type).newTy = (yyvsp[-3].Type).newTy;
- (yyval.Type).oldTy = FunctionTy;
+ std::string newTy( (yyvsp[-3].Type)->getNewTy() + "(");
+ for (unsigned i = 0; i < (yyvsp[-1].TypeVec)->size(); ++i) {
+ if (i != 0)
+ newTy += ", ";
+ if ((*(yyvsp[-1].TypeVec))[i]->isVoid())
+ newTy += "...";
+ else
+ newTy += (*(yyvsp[-1].TypeVec))[i]->getNewTy();
+ }
+ newTy += ")";
+ (yyval.Type) = new TypeInfo(new std::string(newTy), (yyvsp[-3].Type), (yyvsp[-1].TypeVec));
+ EnumeratedTypes.push_back(*(yyval.Type));
;}
break;
case 132:
-#line 480 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 555 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Sized array type?
(yyvsp[-3].String)->insert(0,"[ ");
- *(yyvsp[-3].String) += " x " + *(yyvsp[-1].Type).newTy + " ]";
- delete (yyvsp[-1].Type).newTy;
- (yyval.Type).newTy = (yyvsp[-3].String);
- (yyval.Type).oldTy = ArrayTy;
- (yyval.Type).elemTy = (yyvsp[-1].Type).oldTy;
+ *(yyvsp[-3].String) += " x " + (yyvsp[-1].Type)->getNewTy() + " ]";
+ uint64_t elems = atoi((yyvsp[-3].String)->c_str());
+ (yyval.Type) = new TypeInfo((yyvsp[-3].String), ArrayTy, (yyvsp[-1].Type), elems);
+ EnumeratedTypes.push_back(*(yyval.Type));
;}
break;
case 133:
-#line 488 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 562 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Packed array type?
(yyvsp[-3].String)->insert(0,"< ");
- *(yyvsp[-3].String) += " x " + *(yyvsp[-1].Type).newTy + " >";
- delete (yyvsp[-1].Type).newTy;
- (yyval.Type).newTy = (yyvsp[-3].String);
- (yyval.Type).oldTy = PackedTy;
- (yyval.Type).elemTy = (yyvsp[-1].Type).oldTy;
+ *(yyvsp[-3].String) += " x " + (yyvsp[-1].Type)->getNewTy() + " >";
+ uint64_t elems = atoi((yyvsp[-3].String)->c_str());
+ (yyval.Type) = new TypeInfo((yyvsp[-3].String), PackedTy, (yyvsp[-1].Type), elems);
+ EnumeratedTypes.push_back(*(yyval.Type));
;}
break;
case 134:
-#line 496 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 569 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Structure type?
- (yyvsp[-1].String)->insert(0, "{ ");
- *(yyvsp[-1].String) += " }";
- (yyval.Type).newTy = (yyvsp[-1].String);
- (yyval.Type).oldTy = StructTy;
+ std::string newTy("{");
+ for (unsigned i = 0; i < (yyvsp[-1].TypeVec)->size(); ++i) {
+ if (i != 0)
+ newTy += ", ";
+ newTy += (*(yyvsp[-1].TypeVec))[i]->getNewTy();
+ }
+ newTy += "}";
+ (yyval.Type) = new TypeInfo(new std::string(newTy), StructTy, (yyvsp[-1].TypeVec));
+ EnumeratedTypes.push_back(*(yyval.Type));
;}
break;
case 135:
-#line 502 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 580 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Empty structure type?
- (yyval.Type).newTy = new std::string("{}");
- (yyval.Type).oldTy = StructTy;
+ (yyval.Type) = new TypeInfo(new std::string("{}"), StructTy, new TypeList());
+ EnumeratedTypes.push_back(*(yyval.Type));
;}
break;
case 136:
-#line 506 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 584 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Packed Structure type?
- (yyvsp[-2].String)->insert(0, "<{ ");
- *(yyvsp[-2].String) += " }>";
- (yyval.Type).newTy = (yyvsp[-2].String);
- (yyval.Type).oldTy = StructTy;
+ std::string newTy("<{");
+ for (unsigned i = 0; i < (yyvsp[-2].TypeVec)->size(); ++i) {
+ if (i != 0)
+ newTy += ", ";
+ newTy += (*(yyvsp[-2].TypeVec))[i]->getNewTy();
+ }
+ newTy += "}>";
+ (yyval.Type) = new TypeInfo(new std::string(newTy), PackedStructTy, (yyvsp[-2].TypeVec));
+ EnumeratedTypes.push_back(*(yyval.Type));
;}
break;
case 137:
-#line 512 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 595 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Empty packed structure type?
- (yyval.Type).newTy = new std::string("<{}>");
- (yyval.Type).oldTy = StructTy;
+ (yyval.Type) = new TypeInfo(new std::string("<{}>"), PackedStructTy, new TypeList());
+ EnumeratedTypes.push_back(*(yyval.Type));
;}
break;
case 138:
-#line 516 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 599 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Pointer type?
- *(yyvsp[-1].Type).newTy += '*';
- (yyval.Type).elemTy = (yyvsp[-1].Type).oldTy;
- (yyvsp[-1].Type).oldTy = PointerTy;
- (yyval.Type) = (yyvsp[-1].Type);
+ (yyval.Type) = (yyvsp[-1].Type)->getPointerType();
+ EnumeratedTypes.push_back(*(yyval.Type));
;}
break;
case 139:
-#line 527 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 608 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
- (yyval.String) = (yyvsp[0].Type).newTy;
+ (yyval.TypeVec) = new TypeList();
+ (yyval.TypeVec)->push_back((yyvsp[0].Type));
;}
break;
case 140:
-#line 530 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 612 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
- *(yyvsp[-2].String) += ", " + *(yyvsp[0].Type).newTy;
- delete (yyvsp[0].Type).newTy;
- (yyval.String) = (yyvsp[-2].String);
+ (yyval.TypeVec) = (yyvsp[-2].TypeVec);
+ (yyval.TypeVec)->push_back((yyvsp[0].Type));
;}
break;
case 142:
-#line 539 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 620 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
- *(yyvsp[-2].String) += ", ...";
+ (yyval.TypeVec) = (yyvsp[-2].TypeVec);
+ (yyval.TypeVec)->push_back(new TypeInfo("void",VoidTy));
delete (yyvsp[0].String);
- (yyval.String) = (yyvsp[-2].String);
;}
break;
case 143:
-#line 544 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 625 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
- (yyval.String) = (yyvsp[0].String);
+ (yyval.TypeVec) = new TypeList();
+ (yyval.TypeVec)->push_back(new TypeInfo("void",VoidTy));
+ delete (yyvsp[0].String);
;}
break;
case 144:
-#line 547 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 630 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
- (yyval.String) = new std::string();
+ (yyval.TypeVec) = new TypeList();
;}
break;
case 145:
-#line 557 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 640 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Nonempty unsized arr
(yyval.Const).type = (yyvsp[-3].Type);
- (yyval.Const).cnst = new std::string(*(yyvsp[-3].Type).newTy);
+ (yyval.Const).cnst = new std::string((yyvsp[-3].Type)->getNewTy());
*(yyval.Const).cnst += " [ " + *(yyvsp[-1].String) + " ]";
delete (yyvsp[-1].String);
;}
break;
case 146:
-#line 563 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 646 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.Const).type = (yyvsp[-2].Type);
- (yyval.Const).cnst = new std::string(*(yyvsp[-2].Type).newTy);
+ (yyval.Const).cnst = new std::string((yyvsp[-2].Type)->getNewTy());
*(yyval.Const).cnst += "[ ]";
;}
break;
case 147:
-#line 568 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 651 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.Const).type = (yyvsp[-2].Type);
- (yyval.Const).cnst = new std::string(*(yyvsp[-2].Type).newTy);
+ (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 574 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 657 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Nonempty unsized arr
(yyval.Const).type = (yyvsp[-3].Type);
- (yyval.Const).cnst = new std::string(*(yyvsp[-3].Type).newTy);
+ (yyval.Const).cnst = new std::string((yyvsp[-3].Type)->getNewTy());
*(yyval.Const).cnst += " < " + *(yyvsp[-1].String) + " >";
delete (yyvsp[-1].String);
;}
break;
case 149:
-#line 580 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 663 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.Const).type = (yyvsp[-3].Type);
- (yyval.Const).cnst = new std::string(*(yyvsp[-3].Type).newTy);
+ (yyval.Const).cnst = new std::string((yyvsp[-3].Type)->getNewTy());
*(yyval.Const).cnst += " { " + *(yyvsp[-1].String) + " }";
delete (yyvsp[-1].String);
;}
break;
case 150:
-#line 586 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 669 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.Const).type = (yyvsp[-2].Type);
- (yyval.Const).cnst = new std::string(*(yyvsp[-2].Type).newTy);
+ (yyval.Const).cnst = new std::string((yyvsp[-2].Type)->getNewTy());
*(yyval.Const).cnst += " {}";
;}
break;
case 151:
-#line 591 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 674 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.Const).type = (yyvsp[-1].Type);
- (yyval.Const).cnst = new std::string(*(yyvsp[-1].Type).newTy);
+ (yyval.Const).cnst = new std::string((yyvsp[-1].Type)->getNewTy());
*(yyval.Const).cnst += " " + *(yyvsp[0].String);
delete (yyvsp[0].String);
;}
break;
case 152:
-#line 597 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 680 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.Const).type = (yyvsp[-1].Type);
- (yyval.Const).cnst = new std::string(*(yyvsp[-1].Type).newTy);
+ (yyval.Const).cnst = new std::string((yyvsp[-1].Type)->getNewTy());
*(yyval.Const).cnst += " " + *(yyvsp[0].String);
delete (yyvsp[0].String);
;}
break;
case 153:
-#line 603 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 686 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
+ std::string Name = getUniqueName((yyvsp[0].String),(yyvsp[-1].Type));
(yyval.Const).type = (yyvsp[-1].Type);
- (yyval.Const).cnst = new std::string(*(yyvsp[-1].Type).newTy);
- *(yyval.Const).cnst += " " + *(yyvsp[0].String);
+ (yyval.Const).cnst = new std::string((yyvsp[-1].Type)->getNewTy());
+ *(yyval.Const).cnst += " " + Name;
delete (yyvsp[0].String);
;}
break;
case 154:
-#line 609 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 693 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.Const).type = (yyvsp[-1].Type);
- (yyval.Const).cnst = new std::string(*(yyvsp[-1].Type).newTy);
+ (yyval.Const).cnst = new std::string((yyvsp[-1].Type)->getNewTy());
*(yyval.Const).cnst += " " + *(yyvsp[0].String);
delete (yyvsp[0].String);
;}
break;
case 155:
-#line 615 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 699 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.Const).type = (yyvsp[-1].Type);
- (yyval.Const).cnst = new std::string(*(yyvsp[-1].Type).newTy);
+ (yyval.Const).cnst = new std::string((yyvsp[-1].Type)->getNewTy());
*(yyval.Const).cnst += " " + *(yyvsp[0].String);
delete (yyvsp[0].String);
;}
break;
case 156:
-#line 621 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 705 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // integral constants
(yyval.Const).type = (yyvsp[-1].Type);
- (yyval.Const).cnst = new std::string(*(yyvsp[-1].Type).newTy);
+ (yyval.Const).cnst = new std::string((yyvsp[-1].Type)->getNewTy());
*(yyval.Const).cnst += " " + *(yyvsp[0].String);
delete (yyvsp[0].String);
;}
break;
case 157:
-#line 627 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 711 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // integral constants
(yyval.Const).type = (yyvsp[-1].Type);
- (yyval.Const).cnst = new std::string(*(yyvsp[-1].Type).newTy);
+ (yyval.Const).cnst = new std::string((yyvsp[-1].Type)->getNewTy());
*(yyval.Const).cnst += " " + *(yyvsp[0].String);
delete (yyvsp[0].String);
;}
break;
case 158:
-#line 633 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 717 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Boolean constants
(yyval.Const).type = (yyvsp[-1].Type);
- (yyval.Const).cnst = new std::string(*(yyvsp[-1].Type).newTy);
+ (yyval.Const).cnst = new std::string((yyvsp[-1].Type)->getNewTy());
*(yyval.Const).cnst += " " + *(yyvsp[0].String);
delete (yyvsp[0].String);
;}
break;
case 159:
-#line 639 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 723 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Boolean constants
(yyval.Const).type = (yyvsp[-1].Type);
- (yyval.Const).cnst = new std::string(*(yyvsp[-1].Type).newTy);
+ (yyval.Const).cnst = new std::string((yyvsp[-1].Type)->getNewTy());
*(yyval.Const).cnst += " " + *(yyvsp[0].String);
delete (yyvsp[0].String);
;}
break;
case 160:
-#line 645 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 729 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Float & Double constants
(yyval.Const).type = (yyvsp[-1].Type);
- (yyval.Const).cnst = new std::string(*(yyvsp[-1].Type).newTy);
+ (yyval.Const).cnst = new std::string((yyvsp[-1].Type)->getNewTy());
*(yyval.Const).cnst += " " + *(yyvsp[0].String);
delete (yyvsp[0].String);
;}
break;
case 161:
-#line 653 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 737 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
std::string source = *(yyvsp[-3].Const).cnst;
- TypeInfo DstTy = (yyvsp[-1].Type);
- ResolveType(DstTy);
+ TypeInfo* DstTy = ResolveType((yyvsp[-1].Type));
if (*(yyvsp[-5].String) == "cast") {
// Call getCastUpgrade to upgrade the old cast
- (yyval.String) = new std::string(getCastUpgrade(source, (yyvsp[-3].Const).type, (yyvsp[-1].Type), true));
+ (yyval.String) = new std::string(getCastUpgrade(source, (yyvsp[-3].Const).type, DstTy, true));
} else {
// Nothing to upgrade, just create the cast constant expr
(yyval.String) = new std::string(*(yyvsp[-5].String));
- *(yyval.String) += "( " + source + " to " + *(yyvsp[-1].Type).newTy + ")";
+ *(yyval.String) += "( " + source + " to " + (yyvsp[-1].Type)->getNewTy() + ")";
}
- delete (yyvsp[-5].String); (yyvsp[-3].Const).destroy(); delete (yyvsp[-2].String); (yyvsp[-1].Type).destroy();
+ delete (yyvsp[-5].String); (yyvsp[-3].Const).destroy(); delete (yyvsp[-2].String); delete (yyvsp[-1].Type);
;}
break;
case 162:
-#line 667 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 750 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-4].String) += "(" + *(yyvsp[-2].Const).cnst;
for (unsigned i = 0; i < (yyvsp[-1].ValList)->size(); ++i) {
@@ -2857,7 +2939,7 @@
break;
case 163:
-#line 679 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 762 "/proj/llvm/llvm-3/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();
@@ -2866,7 +2948,7 @@
break;
case 164:
-#line 684 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 767 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
const char* op = getDivRemOpcode(*(yyvsp[-5].String), (yyvsp[-3].Const).type);
(yyval.String) = new std::string(op);
@@ -2876,7 +2958,7 @@
break;
case 165:
-#line 690 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 773 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-5].String) += "(" + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")";
(yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy();
@@ -2885,7 +2967,7 @@
break;
case 166:
-#line 695 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 778 "/proj/llvm/llvm-3/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 + ")";
@@ -2895,7 +2977,7 @@
break;
case 167:
-#line 701 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 784 "/proj/llvm/llvm-3/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();
@@ -2904,7 +2986,7 @@
break;
case 168:
-#line 706 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 789 "/proj/llvm/llvm-3/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();
@@ -2913,11 +2995,11 @@
break;
case 169:
-#line 711 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 794 "/proj/llvm/llvm-3/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();
@@ -2925,7 +3007,7 @@
break;
case 170:
-#line 719 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 802 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-5].String) += "(" + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")";
(yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy();
@@ -2934,7 +3016,7 @@
break;
case 171:
-#line 724 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 807 "/proj/llvm/llvm-3/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();
@@ -2943,7 +3025,7 @@
break;
case 172:
-#line 729 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 812 "/proj/llvm/llvm-3/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();
@@ -2952,7 +3034,7 @@
break;
case 173:
-#line 739 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 822 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-2].String) += ", " + *(yyvsp[0].Const).cnst;
(yyvsp[0].Const).destroy();
@@ -2961,25 +3043,25 @@
break;
case 174:
-#line 744 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 827 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string(*(yyvsp[0].Const).cnst); (yyvsp[0].Const).destroy(); ;}
break;
case 177:
-#line 759 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 842 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
;}
break;
case 178:
-#line 764 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 847 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.String) = 0;
;}
break;
case 179:
-#line 767 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 850 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*O << *(yyvsp[0].String) << '\n';
delete (yyvsp[0].String);
@@ -2988,7 +3070,7 @@
break;
case 180:
-#line 772 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 855 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*O << "module asm " << ' ' << *(yyvsp[0].String) << '\n';
(yyval.String) = 0;
@@ -2996,7 +3078,7 @@
break;
case 181:
-#line 776 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 859 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*O << "implementation\n";
(yyval.String) = 0;
@@ -3004,33 +3086,31 @@
break;
case 182:
-#line 780 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 863 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = 0; ;}
break;
case 184:
-#line 782 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 865 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = (yyvsp[0].String); *(yyval.String) = "external"; ;}
break;
case 185:
-#line 785 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 868 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
- EnumeratedTypes.push_back((yyvsp[0].Type));
+ EnumeratedTypes.push_back(*(yyvsp[0].Type));
if (!(yyvsp[-2].String)->empty()) {
- NamedTypes[*(yyvsp[-2].String)].newTy = new std::string(*(yyvsp[0].Type).newTy);
- NamedTypes[*(yyvsp[-2].String)].oldTy = (yyvsp[0].Type).oldTy;
- NamedTypes[*(yyvsp[-2].String)].elemTy = (yyvsp[0].Type).elemTy;
+ NamedTypes[*(yyvsp[-2].String)] = *(yyvsp[0].Type);
*O << *(yyvsp[-2].String) << " = ";
}
- *O << "type " << *(yyvsp[0].Type).newTy << '\n';
- delete (yyvsp[-2].String); delete (yyvsp[-1].String); (yyvsp[0].Type).destroy();
+ *O << "type " << (yyvsp[0].Type)->getNewTy() << '\n';
+ delete (yyvsp[-2].String); delete (yyvsp[-1].String);
(yyval.String) = 0;
;}
break;
case 186:
-#line 797 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 878 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Function prototypes can be in const pool
*O << *(yyvsp[0].String) << '\n';
delete (yyvsp[0].String);
@@ -3039,7 +3119,7 @@
break;
case 187:
-#line 802 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 883 "/proj/llvm/llvm-3/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);
@@ -3048,59 +3128,63 @@
break;
case 188:
-#line 807 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 888 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
if (!(yyvsp[-4].String)->empty()) {
- *O << *(yyvsp[-4].String) << " = ";
- Globals[*(yyvsp[-4].String)] = (yyvsp[-1].Const).type.clone();
+ std::string Name = getUniqueName((yyvsp[-4].String),(yyvsp[-1].Const).type);
+ *O << Name << " = ";
+ Globals[Name] = *(yyvsp[-1].Const).type;
}
*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); (yyvsp[-1].Const).destroy(); delete (yyvsp[0].String);
+ delete (yyvsp[-4].String); delete (yyvsp[-3].String); delete (yyvsp[-2].String); delete (yyvsp[0].String);
(yyval.String) = 0;
;}
break;
case 189:
-#line 816 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 898 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
if (!(yyvsp[-4].String)->empty()) {
- *O << *(yyvsp[-4].String) << " = ";
- Globals[*(yyvsp[-4].String)] = (yyvsp[-1].Type).clone();
+ std::string Name = getUniqueName((yyvsp[-4].String),(yyvsp[-1].Type));
+ *O << Name << " = ";
+ Globals[Name] = *(yyvsp[-1].Type);
}
- *O << *(yyvsp[-3].String) << ' ' << *(yyvsp[-2].String) << ' ' << *(yyvsp[-1].Type).newTy << ' ' << *(yyvsp[0].String) << '\n';
- delete (yyvsp[-4].String); delete (yyvsp[-3].String); delete (yyvsp[-2].String); (yyvsp[-1].Type).destroy(); delete (yyvsp[0].String);
+ *O << *(yyvsp[-3].String) << ' ' << *(yyvsp[-2].String) << ' ' << (yyvsp[-1].Type)->getNewTy() << ' ' << *(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 190:
-#line 825 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 908 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
if (!(yyvsp[-4].String)->empty()) {
- *O << *(yyvsp[-4].String) << " = ";
- Globals[*(yyvsp[-4].String)] = (yyvsp[-1].Type).clone();
+ std::string Name = getUniqueName((yyvsp[-4].String),(yyvsp[-1].Type));
+ *O << Name << " = ";
+ Globals[Name] = *(yyvsp[-1].Type);
}
- *O << *(yyvsp[-3].String) << ' ' << *(yyvsp[-2].String) << ' ' << *(yyvsp[-1].Type).newTy << ' ' << *(yyvsp[0].String) << '\n';
- delete (yyvsp[-4].String); delete (yyvsp[-3].String); delete (yyvsp[-2].String); (yyvsp[-1].Type).destroy(); delete (yyvsp[0].String);
+ *O << *(yyvsp[-3].String) << ' ' << *(yyvsp[-2].String) << ' ' << (yyvsp[-1].Type)->getNewTy() << ' ' << *(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 191:
-#line 834 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 918 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
if (!(yyvsp[-4].String)->empty()) {
- *O << *(yyvsp[-4].String) << " = ";
- Globals[*(yyvsp[-4].String)] = (yyvsp[-1].Type).clone();
+ std::string Name = getUniqueName((yyvsp[-4].String),(yyvsp[-1].Type));
+ *O << Name << " = ";
+ Globals[Name] = *(yyvsp[-1].Type);
}
- *O << *(yyvsp[-3].String) << ' ' << *(yyvsp[-2].String) << ' ' << *(yyvsp[-1].Type).newTy << ' ' << *(yyvsp[0].String) << '\n';
- delete (yyvsp[-4].String); delete (yyvsp[-3].String); delete (yyvsp[-2].String); (yyvsp[-1].Type).destroy(); delete (yyvsp[0].String);
+ *O << *(yyvsp[-3].String) << ' ' << *(yyvsp[-2].String) << ' ' << (yyvsp[-1].Type)->getNewTy() << ' ' << *(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 192:
-#line 843 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 928 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*O << *(yyvsp[-1].String) << ' ' << *(yyvsp[0].String) << '\n';
delete (yyvsp[-1].String); delete (yyvsp[0].String);
@@ -3109,7 +3193,7 @@
break;
case 193:
-#line 848 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 933 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*O << *(yyvsp[-2].String) << " = " << *(yyvsp[0].String) << '\n';
delete (yyvsp[-2].String); delete (yyvsp[0].String);
@@ -3118,14 +3202,14 @@
break;
case 194:
-#line 853 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 938 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.String) = 0;
;}
break;
case 198:
-#line 863 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 948 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-2].String) += " = " + *(yyvsp[0].String);
delete (yyvsp[0].String);
@@ -3134,7 +3218,7 @@
break;
case 199:
-#line 868 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 953 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-2].String) += " = " + *(yyvsp[0].String);
if (*(yyvsp[0].String) == "64")
@@ -3145,7 +3229,7 @@
break;
case 200:
-#line 875 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 960 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-2].String) += " = " + *(yyvsp[0].String);
delete (yyvsp[0].String);
@@ -3154,7 +3238,7 @@
break;
case 201:
-#line 880 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 965 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-2].String) += " = " + *(yyvsp[0].String);
delete (yyvsp[0].String);
@@ -3163,7 +3247,7 @@
break;
case 202:
-#line 887 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 972 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyvsp[-1].String)->insert(0, "[ ");
*(yyvsp[-1].String) += " ]";
@@ -3172,7 +3256,7 @@
break;
case 203:
-#line 894 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 979 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-2].String) += ", " + *(yyvsp[0].String);
delete (yyvsp[0].String);
@@ -3181,29 +3265,31 @@
break;
case 205:
-#line 900 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 985 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.String) = new std::string();
;}
break;
case 209:
-#line 909 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 994 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string(); ;}
break;
case 210:
-#line 911 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 996 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
- (yyval.String) = (yyvsp[-1].Type).newTy;
- if (!(yyvsp[0].String)->empty())
- *(yyval.String) += " " + *(yyvsp[0].String);
+ (yyval.String) = new std::string((yyvsp[-1].Type)->getNewTy());
+ if (!(yyvsp[0].String)->empty()) {
+ std::string Name = getUniqueName((yyvsp[0].String), (yyvsp[-1].Type));
+ *(yyval.String) += " " + Name;
+ }
delete (yyvsp[0].String);
;}
break;
case 211:
-#line 918 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1005 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-2].String) += ", " + *(yyvsp[0].String);
delete (yyvsp[0].String);
@@ -3211,21 +3297,21 @@
break;
case 212:
-#line 922 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1009 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.String) = (yyvsp[0].String);
;}
break;
case 213:
-#line 926 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1013 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.String) = (yyvsp[0].String);
;}
break;
case 214:
-#line 929 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1016 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-2].String) += ", ...";
(yyval.String) = (yyvsp[-2].String);
@@ -3234,31 +3320,30 @@
break;
case 215:
-#line 934 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1021 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.String) = (yyvsp[0].String);
;}
break;
case 216:
-#line 937 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1024 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string(); ;}
break;
case 217:
-#line 940 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1027 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
if (!(yyvsp[-7].String)->empty()) {
*(yyvsp[-7].String) += " ";
}
- *(yyvsp[-7].String) += *(yyvsp[-6].Type).newTy + " " + *(yyvsp[-5].String) + "(" + *(yyvsp[-3].String) + ")";
+ *(yyvsp[-7].String) += (yyvsp[-6].Type)->getNewTy() + " " + *(yyvsp[-5].String) + "(" + *(yyvsp[-3].String) + ")";
if (!(yyvsp[-1].String)->empty()) {
*(yyvsp[-7].String) += " " + *(yyvsp[-1].String);
}
if (!(yyvsp[0].String)->empty()) {
*(yyvsp[-7].String) += " " + *(yyvsp[0].String);
}
- (yyvsp[-6].Type).destroy();
delete (yyvsp[-5].String);
delete (yyvsp[-3].String);
delete (yyvsp[-1].String);
@@ -3268,17 +3353,17 @@
break;
case 218:
-#line 959 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1045 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string("{"); delete (yyvsp[0].String); ;}
break;
case 219:
-#line 960 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1046 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string ("{"); ;}
break;
case 220:
-#line 963 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1049 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*O << "define ";
if (!(yyvsp[-2].String)->empty()) {
@@ -3291,32 +3376,33 @@
break;
case 221:
-#line 974 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1060 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string("}"); delete (yyvsp[0].String); ;}
break;
case 222:
-#line 975 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1061 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string("}"); ;}
break;
case 223:
-#line 977 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1063 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
if ((yyvsp[-1].String))
*O << *(yyvsp[-1].String);
*O << *(yyvsp[0].String) << "\n\n";
+ delete (yyvsp[-2].String); delete (yyvsp[-1].String); delete (yyvsp[0].String);
(yyval.String) = 0;
;}
break;
case 224:
-#line 985 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1072 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string(); ;}
break;
case 227:
-#line 991 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1078 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
if (!(yyvsp[-1].String)->empty())
*(yyvsp[-2].String) += " " + *(yyvsp[-1].String);
@@ -3328,12 +3414,12 @@
break;
case 228:
-#line 1004 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1091 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string(); ;}
break;
case 238:
-#line 1010 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1097 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyvsp[-1].String)->insert(0, "<");
*(yyvsp[-1].String) += ">";
@@ -3342,7 +3428,7 @@
break;
case 240:
-#line 1016 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1103 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
if (!(yyvsp[-3].String)->empty()) {
*(yyvsp[-4].String) += " " + *(yyvsp[-3].String);
@@ -3354,57 +3440,58 @@
break;
case 243:
-#line 1029 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1116 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.Value).val = (yyvsp[0].String);
(yyval.Value).constant = false;
- (yyval.Value).type.newTy = 0;
- (yyval.Value).type.oldTy = UnresolvedTy;
+ (yyval.Value).type = new TypeInfo();
;}
break;
case 244:
-#line 1035 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1121 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.Value).val = (yyvsp[0].String);
(yyval.Value).constant = true;
- (yyval.Value).type.newTy = 0;
- (yyval.Value).type.oldTy = UnresolvedTy;
+ (yyval.Value).type = new TypeInfo();
;}
break;
case 245:
-#line 1046 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1131 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
+ std::string Name = getUniqueName((yyvsp[0].Value).val, (yyvsp[-1].Type));
(yyval.Value) = (yyvsp[0].Value);
+ delete (yyval.Value).val;
+ delete (yyval.Value).type;
+ (yyval.Value).val = new std::string((yyvsp[-1].Type)->getNewTy() + " " + Name);
(yyval.Value).type = (yyvsp[-1].Type);
- (yyval.Value).val->insert(0, *(yyvsp[-1].Type).newTy + " ");
;}
break;
case 246:
-#line 1052 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1140 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.String) = 0;
;}
break;
case 247:
-#line 1055 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1143 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Do not allow functions with 0 basic blocks
(yyval.String) = 0;
;}
break;
case 248:
-#line 1063 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1151 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.String) = 0;
;}
break;
case 249:
-#line 1067 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1155 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*O << " " << *(yyvsp[0].String) << '\n';
delete (yyvsp[0].String);
@@ -3413,14 +3500,14 @@
break;
case 250:
-#line 1072 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1160 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.String) = 0;
;}
break;
case 251:
-#line 1075 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1163 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*O << *(yyvsp[0].String) << '\n';
delete (yyvsp[0].String);
@@ -3429,12 +3516,12 @@
break;
case 253:
-#line 1081 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1169 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = (yyvsp[0].String); *(yyval.String) = "unwind"; ;}
break;
case 254:
-#line 1083 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1171 "/proj/llvm/llvm-3/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();
@@ -3443,63 +3530,69 @@
break;
case 255:
-#line 1088 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1176 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Return with no result...
- *O << " " << *(yyvsp[-1].String) << ' ' << *(yyvsp[0].Type).newTy << '\n';
- delete (yyvsp[-1].String); (yyvsp[0].Type).destroy();
+ *O << " " << *(yyvsp[-1].String) << ' ' << (yyvsp[0].Type)->getNewTy() << '\n';
+ delete (yyvsp[-1].String); delete (yyvsp[0].Type);
(yyval.String) = 0;
;}
break;
case 256:
-#line 1093 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1181 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Unconditional Branch...
- *O << " " << *(yyvsp[-2].String) << ' ' << *(yyvsp[-1].Type).newTy << ' ' << *(yyvsp[0].Value).val << '\n';
- delete (yyvsp[-2].String); (yyvsp[-1].Type).destroy(); (yyvsp[0].Value).destroy();
+ *O << " " << *(yyvsp[-2].String) << ' ' << (yyvsp[-1].Type)->getNewTy() << ' ' << *(yyvsp[0].Value).val << '\n';
+ delete (yyvsp[-2].String); delete (yyvsp[-1].Type); (yyvsp[0].Value).destroy();
(yyval.String) = 0;
;}
break;
case 257:
-#line 1098 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1186 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
- *O << " " << *(yyvsp[-8].String) << ' ' << *(yyvsp[-7].Type).newTy << ' ' << *(yyvsp[-6].Value).val << ", "
- << *(yyvsp[-4].Type).newTy << ' ' << *(yyvsp[-3].Value).val << ", " << *(yyvsp[-1].Type).newTy << ' '
+ 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[-7].Type).destroy(); (yyvsp[-6].Value).destroy(); (yyvsp[-4].Type).destroy(); (yyvsp[-3].Value).destroy();
- (yyvsp[-1].Type).destroy(); (yyvsp[0].Value).destroy();
+ delete (yyvsp[-8].String); delete (yyvsp[-7].Type); (yyvsp[-6].Value).destroy(); delete (yyvsp[-4].Type); (yyvsp[-3].Value).destroy();
+ delete (yyvsp[-1].Type); (yyvsp[0].Value).destroy();
(yyval.String) = 0;
;}
break;
case 258:
-#line 1106 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1195 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
- *O << " " << *(yyvsp[-8].String) << ' ' << *(yyvsp[-7].Type).newTy << ' ' << *(yyvsp[-6].Value).val << ", "
- << *(yyvsp[-4].Type).newTy << ' ' << *(yyvsp[-3].Value).val << " [" << *(yyvsp[-1].String) << " ]\n";
- delete (yyvsp[-8].String); (yyvsp[-7].Type).destroy(); (yyvsp[-6].Value).destroy(); (yyvsp[-4].Type).destroy(); (yyvsp[-3].Value).destroy();
+ 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); delete (yyvsp[-7].Type); (yyvsp[-6].Value).destroy(); delete (yyvsp[-4].Type); (yyvsp[-3].Value).destroy();
delete (yyvsp[-1].String);
(yyval.String) = 0;
;}
break;
case 259:
-#line 1113 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1203 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
- *O << " " << *(yyvsp[-7].String) << ' ' << *(yyvsp[-6].Type).newTy << ' ' << *(yyvsp[-5].Value).val << ", "
- << *(yyvsp[-3].Type).newTy << ' ' << *(yyvsp[-2].Value).val << "[]\n";
- delete (yyvsp[-7].String); (yyvsp[-6].Type).destroy(); (yyvsp[-5].Value).destroy(); (yyvsp[-3].Type).destroy(); (yyvsp[-2].Value).destroy();
+ 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); delete (yyvsp[-6].Type); (yyvsp[-5].Value).destroy(); delete (yyvsp[-3].Type); (yyvsp[-2].Value).destroy();
(yyval.String) = 0;
;}
break;
case 260:
-#line 1120 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1211 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
+ TypeInfo* ResTy = getFunctionReturnType((yyvsp[-10].Type));
*O << " ";
- if (!(yyvsp[-13].String)->empty())
- *O << *(yyvsp[-13].String) << " = ";
- *O << *(yyvsp[-12].String) << ' ' << *(yyvsp[-11].String) << ' ' << *(yyvsp[-10].Type).newTy << ' ' << *(yyvsp[-9].Value).val << " (";
+ if (!(yyvsp[-13].String)->empty()) {
+ 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 << " (";
for (unsigned i = 0; i < (yyvsp[-7].ValList)->size(); ++i) {
ValueInfo& VI = (*(yyvsp[-7].ValList))[i];
*O << *VI.val;
@@ -3507,17 +3600,17 @@
*O << ", ";
VI.destroy();
}
- *O << ") " << *(yyvsp[-5].String) << ' ' << *(yyvsp[-4].Type).newTy << ' ' << *(yyvsp[-3].Value).val << ' '
- << *(yyvsp[-2].String) << ' ' << *(yyvsp[-1].Type).newTy << ' ' << *(yyvsp[0].Value).val << '\n';
- delete (yyvsp[-13].String); delete (yyvsp[-12].String); delete (yyvsp[-11].String); (yyvsp[-10].Type).destroy(); (yyvsp[-9].Value).destroy(); delete (yyvsp[-7].ValList);
- delete (yyvsp[-5].String); (yyvsp[-4].Type).destroy(); (yyvsp[-3].Value).destroy(); delete (yyvsp[-2].String); (yyvsp[-1].Type).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[-10].Type); (yyvsp[-9].Value).destroy(); delete (yyvsp[-7].ValList);
+ delete (yyvsp[-5].String); delete (yyvsp[-4].Type); (yyvsp[-3].Value).destroy(); delete (yyvsp[-2].String); delete (yyvsp[-1].Type);
(yyvsp[0].Value).destroy();
(yyval.String) = 0;
;}
break;
case 261:
-#line 1139 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1233 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*O << " " << *(yyvsp[0].String) << '\n';
delete (yyvsp[0].String);
@@ -3526,7 +3619,7 @@
break;
case 262:
-#line 1144 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1238 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*O << " " << *(yyvsp[0].String) << '\n';
delete (yyvsp[0].String);
@@ -3535,26 +3628,27 @@
break;
case 263:
-#line 1150 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1244 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
- *(yyvsp[-5].String) += " " + *(yyvsp[-4].Type).newTy + " " + *(yyvsp[-3].String) + ", " + *(yyvsp[-1].Type).newTy + " " + *(yyvsp[0].Value).val;
- (yyvsp[-4].Type).destroy(); delete (yyvsp[-3].String); (yyvsp[-1].Type).destroy(); (yyvsp[0].Value).destroy();
+ *(yyvsp[-5].String) += " " + (yyvsp[-4].Type)->getNewTy() + " " + *(yyvsp[-3].String) + ", " + (yyvsp[-1].Type)->getNewTy() + " " +
+ *(yyvsp[0].Value).val;
+ delete (yyvsp[-4].Type); delete (yyvsp[-3].String); delete (yyvsp[-1].Type); (yyvsp[0].Value).destroy();
(yyval.String) = (yyvsp[-5].String);
;}
break;
case 264:
-#line 1155 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1250 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
- (yyvsp[-3].String)->insert(0, *(yyvsp[-4].Type).newTy + " " );
- *(yyvsp[-3].String) += ", " + *(yyvsp[-1].Type).newTy + " " + *(yyvsp[0].Value).val;
- (yyvsp[-4].Type).destroy(); (yyvsp[-1].Type).destroy(); (yyvsp[0].Value).destroy();
+ (yyvsp[-3].String)->insert(0, (yyvsp[-4].Type)->getNewTy() + " " );
+ *(yyvsp[-3].String) += ", " + (yyvsp[-1].Type)->getNewTy() + " " + *(yyvsp[0].Value).val;
+ delete (yyvsp[-4].Type); delete (yyvsp[-1].Type); (yyvsp[0].Value).destroy();
(yyval.String) = (yyvsp[-3].String);
;}
break;
case 265:
-#line 1163 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1258 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
if (!(yyvsp[-1].String)->empty()) {
if (deleteUselessCastFlag && *deleteUselessCastName == *(yyvsp[-1].String)) {
@@ -3562,64 +3656,67 @@
(yyvsp[-1].String)->insert(0, "; "); // don't actually delete it, just comment it out
delete deleteUselessCastName;
} else {
- *(yyvsp[-1].String) += " = ";
+ // Get a unique name for the name of this value, based on its type.
+ *(yyvsp[-1].String) = getUniqueName((yyvsp[-1].String), (yyvsp[0].Value).type) + " = ";
}
}
- *(yyvsp[-1].String) += *(yyvsp[0].String);
- delete (yyvsp[0].String);
+ *(yyvsp[-1].String) += *(yyvsp[0].Value).val;
+ (yyvsp[0].Value).destroy();
deleteUselessCastFlag = false;
(yyval.String) = (yyvsp[-1].String);
;}
break;
case 266:
-#line 1180 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1276 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Used for PHI nodes
- (yyvsp[-3].Value).val->insert(0, *(yyvsp[-5].Type).newTy + "[");
- *(yyvsp[-3].Value).val += "," + *(yyvsp[-1].Value).val + "]";
- (yyvsp[-5].Type).destroy(); (yyvsp[-1].Value).destroy();
- (yyval.String) = new std::string(*(yyvsp[-3].Value).val);
- (yyvsp[-3].Value).destroy();
+ 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();
;}
break;
case 267:
-#line 1187 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1284 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
- *(yyvsp[-6].String) += ", [" + *(yyvsp[-3].Value).val + "," + *(yyvsp[-1].Value).val + "]";
+ 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();
- (yyval.String) = (yyvsp[-6].String);
+ (yyval.Value) = (yyvsp[-6].Value);
;}
break;
case 268:
-#line 1195 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
- {
+#line 1293 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+ {
(yyval.ValList) = new ValueList();
(yyval.ValList)->push_back((yyvsp[0].Value));
;}
break;
case 269:
-#line 1199 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1297 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
- (yyvsp[-2].ValList)->push_back((yyvsp[0].Value));
(yyval.ValList) = (yyvsp[-2].ValList);
+ (yyval.ValList)->push_back((yyvsp[0].Value));
;}
break;
case 270:
-#line 1206 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1304 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.ValList) = (yyvsp[0].ValList); ;}
break;
case 271:
-#line 1207 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1305 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.ValList) = new ValueList(); ;}
break;
case 272:
-#line 1211 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1309 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-1].String) += " " + *(yyvsp[0].String);
delete (yyvsp[0].String);
@@ -3628,92 +3725,108 @@
break;
case 274:
-#line 1219 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1317 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
const char* op = getDivRemOpcode(*(yyvsp[-4].String), (yyvsp[-3].Type));
- (yyval.String) = new std::string(op);
- *(yyval.String) += " " + *(yyvsp[-3].Type).newTy + " " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Value).val;
- delete (yyvsp[-4].String); (yyvsp[-3].Type).destroy(); (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).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();
;}
break;
case 275:
-#line 1225 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1326 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
- *(yyvsp[-4].String) += " " + *(yyvsp[-3].Type).newTy + " " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Value).val;
- (yyvsp[-3].Type).destroy(); (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
- (yyval.String) = (yyvsp[-4].String);
+ 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();
;}
break;
case 276:
-#line 1230 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1334 "/proj/llvm/llvm-3/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));
*(yyvsp[-4].String) = getCompareOp(*(yyvsp[-4].String), (yyvsp[-3].Type));
- *(yyvsp[-4].String) += " " + *(yyvsp[-3].Type).newTy + " " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Value).val;
- (yyvsp[-3].Type).destroy(); (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
- (yyval.String) = (yyvsp[-4].String);
+ *(yyvsp[-4].String) += " " + (yyvsp[-3].Type)->getNewTy() + " " + Name1 + ", " + Name2;
+ (yyval.Value).val = (yyvsp[-4].String);
+ (yyval.Value).type = new TypeInfo("bool",BoolTy);
+ (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
;}
break;
case 277:
-#line 1236 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1343 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
- *(yyvsp[-5].String) += " " + *(yyvsp[-4].String) + " " + *(yyvsp[-3].Type).newTy + " " + *(yyvsp[-2].Value).val + "," + *(yyvsp[0].Value).val;
+ 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 = new TypeInfo("bool",BoolTy);
delete (yyvsp[-4].String); (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
- (yyval.String) = (yyvsp[-5].String);
;}
break;
case 278:
-#line 1241 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1351 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
- *(yyvsp[-5].String) += " " + *(yyvsp[-4].String) + " " + *(yyvsp[-3].Type).newTy + " " + *(yyvsp[-2].Value).val + "," + *(yyvsp[0].Value).val;
+ 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 = new TypeInfo("bool",BoolTy);
delete (yyvsp[-4].String); (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
- (yyval.String) = (yyvsp[-5].String);
;}
break;
case 279:
-#line 1246 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1359 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
- *(yyvsp[-1].String) += " " + *(yyvsp[0].Value).val;
- (yyvsp[0].Value).destroy();
- (yyval.String) = (yyvsp[-1].String);
+ (yyval.Value) = (yyvsp[0].Value);
+ (yyval.Value).val->insert(0, *(yyvsp[-1].String) + " ");
+ delete (yyvsp[-1].String);
;}
break;
case 280:
-#line 1251 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1364 "/proj/llvm/llvm-3/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.String) = new std::string(shiftop);
- *(yyval.String) += " " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Value).val;
- delete (yyvsp[-3].String); (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
+ 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); delete (yyvsp[-2].Value).val; (yyvsp[0].Value).destroy();
;}
break;
case 281:
-#line 1259 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1373 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
std::string source = *(yyvsp[-2].Value).val;
- TypeInfo SrcTy = (yyvsp[-2].Value).type;
- TypeInfo DstTy = (yyvsp[0].Type);
- ResolveType(DstTy);
- (yyval.String) = new std::string();
+ TypeInfo* SrcTy = (yyvsp[-2].Value).type;
+ TypeInfo* DstTy = ResolveType((yyvsp[0].Type));
+ (yyval.Value).val = new std::string();
if (*(yyvsp[-3].String) == "cast") {
- *(yyval.String) += getCastUpgrade(source, SrcTy, DstTy, false);
+ *(yyval.Value).val += getCastUpgrade(source, SrcTy, DstTy, false);
} else {
- *(yyval.String) += *(yyvsp[-3].String) + " " + source + " to " + *DstTy.newTy;
+ *(yyval.Value).val += *(yyvsp[-3].String) + " " + source + " to " + DstTy->getNewTy();
}
+ (yyval.Value).type = (yyvsp[0].Type);
// 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
// when assembled and perform no code gen action so just remove them.
if (*(yyvsp[-3].String) == "cast" || *(yyvsp[-3].String) == "bitcast")
- if ((yyvsp[-2].Value).type.isInteger() && (yyvsp[0].Type).isInteger() &&
- (yyvsp[-2].Value).type.getBitWidth() == (yyvsp[0].Type).getBitWidth()) {
+ if ((yyvsp[-2].Value).type->isInteger() && DstTy->isInteger() &&
+ (yyvsp[-2].Value).type->getBitWidth() == DstTy->getBitWidth()) {
deleteUselessCastFlag = true; // Flag the "Inst" rule
deleteUselessCastName = new std::string(*(yyvsp[-2].Value).val); // save the name
size_t pos = deleteUselessCastName->find_first_of("%\"",0);
@@ -3723,72 +3836,79 @@
}
}
delete (yyvsp[-3].String); (yyvsp[-2].Value).destroy();
- delete (yyvsp[-1].String); (yyvsp[0].Type).destroy();
+ delete (yyvsp[-1].String);
;}
break;
case 282:
-#line 1287 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1401 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-5].String) += " " + *(yyvsp[-4].Value).val + ", " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Value).val;
- (yyvsp[-4].Value).destroy(); (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
- (yyval.String) = (yyvsp[-5].String);
+ (yyval.Value).val = (yyvsp[-5].String);
+ (yyval.Value).type = (yyvsp[-2].Value).type;
+ (yyvsp[-4].Value).destroy(); delete (yyvsp[-2].Value).val; (yyvsp[0].Value).destroy();
;}
break;
case 283:
-#line 1292 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1407 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
- *(yyvsp[-3].String) += " " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Type).newTy;
- (yyvsp[-2].Value).destroy(); (yyvsp[0].Type).destroy();
- (yyval.String) = (yyvsp[-3].String);
+ *(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();
;}
break;
case 284:
-#line 1297 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1413 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-3].String) += " " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Value).val;
- (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
- (yyval.String) = (yyvsp[-3].String);
+ (yyval.Value).val = (yyvsp[-3].String);
+ ResolveType((yyvsp[-2].Value).type);
+ (yyval.Value).type = (yyvsp[-2].Value).type->getElementType()->clone();
+ delete (yyvsp[-2].Value).val; (yyvsp[0].Value).destroy();
;}
break;
case 285:
-#line 1302 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1420 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-5].String) += " " + *(yyvsp[-4].Value).val + ", " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Value).val;
- (yyvsp[-4].Value).destroy(); (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
- (yyval.String) = (yyvsp[-5].String);
+ (yyval.Value).val = (yyvsp[-5].String);
+ (yyval.Value).type = (yyvsp[-4].Value).type;
+ delete (yyvsp[-4].Value).val; (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
;}
break;
case 286:
-#line 1307 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1426 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-5].String) += " " + *(yyvsp[-4].Value).val + ", " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Value).val;
- (yyvsp[-4].Value).destroy(); (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
- (yyval.String) = (yyvsp[-5].String);
+ (yyval.Value).val = (yyvsp[-5].String);
+ (yyval.Value).type = (yyvsp[-4].Value).type;
+ delete (yyvsp[-4].Value).val; (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
;}
break;
case 287:
-#line 1312 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1432 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
- *(yyvsp[-1].String) += " " + *(yyvsp[0].String);
- delete (yyvsp[0].String);
- (yyval.String) = (yyvsp[-1].String);
+ *(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;
;}
break;
case 288:
-#line 1317 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1438 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
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).newTy + " " + *(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;
@@ -3797,125 +3917,137 @@
VI.destroy();
}
*(yyvsp[-6].String) += ")";
- delete (yyvsp[-5].String); (yyvsp[-4].Type).destroy(); (yyvsp[-3].Value).destroy(); delete (yyvsp[-1].ValList);
- (yyval.String) = (yyvsp[-6].String);
+ (yyval.Value).val = (yyvsp[-6].String);
+ (yyval.Value).type = getFunctionReturnType((yyvsp[-4].Type));
+ delete (yyvsp[-5].String); delete (yyvsp[-4].Type); (yyvsp[-3].Value).destroy(); delete (yyvsp[-1].ValList);
;}
break;
case 290:
-#line 1339 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1461 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.ValList) = (yyvsp[0].ValList); ;}
break;
case 291:
-#line 1340 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1462 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.ValList) = new ValueList(); ;}
break;
case 293:
-#line 1345 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1467 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string(); ;}
break;
case 294:
-#line 1348 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1470 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
- *(yyvsp[-2].String) += " " + *(yyvsp[-1].Type).newTy;
+ *(yyvsp[-2].String) += " " + (yyvsp[-1].Type)->getNewTy();
if (!(yyvsp[0].String)->empty())
*(yyvsp[-2].String) += " " + *(yyvsp[0].String);
- (yyvsp[-1].Type).destroy(); delete (yyvsp[0].String);
- (yyval.String) = (yyvsp[-2].String);
+ (yyval.Value).val = (yyvsp[-2].String);
+ (yyval.Value).type = (yyvsp[-1].Type)->getPointerType();
+ delete (yyvsp[-1].Type); delete (yyvsp[0].String);
;}
break;
case 295:
-#line 1355 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1478 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
- *(yyvsp[-5].String) += " " + *(yyvsp[-4].Type).newTy + ", " + *(yyvsp[-2].Type).newTy + " " + *(yyvsp[-1].Value).val;
+ 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);
- (yyvsp[-4].Type).destroy(); (yyvsp[-2].Type).destroy(); (yyvsp[-1].Value).destroy(); delete (yyvsp[0].String);
- (yyval.String) = (yyvsp[-5].String);
+ (yyval.Value).val = (yyvsp[-5].String);
+ (yyval.Value).type = (yyvsp[-4].Type)->getPointerType();
+ delete (yyvsp[-4].Type); delete (yyvsp[-2].Type); (yyvsp[-1].Value).destroy(); delete (yyvsp[0].String);
;}
break;
case 296:
-#line 1362 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1487 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
- *(yyvsp[-2].String) += " " + *(yyvsp[-1].Type).newTy;
+ *(yyvsp[-2].String) += " " + (yyvsp[-1].Type)->getNewTy();
if (!(yyvsp[0].String)->empty())
*(yyvsp[-2].String) += " " + *(yyvsp[0].String);
- (yyvsp[-1].Type).destroy(); delete (yyvsp[0].String);
- (yyval.String) = (yyvsp[-2].String);
+ (yyval.Value).val = (yyvsp[-2].String);
+ (yyval.Value).type = (yyvsp[-1].Type)->getPointerType();
+ delete (yyvsp[-1].Type); delete (yyvsp[0].String);
;}
break;
case 297:
-#line 1369 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1495 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
- *(yyvsp[-5].String) += " " + *(yyvsp[-4].Type).newTy + ", " + *(yyvsp[-2].Type).newTy + " " + *(yyvsp[-1].Value).val;
+ 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);
- (yyvsp[-4].Type).destroy(); (yyvsp[-2].Type).destroy(); (yyvsp[-1].Value).destroy(); delete (yyvsp[0].String);
- (yyval.String) = (yyvsp[-5].String);
+ (yyval.Value).val = (yyvsp[-5].String);
+ (yyval.Value).type = (yyvsp[-4].Type)->getPointerType();
+ delete (yyvsp[-4].Type); delete (yyvsp[-2].Type); (yyvsp[-1].Value).destroy(); delete (yyvsp[0].String);
;}
break;
case 298:
-#line 1376 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1504 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-1].String) += " " + *(yyvsp[0].Value).val;
+ (yyval.Value).val = (yyvsp[-1].String);
+ (yyval.Value).type = new TypeInfo("void", VoidTy);
(yyvsp[0].Value).destroy();
- (yyval.String) = (yyvsp[-1].String);
;}
break;
case 299:
-#line 1381 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1510 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
+ 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).newTy + " " + *(yyvsp[0].Value).val;
- delete (yyvsp[-2].String); (yyvsp[-1].Type).destroy(); (yyvsp[0].Value).destroy();
- (yyval.String) = (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()->clone();
+ delete (yyvsp[-2].String); delete (yyvsp[-1].Type); (yyvsp[0].Value).destroy();
;}
break;
case 300:
-#line 1388 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1519 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
+ 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).newTy + " " + *(yyvsp[0].Value).val;
- delete (yyvsp[-4].String); (yyvsp[-3].Value).destroy(); (yyvsp[-1].Type).destroy(); (yyvsp[0].Value).destroy();
- (yyval.String) = (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 = new TypeInfo("void", VoidTy);
+ delete (yyvsp[-4].String); (yyvsp[-3].Value).destroy(); delete (yyvsp[-1].Type); (yyvsp[0].Value).destroy();
;}
break;
case 301:
-#line 1395 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1528 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
+ 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) {
+ if (VI.type->isUnsigned() && !VI.isConstant() &&
+ VI.type->getBitWidth() < 64) {
std::string* old = VI.val;
*O << " %gep_upgrade" << unique << " = zext " << *old
<< " to i64\n";
VI.val = new std::string("i64 %gep_upgrade" + llvm::utostr(unique++));
- VI.type.oldTy = ULongTy;
- delete old;
+ VI.type->setOldTy(ULongTy);
}
}
- *(yyvsp[-3].String) += " " + *(yyvsp[-2].Type).newTy + " " + *(yyvsp[-1].Value).val;
+ *(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;
- VI.destroy();
}
- (yyvsp[-2].Type).destroy(); (yyvsp[-1].Value).destroy(); delete (yyvsp[0].ValList);
- (yyval.String) = (yyvsp[-3].String);
+ (yyval.Value).val = (yyvsp[-3].String);
+ (yyval.Value).type = getGEPIndexedType((yyvsp[-2].Type),(yyvsp[0].ValList));
+ (yyvsp[-1].Value).destroy(); delete (yyvsp[0].ValList);
;}
break;
@@ -3924,7 +4056,7 @@
}
/* Line 1126 of yacc.c. */
-#line 3928 "UpgradeParser.tab.c"
+#line 4060 "UpgradeParser.tab.c"
yyvsp -= yylen;
yyssp -= yylen;
@@ -4192,7 +4324,7 @@
}
-#line 1419 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1552 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
int yyerror(const char *ErrorMsg) {
Index: llvm/tools/llvm-upgrade/UpgradeParser.cpp.cvs
diff -u llvm/tools/llvm-upgrade/UpgradeParser.cpp.cvs:1.28 llvm/tools/llvm-upgrade/UpgradeParser.cpp.cvs:1.29
--- llvm/tools/llvm-upgrade/UpgradeParser.cpp.cvs:1.28 Sun Dec 31 19:20:41 2006
+++ llvm/tools/llvm-upgrade/UpgradeParser.cpp.cvs Mon Jan 1 23:45:11 2007
@@ -371,12 +371,10 @@
#line 14 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
#include "ParserInternals.h"
-#include <llvm/ADT/StringExtras.h>
#include <algorithm>
#include <map>
#include <utility>
#include <iostream>
-#include <cassert>
#define YYERROR_VERBOSE 1
#define YYINCLUDED_STDLIB_H
@@ -436,71 +434,72 @@
}
}
-static void ResolveType(TypeInfo& Ty) {
- if (Ty.oldTy == UnresolvedTy) {
- TypeMap::iterator I = NamedTypes.find(*Ty.newTy);
+TypeInfo* ResolveType(TypeInfo*& Ty) {
+ if (Ty->isUnresolved()) {
+ TypeMap::iterator I = NamedTypes.find(Ty->getNewTy());
if (I != NamedTypes.end()) {
- Ty.oldTy = I->second.oldTy;
- Ty.elemTy = I->second.elemTy;
+ Ty = I->second.clone();
+ return Ty;
} else {
- std::string msg("Can't resolve type: ");
- msg += *Ty.newTy;
+ std::string msg("Cannot resolve type: ");
+ msg += Ty->getNewTy();
yyerror(msg.c_str());
}
- } else if (Ty.oldTy == NumericTy) {
- unsigned ref = atoi(&((Ty.newTy->c_str())[1])); // Skip the '\\'
+ } else if (Ty->isNumeric()) {
+ unsigned ref = atoi(&((Ty->getNewTy().c_str())[1])); // Skip the '\\'
if (ref < EnumeratedTypes.size()) {
- Ty.oldTy = EnumeratedTypes[ref].oldTy;
- Ty.elemTy = EnumeratedTypes[ref].elemTy;
+ Ty = EnumeratedTypes[ref].clone();
+ return Ty;
} else {
std::string msg("Can't resolve type: ");
- msg += *Ty.newTy;
+ msg += Ty->getNewTy();
yyerror(msg.c_str());
}
}
// otherwise its already resolved.
+ return Ty;
}
static const char* getCastOpcode(
- std::string& Source, const TypeInfo& SrcTy, const TypeInfo& DstTy)
+ std::string& Source, const TypeInfo* SrcTy, const TypeInfo* DstTy)
{
- unsigned SrcBits = SrcTy.getBitWidth();
- unsigned DstBits = DstTy.getBitWidth();
+ unsigned SrcBits = SrcTy->getBitWidth();
+ unsigned DstBits = DstTy->getBitWidth();
const char* opcode = "bitcast";
// Run through the possibilities ...
- if (DstTy.isIntegral()) { // Casting to integral
- if (SrcTy.isIntegral()) { // Casting from integral
+ if (DstTy->isIntegral()) { // Casting to integral
+ if (SrcTy->isIntegral()) { // Casting from integral
if (DstBits < SrcBits)
opcode = "trunc";
else if (DstBits > SrcBits) { // its an extension
- if (SrcTy.isSigned())
+ if (SrcTy->isSigned())
opcode ="sext"; // signed -> SEXT
else
opcode = "zext"; // unsigned -> ZEXT
} else {
opcode = "bitcast"; // Same size, No-op cast
}
- } else if (SrcTy.isFloatingPoint()) { // Casting from floating pt
- if (DstTy.isSigned())
+ } else if (SrcTy->isFloatingPoint()) { // Casting from floating pt
+ if (DstTy->isSigned())
opcode = "fptosi"; // FP -> sint
else
opcode = "fptoui"; // FP -> uint
- } else if (SrcTy.isPacked()) {
- assert(DstBits == SrcTy.getBitWidth() &&
+ } else if (SrcTy->isPacked()) {
+ assert(DstBits == SrcTy->getBitWidth() &&
"Casting packed to integer of different width");
opcode = "bitcast"; // same size, no-op cast
} else {
- assert(SrcTy.isPointer() &&
+ assert(SrcTy->isPointer() &&
"Casting from a value that is not first-class type");
opcode = "ptrtoint"; // ptr -> int
}
- } else if (DstTy.isFloatingPoint()) { // Casting to floating pt
- if (SrcTy.isIntegral()) { // Casting from integral
- if (SrcTy.isSigned())
+ } else if (DstTy->isFloatingPoint()) { // Casting to floating pt
+ if (SrcTy->isIntegral()) { // Casting from integral
+ if (SrcTy->isSigned())
opcode = "sitofp"; // sint -> FP
else
opcode = "uitofp"; // uint -> FP
- } else if (SrcTy.isFloatingPoint()) { // Casting from floating pt
+ } else if (SrcTy->isFloatingPoint()) { // Casting from floating pt
if (DstBits < SrcBits) {
opcode = "fptrunc"; // FP -> smaller FP
} else if (DstBits > SrcBits) {
@@ -508,27 +507,27 @@
} else {
opcode ="bitcast"; // same size, no-op cast
}
- } else if (SrcTy.isPacked()) {
- assert(DstBits == SrcTy.getBitWidth() &&
+ } else if (SrcTy->isPacked()) {
+ assert(DstBits == SrcTy->getBitWidth() &&
"Casting packed to floating point of different width");
opcode = "bitcast"; // same size, no-op cast
} else {
assert(0 && "Casting pointer or non-first class to float");
}
- } else if (DstTy.isPacked()) {
- if (SrcTy.isPacked()) {
- assert(DstTy.getBitWidth() == SrcTy.getBitWidth() &&
+ } else if (DstTy->isPacked()) {
+ if (SrcTy->isPacked()) {
+ assert(DstTy->getBitWidth() == SrcTy->getBitWidth() &&
"Casting packed to packed of different widths");
opcode = "bitcast"; // packed -> packed
- } else if (DstTy.getBitWidth() == SrcBits) {
+ } else if (DstTy->getBitWidth() == SrcBits) {
opcode = "bitcast"; // float/int -> packed
} else {
assert(!"Illegal cast to packed (wrong type or size)");
}
- } else if (DstTy.isPointer()) {
- if (SrcTy.isPointer()) {
+ } else if (DstTy->isPointer()) {
+ if (SrcTy->isPointer()) {
opcode = "bitcast"; // ptr -> ptr
- } else if (SrcTy.isIntegral()) {
+ } else if (SrcTy->isIntegral()) {
opcode = "inttoptr"; // int -> ptr
} else {
assert(!"Casting invalid type to pointer");
@@ -539,12 +538,12 @@
return opcode;
}
-static std::string getCastUpgrade(
- const std::string& Src, TypeInfo& SrcTy, TypeInfo& DstTy, bool isConst)
+static std::string getCastUpgrade(const std::string& Src, TypeInfo* SrcTy,
+ TypeInfo* DstTy, bool isConst)
{
std::string Result;
std::string Source = Src;
- if (SrcTy.isFloatingPoint() && DstTy.isPointer()) {
+ if (SrcTy->isFloatingPoint() && DstTy->isPointer()) {
// fp -> ptr cast is no longer supported but we must upgrade this
// by doing a double cast: fp -> int -> ptr
if (isConst)
@@ -555,16 +554,16 @@
Source = "i64 %cast_upgrade" + llvm::utostr(unique);
}
// Update the SrcTy for the getCastOpcode call below
- SrcTy.destroy();
- SrcTy.newTy = new std::string("i64");
- SrcTy.oldTy = ULongTy;
- } else if (DstTy.oldTy == BoolTy && SrcTy.oldTy != BoolTy) {
- // cast ptr %x to bool was previously defined as setne ptr %x, null
- // The ptrtoint semantic is to truncate, not compare so we must retain
- // the original intent by replace the cast with a setne
- const char* comparator = SrcTy.isPointer() ? ", null" :
- (SrcTy.isFloatingPoint() ? ", 0.0" : ", 0");
- const char* compareOp = SrcTy.isFloatingPoint() ? "fcmp one " : "icmp ne ";
+ delete SrcTy;
+ SrcTy = new TypeInfo("i64", ULongTy);
+ } else if (DstTy->isBool()) {
+ // cast type %x to bool was previously defined as setne type %x, null
+ // The cast semantic is now to truncate, not compare so we must retain
+ // the original intent by replacing the cast with a setne
+ const char* comparator = SrcTy->isPointer() ? ", null" :
+ (SrcTy->isFloatingPoint() ? ", 0.0" :
+ (SrcTy->isBool() ? ", false" : ", 0"));
+ const char* compareOp = SrcTy->isFloatingPoint() ? "fcmp one " : "icmp ne ";
if (isConst) {
Result = "(" + Source + comparator + ")";
Result = compareOp + Result;
@@ -576,33 +575,32 @@
ResolveType(DstTy);
std::string Opcode(getCastOpcode(Source, SrcTy, DstTy));
if (isConst)
- Result += Opcode + "( " + Source + " to " + *DstTy.newTy + ")";
+ Result += Opcode + "( " + Source + " to " + DstTy->getNewTy() + ")";
else
- Result += Opcode + " " + Source + " to " + *DstTy.newTy;
+ Result += Opcode + " " + Source + " to " + DstTy->getNewTy();
return Result;
}
-const char* getDivRemOpcode(const std::string& opcode, const TypeInfo& TI) {
+const char* getDivRemOpcode(const std::string& opcode, TypeInfo* TI) {
const char* op = opcode.c_str();
- TypeInfo Ty = TI;
- ResolveType(Ty);
- if (Ty.isPacked())
- Ty.oldTy = Ty.getElementType();
+ const TypeInfo* Ty = ResolveType(TI);
+ if (Ty->isPacked())
+ Ty = Ty->getElementType();
if (opcode == "div")
- if (Ty.isFloatingPoint())
+ if (Ty->isFloatingPoint())
op = "fdiv";
- else if (Ty.isUnsigned())
+ else if (Ty->isUnsigned())
op = "udiv";
- else if (Ty.isSigned())
+ else if (Ty->isSigned())
op = "sdiv";
else
yyerror("Invalid type for div instruction");
else if (opcode == "rem")
- if (Ty.isFloatingPoint())
+ if (Ty->isFloatingPoint())
op = "frem";
- else if (Ty.isUnsigned())
+ else if (Ty->isUnsigned())
op = "urem";
- else if (Ty.isSigned())
+ else if (Ty->isSigned())
op = "srem";
else
yyerror("Invalid type for rem instruction");
@@ -610,7 +608,7 @@
}
std::string
-getCompareOp(const std::string& setcc, const TypeInfo& TI) {
+getCompareOp(const std::string& setcc, const TypeInfo* TI) {
assert(setcc.length() == 5);
char cc1 = setcc[3];
char cc2 = setcc[4];
@@ -619,20 +617,20 @@
std::string result("xcmp xxx");
result[6] = cc1;
result[7] = cc2;
- if (TI.isFloatingPoint()) {
+ if (TI->isFloatingPoint()) {
result[0] = 'f';
result[5] = 'o';
if (cc1 == 'n')
result[5] = 'u'; // NE maps to unordered
else
result[5] = 'o'; // everything else maps to ordered
- } else if (TI.isIntegral() || TI.isPointer()) {
+ } else if (TI->isIntegral() || TI->isPointer()) {
result[0] = 'i';
if ((cc1 == 'e' && cc2 == 'q') || (cc1 == 'n' && cc2 == 'e'))
result.erase(5,1);
- else if (TI.isSigned())
+ else if (TI->isSigned())
result[5] = 's';
- else if (TI.isUnsigned() || TI.isPointer() || TI.isBool())
+ else if (TI->isUnsigned() || TI->isPointer() || TI->isBool())
result[5] = 'u';
else
yyerror("Invalid integral type for setcc");
@@ -640,6 +638,76 @@
return result;
}
+static TypeInfo* getFunctionReturnType(TypeInfo* PFTy) {
+ ResolveType(PFTy);
+ if (PFTy->isPointer()) {
+ TypeInfo* ElemTy = PFTy->getElementType();
+ ResolveType(ElemTy);
+ if (ElemTy->isFunction())
+ return ElemTy->getResultType()->clone();
+ } else if (PFTy->isFunction()) {
+ return PFTy->getResultType()->clone();
+ }
+ return PFTy->clone();
+}
+
+static TypeInfo* getGEPIndexedType(TypeInfo* PTy, ValueList* idxs) {
+ ResolveType(PTy);
+ assert(PTy->isPointer() && "GEP Operand is not a pointer?");
+ TypeInfo* Result = PTy->getElementType(); // just skip first index
+ ResolveType(Result);
+ for (unsigned i = 1; i < idxs->size(); ++i) {
+ if (Result->isComposite()) {
+ Result = Result->getIndexedType((*idxs)[i]);
+ ResolveType(Result);
+ } else
+ yyerror("Invalid type for index");
+ }
+ return Result->getPointerType();
+}
+
+static std::string makeUniqueName(const std::string *Name, bool isSigned) {
+ const char *suffix = ".u";
+ if (isSigned)
+ suffix = ".s";
+ if ((*Name)[Name->size()-1] == '"') {
+ std::string Result(*Name);
+ Result.insert(Name->size()-1, suffix);
+ return Result;
+ }
+ return *Name + suffix;
+}
+
+// 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, TypeInfo* Ty) {
+ // If its not a symbolic name, don't modify it, probably a constant val.
+ if ((*Name)[0] != '%' && (*Name)[0] != '"')
+ return *Name;
+ // If its a numeric reference, just leave it alone.
+ if (isdigit((*Name)[1]))
+ return *Name;
+
+ // Resolve the type
+ ResolveType(Ty);
+
+ // Default the result to the current name
+ std::string Result = *Name;
+
+ if (Ty->isInteger()) {
+ // If its an integer type, make the name unique
+ Result = makeUniqueName(Name, Ty->isSigned());
+ } else if (Ty->isPointer()) {
+ while (Ty->isPointer())
+ Ty = Ty->getElementType();
+ if (Ty->isInteger())
+ Result = makeUniqueName(Name, Ty->isSigned());
+ }
+ return Result;
+}
+
/* Enabling traces. */
@@ -661,16 +729,17 @@
#endif
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
-#line 289 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 357 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
typedef union YYSTYPE {
std::string* String;
- TypeInfo Type;
+ TypeInfo* Type;
ValueInfo Value;
ConstInfo Const;
ValueList* ValList;
+ TypeList* TypeVec;
} YYSTYPE;
/* Line 196 of yacc.c. */
-#line 674 "UpgradeParser.tab.c"
+#line 743 "UpgradeParser.tab.c"
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1
@@ -682,7 +751,7 @@
/* Line 219 of yacc.c. */
-#line 686 "UpgradeParser.tab.c"
+#line 755 "UpgradeParser.tab.c"
#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
# define YYSIZE_T __SIZE_TYPE__
@@ -1038,37 +1107,37 @@
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const unsigned short int yyrline[] =
{
- 0, 352, 352, 352, 353, 353, 357, 357, 357, 357,
- 357, 357, 357, 358, 358, 358, 358, 359, 359, 359,
- 360, 360, 360, 360, 360, 360, 361, 361, 361, 361,
- 361, 361, 361, 361, 361, 361, 362, 362, 362, 362,
- 362, 362, 362, 362, 362, 362, 363, 363, 363, 363,
- 363, 363, 364, 364, 364, 364, 365, 365, 365, 365,
- 365, 365, 365, 366, 366, 366, 366, 366, 366, 371,
- 371, 371, 371, 372, 372, 372, 372, 373, 373, 374,
- 374, 377, 380, 385, 385, 385, 385, 385, 385, 386,
- 387, 390, 390, 390, 390, 390, 391, 392, 397, 402,
- 403, 406, 407, 415, 421, 422, 425, 426, 435, 436,
- 449, 449, 450, 450, 451, 455, 455, 455, 455, 455,
- 455, 455, 456, 456, 456, 456, 456, 458, 462, 466,
- 469, 474, 480, 488, 496, 502, 506, 512, 516, 527,
- 530, 538, 539, 544, 547, 557, 563, 568, 574, 580,
- 586, 591, 597, 603, 609, 615, 621, 627, 633, 639,
- 645, 653, 667, 679, 684, 690, 695, 701, 706, 711,
- 719, 724, 729, 739, 744, 749, 749, 759, 764, 767,
- 772, 776, 780, 782, 782, 785, 797, 802, 807, 816,
- 825, 834, 843, 848, 853, 858, 860, 860, 863, 868,
- 875, 880, 887, 894, 899, 900, 908, 908, 909, 909,
- 911, 918, 922, 926, 929, 934, 937, 940, 959, 960,
- 963, 974, 975, 977, 985, 986, 987, 991, 1004, 1005,
- 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1009, 1010, 1015,
- 1016, 1025, 1025, 1029, 1035, 1046, 1052, 1055, 1063, 1067,
- 1072, 1075, 1081, 1081, 1083, 1088, 1093, 1098, 1106, 1113,
- 1119, 1139, 1144, 1150, 1155, 1163, 1180, 1187, 1195, 1199,
- 1206, 1207, 1211, 1216, 1219, 1225, 1230, 1236, 1241, 1246,
- 1251, 1259, 1287, 1292, 1297, 1302, 1307, 1312, 1317, 1334,
- 1339, 1340, 1344, 1345, 1348, 1355, 1362, 1369, 1376, 1381,
- 1388, 1395
+ 0, 422, 422, 422, 423, 423, 427, 427, 427, 427,
+ 427, 427, 427, 428, 428, 428, 428, 429, 429, 429,
+ 430, 430, 430, 430, 430, 430, 431, 431, 431, 431,
+ 431, 431, 431, 431, 431, 431, 432, 432, 432, 432,
+ 432, 432, 432, 432, 432, 432, 433, 433, 433, 433,
+ 433, 433, 434, 434, 434, 434, 435, 435, 435, 435,
+ 435, 435, 435, 436, 436, 436, 436, 436, 436, 441,
+ 441, 441, 441, 442, 442, 442, 442, 443, 443, 444,
+ 444, 447, 450, 455, 455, 455, 455, 455, 455, 456,
+ 457, 460, 460, 460, 460, 460, 461, 462, 467, 472,
+ 473, 476, 477, 485, 491, 492, 495, 496, 505, 506,
+ 519, 519, 520, 520, 521, 525, 525, 525, 525, 525,
+ 525, 525, 526, 526, 526, 526, 526, 528, 531, 534,
+ 537, 541, 555, 562, 569, 580, 584, 595, 599, 608,
+ 612, 619, 620, 625, 630, 640, 646, 651, 657, 663,
+ 669, 674, 680, 686, 693, 699, 705, 711, 717, 723,
+ 729, 737, 750, 762, 767, 773, 778, 784, 789, 794,
+ 802, 807, 812, 822, 827, 832, 832, 842, 847, 850,
+ 855, 859, 863, 865, 865, 868, 878, 883, 888, 898,
+ 908, 918, 928, 933, 938, 943, 945, 945, 948, 953,
+ 960, 965, 972, 979, 984, 985, 993, 993, 994, 994,
+ 996, 1005, 1009, 1013, 1016, 1021, 1024, 1027, 1045, 1046,
+ 1049, 1060, 1061, 1063, 1072, 1073, 1074, 1078, 1091, 1092,
+ 1095, 1095, 1095, 1095, 1095, 1095, 1095, 1096, 1097, 1102,
+ 1103, 1112, 1112, 1116, 1121, 1131, 1140, 1143, 1151, 1155,
+ 1160, 1163, 1169, 1169, 1171, 1176, 1181, 1186, 1195, 1203,
+ 1210, 1233, 1238, 1244, 1250, 1258, 1276, 1284, 1293, 1297,
+ 1304, 1305, 1309, 1314, 1317, 1326, 1334, 1343, 1351, 1359,
+ 1364, 1373, 1401, 1407, 1413, 1420, 1426, 1432, 1438, 1456,
+ 1461, 1462, 1466, 1467, 1470, 1478, 1487, 1495, 1504, 1510,
+ 1519, 1528
};
#endif
@@ -2417,26 +2486,26 @@
switch (yyn)
{
case 81:
-#line 377 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 447 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.String) = (yyvsp[-1].String);
;}
break;
case 82:
-#line 380 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 450 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.String) = new std::string("");
;}
break;
case 90:
-#line 387 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 457 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string(""); ;}
break;
case 97:
-#line 392 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 462 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-1].String) += *(yyvsp[0].String);
delete (yyvsp[0].String);
@@ -2445,27 +2514,27 @@
break;
case 98:
-#line 397 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 467 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string(""); ;}
break;
case 99:
-#line 402 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 472 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string(); ;}
break;
case 100:
-#line 403 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 473 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ *(yyvsp[-1].String) += " " + *(yyvsp[0].String); delete (yyvsp[0].String); (yyval.String) = (yyvsp[-1].String); ;}
break;
case 101:
-#line 406 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 476 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string(); ;}
break;
case 102:
-#line 407 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 477 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyvsp[-1].String)->insert(0, ", ");
*(yyvsp[-1].String) += " " + *(yyvsp[0].String);
@@ -2475,7 +2544,7 @@
break;
case 103:
-#line 415 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 485 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-1].String) += " " + *(yyvsp[0].String);
delete (yyvsp[0].String);
@@ -2484,17 +2553,17 @@
break;
case 104:
-#line 421 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 491 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string(); ;}
break;
case 106:
-#line 425 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 495 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string(); ;}
break;
case 107:
-#line 426 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 496 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyvsp[-1].String)->insert(0, ", ");
if (!(yyvsp[0].String)->empty())
@@ -2505,7 +2574,7 @@
break;
case 109:
-#line 436 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 506 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-1].String) += " " + *(yyvsp[0].String);
delete (yyvsp[0].String);
@@ -2514,334 +2583,347 @@
break;
case 127:
-#line 458 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 528 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
- (yyval.Type).newTy = (yyvsp[0].String);
- (yyval.Type).oldTy = OpaqueTy;
+ (yyval.Type) = new TypeInfo((yyvsp[0].String), OpaqueTy);
;}
break;
case 128:
-#line 462 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 531 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
- (yyval.Type).newTy = (yyvsp[0].String);
- (yyval.Type).oldTy = UnresolvedTy;
+ (yyval.Type) = new TypeInfo((yyvsp[0].String), UnresolvedTy);
;}
break;
case 129:
-#line 466 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 534 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.Type) = (yyvsp[0].Type);
;}
break;
case 130:
-#line 469 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 537 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Type UpReference
(yyvsp[0].String)->insert(0, "\\");
- (yyval.Type).newTy = (yyvsp[0].String);
- (yyval.Type).oldTy = NumericTy;
+ (yyval.Type) = new TypeInfo((yyvsp[0].String), NumericTy);
;}
break;
case 131:
-#line 474 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 541 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Function derived type?
- *(yyvsp[-3].Type).newTy += "( " + *(yyvsp[-1].String) + " )";
- delete (yyvsp[-1].String);
- (yyval.Type).newTy = (yyvsp[-3].Type).newTy;
- (yyval.Type).oldTy = FunctionTy;
+ std::string newTy( (yyvsp[-3].Type)->getNewTy() + "(");
+ for (unsigned i = 0; i < (yyvsp[-1].TypeVec)->size(); ++i) {
+ if (i != 0)
+ newTy += ", ";
+ if ((*(yyvsp[-1].TypeVec))[i]->isVoid())
+ newTy += "...";
+ else
+ newTy += (*(yyvsp[-1].TypeVec))[i]->getNewTy();
+ }
+ newTy += ")";
+ (yyval.Type) = new TypeInfo(new std::string(newTy), (yyvsp[-3].Type), (yyvsp[-1].TypeVec));
+ EnumeratedTypes.push_back(*(yyval.Type));
;}
break;
case 132:
-#line 480 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 555 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Sized array type?
(yyvsp[-3].String)->insert(0,"[ ");
- *(yyvsp[-3].String) += " x " + *(yyvsp[-1].Type).newTy + " ]";
- delete (yyvsp[-1].Type).newTy;
- (yyval.Type).newTy = (yyvsp[-3].String);
- (yyval.Type).oldTy = ArrayTy;
- (yyval.Type).elemTy = (yyvsp[-1].Type).oldTy;
+ *(yyvsp[-3].String) += " x " + (yyvsp[-1].Type)->getNewTy() + " ]";
+ uint64_t elems = atoi((yyvsp[-3].String)->c_str());
+ (yyval.Type) = new TypeInfo((yyvsp[-3].String), ArrayTy, (yyvsp[-1].Type), elems);
+ EnumeratedTypes.push_back(*(yyval.Type));
;}
break;
case 133:
-#line 488 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 562 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Packed array type?
(yyvsp[-3].String)->insert(0,"< ");
- *(yyvsp[-3].String) += " x " + *(yyvsp[-1].Type).newTy + " >";
- delete (yyvsp[-1].Type).newTy;
- (yyval.Type).newTy = (yyvsp[-3].String);
- (yyval.Type).oldTy = PackedTy;
- (yyval.Type).elemTy = (yyvsp[-1].Type).oldTy;
+ *(yyvsp[-3].String) += " x " + (yyvsp[-1].Type)->getNewTy() + " >";
+ uint64_t elems = atoi((yyvsp[-3].String)->c_str());
+ (yyval.Type) = new TypeInfo((yyvsp[-3].String), PackedTy, (yyvsp[-1].Type), elems);
+ EnumeratedTypes.push_back(*(yyval.Type));
;}
break;
case 134:
-#line 496 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 569 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Structure type?
- (yyvsp[-1].String)->insert(0, "{ ");
- *(yyvsp[-1].String) += " }";
- (yyval.Type).newTy = (yyvsp[-1].String);
- (yyval.Type).oldTy = StructTy;
+ std::string newTy("{");
+ for (unsigned i = 0; i < (yyvsp[-1].TypeVec)->size(); ++i) {
+ if (i != 0)
+ newTy += ", ";
+ newTy += (*(yyvsp[-1].TypeVec))[i]->getNewTy();
+ }
+ newTy += "}";
+ (yyval.Type) = new TypeInfo(new std::string(newTy), StructTy, (yyvsp[-1].TypeVec));
+ EnumeratedTypes.push_back(*(yyval.Type));
;}
break;
case 135:
-#line 502 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 580 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Empty structure type?
- (yyval.Type).newTy = new std::string("{}");
- (yyval.Type).oldTy = StructTy;
+ (yyval.Type) = new TypeInfo(new std::string("{}"), StructTy, new TypeList());
+ EnumeratedTypes.push_back(*(yyval.Type));
;}
break;
case 136:
-#line 506 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 584 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Packed Structure type?
- (yyvsp[-2].String)->insert(0, "<{ ");
- *(yyvsp[-2].String) += " }>";
- (yyval.Type).newTy = (yyvsp[-2].String);
- (yyval.Type).oldTy = StructTy;
+ std::string newTy("<{");
+ for (unsigned i = 0; i < (yyvsp[-2].TypeVec)->size(); ++i) {
+ if (i != 0)
+ newTy += ", ";
+ newTy += (*(yyvsp[-2].TypeVec))[i]->getNewTy();
+ }
+ newTy += "}>";
+ (yyval.Type) = new TypeInfo(new std::string(newTy), PackedStructTy, (yyvsp[-2].TypeVec));
+ EnumeratedTypes.push_back(*(yyval.Type));
;}
break;
case 137:
-#line 512 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 595 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Empty packed structure type?
- (yyval.Type).newTy = new std::string("<{}>");
- (yyval.Type).oldTy = StructTy;
+ (yyval.Type) = new TypeInfo(new std::string("<{}>"), PackedStructTy, new TypeList());
+ EnumeratedTypes.push_back(*(yyval.Type));
;}
break;
case 138:
-#line 516 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 599 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Pointer type?
- *(yyvsp[-1].Type).newTy += '*';
- (yyval.Type).elemTy = (yyvsp[-1].Type).oldTy;
- (yyvsp[-1].Type).oldTy = PointerTy;
- (yyval.Type) = (yyvsp[-1].Type);
+ (yyval.Type) = (yyvsp[-1].Type)->getPointerType();
+ EnumeratedTypes.push_back(*(yyval.Type));
;}
break;
case 139:
-#line 527 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 608 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
- (yyval.String) = (yyvsp[0].Type).newTy;
+ (yyval.TypeVec) = new TypeList();
+ (yyval.TypeVec)->push_back((yyvsp[0].Type));
;}
break;
case 140:
-#line 530 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 612 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
- *(yyvsp[-2].String) += ", " + *(yyvsp[0].Type).newTy;
- delete (yyvsp[0].Type).newTy;
- (yyval.String) = (yyvsp[-2].String);
+ (yyval.TypeVec) = (yyvsp[-2].TypeVec);
+ (yyval.TypeVec)->push_back((yyvsp[0].Type));
;}
break;
case 142:
-#line 539 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 620 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
- *(yyvsp[-2].String) += ", ...";
+ (yyval.TypeVec) = (yyvsp[-2].TypeVec);
+ (yyval.TypeVec)->push_back(new TypeInfo("void",VoidTy));
delete (yyvsp[0].String);
- (yyval.String) = (yyvsp[-2].String);
;}
break;
case 143:
-#line 544 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 625 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
- (yyval.String) = (yyvsp[0].String);
+ (yyval.TypeVec) = new TypeList();
+ (yyval.TypeVec)->push_back(new TypeInfo("void",VoidTy));
+ delete (yyvsp[0].String);
;}
break;
case 144:
-#line 547 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 630 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
- (yyval.String) = new std::string();
+ (yyval.TypeVec) = new TypeList();
;}
break;
case 145:
-#line 557 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 640 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Nonempty unsized arr
(yyval.Const).type = (yyvsp[-3].Type);
- (yyval.Const).cnst = new std::string(*(yyvsp[-3].Type).newTy);
+ (yyval.Const).cnst = new std::string((yyvsp[-3].Type)->getNewTy());
*(yyval.Const).cnst += " [ " + *(yyvsp[-1].String) + " ]";
delete (yyvsp[-1].String);
;}
break;
case 146:
-#line 563 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 646 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.Const).type = (yyvsp[-2].Type);
- (yyval.Const).cnst = new std::string(*(yyvsp[-2].Type).newTy);
+ (yyval.Const).cnst = new std::string((yyvsp[-2].Type)->getNewTy());
*(yyval.Const).cnst += "[ ]";
;}
break;
case 147:
-#line 568 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 651 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.Const).type = (yyvsp[-2].Type);
- (yyval.Const).cnst = new std::string(*(yyvsp[-2].Type).newTy);
+ (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 574 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 657 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Nonempty unsized arr
(yyval.Const).type = (yyvsp[-3].Type);
- (yyval.Const).cnst = new std::string(*(yyvsp[-3].Type).newTy);
+ (yyval.Const).cnst = new std::string((yyvsp[-3].Type)->getNewTy());
*(yyval.Const).cnst += " < " + *(yyvsp[-1].String) + " >";
delete (yyvsp[-1].String);
;}
break;
case 149:
-#line 580 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 663 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.Const).type = (yyvsp[-3].Type);
- (yyval.Const).cnst = new std::string(*(yyvsp[-3].Type).newTy);
+ (yyval.Const).cnst = new std::string((yyvsp[-3].Type)->getNewTy());
*(yyval.Const).cnst += " { " + *(yyvsp[-1].String) + " }";
delete (yyvsp[-1].String);
;}
break;
case 150:
-#line 586 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 669 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.Const).type = (yyvsp[-2].Type);
- (yyval.Const).cnst = new std::string(*(yyvsp[-2].Type).newTy);
+ (yyval.Const).cnst = new std::string((yyvsp[-2].Type)->getNewTy());
*(yyval.Const).cnst += " {}";
;}
break;
case 151:
-#line 591 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 674 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.Const).type = (yyvsp[-1].Type);
- (yyval.Const).cnst = new std::string(*(yyvsp[-1].Type).newTy);
+ (yyval.Const).cnst = new std::string((yyvsp[-1].Type)->getNewTy());
*(yyval.Const).cnst += " " + *(yyvsp[0].String);
delete (yyvsp[0].String);
;}
break;
case 152:
-#line 597 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 680 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.Const).type = (yyvsp[-1].Type);
- (yyval.Const).cnst = new std::string(*(yyvsp[-1].Type).newTy);
+ (yyval.Const).cnst = new std::string((yyvsp[-1].Type)->getNewTy());
*(yyval.Const).cnst += " " + *(yyvsp[0].String);
delete (yyvsp[0].String);
;}
break;
case 153:
-#line 603 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 686 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
+ std::string Name = getUniqueName((yyvsp[0].String),(yyvsp[-1].Type));
(yyval.Const).type = (yyvsp[-1].Type);
- (yyval.Const).cnst = new std::string(*(yyvsp[-1].Type).newTy);
- *(yyval.Const).cnst += " " + *(yyvsp[0].String);
+ (yyval.Const).cnst = new std::string((yyvsp[-1].Type)->getNewTy());
+ *(yyval.Const).cnst += " " + Name;
delete (yyvsp[0].String);
;}
break;
case 154:
-#line 609 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 693 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.Const).type = (yyvsp[-1].Type);
- (yyval.Const).cnst = new std::string(*(yyvsp[-1].Type).newTy);
+ (yyval.Const).cnst = new std::string((yyvsp[-1].Type)->getNewTy());
*(yyval.Const).cnst += " " + *(yyvsp[0].String);
delete (yyvsp[0].String);
;}
break;
case 155:
-#line 615 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 699 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.Const).type = (yyvsp[-1].Type);
- (yyval.Const).cnst = new std::string(*(yyvsp[-1].Type).newTy);
+ (yyval.Const).cnst = new std::string((yyvsp[-1].Type)->getNewTy());
*(yyval.Const).cnst += " " + *(yyvsp[0].String);
delete (yyvsp[0].String);
;}
break;
case 156:
-#line 621 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 705 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // integral constants
(yyval.Const).type = (yyvsp[-1].Type);
- (yyval.Const).cnst = new std::string(*(yyvsp[-1].Type).newTy);
+ (yyval.Const).cnst = new std::string((yyvsp[-1].Type)->getNewTy());
*(yyval.Const).cnst += " " + *(yyvsp[0].String);
delete (yyvsp[0].String);
;}
break;
case 157:
-#line 627 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 711 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // integral constants
(yyval.Const).type = (yyvsp[-1].Type);
- (yyval.Const).cnst = new std::string(*(yyvsp[-1].Type).newTy);
+ (yyval.Const).cnst = new std::string((yyvsp[-1].Type)->getNewTy());
*(yyval.Const).cnst += " " + *(yyvsp[0].String);
delete (yyvsp[0].String);
;}
break;
case 158:
-#line 633 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 717 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Boolean constants
(yyval.Const).type = (yyvsp[-1].Type);
- (yyval.Const).cnst = new std::string(*(yyvsp[-1].Type).newTy);
+ (yyval.Const).cnst = new std::string((yyvsp[-1].Type)->getNewTy());
*(yyval.Const).cnst += " " + *(yyvsp[0].String);
delete (yyvsp[0].String);
;}
break;
case 159:
-#line 639 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 723 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Boolean constants
(yyval.Const).type = (yyvsp[-1].Type);
- (yyval.Const).cnst = new std::string(*(yyvsp[-1].Type).newTy);
+ (yyval.Const).cnst = new std::string((yyvsp[-1].Type)->getNewTy());
*(yyval.Const).cnst += " " + *(yyvsp[0].String);
delete (yyvsp[0].String);
;}
break;
case 160:
-#line 645 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 729 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Float & Double constants
(yyval.Const).type = (yyvsp[-1].Type);
- (yyval.Const).cnst = new std::string(*(yyvsp[-1].Type).newTy);
+ (yyval.Const).cnst = new std::string((yyvsp[-1].Type)->getNewTy());
*(yyval.Const).cnst += " " + *(yyvsp[0].String);
delete (yyvsp[0].String);
;}
break;
case 161:
-#line 653 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 737 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
std::string source = *(yyvsp[-3].Const).cnst;
- TypeInfo DstTy = (yyvsp[-1].Type);
- ResolveType(DstTy);
+ TypeInfo* DstTy = ResolveType((yyvsp[-1].Type));
if (*(yyvsp[-5].String) == "cast") {
// Call getCastUpgrade to upgrade the old cast
- (yyval.String) = new std::string(getCastUpgrade(source, (yyvsp[-3].Const).type, (yyvsp[-1].Type), true));
+ (yyval.String) = new std::string(getCastUpgrade(source, (yyvsp[-3].Const).type, DstTy, true));
} else {
// Nothing to upgrade, just create the cast constant expr
(yyval.String) = new std::string(*(yyvsp[-5].String));
- *(yyval.String) += "( " + source + " to " + *(yyvsp[-1].Type).newTy + ")";
+ *(yyval.String) += "( " + source + " to " + (yyvsp[-1].Type)->getNewTy() + ")";
}
- delete (yyvsp[-5].String); (yyvsp[-3].Const).destroy(); delete (yyvsp[-2].String); (yyvsp[-1].Type).destroy();
+ delete (yyvsp[-5].String); (yyvsp[-3].Const).destroy(); delete (yyvsp[-2].String); delete (yyvsp[-1].Type);
;}
break;
case 162:
-#line 667 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 750 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-4].String) += "(" + *(yyvsp[-2].Const).cnst;
for (unsigned i = 0; i < (yyvsp[-1].ValList)->size(); ++i) {
@@ -2857,7 +2939,7 @@
break;
case 163:
-#line 679 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 762 "/proj/llvm/llvm-3/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();
@@ -2866,7 +2948,7 @@
break;
case 164:
-#line 684 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 767 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
const char* op = getDivRemOpcode(*(yyvsp[-5].String), (yyvsp[-3].Const).type);
(yyval.String) = new std::string(op);
@@ -2876,7 +2958,7 @@
break;
case 165:
-#line 690 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 773 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-5].String) += "(" + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")";
(yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy();
@@ -2885,7 +2967,7 @@
break;
case 166:
-#line 695 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 778 "/proj/llvm/llvm-3/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 + ")";
@@ -2895,7 +2977,7 @@
break;
case 167:
-#line 701 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 784 "/proj/llvm/llvm-3/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();
@@ -2904,7 +2986,7 @@
break;
case 168:
-#line 706 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 789 "/proj/llvm/llvm-3/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();
@@ -2913,11 +2995,11 @@
break;
case 169:
-#line 711 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 794 "/proj/llvm/llvm-3/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();
@@ -2925,7 +3007,7 @@
break;
case 170:
-#line 719 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 802 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-5].String) += "(" + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")";
(yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy();
@@ -2934,7 +3016,7 @@
break;
case 171:
-#line 724 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 807 "/proj/llvm/llvm-3/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();
@@ -2943,7 +3025,7 @@
break;
case 172:
-#line 729 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 812 "/proj/llvm/llvm-3/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();
@@ -2952,7 +3034,7 @@
break;
case 173:
-#line 739 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 822 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-2].String) += ", " + *(yyvsp[0].Const).cnst;
(yyvsp[0].Const).destroy();
@@ -2961,25 +3043,25 @@
break;
case 174:
-#line 744 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 827 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string(*(yyvsp[0].Const).cnst); (yyvsp[0].Const).destroy(); ;}
break;
case 177:
-#line 759 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 842 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
;}
break;
case 178:
-#line 764 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 847 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.String) = 0;
;}
break;
case 179:
-#line 767 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 850 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*O << *(yyvsp[0].String) << '\n';
delete (yyvsp[0].String);
@@ -2988,7 +3070,7 @@
break;
case 180:
-#line 772 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 855 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*O << "module asm " << ' ' << *(yyvsp[0].String) << '\n';
(yyval.String) = 0;
@@ -2996,7 +3078,7 @@
break;
case 181:
-#line 776 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 859 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*O << "implementation\n";
(yyval.String) = 0;
@@ -3004,33 +3086,31 @@
break;
case 182:
-#line 780 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 863 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = 0; ;}
break;
case 184:
-#line 782 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 865 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = (yyvsp[0].String); *(yyval.String) = "external"; ;}
break;
case 185:
-#line 785 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 868 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
- EnumeratedTypes.push_back((yyvsp[0].Type));
+ EnumeratedTypes.push_back(*(yyvsp[0].Type));
if (!(yyvsp[-2].String)->empty()) {
- NamedTypes[*(yyvsp[-2].String)].newTy = new std::string(*(yyvsp[0].Type).newTy);
- NamedTypes[*(yyvsp[-2].String)].oldTy = (yyvsp[0].Type).oldTy;
- NamedTypes[*(yyvsp[-2].String)].elemTy = (yyvsp[0].Type).elemTy;
+ NamedTypes[*(yyvsp[-2].String)] = *(yyvsp[0].Type);
*O << *(yyvsp[-2].String) << " = ";
}
- *O << "type " << *(yyvsp[0].Type).newTy << '\n';
- delete (yyvsp[-2].String); delete (yyvsp[-1].String); (yyvsp[0].Type).destroy();
+ *O << "type " << (yyvsp[0].Type)->getNewTy() << '\n';
+ delete (yyvsp[-2].String); delete (yyvsp[-1].String);
(yyval.String) = 0;
;}
break;
case 186:
-#line 797 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 878 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Function prototypes can be in const pool
*O << *(yyvsp[0].String) << '\n';
delete (yyvsp[0].String);
@@ -3039,7 +3119,7 @@
break;
case 187:
-#line 802 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 883 "/proj/llvm/llvm-3/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);
@@ -3048,59 +3128,63 @@
break;
case 188:
-#line 807 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 888 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
if (!(yyvsp[-4].String)->empty()) {
- *O << *(yyvsp[-4].String) << " = ";
- Globals[*(yyvsp[-4].String)] = (yyvsp[-1].Const).type.clone();
+ std::string Name = getUniqueName((yyvsp[-4].String),(yyvsp[-1].Const).type);
+ *O << Name << " = ";
+ Globals[Name] = *(yyvsp[-1].Const).type;
}
*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); (yyvsp[-1].Const).destroy(); delete (yyvsp[0].String);
+ delete (yyvsp[-4].String); delete (yyvsp[-3].String); delete (yyvsp[-2].String); delete (yyvsp[0].String);
(yyval.String) = 0;
;}
break;
case 189:
-#line 816 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 898 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
if (!(yyvsp[-4].String)->empty()) {
- *O << *(yyvsp[-4].String) << " = ";
- Globals[*(yyvsp[-4].String)] = (yyvsp[-1].Type).clone();
+ std::string Name = getUniqueName((yyvsp[-4].String),(yyvsp[-1].Type));
+ *O << Name << " = ";
+ Globals[Name] = *(yyvsp[-1].Type);
}
- *O << *(yyvsp[-3].String) << ' ' << *(yyvsp[-2].String) << ' ' << *(yyvsp[-1].Type).newTy << ' ' << *(yyvsp[0].String) << '\n';
- delete (yyvsp[-4].String); delete (yyvsp[-3].String); delete (yyvsp[-2].String); (yyvsp[-1].Type).destroy(); delete (yyvsp[0].String);
+ *O << *(yyvsp[-3].String) << ' ' << *(yyvsp[-2].String) << ' ' << (yyvsp[-1].Type)->getNewTy() << ' ' << *(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 190:
-#line 825 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 908 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
if (!(yyvsp[-4].String)->empty()) {
- *O << *(yyvsp[-4].String) << " = ";
- Globals[*(yyvsp[-4].String)] = (yyvsp[-1].Type).clone();
+ std::string Name = getUniqueName((yyvsp[-4].String),(yyvsp[-1].Type));
+ *O << Name << " = ";
+ Globals[Name] = *(yyvsp[-1].Type);
}
- *O << *(yyvsp[-3].String) << ' ' << *(yyvsp[-2].String) << ' ' << *(yyvsp[-1].Type).newTy << ' ' << *(yyvsp[0].String) << '\n';
- delete (yyvsp[-4].String); delete (yyvsp[-3].String); delete (yyvsp[-2].String); (yyvsp[-1].Type).destroy(); delete (yyvsp[0].String);
+ *O << *(yyvsp[-3].String) << ' ' << *(yyvsp[-2].String) << ' ' << (yyvsp[-1].Type)->getNewTy() << ' ' << *(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 191:
-#line 834 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 918 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
if (!(yyvsp[-4].String)->empty()) {
- *O << *(yyvsp[-4].String) << " = ";
- Globals[*(yyvsp[-4].String)] = (yyvsp[-1].Type).clone();
+ std::string Name = getUniqueName((yyvsp[-4].String),(yyvsp[-1].Type));
+ *O << Name << " = ";
+ Globals[Name] = *(yyvsp[-1].Type);
}
- *O << *(yyvsp[-3].String) << ' ' << *(yyvsp[-2].String) << ' ' << *(yyvsp[-1].Type).newTy << ' ' << *(yyvsp[0].String) << '\n';
- delete (yyvsp[-4].String); delete (yyvsp[-3].String); delete (yyvsp[-2].String); (yyvsp[-1].Type).destroy(); delete (yyvsp[0].String);
+ *O << *(yyvsp[-3].String) << ' ' << *(yyvsp[-2].String) << ' ' << (yyvsp[-1].Type)->getNewTy() << ' ' << *(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 192:
-#line 843 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 928 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*O << *(yyvsp[-1].String) << ' ' << *(yyvsp[0].String) << '\n';
delete (yyvsp[-1].String); delete (yyvsp[0].String);
@@ -3109,7 +3193,7 @@
break;
case 193:
-#line 848 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 933 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*O << *(yyvsp[-2].String) << " = " << *(yyvsp[0].String) << '\n';
delete (yyvsp[-2].String); delete (yyvsp[0].String);
@@ -3118,14 +3202,14 @@
break;
case 194:
-#line 853 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 938 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.String) = 0;
;}
break;
case 198:
-#line 863 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 948 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-2].String) += " = " + *(yyvsp[0].String);
delete (yyvsp[0].String);
@@ -3134,7 +3218,7 @@
break;
case 199:
-#line 868 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 953 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-2].String) += " = " + *(yyvsp[0].String);
if (*(yyvsp[0].String) == "64")
@@ -3145,7 +3229,7 @@
break;
case 200:
-#line 875 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 960 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-2].String) += " = " + *(yyvsp[0].String);
delete (yyvsp[0].String);
@@ -3154,7 +3238,7 @@
break;
case 201:
-#line 880 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 965 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-2].String) += " = " + *(yyvsp[0].String);
delete (yyvsp[0].String);
@@ -3163,7 +3247,7 @@
break;
case 202:
-#line 887 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 972 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyvsp[-1].String)->insert(0, "[ ");
*(yyvsp[-1].String) += " ]";
@@ -3172,7 +3256,7 @@
break;
case 203:
-#line 894 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 979 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-2].String) += ", " + *(yyvsp[0].String);
delete (yyvsp[0].String);
@@ -3181,29 +3265,31 @@
break;
case 205:
-#line 900 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 985 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.String) = new std::string();
;}
break;
case 209:
-#line 909 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 994 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string(); ;}
break;
case 210:
-#line 911 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 996 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
- (yyval.String) = (yyvsp[-1].Type).newTy;
- if (!(yyvsp[0].String)->empty())
- *(yyval.String) += " " + *(yyvsp[0].String);
+ (yyval.String) = new std::string((yyvsp[-1].Type)->getNewTy());
+ if (!(yyvsp[0].String)->empty()) {
+ std::string Name = getUniqueName((yyvsp[0].String), (yyvsp[-1].Type));
+ *(yyval.String) += " " + Name;
+ }
delete (yyvsp[0].String);
;}
break;
case 211:
-#line 918 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1005 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-2].String) += ", " + *(yyvsp[0].String);
delete (yyvsp[0].String);
@@ -3211,21 +3297,21 @@
break;
case 212:
-#line 922 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1009 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.String) = (yyvsp[0].String);
;}
break;
case 213:
-#line 926 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1013 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.String) = (yyvsp[0].String);
;}
break;
case 214:
-#line 929 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1016 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-2].String) += ", ...";
(yyval.String) = (yyvsp[-2].String);
@@ -3234,31 +3320,30 @@
break;
case 215:
-#line 934 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1021 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.String) = (yyvsp[0].String);
;}
break;
case 216:
-#line 937 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1024 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string(); ;}
break;
case 217:
-#line 940 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1027 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
if (!(yyvsp[-7].String)->empty()) {
*(yyvsp[-7].String) += " ";
}
- *(yyvsp[-7].String) += *(yyvsp[-6].Type).newTy + " " + *(yyvsp[-5].String) + "(" + *(yyvsp[-3].String) + ")";
+ *(yyvsp[-7].String) += (yyvsp[-6].Type)->getNewTy() + " " + *(yyvsp[-5].String) + "(" + *(yyvsp[-3].String) + ")";
if (!(yyvsp[-1].String)->empty()) {
*(yyvsp[-7].String) += " " + *(yyvsp[-1].String);
}
if (!(yyvsp[0].String)->empty()) {
*(yyvsp[-7].String) += " " + *(yyvsp[0].String);
}
- (yyvsp[-6].Type).destroy();
delete (yyvsp[-5].String);
delete (yyvsp[-3].String);
delete (yyvsp[-1].String);
@@ -3268,17 +3353,17 @@
break;
case 218:
-#line 959 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1045 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string("{"); delete (yyvsp[0].String); ;}
break;
case 219:
-#line 960 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1046 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string ("{"); ;}
break;
case 220:
-#line 963 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1049 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*O << "define ";
if (!(yyvsp[-2].String)->empty()) {
@@ -3291,32 +3376,33 @@
break;
case 221:
-#line 974 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1060 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string("}"); delete (yyvsp[0].String); ;}
break;
case 222:
-#line 975 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1061 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string("}"); ;}
break;
case 223:
-#line 977 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1063 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
if ((yyvsp[-1].String))
*O << *(yyvsp[-1].String);
*O << *(yyvsp[0].String) << "\n\n";
+ delete (yyvsp[-2].String); delete (yyvsp[-1].String); delete (yyvsp[0].String);
(yyval.String) = 0;
;}
break;
case 224:
-#line 985 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1072 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string(); ;}
break;
case 227:
-#line 991 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1078 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
if (!(yyvsp[-1].String)->empty())
*(yyvsp[-2].String) += " " + *(yyvsp[-1].String);
@@ -3328,12 +3414,12 @@
break;
case 228:
-#line 1004 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1091 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string(); ;}
break;
case 238:
-#line 1010 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1097 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyvsp[-1].String)->insert(0, "<");
*(yyvsp[-1].String) += ">";
@@ -3342,7 +3428,7 @@
break;
case 240:
-#line 1016 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1103 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
if (!(yyvsp[-3].String)->empty()) {
*(yyvsp[-4].String) += " " + *(yyvsp[-3].String);
@@ -3354,57 +3440,58 @@
break;
case 243:
-#line 1029 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1116 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.Value).val = (yyvsp[0].String);
(yyval.Value).constant = false;
- (yyval.Value).type.newTy = 0;
- (yyval.Value).type.oldTy = UnresolvedTy;
+ (yyval.Value).type = new TypeInfo();
;}
break;
case 244:
-#line 1035 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1121 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.Value).val = (yyvsp[0].String);
(yyval.Value).constant = true;
- (yyval.Value).type.newTy = 0;
- (yyval.Value).type.oldTy = UnresolvedTy;
+ (yyval.Value).type = new TypeInfo();
;}
break;
case 245:
-#line 1046 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1131 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
+ std::string Name = getUniqueName((yyvsp[0].Value).val, (yyvsp[-1].Type));
(yyval.Value) = (yyvsp[0].Value);
+ delete (yyval.Value).val;
+ delete (yyval.Value).type;
+ (yyval.Value).val = new std::string((yyvsp[-1].Type)->getNewTy() + " " + Name);
(yyval.Value).type = (yyvsp[-1].Type);
- (yyval.Value).val->insert(0, *(yyvsp[-1].Type).newTy + " ");
;}
break;
case 246:
-#line 1052 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1140 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.String) = 0;
;}
break;
case 247:
-#line 1055 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1143 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Do not allow functions with 0 basic blocks
(yyval.String) = 0;
;}
break;
case 248:
-#line 1063 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1151 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.String) = 0;
;}
break;
case 249:
-#line 1067 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1155 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*O << " " << *(yyvsp[0].String) << '\n';
delete (yyvsp[0].String);
@@ -3413,14 +3500,14 @@
break;
case 250:
-#line 1072 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1160 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.String) = 0;
;}
break;
case 251:
-#line 1075 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1163 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*O << *(yyvsp[0].String) << '\n';
delete (yyvsp[0].String);
@@ -3429,12 +3516,12 @@
break;
case 253:
-#line 1081 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1169 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = (yyvsp[0].String); *(yyval.String) = "unwind"; ;}
break;
case 254:
-#line 1083 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1171 "/proj/llvm/llvm-3/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();
@@ -3443,63 +3530,69 @@
break;
case 255:
-#line 1088 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1176 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Return with no result...
- *O << " " << *(yyvsp[-1].String) << ' ' << *(yyvsp[0].Type).newTy << '\n';
- delete (yyvsp[-1].String); (yyvsp[0].Type).destroy();
+ *O << " " << *(yyvsp[-1].String) << ' ' << (yyvsp[0].Type)->getNewTy() << '\n';
+ delete (yyvsp[-1].String); delete (yyvsp[0].Type);
(yyval.String) = 0;
;}
break;
case 256:
-#line 1093 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1181 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Unconditional Branch...
- *O << " " << *(yyvsp[-2].String) << ' ' << *(yyvsp[-1].Type).newTy << ' ' << *(yyvsp[0].Value).val << '\n';
- delete (yyvsp[-2].String); (yyvsp[-1].Type).destroy(); (yyvsp[0].Value).destroy();
+ *O << " " << *(yyvsp[-2].String) << ' ' << (yyvsp[-1].Type)->getNewTy() << ' ' << *(yyvsp[0].Value).val << '\n';
+ delete (yyvsp[-2].String); delete (yyvsp[-1].Type); (yyvsp[0].Value).destroy();
(yyval.String) = 0;
;}
break;
case 257:
-#line 1098 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1186 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
- *O << " " << *(yyvsp[-8].String) << ' ' << *(yyvsp[-7].Type).newTy << ' ' << *(yyvsp[-6].Value).val << ", "
- << *(yyvsp[-4].Type).newTy << ' ' << *(yyvsp[-3].Value).val << ", " << *(yyvsp[-1].Type).newTy << ' '
+ 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[-7].Type).destroy(); (yyvsp[-6].Value).destroy(); (yyvsp[-4].Type).destroy(); (yyvsp[-3].Value).destroy();
- (yyvsp[-1].Type).destroy(); (yyvsp[0].Value).destroy();
+ delete (yyvsp[-8].String); delete (yyvsp[-7].Type); (yyvsp[-6].Value).destroy(); delete (yyvsp[-4].Type); (yyvsp[-3].Value).destroy();
+ delete (yyvsp[-1].Type); (yyvsp[0].Value).destroy();
(yyval.String) = 0;
;}
break;
case 258:
-#line 1106 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1195 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
- *O << " " << *(yyvsp[-8].String) << ' ' << *(yyvsp[-7].Type).newTy << ' ' << *(yyvsp[-6].Value).val << ", "
- << *(yyvsp[-4].Type).newTy << ' ' << *(yyvsp[-3].Value).val << " [" << *(yyvsp[-1].String) << " ]\n";
- delete (yyvsp[-8].String); (yyvsp[-7].Type).destroy(); (yyvsp[-6].Value).destroy(); (yyvsp[-4].Type).destroy(); (yyvsp[-3].Value).destroy();
+ 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); delete (yyvsp[-7].Type); (yyvsp[-6].Value).destroy(); delete (yyvsp[-4].Type); (yyvsp[-3].Value).destroy();
delete (yyvsp[-1].String);
(yyval.String) = 0;
;}
break;
case 259:
-#line 1113 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1203 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
- *O << " " << *(yyvsp[-7].String) << ' ' << *(yyvsp[-6].Type).newTy << ' ' << *(yyvsp[-5].Value).val << ", "
- << *(yyvsp[-3].Type).newTy << ' ' << *(yyvsp[-2].Value).val << "[]\n";
- delete (yyvsp[-7].String); (yyvsp[-6].Type).destroy(); (yyvsp[-5].Value).destroy(); (yyvsp[-3].Type).destroy(); (yyvsp[-2].Value).destroy();
+ 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); delete (yyvsp[-6].Type); (yyvsp[-5].Value).destroy(); delete (yyvsp[-3].Type); (yyvsp[-2].Value).destroy();
(yyval.String) = 0;
;}
break;
case 260:
-#line 1120 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1211 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
+ TypeInfo* ResTy = getFunctionReturnType((yyvsp[-10].Type));
*O << " ";
- if (!(yyvsp[-13].String)->empty())
- *O << *(yyvsp[-13].String) << " = ";
- *O << *(yyvsp[-12].String) << ' ' << *(yyvsp[-11].String) << ' ' << *(yyvsp[-10].Type).newTy << ' ' << *(yyvsp[-9].Value).val << " (";
+ if (!(yyvsp[-13].String)->empty()) {
+ 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 << " (";
for (unsigned i = 0; i < (yyvsp[-7].ValList)->size(); ++i) {
ValueInfo& VI = (*(yyvsp[-7].ValList))[i];
*O << *VI.val;
@@ -3507,17 +3600,17 @@
*O << ", ";
VI.destroy();
}
- *O << ") " << *(yyvsp[-5].String) << ' ' << *(yyvsp[-4].Type).newTy << ' ' << *(yyvsp[-3].Value).val << ' '
- << *(yyvsp[-2].String) << ' ' << *(yyvsp[-1].Type).newTy << ' ' << *(yyvsp[0].Value).val << '\n';
- delete (yyvsp[-13].String); delete (yyvsp[-12].String); delete (yyvsp[-11].String); (yyvsp[-10].Type).destroy(); (yyvsp[-9].Value).destroy(); delete (yyvsp[-7].ValList);
- delete (yyvsp[-5].String); (yyvsp[-4].Type).destroy(); (yyvsp[-3].Value).destroy(); delete (yyvsp[-2].String); (yyvsp[-1].Type).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[-10].Type); (yyvsp[-9].Value).destroy(); delete (yyvsp[-7].ValList);
+ delete (yyvsp[-5].String); delete (yyvsp[-4].Type); (yyvsp[-3].Value).destroy(); delete (yyvsp[-2].String); delete (yyvsp[-1].Type);
(yyvsp[0].Value).destroy();
(yyval.String) = 0;
;}
break;
case 261:
-#line 1139 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1233 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*O << " " << *(yyvsp[0].String) << '\n';
delete (yyvsp[0].String);
@@ -3526,7 +3619,7 @@
break;
case 262:
-#line 1144 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1238 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*O << " " << *(yyvsp[0].String) << '\n';
delete (yyvsp[0].String);
@@ -3535,26 +3628,27 @@
break;
case 263:
-#line 1150 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1244 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
- *(yyvsp[-5].String) += " " + *(yyvsp[-4].Type).newTy + " " + *(yyvsp[-3].String) + ", " + *(yyvsp[-1].Type).newTy + " " + *(yyvsp[0].Value).val;
- (yyvsp[-4].Type).destroy(); delete (yyvsp[-3].String); (yyvsp[-1].Type).destroy(); (yyvsp[0].Value).destroy();
+ *(yyvsp[-5].String) += " " + (yyvsp[-4].Type)->getNewTy() + " " + *(yyvsp[-3].String) + ", " + (yyvsp[-1].Type)->getNewTy() + " " +
+ *(yyvsp[0].Value).val;
+ delete (yyvsp[-4].Type); delete (yyvsp[-3].String); delete (yyvsp[-1].Type); (yyvsp[0].Value).destroy();
(yyval.String) = (yyvsp[-5].String);
;}
break;
case 264:
-#line 1155 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1250 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
- (yyvsp[-3].String)->insert(0, *(yyvsp[-4].Type).newTy + " " );
- *(yyvsp[-3].String) += ", " + *(yyvsp[-1].Type).newTy + " " + *(yyvsp[0].Value).val;
- (yyvsp[-4].Type).destroy(); (yyvsp[-1].Type).destroy(); (yyvsp[0].Value).destroy();
+ (yyvsp[-3].String)->insert(0, (yyvsp[-4].Type)->getNewTy() + " " );
+ *(yyvsp[-3].String) += ", " + (yyvsp[-1].Type)->getNewTy() + " " + *(yyvsp[0].Value).val;
+ delete (yyvsp[-4].Type); delete (yyvsp[-1].Type); (yyvsp[0].Value).destroy();
(yyval.String) = (yyvsp[-3].String);
;}
break;
case 265:
-#line 1163 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1258 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
if (!(yyvsp[-1].String)->empty()) {
if (deleteUselessCastFlag && *deleteUselessCastName == *(yyvsp[-1].String)) {
@@ -3562,64 +3656,67 @@
(yyvsp[-1].String)->insert(0, "; "); // don't actually delete it, just comment it out
delete deleteUselessCastName;
} else {
- *(yyvsp[-1].String) += " = ";
+ // Get a unique name for the name of this value, based on its type.
+ *(yyvsp[-1].String) = getUniqueName((yyvsp[-1].String), (yyvsp[0].Value).type) + " = ";
}
}
- *(yyvsp[-1].String) += *(yyvsp[0].String);
- delete (yyvsp[0].String);
+ *(yyvsp[-1].String) += *(yyvsp[0].Value).val;
+ (yyvsp[0].Value).destroy();
deleteUselessCastFlag = false;
(yyval.String) = (yyvsp[-1].String);
;}
break;
case 266:
-#line 1180 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1276 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Used for PHI nodes
- (yyvsp[-3].Value).val->insert(0, *(yyvsp[-5].Type).newTy + "[");
- *(yyvsp[-3].Value).val += "," + *(yyvsp[-1].Value).val + "]";
- (yyvsp[-5].Type).destroy(); (yyvsp[-1].Value).destroy();
- (yyval.String) = new std::string(*(yyvsp[-3].Value).val);
- (yyvsp[-3].Value).destroy();
+ 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();
;}
break;
case 267:
-#line 1187 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1284 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
- *(yyvsp[-6].String) += ", [" + *(yyvsp[-3].Value).val + "," + *(yyvsp[-1].Value).val + "]";
+ 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();
- (yyval.String) = (yyvsp[-6].String);
+ (yyval.Value) = (yyvsp[-6].Value);
;}
break;
case 268:
-#line 1195 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
- {
+#line 1293 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+ {
(yyval.ValList) = new ValueList();
(yyval.ValList)->push_back((yyvsp[0].Value));
;}
break;
case 269:
-#line 1199 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1297 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
- (yyvsp[-2].ValList)->push_back((yyvsp[0].Value));
(yyval.ValList) = (yyvsp[-2].ValList);
+ (yyval.ValList)->push_back((yyvsp[0].Value));
;}
break;
case 270:
-#line 1206 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1304 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.ValList) = (yyvsp[0].ValList); ;}
break;
case 271:
-#line 1207 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1305 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.ValList) = new ValueList(); ;}
break;
case 272:
-#line 1211 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1309 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-1].String) += " " + *(yyvsp[0].String);
delete (yyvsp[0].String);
@@ -3628,92 +3725,108 @@
break;
case 274:
-#line 1219 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1317 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
const char* op = getDivRemOpcode(*(yyvsp[-4].String), (yyvsp[-3].Type));
- (yyval.String) = new std::string(op);
- *(yyval.String) += " " + *(yyvsp[-3].Type).newTy + " " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Value).val;
- delete (yyvsp[-4].String); (yyvsp[-3].Type).destroy(); (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).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();
;}
break;
case 275:
-#line 1225 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1326 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
- *(yyvsp[-4].String) += " " + *(yyvsp[-3].Type).newTy + " " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Value).val;
- (yyvsp[-3].Type).destroy(); (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
- (yyval.String) = (yyvsp[-4].String);
+ 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();
;}
break;
case 276:
-#line 1230 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1334 "/proj/llvm/llvm-3/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));
*(yyvsp[-4].String) = getCompareOp(*(yyvsp[-4].String), (yyvsp[-3].Type));
- *(yyvsp[-4].String) += " " + *(yyvsp[-3].Type).newTy + " " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Value).val;
- (yyvsp[-3].Type).destroy(); (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
- (yyval.String) = (yyvsp[-4].String);
+ *(yyvsp[-4].String) += " " + (yyvsp[-3].Type)->getNewTy() + " " + Name1 + ", " + Name2;
+ (yyval.Value).val = (yyvsp[-4].String);
+ (yyval.Value).type = new TypeInfo("bool",BoolTy);
+ (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
;}
break;
case 277:
-#line 1236 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1343 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
- *(yyvsp[-5].String) += " " + *(yyvsp[-4].String) + " " + *(yyvsp[-3].Type).newTy + " " + *(yyvsp[-2].Value).val + "," + *(yyvsp[0].Value).val;
+ 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 = new TypeInfo("bool",BoolTy);
delete (yyvsp[-4].String); (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
- (yyval.String) = (yyvsp[-5].String);
;}
break;
case 278:
-#line 1241 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1351 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
- *(yyvsp[-5].String) += " " + *(yyvsp[-4].String) + " " + *(yyvsp[-3].Type).newTy + " " + *(yyvsp[-2].Value).val + "," + *(yyvsp[0].Value).val;
+ 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 = new TypeInfo("bool",BoolTy);
delete (yyvsp[-4].String); (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
- (yyval.String) = (yyvsp[-5].String);
;}
break;
case 279:
-#line 1246 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1359 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
- *(yyvsp[-1].String) += " " + *(yyvsp[0].Value).val;
- (yyvsp[0].Value).destroy();
- (yyval.String) = (yyvsp[-1].String);
+ (yyval.Value) = (yyvsp[0].Value);
+ (yyval.Value).val->insert(0, *(yyvsp[-1].String) + " ");
+ delete (yyvsp[-1].String);
;}
break;
case 280:
-#line 1251 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1364 "/proj/llvm/llvm-3/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.String) = new std::string(shiftop);
- *(yyval.String) += " " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Value).val;
- delete (yyvsp[-3].String); (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
+ 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); delete (yyvsp[-2].Value).val; (yyvsp[0].Value).destroy();
;}
break;
case 281:
-#line 1259 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1373 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
std::string source = *(yyvsp[-2].Value).val;
- TypeInfo SrcTy = (yyvsp[-2].Value).type;
- TypeInfo DstTy = (yyvsp[0].Type);
- ResolveType(DstTy);
- (yyval.String) = new std::string();
+ TypeInfo* SrcTy = (yyvsp[-2].Value).type;
+ TypeInfo* DstTy = ResolveType((yyvsp[0].Type));
+ (yyval.Value).val = new std::string();
if (*(yyvsp[-3].String) == "cast") {
- *(yyval.String) += getCastUpgrade(source, SrcTy, DstTy, false);
+ *(yyval.Value).val += getCastUpgrade(source, SrcTy, DstTy, false);
} else {
- *(yyval.String) += *(yyvsp[-3].String) + " " + source + " to " + *DstTy.newTy;
+ *(yyval.Value).val += *(yyvsp[-3].String) + " " + source + " to " + DstTy->getNewTy();
}
+ (yyval.Value).type = (yyvsp[0].Type);
// 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
// when assembled and perform no code gen action so just remove them.
if (*(yyvsp[-3].String) == "cast" || *(yyvsp[-3].String) == "bitcast")
- if ((yyvsp[-2].Value).type.isInteger() && (yyvsp[0].Type).isInteger() &&
- (yyvsp[-2].Value).type.getBitWidth() == (yyvsp[0].Type).getBitWidth()) {
+ if ((yyvsp[-2].Value).type->isInteger() && DstTy->isInteger() &&
+ (yyvsp[-2].Value).type->getBitWidth() == DstTy->getBitWidth()) {
deleteUselessCastFlag = true; // Flag the "Inst" rule
deleteUselessCastName = new std::string(*(yyvsp[-2].Value).val); // save the name
size_t pos = deleteUselessCastName->find_first_of("%\"",0);
@@ -3723,72 +3836,79 @@
}
}
delete (yyvsp[-3].String); (yyvsp[-2].Value).destroy();
- delete (yyvsp[-1].String); (yyvsp[0].Type).destroy();
+ delete (yyvsp[-1].String);
;}
break;
case 282:
-#line 1287 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1401 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-5].String) += " " + *(yyvsp[-4].Value).val + ", " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Value).val;
- (yyvsp[-4].Value).destroy(); (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
- (yyval.String) = (yyvsp[-5].String);
+ (yyval.Value).val = (yyvsp[-5].String);
+ (yyval.Value).type = (yyvsp[-2].Value).type;
+ (yyvsp[-4].Value).destroy(); delete (yyvsp[-2].Value).val; (yyvsp[0].Value).destroy();
;}
break;
case 283:
-#line 1292 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1407 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
- *(yyvsp[-3].String) += " " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Type).newTy;
- (yyvsp[-2].Value).destroy(); (yyvsp[0].Type).destroy();
- (yyval.String) = (yyvsp[-3].String);
+ *(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();
;}
break;
case 284:
-#line 1297 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1413 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-3].String) += " " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Value).val;
- (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
- (yyval.String) = (yyvsp[-3].String);
+ (yyval.Value).val = (yyvsp[-3].String);
+ ResolveType((yyvsp[-2].Value).type);
+ (yyval.Value).type = (yyvsp[-2].Value).type->getElementType()->clone();
+ delete (yyvsp[-2].Value).val; (yyvsp[0].Value).destroy();
;}
break;
case 285:
-#line 1302 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1420 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-5].String) += " " + *(yyvsp[-4].Value).val + ", " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Value).val;
- (yyvsp[-4].Value).destroy(); (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
- (yyval.String) = (yyvsp[-5].String);
+ (yyval.Value).val = (yyvsp[-5].String);
+ (yyval.Value).type = (yyvsp[-4].Value).type;
+ delete (yyvsp[-4].Value).val; (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
;}
break;
case 286:
-#line 1307 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1426 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-5].String) += " " + *(yyvsp[-4].Value).val + ", " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Value).val;
- (yyvsp[-4].Value).destroy(); (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
- (yyval.String) = (yyvsp[-5].String);
+ (yyval.Value).val = (yyvsp[-5].String);
+ (yyval.Value).type = (yyvsp[-4].Value).type;
+ delete (yyvsp[-4].Value).val; (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
;}
break;
case 287:
-#line 1312 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1432 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
- *(yyvsp[-1].String) += " " + *(yyvsp[0].String);
- delete (yyvsp[0].String);
- (yyval.String) = (yyvsp[-1].String);
+ *(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;
;}
break;
case 288:
-#line 1317 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1438 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
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).newTy + " " + *(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;
@@ -3797,125 +3917,137 @@
VI.destroy();
}
*(yyvsp[-6].String) += ")";
- delete (yyvsp[-5].String); (yyvsp[-4].Type).destroy(); (yyvsp[-3].Value).destroy(); delete (yyvsp[-1].ValList);
- (yyval.String) = (yyvsp[-6].String);
+ (yyval.Value).val = (yyvsp[-6].String);
+ (yyval.Value).type = getFunctionReturnType((yyvsp[-4].Type));
+ delete (yyvsp[-5].String); delete (yyvsp[-4].Type); (yyvsp[-3].Value).destroy(); delete (yyvsp[-1].ValList);
;}
break;
case 290:
-#line 1339 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1461 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.ValList) = (yyvsp[0].ValList); ;}
break;
case 291:
-#line 1340 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1462 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.ValList) = new ValueList(); ;}
break;
case 293:
-#line 1345 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1467 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string(); ;}
break;
case 294:
-#line 1348 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1470 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
- *(yyvsp[-2].String) += " " + *(yyvsp[-1].Type).newTy;
+ *(yyvsp[-2].String) += " " + (yyvsp[-1].Type)->getNewTy();
if (!(yyvsp[0].String)->empty())
*(yyvsp[-2].String) += " " + *(yyvsp[0].String);
- (yyvsp[-1].Type).destroy(); delete (yyvsp[0].String);
- (yyval.String) = (yyvsp[-2].String);
+ (yyval.Value).val = (yyvsp[-2].String);
+ (yyval.Value).type = (yyvsp[-1].Type)->getPointerType();
+ delete (yyvsp[-1].Type); delete (yyvsp[0].String);
;}
break;
case 295:
-#line 1355 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1478 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
- *(yyvsp[-5].String) += " " + *(yyvsp[-4].Type).newTy + ", " + *(yyvsp[-2].Type).newTy + " " + *(yyvsp[-1].Value).val;
+ 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);
- (yyvsp[-4].Type).destroy(); (yyvsp[-2].Type).destroy(); (yyvsp[-1].Value).destroy(); delete (yyvsp[0].String);
- (yyval.String) = (yyvsp[-5].String);
+ (yyval.Value).val = (yyvsp[-5].String);
+ (yyval.Value).type = (yyvsp[-4].Type)->getPointerType();
+ delete (yyvsp[-4].Type); delete (yyvsp[-2].Type); (yyvsp[-1].Value).destroy(); delete (yyvsp[0].String);
;}
break;
case 296:
-#line 1362 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1487 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
- *(yyvsp[-2].String) += " " + *(yyvsp[-1].Type).newTy;
+ *(yyvsp[-2].String) += " " + (yyvsp[-1].Type)->getNewTy();
if (!(yyvsp[0].String)->empty())
*(yyvsp[-2].String) += " " + *(yyvsp[0].String);
- (yyvsp[-1].Type).destroy(); delete (yyvsp[0].String);
- (yyval.String) = (yyvsp[-2].String);
+ (yyval.Value).val = (yyvsp[-2].String);
+ (yyval.Value).type = (yyvsp[-1].Type)->getPointerType();
+ delete (yyvsp[-1].Type); delete (yyvsp[0].String);
;}
break;
case 297:
-#line 1369 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1495 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
- *(yyvsp[-5].String) += " " + *(yyvsp[-4].Type).newTy + ", " + *(yyvsp[-2].Type).newTy + " " + *(yyvsp[-1].Value).val;
+ 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);
- (yyvsp[-4].Type).destroy(); (yyvsp[-2].Type).destroy(); (yyvsp[-1].Value).destroy(); delete (yyvsp[0].String);
- (yyval.String) = (yyvsp[-5].String);
+ (yyval.Value).val = (yyvsp[-5].String);
+ (yyval.Value).type = (yyvsp[-4].Type)->getPointerType();
+ delete (yyvsp[-4].Type); delete (yyvsp[-2].Type); (yyvsp[-1].Value).destroy(); delete (yyvsp[0].String);
;}
break;
case 298:
-#line 1376 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1504 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-1].String) += " " + *(yyvsp[0].Value).val;
+ (yyval.Value).val = (yyvsp[-1].String);
+ (yyval.Value).type = new TypeInfo("void", VoidTy);
(yyvsp[0].Value).destroy();
- (yyval.String) = (yyvsp[-1].String);
;}
break;
case 299:
-#line 1381 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1510 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
+ 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).newTy + " " + *(yyvsp[0].Value).val;
- delete (yyvsp[-2].String); (yyvsp[-1].Type).destroy(); (yyvsp[0].Value).destroy();
- (yyval.String) = (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()->clone();
+ delete (yyvsp[-2].String); delete (yyvsp[-1].Type); (yyvsp[0].Value).destroy();
;}
break;
case 300:
-#line 1388 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1519 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
+ 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).newTy + " " + *(yyvsp[0].Value).val;
- delete (yyvsp[-4].String); (yyvsp[-3].Value).destroy(); (yyvsp[-1].Type).destroy(); (yyvsp[0].Value).destroy();
- (yyval.String) = (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 = new TypeInfo("void", VoidTy);
+ delete (yyvsp[-4].String); (yyvsp[-3].Value).destroy(); delete (yyvsp[-1].Type); (yyvsp[0].Value).destroy();
;}
break;
case 301:
-#line 1395 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1528 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
+ 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) {
+ if (VI.type->isUnsigned() && !VI.isConstant() &&
+ VI.type->getBitWidth() < 64) {
std::string* old = VI.val;
*O << " %gep_upgrade" << unique << " = zext " << *old
<< " to i64\n";
VI.val = new std::string("i64 %gep_upgrade" + llvm::utostr(unique++));
- VI.type.oldTy = ULongTy;
- delete old;
+ VI.type->setOldTy(ULongTy);
}
}
- *(yyvsp[-3].String) += " " + *(yyvsp[-2].Type).newTy + " " + *(yyvsp[-1].Value).val;
+ *(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;
- VI.destroy();
}
- (yyvsp[-2].Type).destroy(); (yyvsp[-1].Value).destroy(); delete (yyvsp[0].ValList);
- (yyval.String) = (yyvsp[-3].String);
+ (yyval.Value).val = (yyvsp[-3].String);
+ (yyval.Value).type = getGEPIndexedType((yyvsp[-2].Type),(yyvsp[0].ValList));
+ (yyvsp[-1].Value).destroy(); delete (yyvsp[0].ValList);
;}
break;
@@ -3924,7 +4056,7 @@
}
/* Line 1126 of yacc.c. */
-#line 3928 "UpgradeParser.tab.c"
+#line 4060 "UpgradeParser.tab.c"
yyvsp -= yylen;
yyssp -= yylen;
@@ -4192,7 +4324,7 @@
}
-#line 1419 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1552 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
int yyerror(const char *ErrorMsg) {
Index: llvm/tools/llvm-upgrade/UpgradeParser.h
diff -u llvm/tools/llvm-upgrade/UpgradeParser.h:1.23 llvm/tools/llvm-upgrade/UpgradeParser.h:1.24
--- llvm/tools/llvm-upgrade/UpgradeParser.h:1.23 Sun Dec 31 19:20:41 2006
+++ llvm/tools/llvm-upgrade/UpgradeParser.h Mon Jan 1 23:45:11 2007
@@ -333,16 +333,17 @@
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
-#line 289 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 357 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
typedef union YYSTYPE {
std::string* String;
- TypeInfo Type;
+ TypeInfo* Type;
ValueInfo Value;
ConstInfo Const;
ValueList* ValList;
+ TypeList* TypeVec;
} YYSTYPE;
/* Line 1447 of yacc.c. */
-#line 346 "UpgradeParser.tab.h"
+#line 347 "UpgradeParser.tab.h"
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1
Index: llvm/tools/llvm-upgrade/UpgradeParser.h.cvs
diff -u llvm/tools/llvm-upgrade/UpgradeParser.h.cvs:1.21 llvm/tools/llvm-upgrade/UpgradeParser.h.cvs:1.22
--- llvm/tools/llvm-upgrade/UpgradeParser.h.cvs:1.21 Sun Dec 31 19:20:41 2006
+++ llvm/tools/llvm-upgrade/UpgradeParser.h.cvs Mon Jan 1 23:45:11 2007
@@ -333,16 +333,17 @@
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
-#line 289 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 357 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
typedef union YYSTYPE {
std::string* String;
- TypeInfo Type;
+ TypeInfo* Type;
ValueInfo Value;
ConstInfo Const;
ValueList* ValList;
+ TypeList* TypeVec;
} YYSTYPE;
/* Line 1447 of yacc.c. */
-#line 346 "UpgradeParser.tab.h"
+#line 347 "UpgradeParser.tab.h"
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1
Index: llvm/tools/llvm-upgrade/UpgradeParser.y.cvs
diff -u llvm/tools/llvm-upgrade/UpgradeParser.y.cvs:1.27 llvm/tools/llvm-upgrade/UpgradeParser.y.cvs:1.28
--- llvm/tools/llvm-upgrade/UpgradeParser.y.cvs:1.27 Sun Dec 31 19:20:41 2006
+++ llvm/tools/llvm-upgrade/UpgradeParser.y.cvs Mon Jan 1 23:45:11 2007
@@ -13,12 +13,10 @@
%{
#include "ParserInternals.h"
-#include <llvm/ADT/StringExtras.h>
#include <algorithm>
#include <map>
#include <utility>
#include <iostream>
-#include <cassert>
#define YYERROR_VERBOSE 1
#define YYINCLUDED_STDLIB_H
@@ -78,71 +76,72 @@
}
}
-static void ResolveType(TypeInfo& Ty) {
- if (Ty.oldTy == UnresolvedTy) {
- TypeMap::iterator I = NamedTypes.find(*Ty.newTy);
+TypeInfo* ResolveType(TypeInfo*& Ty) {
+ if (Ty->isUnresolved()) {
+ TypeMap::iterator I = NamedTypes.find(Ty->getNewTy());
if (I != NamedTypes.end()) {
- Ty.oldTy = I->second.oldTy;
- Ty.elemTy = I->second.elemTy;
+ Ty = I->second.clone();
+ return Ty;
} else {
- std::string msg("Can't resolve type: ");
- msg += *Ty.newTy;
+ std::string msg("Cannot resolve type: ");
+ msg += Ty->getNewTy();
yyerror(msg.c_str());
}
- } else if (Ty.oldTy == NumericTy) {
- unsigned ref = atoi(&((Ty.newTy->c_str())[1])); // Skip the '\\'
+ } else if (Ty->isNumeric()) {
+ unsigned ref = atoi(&((Ty->getNewTy().c_str())[1])); // Skip the '\\'
if (ref < EnumeratedTypes.size()) {
- Ty.oldTy = EnumeratedTypes[ref].oldTy;
- Ty.elemTy = EnumeratedTypes[ref].elemTy;
+ Ty = EnumeratedTypes[ref].clone();
+ return Ty;
} else {
std::string msg("Can't resolve type: ");
- msg += *Ty.newTy;
+ msg += Ty->getNewTy();
yyerror(msg.c_str());
}
}
// otherwise its already resolved.
+ return Ty;
}
static const char* getCastOpcode(
- std::string& Source, const TypeInfo& SrcTy, const TypeInfo& DstTy)
+ std::string& Source, const TypeInfo* SrcTy, const TypeInfo* DstTy)
{
- unsigned SrcBits = SrcTy.getBitWidth();
- unsigned DstBits = DstTy.getBitWidth();
+ unsigned SrcBits = SrcTy->getBitWidth();
+ unsigned DstBits = DstTy->getBitWidth();
const char* opcode = "bitcast";
// Run through the possibilities ...
- if (DstTy.isIntegral()) { // Casting to integral
- if (SrcTy.isIntegral()) { // Casting from integral
+ if (DstTy->isIntegral()) { // Casting to integral
+ if (SrcTy->isIntegral()) { // Casting from integral
if (DstBits < SrcBits)
opcode = "trunc";
else if (DstBits > SrcBits) { // its an extension
- if (SrcTy.isSigned())
+ if (SrcTy->isSigned())
opcode ="sext"; // signed -> SEXT
else
opcode = "zext"; // unsigned -> ZEXT
} else {
opcode = "bitcast"; // Same size, No-op cast
}
- } else if (SrcTy.isFloatingPoint()) { // Casting from floating pt
- if (DstTy.isSigned())
+ } else if (SrcTy->isFloatingPoint()) { // Casting from floating pt
+ if (DstTy->isSigned())
opcode = "fptosi"; // FP -> sint
else
opcode = "fptoui"; // FP -> uint
- } else if (SrcTy.isPacked()) {
- assert(DstBits == SrcTy.getBitWidth() &&
+ } else if (SrcTy->isPacked()) {
+ assert(DstBits == SrcTy->getBitWidth() &&
"Casting packed to integer of different width");
opcode = "bitcast"; // same size, no-op cast
} else {
- assert(SrcTy.isPointer() &&
+ assert(SrcTy->isPointer() &&
"Casting from a value that is not first-class type");
opcode = "ptrtoint"; // ptr -> int
}
- } else if (DstTy.isFloatingPoint()) { // Casting to floating pt
- if (SrcTy.isIntegral()) { // Casting from integral
- if (SrcTy.isSigned())
+ } else if (DstTy->isFloatingPoint()) { // Casting to floating pt
+ if (SrcTy->isIntegral()) { // Casting from integral
+ if (SrcTy->isSigned())
opcode = "sitofp"; // sint -> FP
else
opcode = "uitofp"; // uint -> FP
- } else if (SrcTy.isFloatingPoint()) { // Casting from floating pt
+ } else if (SrcTy->isFloatingPoint()) { // Casting from floating pt
if (DstBits < SrcBits) {
opcode = "fptrunc"; // FP -> smaller FP
} else if (DstBits > SrcBits) {
@@ -150,27 +149,27 @@
} else {
opcode ="bitcast"; // same size, no-op cast
}
- } else if (SrcTy.isPacked()) {
- assert(DstBits == SrcTy.getBitWidth() &&
+ } else if (SrcTy->isPacked()) {
+ assert(DstBits == SrcTy->getBitWidth() &&
"Casting packed to floating point of different width");
opcode = "bitcast"; // same size, no-op cast
} else {
assert(0 && "Casting pointer or non-first class to float");
}
- } else if (DstTy.isPacked()) {
- if (SrcTy.isPacked()) {
- assert(DstTy.getBitWidth() == SrcTy.getBitWidth() &&
+ } else if (DstTy->isPacked()) {
+ if (SrcTy->isPacked()) {
+ assert(DstTy->getBitWidth() == SrcTy->getBitWidth() &&
"Casting packed to packed of different widths");
opcode = "bitcast"; // packed -> packed
- } else if (DstTy.getBitWidth() == SrcBits) {
+ } else if (DstTy->getBitWidth() == SrcBits) {
opcode = "bitcast"; // float/int -> packed
} else {
assert(!"Illegal cast to packed (wrong type or size)");
}
- } else if (DstTy.isPointer()) {
- if (SrcTy.isPointer()) {
+ } else if (DstTy->isPointer()) {
+ if (SrcTy->isPointer()) {
opcode = "bitcast"; // ptr -> ptr
- } else if (SrcTy.isIntegral()) {
+ } else if (SrcTy->isIntegral()) {
opcode = "inttoptr"; // int -> ptr
} else {
assert(!"Casting invalid type to pointer");
@@ -181,12 +180,12 @@
return opcode;
}
-static std::string getCastUpgrade(
- const std::string& Src, TypeInfo& SrcTy, TypeInfo& DstTy, bool isConst)
+static std::string getCastUpgrade(const std::string& Src, TypeInfo* SrcTy,
+ TypeInfo* DstTy, bool isConst)
{
std::string Result;
std::string Source = Src;
- if (SrcTy.isFloatingPoint() && DstTy.isPointer()) {
+ if (SrcTy->isFloatingPoint() && DstTy->isPointer()) {
// fp -> ptr cast is no longer supported but we must upgrade this
// by doing a double cast: fp -> int -> ptr
if (isConst)
@@ -197,16 +196,16 @@
Source = "i64 %cast_upgrade" + llvm::utostr(unique);
}
// Update the SrcTy for the getCastOpcode call below
- SrcTy.destroy();
- SrcTy.newTy = new std::string("i64");
- SrcTy.oldTy = ULongTy;
- } else if (DstTy.oldTy == BoolTy && SrcTy.oldTy != BoolTy) {
- // cast ptr %x to bool was previously defined as setne ptr %x, null
- // The ptrtoint semantic is to truncate, not compare so we must retain
- // the original intent by replace the cast with a setne
- const char* comparator = SrcTy.isPointer() ? ", null" :
- (SrcTy.isFloatingPoint() ? ", 0.0" : ", 0");
- const char* compareOp = SrcTy.isFloatingPoint() ? "fcmp one " : "icmp ne ";
+ delete SrcTy;
+ SrcTy = new TypeInfo("i64", ULongTy);
+ } else if (DstTy->isBool()) {
+ // cast type %x to bool was previously defined as setne type %x, null
+ // The cast semantic is now to truncate, not compare so we must retain
+ // the original intent by replacing the cast with a setne
+ const char* comparator = SrcTy->isPointer() ? ", null" :
+ (SrcTy->isFloatingPoint() ? ", 0.0" :
+ (SrcTy->isBool() ? ", false" : ", 0"));
+ const char* compareOp = SrcTy->isFloatingPoint() ? "fcmp one " : "icmp ne ";
if (isConst) {
Result = "(" + Source + comparator + ")";
Result = compareOp + Result;
@@ -218,33 +217,32 @@
ResolveType(DstTy);
std::string Opcode(getCastOpcode(Source, SrcTy, DstTy));
if (isConst)
- Result += Opcode + "( " + Source + " to " + *DstTy.newTy + ")";
+ Result += Opcode + "( " + Source + " to " + DstTy->getNewTy() + ")";
else
- Result += Opcode + " " + Source + " to " + *DstTy.newTy;
+ Result += Opcode + " " + Source + " to " + DstTy->getNewTy();
return Result;
}
-const char* getDivRemOpcode(const std::string& opcode, const TypeInfo& TI) {
+const char* getDivRemOpcode(const std::string& opcode, TypeInfo* TI) {
const char* op = opcode.c_str();
- TypeInfo Ty = TI;
- ResolveType(Ty);
- if (Ty.isPacked())
- Ty.oldTy = Ty.getElementType();
+ const TypeInfo* Ty = ResolveType(TI);
+ if (Ty->isPacked())
+ Ty = Ty->getElementType();
if (opcode == "div")
- if (Ty.isFloatingPoint())
+ if (Ty->isFloatingPoint())
op = "fdiv";
- else if (Ty.isUnsigned())
+ else if (Ty->isUnsigned())
op = "udiv";
- else if (Ty.isSigned())
+ else if (Ty->isSigned())
op = "sdiv";
else
yyerror("Invalid type for div instruction");
else if (opcode == "rem")
- if (Ty.isFloatingPoint())
+ if (Ty->isFloatingPoint())
op = "frem";
- else if (Ty.isUnsigned())
+ else if (Ty->isUnsigned())
op = "urem";
- else if (Ty.isSigned())
+ else if (Ty->isSigned())
op = "srem";
else
yyerror("Invalid type for rem instruction");
@@ -252,7 +250,7 @@
}
std::string
-getCompareOp(const std::string& setcc, const TypeInfo& TI) {
+getCompareOp(const std::string& setcc, const TypeInfo* TI) {
assert(setcc.length() == 5);
char cc1 = setcc[3];
char cc2 = setcc[4];
@@ -261,20 +259,20 @@
std::string result("xcmp xxx");
result[6] = cc1;
result[7] = cc2;
- if (TI.isFloatingPoint()) {
+ if (TI->isFloatingPoint()) {
result[0] = 'f';
result[5] = 'o';
if (cc1 == 'n')
result[5] = 'u'; // NE maps to unordered
else
result[5] = 'o'; // everything else maps to ordered
- } else if (TI.isIntegral() || TI.isPointer()) {
+ } else if (TI->isIntegral() || TI->isPointer()) {
result[0] = 'i';
if ((cc1 == 'e' && cc2 == 'q') || (cc1 == 'n' && cc2 == 'e'))
result.erase(5,1);
- else if (TI.isSigned())
+ else if (TI->isSigned())
result[5] = 's';
- else if (TI.isUnsigned() || TI.isPointer() || TI.isBool())
+ else if (TI->isUnsigned() || TI->isPointer() || TI->isBool())
result[5] = 'u';
else
yyerror("Invalid integral type for setcc");
@@ -282,16 +280,87 @@
return result;
}
+static TypeInfo* getFunctionReturnType(TypeInfo* PFTy) {
+ ResolveType(PFTy);
+ if (PFTy->isPointer()) {
+ TypeInfo* ElemTy = PFTy->getElementType();
+ ResolveType(ElemTy);
+ if (ElemTy->isFunction())
+ return ElemTy->getResultType()->clone();
+ } else if (PFTy->isFunction()) {
+ return PFTy->getResultType()->clone();
+ }
+ return PFTy->clone();
+}
+
+static TypeInfo* getGEPIndexedType(TypeInfo* PTy, ValueList* idxs) {
+ ResolveType(PTy);
+ assert(PTy->isPointer() && "GEP Operand is not a pointer?");
+ TypeInfo* Result = PTy->getElementType(); // just skip first index
+ ResolveType(Result);
+ for (unsigned i = 1; i < idxs->size(); ++i) {
+ if (Result->isComposite()) {
+ Result = Result->getIndexedType((*idxs)[i]);
+ ResolveType(Result);
+ } else
+ yyerror("Invalid type for index");
+ }
+ return Result->getPointerType();
+}
+
+static std::string makeUniqueName(const std::string *Name, bool isSigned) {
+ const char *suffix = ".u";
+ if (isSigned)
+ suffix = ".s";
+ if ((*Name)[Name->size()-1] == '"') {
+ std::string Result(*Name);
+ Result.insert(Name->size()-1, suffix);
+ return Result;
+ }
+ return *Name + suffix;
+}
+
+// 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, TypeInfo* Ty) {
+ // If its not a symbolic name, don't modify it, probably a constant val.
+ if ((*Name)[0] != '%' && (*Name)[0] != '"')
+ return *Name;
+ // If its a numeric reference, just leave it alone.
+ if (isdigit((*Name)[1]))
+ return *Name;
+
+ // Resolve the type
+ ResolveType(Ty);
+
+ // Default the result to the current name
+ std::string Result = *Name;
+
+ if (Ty->isInteger()) {
+ // If its an integer type, make the name unique
+ Result = makeUniqueName(Name, Ty->isSigned());
+ } else if (Ty->isPointer()) {
+ while (Ty->isPointer())
+ Ty = Ty->getElementType();
+ if (Ty->isInteger())
+ Result = makeUniqueName(Name, Ty->isSigned());
+ }
+ return Result;
+}
+
%}
// %file-prefix="UpgradeParser"
%union {
std::string* String;
- TypeInfo Type;
+ TypeInfo* Type;
ValueInfo Value;
ConstInfo Const;
ValueList* ValList;
+ TypeList* TypeVec;
}
%token <Type> VOID BOOL SBYTE UBYTE SHORT USHORT INT UINT LONG ULONG
@@ -322,19 +391,20 @@
%type <String> OptAssign OptLinkage OptCallingConv OptAlign OptCAlign
%type <String> SectionString OptSection GlobalVarAttributes GlobalVarAttribute
-%type <String> ArgTypeListI ConstExpr DefinitionList
+%type <String> ConstExpr DefinitionList
%type <String> ConstPool TargetDefinition LibrariesDefinition LibList OptName
%type <String> ArgVal ArgListH ArgList FunctionHeaderH BEGIN FunctionHeader END
-%type <String> Function FunctionProto BasicBlock TypeListI
-%type <String> InstructionList BBTerminatorInst JumpTable Inst PHIList
-%type <String> OptTailCall InstVal OptVolatile Unwind
-%type <String> MemoryInst SymbolicValueRef OptSideEffect GlobalType
+%type <String> Function FunctionProto BasicBlock
+%type <String> InstructionList BBTerminatorInst JumpTable Inst
+%type <String> OptTailCall OptVolatile Unwind
+%type <String> SymbolicValueRef OptSideEffect GlobalType
%type <String> FnDeclareLinkage BasicBlockList BigOrLittle AsmBlock
%type <String> Name ConstValueRef ConstVector External
%type <String> ShiftOps SetCondOps LogicalOps ArithmeticOps CastOps
%type <String> IPredicates FPredicates
%type <ValList> ValueRefList ValueRefListE IndexList
+%type <TypeVec> TypeListI ArgTypeListI
%type <Type> IntType SIntType UIntType FPType TypesV Types
%type <Type> PrimType UpRTypesV UpRTypes
@@ -342,7 +412,7 @@
%type <String> IntVal EInt64Val
%type <Const> ConstVal
-%type <Value> ValueRef ResolvedVal
+%type <Value> ValueRef ResolvedVal InstVal PHIList MemoryInst
%start Module
@@ -456,68 +526,79 @@
PrimType : LONG | ULONG | FLOAT | DOUBLE | LABEL;
UpRTypes
: OPAQUE {
- $$.newTy = $1;
- $$.oldTy = OpaqueTy;
+ $$ = new TypeInfo($1, OpaqueTy);
}
| SymbolicValueRef {
- $$.newTy = $1;
- $$.oldTy = UnresolvedTy;
+ $$ = new TypeInfo($1, UnresolvedTy);
}
| PrimType {
$$ = $1;
}
| '\\' EUINT64VAL { // Type UpReference
$2->insert(0, "\\");
- $$.newTy = $2;
- $$.oldTy = NumericTy;
+ $$ = new TypeInfo($2, NumericTy);
}
| UpRTypesV '(' ArgTypeListI ')' { // Function derived type?
- *$1.newTy += "( " + *$3 + " )";
- delete $3;
- $$.newTy = $1.newTy;
- $$.oldTy = FunctionTy;
+ std::string newTy( $1->getNewTy() + "(");
+ for (unsigned i = 0; i < $3->size(); ++i) {
+ if (i != 0)
+ newTy += ", ";
+ if ((*$3)[i]->isVoid())
+ newTy += "...";
+ else
+ newTy += (*$3)[i]->getNewTy();
+ }
+ newTy += ")";
+ $$ = new TypeInfo(new std::string(newTy), $1, $3);
+ EnumeratedTypes.push_back(*$$);
}
| '[' EUINT64VAL 'x' UpRTypes ']' { // Sized array type?
$2->insert(0,"[ ");
- *$2 += " x " + *$4.newTy + " ]";
- delete $4.newTy;
- $$.newTy = $2;
- $$.oldTy = ArrayTy;
- $$.elemTy = $4.oldTy;
+ *$2 += " x " + $4->getNewTy() + " ]";
+ uint64_t elems = atoi($2->c_str());
+ $$ = new TypeInfo($2, ArrayTy, $4, elems);
+ EnumeratedTypes.push_back(*$$);
}
| '<' EUINT64VAL 'x' UpRTypes '>' { // Packed array type?
$2->insert(0,"< ");
- *$2 += " x " + *$4.newTy + " >";
- delete $4.newTy;
- $$.newTy = $2;
- $$.oldTy = PackedTy;
- $$.elemTy = $4.oldTy;
+ *$2 += " x " + $4->getNewTy() + " >";
+ uint64_t elems = atoi($2->c_str());
+ $$ = new TypeInfo($2, PackedTy, $4, elems);
+ EnumeratedTypes.push_back(*$$);
}
| '{' TypeListI '}' { // Structure type?
- $2->insert(0, "{ ");
- *$2 += " }";
- $$.newTy = $2;
- $$.oldTy = StructTy;
+ std::string newTy("{");
+ for (unsigned i = 0; i < $2->size(); ++i) {
+ if (i != 0)
+ newTy += ", ";
+ newTy += (*$2)[i]->getNewTy();
+ }
+ newTy += "}";
+ $$ = new TypeInfo(new std::string(newTy), StructTy, $2);
+ EnumeratedTypes.push_back(*$$);
}
| '{' '}' { // Empty structure type?
- $$.newTy = new std::string("{}");
- $$.oldTy = StructTy;
+ $$ = new TypeInfo(new std::string("{}"), StructTy, new TypeList());
+ EnumeratedTypes.push_back(*$$);
}
| '<' '{' TypeListI '}' '>' { // Packed Structure type?
- $3->insert(0, "<{ ");
- *$3 += " }>";
- $$.newTy = $3;
- $$.oldTy = StructTy;
+ std::string newTy("<{");
+ for (unsigned i = 0; i < $3->size(); ++i) {
+ if (i != 0)
+ newTy += ", ";
+ newTy += (*$3)[i]->getNewTy();
+ }
+ newTy += "}>";
+ $$ = new TypeInfo(new std::string(newTy), PackedStructTy, $3);
+ EnumeratedTypes.push_back(*$$);
}
| '<' '{' '}' '>' { // Empty packed structure type?
- $$.newTy = new std::string("<{}>");
- $$.oldTy = StructTy;
+ $$ = new TypeInfo(new std::string("<{}>"), PackedStructTy, new TypeList());
+ EnumeratedTypes.push_back(*$$);
}
| UpRTypes '*' { // Pointer type?
- *$1.newTy += '*';
- $$.elemTy = $1.oldTy;
- $1.oldTy = PointerTy;
- $$ = $1;
+ $$ = $1->getPointerType();
+ EnumeratedTypes.push_back(*$$);
};
// TypeList - Used for struct declarations and as a basis for function type
@@ -525,27 +606,29 @@
//
TypeListI
: UpRTypes {
- $$ = $1.newTy;
+ $$ = new TypeList();
+ $$->push_back($1);
}
| TypeListI ',' UpRTypes {
- *$1 += ", " + *$3.newTy;
- delete $3.newTy;
$$ = $1;
+ $$->push_back($3);
};
// ArgTypeList - List of types for a function type declaration...
ArgTypeListI
: TypeListI
| TypeListI ',' DOTDOTDOT {
- *$1 += ", ...";
- delete $3;
$$ = $1;
+ $$->push_back(new TypeInfo("void",VoidTy));
+ delete $3;
}
| DOTDOTDOT {
- $$ = $1;
+ $$ = new TypeList();
+ $$->push_back(new TypeInfo("void",VoidTy));
+ delete $1;
}
| /*empty*/ {
- $$ = new std::string();
+ $$ = new TypeList();
};
// ConstVal - The various declarations that go into the constant pool. This
@@ -556,95 +639,96 @@
//
ConstVal: Types '[' ConstVector ']' { // Nonempty unsized arr
$$.type = $1;
- $$.cnst = new std::string(*$1.newTy);
+ $$.cnst = new std::string($1->getNewTy());
*$$.cnst += " [ " + *$3 + " ]";
delete $3;
}
| Types '[' ']' {
$$.type = $1;
- $$.cnst = new std::string(*$1.newTy);
+ $$.cnst = new std::string($1->getNewTy());
*$$.cnst += "[ ]";
}
| Types 'c' STRINGCONSTANT {
$$.type = $1;
- $$.cnst = new std::string(*$1.newTy);
+ $$.cnst = new std::string($1->getNewTy());
*$$.cnst += " c" + *$3;
delete $3;
}
| Types '<' ConstVector '>' { // Nonempty unsized arr
$$.type = $1;
- $$.cnst = new std::string(*$1.newTy);
+ $$.cnst = new std::string($1->getNewTy());
*$$.cnst += " < " + *$3 + " >";
delete $3;
}
| Types '{' ConstVector '}' {
$$.type = $1;
- $$.cnst = new std::string(*$1.newTy);
+ $$.cnst = new std::string($1->getNewTy());
*$$.cnst += " { " + *$3 + " }";
delete $3;
}
| Types '{' '}' {
$$.type = $1;
- $$.cnst = new std::string(*$1.newTy);
+ $$.cnst = new std::string($1->getNewTy());
*$$.cnst += " {}";
}
| Types NULL_TOK {
$$.type = $1;
- $$.cnst = new std::string(*$1.newTy);
+ $$.cnst = new std::string($1->getNewTy());
*$$.cnst += " " + *$2;
delete $2;
}
| Types UNDEF {
$$.type = $1;
- $$.cnst = new std::string(*$1.newTy);
+ $$.cnst = new std::string($1->getNewTy());
*$$.cnst += " " + *$2;
delete $2;
}
| Types SymbolicValueRef {
+ std::string Name = getUniqueName($2,$1);
$$.type = $1;
- $$.cnst = new std::string(*$1.newTy);
- *$$.cnst += " " + *$2;
+ $$.cnst = new std::string($1->getNewTy());
+ *$$.cnst += " " + Name;
delete $2;
}
| Types ConstExpr {
$$.type = $1;
- $$.cnst = new std::string(*$1.newTy);
+ $$.cnst = new std::string($1->getNewTy());
*$$.cnst += " " + *$2;
delete $2;
}
| Types ZEROINITIALIZER {
$$.type = $1;
- $$.cnst = new std::string(*$1.newTy);
+ $$.cnst = new std::string($1->getNewTy());
*$$.cnst += " " + *$2;
delete $2;
}
| SIntType EInt64Val { // integral constants
$$.type = $1;
- $$.cnst = new std::string(*$1.newTy);
+ $$.cnst = new std::string($1->getNewTy());
*$$.cnst += " " + *$2;
delete $2;
}
| UIntType EUINT64VAL { // integral constants
$$.type = $1;
- $$.cnst = new std::string(*$1.newTy);
+ $$.cnst = new std::string($1->getNewTy());
*$$.cnst += " " + *$2;
delete $2;
}
| BOOL TRUETOK { // Boolean constants
$$.type = $1;
- $$.cnst = new std::string(*$1.newTy);
+ $$.cnst = new std::string($1->getNewTy());
*$$.cnst += " " + *$2;
delete $2;
}
| BOOL FALSETOK { // Boolean constants
$$.type = $1;
- $$.cnst = new std::string(*$1.newTy);
+ $$.cnst = new std::string($1->getNewTy());
*$$.cnst += " " + *$2;
delete $2;
}
| FPType FPVAL { // Float & Double constants
$$.type = $1;
- $$.cnst = new std::string(*$1.newTy);
+ $$.cnst = new std::string($1->getNewTy());
*$$.cnst += " " + *$2;
delete $2;
};
@@ -652,17 +736,16 @@
ConstExpr: CastOps '(' ConstVal TO Types ')' {
std::string source = *$3.cnst;
- TypeInfo DstTy = $5;
- ResolveType(DstTy);
+ TypeInfo* DstTy = ResolveType($5);
if (*$1 == "cast") {
// Call getCastUpgrade to upgrade the old cast
- $$ = new std::string(getCastUpgrade(source, $3.type, $5, true));
+ $$ = new std::string(getCastUpgrade(source, $3.type, DstTy, true));
} else {
// Nothing to upgrade, just create the cast constant expr
$$ = new std::string(*$1);
- *$$ += "( " + source + " to " + *$5.newTy + ")";
+ *$$ += "( " + source + " to " + $5->getNewTy() + ")";
}
- delete $1; $3.destroy(); delete $4; $5.destroy();
+ delete $1; $3.destroy(); delete $4; delete $5;
}
| GETELEMENTPTR '(' ConstVal IndexList ')' {
*$1 += "(" + *$3.cnst;
@@ -711,7 +794,7 @@
| 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();
@@ -783,15 +866,13 @@
// ConstPool - Constants with optional names assigned to them.
ConstPool : ConstPool OptAssign TYPE TypesV {
- EnumeratedTypes.push_back($4);
+ EnumeratedTypes.push_back(*$4);
if (!$2->empty()) {
- NamedTypes[*$2].newTy = new std::string(*$4.newTy);
- NamedTypes[*$2].oldTy = $4.oldTy;
- NamedTypes[*$2].elemTy = $4.elemTy;
+ NamedTypes[*$2] = *$4;
*O << *$2 << " = ";
}
- *O << "type " << *$4.newTy << '\n';
- delete $2; delete $3; $4.destroy();
+ *O << "type " << $4->getNewTy() << '\n';
+ delete $2; delete $3;
$$ = 0;
}
| ConstPool FunctionProto { // Function prototypes can be in const pool
@@ -806,38 +887,42 @@
}
| ConstPool OptAssign OptLinkage GlobalType ConstVal GlobalVarAttributes {
if (!$2->empty()) {
- *O << *$2 << " = ";
- Globals[*$2] = $5.type.clone();
+ std::string Name = getUniqueName($2,$5.type);
+ *O << Name << " = ";
+ Globals[Name] = *$5.type;
}
*O << *$3 << ' ' << *$4 << ' ' << *$5.cnst << ' ' << *$6 << '\n';
- delete $2; delete $3; delete $4; $5.destroy(); delete $6;
+ delete $2; delete $3; delete $4; delete $6;
$$ = 0;
}
| ConstPool OptAssign External GlobalType Types GlobalVarAttributes {
if (!$2->empty()) {
- *O << *$2 << " = ";
- Globals[*$2] = $5.clone();
+ std::string Name = getUniqueName($2,$5);
+ *O << Name << " = ";
+ Globals[Name] = *$5;
}
- *O << *$3 << ' ' << *$4 << ' ' << *$5.newTy << ' ' << *$6 << '\n';
- delete $2; delete $3; delete $4; $5.destroy(); delete $6;
+ *O << *$3 << ' ' << *$4 << ' ' << $5->getNewTy() << ' ' << *$6 << '\n';
+ delete $2; delete $3; delete $4; delete $6;
$$ = 0;
}
| ConstPool OptAssign DLLIMPORT GlobalType Types GlobalVarAttributes {
if (!$2->empty()) {
- *O << *$2 << " = ";
- Globals[*$2] = $5.clone();
+ std::string Name = getUniqueName($2,$5);
+ *O << Name << " = ";
+ Globals[Name] = *$5;
}
- *O << *$3 << ' ' << *$4 << ' ' << *$5.newTy << ' ' << *$6 << '\n';
- delete $2; delete $3; delete $4; $5.destroy(); delete $6;
+ *O << *$3 << ' ' << *$4 << ' ' << $5->getNewTy() << ' ' << *$6 << '\n';
+ delete $2; delete $3; delete $4; delete $6;
$$ = 0;
}
| ConstPool OptAssign EXTERN_WEAK GlobalType Types GlobalVarAttributes {
if (!$2->empty()) {
- *O << *$2 << " = ";
- Globals[*$2] = $5.clone();
+ std::string Name = getUniqueName($2,$5);
+ *O << Name << " = ";
+ Globals[Name] = *$5;
}
- *O << *$3 << ' ' << *$4 << ' ' << *$5.newTy << ' ' << *$6 << '\n';
- delete $2; delete $3; delete $4; $5.destroy(); delete $6;
+ *O << *$3 << ' ' << *$4 << ' ' << $5->getNewTy() << ' ' << *$6 << '\n';
+ delete $2; delete $3; delete $4; delete $6;
$$ = 0;
}
| ConstPool TARGET TargetDefinition {
@@ -909,9 +994,11 @@
OptName : Name | /*empty*/ { $$ = new std::string(); };
ArgVal : Types OptName {
- $$ = $1.newTy;
- if (!$2->empty())
- *$$ += " " + *$2;
+ $$ = new std::string($1->getNewTy());
+ if (!$2->empty()) {
+ std::string Name = getUniqueName($2, $1);
+ *$$ += " " + Name;
+ }
delete $2;
};
@@ -941,14 +1028,13 @@
if (!$1->empty()) {
*$1 += " ";
}
- *$1 += *$2.newTy + " " + *$3 + "(" + *$5 + ")";
+ *$1 += $2->getNewTy() + " " + *$3 + "(" + *$5 + ")";
if (!$7->empty()) {
*$1 += " " + *$7;
}
if (!$8->empty()) {
*$1 += " " + *$8;
}
- $2.destroy();
delete $3;
delete $5;
delete $7;
@@ -978,6 +1064,7 @@
if ($2)
*O << *$2;
*O << *$3 << "\n\n";
+ delete $1; delete $2; delete $3;
$$ = 0;
};
@@ -1029,14 +1116,12 @@
: SymbolicValueRef {
$$.val = $1;
$$.constant = false;
- $$.type.newTy = 0;
- $$.type.oldTy = UnresolvedTy;
+ $$.type = new TypeInfo();
}
| ConstValueRef {
$$.val = $1;
$$.constant = true;
- $$.type.newTy = 0;
- $$.type.oldTy = UnresolvedTy;
+ $$.type = new TypeInfo();
}
;
@@ -1044,9 +1129,12 @@
// type immediately preceeds the value reference, and allows complex constant
// pool references (for things like: 'ret [2 x int] [ int 12, int 42]')
ResolvedVal : Types ValueRef {
+ std::string Name = getUniqueName($2.val, $1);
$$ = $2;
+ delete $$.val;
+ delete $$.type;
+ $$.val = new std::string($1->getNewTy() + " " + Name);
$$.type = $1;
- $$.val->insert(0, *$1.newTy + " ");
};
BasicBlockList : BasicBlockList BasicBlock {
@@ -1086,42 +1174,48 @@
$$ = 0;
}
| RET VOID { // Return with no result...
- *O << " " << *$1 << ' ' << *$2.newTy << '\n';
- delete $1; $2.destroy();
+ *O << " " << *$1 << ' ' << $2->getNewTy() << '\n';
+ delete $1; delete $2;
$$ = 0;
}
| BR LABEL ValueRef { // Unconditional Branch...
- *O << " " << *$1 << ' ' << *$2.newTy << ' ' << *$3.val << '\n';
- delete $1; $2.destroy(); $3.destroy();
+ *O << " " << *$1 << ' ' << $2->getNewTy() << ' ' << *$3.val << '\n';
+ delete $1; delete $2; $3.destroy();
$$ = 0;
} // Conditional Branch...
| BR BOOL ValueRef ',' LABEL ValueRef ',' LABEL ValueRef {
- *O << " " << *$1 << ' ' << *$2.newTy << ' ' << *$3.val << ", "
- << *$5.newTy << ' ' << *$6.val << ", " << *$8.newTy << ' '
+ std::string Name = getUniqueName($3.val, $2);
+ *O << " " << *$1 << ' ' << $2->getNewTy() << ' ' << Name << ", "
+ << $5->getNewTy() << ' ' << *$6.val << ", " << $8->getNewTy() << ' '
<< *$9.val << '\n';
- delete $1; $2.destroy(); $3.destroy(); $5.destroy(); $6.destroy();
- $8.destroy(); $9.destroy();
+ delete $1; delete $2; $3.destroy(); delete $5; $6.destroy();
+ delete $8; $9.destroy();
$$ = 0;
}
| SWITCH IntType ValueRef ',' LABEL ValueRef '[' JumpTable ']' {
- *O << " " << *$1 << ' ' << *$2.newTy << ' ' << *$3.val << ", "
- << *$5.newTy << ' ' << *$6.val << " [" << *$8 << " ]\n";
- delete $1; $2.destroy(); $3.destroy(); $5.destroy(); $6.destroy();
+ std::string Name = getUniqueName($3.val, $2);
+ *O << " " << *$1 << ' ' << $2->getNewTy() << ' ' << Name << ", "
+ << $5->getNewTy() << ' ' << *$6.val << " [" << *$8 << " ]\n";
+ delete $1; delete $2; $3.destroy(); delete $5; $6.destroy();
delete $8;
$$ = 0;
}
| SWITCH IntType ValueRef ',' LABEL ValueRef '[' ']' {
- *O << " " << *$1 << ' ' << *$2.newTy << ' ' << *$3.val << ", "
- << *$5.newTy << ' ' << *$6.val << "[]\n";
- delete $1; $2.destroy(); $3.destroy(); $5.destroy(); $6.destroy();
+ std::string Name = getUniqueName($3.val, $2);
+ *O << " " << *$1 << ' ' << $2->getNewTy() << ' ' << Name << ", "
+ << $5->getNewTy() << ' ' << *$6.val << "[]\n";
+ delete $1; delete $2; $3.destroy(); delete $5; $6.destroy();
$$ = 0;
}
| OptAssign INVOKE OptCallingConv TypesV ValueRef '(' ValueRefListE ')'
TO LABEL ValueRef Unwind LABEL ValueRef {
+ TypeInfo* ResTy = getFunctionReturnType($4);
*O << " ";
- if (!$1->empty())
- *O << *$1 << " = ";
- *O << *$2 << ' ' << *$3 << ' ' << *$4.newTy << ' ' << *$5.val << " (";
+ if (!$1->empty()) {
+ std::string Name = getUniqueName($1, ResTy);
+ *O << Name << " = ";
+ }
+ *O << *$2 << ' ' << *$3 << ' ' << $4->getNewTy() << ' ' << *$5.val << " (";
for (unsigned i = 0; i < $7->size(); ++i) {
ValueInfo& VI = (*$7)[i];
*O << *VI.val;
@@ -1129,10 +1223,10 @@
*O << ", ";
VI.destroy();
}
- *O << ") " << *$9 << ' ' << *$10.newTy << ' ' << *$11.val << ' '
- << *$12 << ' ' << *$13.newTy << ' ' << *$14.val << '\n';
- delete $1; delete $2; delete $3; $4.destroy(); $5.destroy(); delete $7;
- delete $9; $10.destroy(); $11.destroy(); delete $12; $13.destroy();
+ *O << ") " << *$9 << ' ' << $10->getNewTy() << ' ' << *$11.val << ' '
+ << *$12 << ' ' << $13->getNewTy() << ' ' << *$14.val << '\n';
+ delete $1; delete $2; delete $3; delete $4; $5.destroy(); delete $7;
+ delete $9; delete $10; $11.destroy(); delete $12; delete $13;
$14.destroy();
$$ = 0;
}
@@ -1148,14 +1242,15 @@
};
JumpTable : JumpTable IntType ConstValueRef ',' LABEL ValueRef {
- *$1 += " " + *$2.newTy + " " + *$3 + ", " + *$5.newTy + " " + *$6.val;
- $2.destroy(); delete $3; $5.destroy(); $6.destroy();
+ *$1 += " " + $2->getNewTy() + " " + *$3 + ", " + $5->getNewTy() + " " +
+ *$6.val;
+ delete $2; delete $3; delete $5; $6.destroy();
$$ = $1;
}
| IntType ConstValueRef ',' LABEL ValueRef {
- $2->insert(0, *$1.newTy + " " );
- *$2 += ", " + *$4.newTy + " " + *$5.val;
- $1.destroy(); $4.destroy(); $5.destroy();
+ $2->insert(0, $1->getNewTy() + " " );
+ *$2 += ", " + $4->getNewTy() + " " + *$5.val;
+ delete $1; delete $4; $5.destroy();
$$ = $2;
};
@@ -1167,38 +1262,41 @@
$1->insert(0, "; "); // don't actually delete it, just comment it out
delete deleteUselessCastName;
} else {
- *$1 += " = ";
+ // Get a unique name for the name of this value, based on its type.
+ *$1 = getUniqueName($1, $2.type) + " = ";
}
}
- *$1 += *$2;
- delete $2;
+ *$1 += *$2.val;
+ $2.destroy();
deleteUselessCastFlag = false;
$$ = $1;
};
PHIList
: Types '[' ValueRef ',' ValueRef ']' { // Used for PHI nodes
- $3.val->insert(0, *$1.newTy + "[");
- *$3.val += "," + *$5.val + "]";
- $1.destroy(); $5.destroy();
- $$ = new std::string(*$3.val);
- $3.destroy();
+ 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();
}
| PHIList ',' '[' ValueRef ',' ValueRef ']' {
- *$1 += ", [" + *$4.val + "," + *$6.val + "]";
+ std::string Name = getUniqueName($4.val, $1.type);
+ *$1.val += ", [" + Name + "," + *$6.val + "]";
$4.destroy(); $6.destroy();
$$ = $1;
};
ValueRefList
- : ResolvedVal {
+ : ResolvedVal {
$$ = new ValueList();
$$->push_back($1);
}
| ValueRefList ',' ResolvedVal {
- $1->push_back($3);
$$ = $1;
+ $$->push_back($3);
};
// ValueRefListE - Just like ValueRefList, except that it may also be empty!
@@ -1218,61 +1316,77 @@
InstVal : ArithmeticOps Types ValueRef ',' ValueRef {
const char* op = getDivRemOpcode(*$1, $2);
- $$ = new std::string(op);
- *$$ += " " + *$2.newTy + " " + *$3.val + ", " + *$5.val;
- delete $1; $2.destroy(); $3.destroy(); $5.destroy();
+ 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();
}
| LogicalOps Types ValueRef ',' ValueRef {
- *$1 += " " + *$2.newTy + " " + *$3.val + ", " + *$5.val;
- $2.destroy(); $3.destroy(); $5.destroy();
- $$ = $1;
+ 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();
}
| SetCondOps Types ValueRef ',' ValueRef {
+ std::string Name1 = getUniqueName($3.val, $2);
+ std::string Name2 = getUniqueName($5.val, $2);
*$1 = getCompareOp(*$1, $2);
- *$1 += " " + *$2.newTy + " " + *$3.val + ", " + *$5.val;
- $2.destroy(); $3.destroy(); $5.destroy();
- $$ = $1;
+ *$1 += " " + $2->getNewTy() + " " + Name1 + ", " + Name2;
+ $$.val = $1;
+ $$.type = new TypeInfo("bool",BoolTy);
+ $3.destroy(); $5.destroy();
}
| ICMP IPredicates Types ValueRef ',' ValueRef {
- *$1 += " " + *$2 + " " + *$3.newTy + " " + *$4.val + "," + *$6.val;
+ std::string Name1 = getUniqueName($4.val, $3);
+ std::string Name2 = getUniqueName($6.val, $3);
+ *$1 += " " + *$2 + " " + $3->getNewTy() + " " + Name1 + "," + Name2;
+ $$.val = $1;
+ $$.type = new TypeInfo("bool",BoolTy);
delete $2; $4.destroy(); $6.destroy();
- $$ = $1;
}
| FCMP FPredicates Types ValueRef ',' ValueRef {
- *$1 += " " + *$2 + " " + *$3.newTy + " " + *$4.val + "," + *$6.val;
+ std::string Name1 = getUniqueName($4.val, $3);
+ std::string Name2 = getUniqueName($6.val, $3);
+ *$1 += " " + *$2 + " " + $3->getNewTy() + " " + Name1 + "," + Name2;
+ $$.val = $1;
+ $$.type = new TypeInfo("bool",BoolTy);
delete $2; $4.destroy(); $6.destroy();
- $$ = $1;
}
| NOT ResolvedVal {
- *$1 += " " + *$2.val;
- $2.destroy();
- $$ = $1;
+ $$ = $2;
+ $$.val->insert(0, *$1 + " ");
+ delete $1;
}
| ShiftOps ResolvedVal ',' ResolvedVal {
const char* shiftop = $1->c_str();
if (*$1 == "shr")
- shiftop = ($2.type.isUnsigned()) ? "lshr" : "ashr";
- $$ = new std::string(shiftop);
- *$$ += " " + *$2.val + ", " + *$4.val;
- delete $1; $2.destroy(); $4.destroy();
+ shiftop = ($2.type->isUnsigned()) ? "lshr" : "ashr";
+ $$.val = new std::string(shiftop);
+ *$$.val += " " + *$2.val + ", " + *$4.val;
+ $$.type = $2.type;
+ delete $1; delete $2.val; $4.destroy();
}
| CastOps ResolvedVal TO Types {
std::string source = *$2.val;
- TypeInfo SrcTy = $2.type;
- TypeInfo DstTy = $4;
- ResolveType(DstTy);
- $$ = new std::string();
+ TypeInfo* SrcTy = $2.type;
+ TypeInfo* DstTy = ResolveType($4);
+ $$.val = new std::string();
if (*$1 == "cast") {
- *$$ += getCastUpgrade(source, SrcTy, DstTy, false);
+ *$$.val += getCastUpgrade(source, SrcTy, DstTy, false);
} else {
- *$$ += *$1 + " " + source + " to " + *DstTy.newTy;
+ *$$.val += *$1 + " " + source + " to " + DstTy->getNewTy();
}
+ $$.type = $4;
// 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
// when assembled and perform no code gen action so just remove them.
if (*$1 == "cast" || *$1 == "bitcast")
- if ($2.type.isInteger() && $4.isInteger() &&
- $2.type.getBitWidth() == $4.getBitWidth()) {
+ if ($2.type->isInteger() && DstTy->isInteger() &&
+ $2.type->getBitWidth() == DstTy->getBitWidth()) {
deleteUselessCastFlag = true; // Flag the "Inst" rule
deleteUselessCastName = new std::string(*$2.val); // save the name
size_t pos = deleteUselessCastName->find_first_of("%\"",0);
@@ -1282,44 +1396,51 @@
}
}
delete $1; $2.destroy();
- delete $3; $4.destroy();
+ delete $3;
}
| SELECT ResolvedVal ',' ResolvedVal ',' ResolvedVal {
*$1 += " " + *$2.val + ", " + *$4.val + ", " + *$6.val;
- $2.destroy(); $4.destroy(); $6.destroy();
- $$ = $1;
+ $$.val = $1;
+ $$.type = $4.type;
+ $2.destroy(); delete $4.val; $6.destroy();
}
| VAARG ResolvedVal ',' Types {
- *$1 += " " + *$2.val + ", " + *$4.newTy;
- $2.destroy(); $4.destroy();
- $$ = $1;
+ *$1 += " " + *$2.val + ", " + $4->getNewTy();
+ $$.val = $1;
+ $$.type = $4;
+ $2.destroy();
}
| EXTRACTELEMENT ResolvedVal ',' ResolvedVal {
*$1 += " " + *$2.val + ", " + *$4.val;
- $2.destroy(); $4.destroy();
- $$ = $1;
+ $$.val = $1;
+ ResolveType($2.type);
+ $$.type = $2.type->getElementType()->clone();
+ delete $2.val; $4.destroy();
}
| INSERTELEMENT ResolvedVal ',' ResolvedVal ',' ResolvedVal {
*$1 += " " + *$2.val + ", " + *$4.val + ", " + *$6.val;
- $2.destroy(); $4.destroy(); $6.destroy();
- $$ = $1;
+ $$.val = $1;
+ $$.type = $2.type;
+ delete $2.val; $4.destroy(); $6.destroy();
}
| SHUFFLEVECTOR ResolvedVal ',' ResolvedVal ',' ResolvedVal {
*$1 += " " + *$2.val + ", " + *$4.val + ", " + *$6.val;
- $2.destroy(); $4.destroy(); $6.destroy();
- $$ = $1;
+ $$.val = $1;
+ $$.type = $2.type;
+ delete $2.val; $4.destroy(); $6.destroy();
}
| PHI_TOK PHIList {
- *$1 += " " + *$2;
- delete $2;
- $$ = $1;
+ *$1 += " " + *$2.val;
+ $$.val = $1;
+ $$.type = $2.type;
+ delete $2.val;
}
| OptTailCall OptCallingConv TypesV ValueRef '(' ValueRefListE ')' {
if (!$2->empty())
*$1 += " " + *$2;
if (!$1->empty())
*$1 += " ";
- *$1 += *$3.newTy + " " + *$4.val + "(";
+ *$1 += $3->getNewTy() + " " + *$4.val + "(";
for (unsigned i = 0; i < $6->size(); ++i) {
ValueInfo& VI = (*$6)[i];
*$1 += *VI.val;
@@ -1328,8 +1449,9 @@
VI.destroy();
}
*$1 += ")";
- delete $2; $3.destroy(); $4.destroy(); delete $6;
- $$ = $1;
+ $$.val = $1;
+ $$.type = getFunctionReturnType($3);
+ delete $2; delete $3; $4.destroy(); delete $6;
}
| MemoryInst ;
@@ -1346,74 +1468,85 @@
;
MemoryInst : MALLOC Types OptCAlign {
- *$1 += " " + *$2.newTy;
+ *$1 += " " + $2->getNewTy();
if (!$3->empty())
*$1 += " " + *$3;
- $2.destroy(); delete $3;
- $$ = $1;
+ $$.val = $1;
+ $$.type = $2->getPointerType();
+ delete $2; delete $3;
}
| MALLOC Types ',' UINT ValueRef OptCAlign {
- *$1 += " " + *$2.newTy + ", " + *$4.newTy + " " + *$5.val;
+ std::string Name = getUniqueName($5.val, $4);
+ *$1 += " " + $2->getNewTy() + ", " + $4->getNewTy() + " " + Name;
if (!$6->empty())
*$1 += " " + *$6;
- $2.destroy(); $4.destroy(); $5.destroy(); delete $6;
- $$ = $1;
+ $$.val = $1;
+ $$.type = $2->getPointerType();
+ delete $2; delete $4; $5.destroy(); delete $6;
}
| ALLOCA Types OptCAlign {
- *$1 += " " + *$2.newTy;
+ *$1 += " " + $2->getNewTy();
if (!$3->empty())
*$1 += " " + *$3;
- $2.destroy(); delete $3;
- $$ = $1;
+ $$.val = $1;
+ $$.type = $2->getPointerType();
+ delete $2; delete $3;
}
| ALLOCA Types ',' UINT ValueRef OptCAlign {
- *$1 += " " + *$2.newTy + ", " + *$4.newTy + " " + *$5.val;
+ std::string Name = getUniqueName($5.val, $4);
+ *$1 += " " + $2->getNewTy() + ", " + $4->getNewTy() + " " + Name;
if (!$6->empty())
*$1 += " " + *$6;
- $2.destroy(); $4.destroy(); $5.destroy(); delete $6;
- $$ = $1;
+ $$.val = $1;
+ $$.type = $2->getPointerType();
+ delete $2; delete $4; $5.destroy(); delete $6;
}
| FREE ResolvedVal {
*$1 += " " + *$2.val;
+ $$.val = $1;
+ $$.type = new TypeInfo("void", VoidTy);
$2.destroy();
- $$ = $1;
}
| OptVolatile LOAD Types ValueRef {
+ std::string Name = getUniqueName($4.val, $3);
if (!$1->empty())
*$1 += " ";
- *$1 += *$2 + " " + *$3.newTy + " " + *$4.val;
- delete $2; $3.destroy(); $4.destroy();
- $$ = $1;
+ *$1 += *$2 + " " + $3->getNewTy() + " " + Name;
+ $$.val = $1;
+ $$.type = $3->getElementType()->clone();
+ delete $2; delete $3; $4.destroy();
}
| OptVolatile STORE ResolvedVal ',' Types ValueRef {
+ std::string Name = getUniqueName($6.val, $5);
if (!$1->empty())
*$1 += " ";
- *$1 += *$2 + " " + *$3.val + ", " + *$5.newTy + " " + *$6.val;
- delete $2; $3.destroy(); $5.destroy(); $6.destroy();
- $$ = $1;
+ *$1 += *$2 + " " + *$3.val + ", " + $5->getNewTy() + " " + Name;
+ $$.val = $1;
+ $$.type = new TypeInfo("void", VoidTy);
+ delete $2; $3.destroy(); delete $5; $6.destroy();
}
| GETELEMENTPTR Types ValueRef IndexList {
+ 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) {
+ if (VI.type->isUnsigned() && !VI.isConstant() &&
+ VI.type->getBitWidth() < 64) {
std::string* old = VI.val;
*O << " %gep_upgrade" << unique << " = zext " << *old
<< " to i64\n";
VI.val = new std::string("i64 %gep_upgrade" + llvm::utostr(unique++));
- VI.type.oldTy = ULongTy;
- delete old;
+ VI.type->setOldTy(ULongTy);
}
}
- *$1 += " " + *$2.newTy + " " + *$3.val;
+ *$1 += " " + $2->getNewTy() + " " + Name;
for (unsigned i = 0; i < $4->size(); ++i) {
ValueInfo& VI = (*$4)[i];
*$1 += ", " + *VI.val;
- VI.destroy();
}
- $2.destroy(); $3.destroy(); delete $4;
- $$ = $1;
+ $$.val = $1;
+ $$.type = getGEPIndexedType($2,$4);
+ $3.destroy(); delete $4;
};
%%
More information about the llvm-commits
mailing list