For PR411:
This patch replaces the SymbolTable class with ValueSymbolTable which does
not support types planes. This means that all symbol names in LLVM must now
be unique. The patch addresses the necessary changes to deal with this and
removes code no longer needed as a result. This completes the bulk of the
changes for this PR. Some cleanup patches will follow.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33918 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AsmParser/Lexer.cpp.cvs b/lib/AsmParser/Lexer.cpp.cvs
index f2e3e13..9257cce 100644
--- a/lib/AsmParser/Lexer.cpp.cvs
+++ b/lib/AsmParser/Lexer.cpp.cvs
@@ -869,7 +869,7 @@
#define YY_MORE_ADJ 0
#define YY_RESTORE_YY_MORE_OFFSET
char *yytext;
-#line 1 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 1 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
#define INITIAL 0
/*===-- Lexer.l - Scanner for llvm assembly files --------------*- C++ -*--===//
//
@@ -884,7 +884,7 @@
//
//===----------------------------------------------------------------------===*/
#define YY_NEVER_INTERACTIVE 1
-#line 28 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 28 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
#include "ParserInternals.h"
#include "llvm/Module.h"
#include <list>
@@ -1168,7 +1168,7 @@
register char *yy_cp = NULL, *yy_bp = NULL;
register int yy_act;
-#line 189 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 189 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
#line 1175 "Lexer.cpp"
@@ -1264,252 +1264,252 @@
{ /* beginning of action switch */
case 1:
YY_RULE_SETUP
-#line 191 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 191 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ /* Ignore comments for now */ }
YY_BREAK
case 2:
YY_RULE_SETUP
-#line 193 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 193 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return BEGINTOK; }
YY_BREAK
case 3:
YY_RULE_SETUP
-#line 194 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 194 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return ENDTOK; }
YY_BREAK
case 4:
YY_RULE_SETUP
-#line 195 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 195 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return TRUETOK; }
YY_BREAK
case 5:
YY_RULE_SETUP
-#line 196 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 196 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return FALSETOK; }
YY_BREAK
case 6:
YY_RULE_SETUP
-#line 197 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 197 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return DECLARE; }
YY_BREAK
case 7:
YY_RULE_SETUP
-#line 198 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 198 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return DEFINE; }
YY_BREAK
case 8:
YY_RULE_SETUP
-#line 199 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 199 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return GLOBAL; }
YY_BREAK
case 9:
YY_RULE_SETUP
-#line 200 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 200 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return CONSTANT; }
YY_BREAK
case 10:
YY_RULE_SETUP
-#line 201 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 201 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return INTERNAL; }
YY_BREAK
case 11:
YY_RULE_SETUP
-#line 202 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 202 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return LINKONCE; }
YY_BREAK
case 12:
YY_RULE_SETUP
-#line 203 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 203 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return WEAK; }
YY_BREAK
case 13:
YY_RULE_SETUP
-#line 204 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 204 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return APPENDING; }
YY_BREAK
case 14:
YY_RULE_SETUP
-#line 205 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 205 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return DLLIMPORT; }
YY_BREAK
case 15:
YY_RULE_SETUP
-#line 206 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 206 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return DLLEXPORT; }
YY_BREAK
case 16:
YY_RULE_SETUP
-#line 207 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 207 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return HIDDEN; }
YY_BREAK
case 17:
YY_RULE_SETUP
-#line 208 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 208 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return EXTERN_WEAK; }
YY_BREAK
case 18:
YY_RULE_SETUP
-#line 209 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 209 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return EXTERNAL; }
YY_BREAK
case 19:
YY_RULE_SETUP
-#line 210 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 210 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return IMPLEMENTATION; }
YY_BREAK
case 20:
YY_RULE_SETUP
-#line 211 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 211 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return ZEROINITIALIZER; }
YY_BREAK
case 21:
YY_RULE_SETUP
-#line 212 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 212 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return DOTDOTDOT; }
YY_BREAK
case 22:
YY_RULE_SETUP
-#line 213 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 213 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return UNDEF; }
YY_BREAK
case 23:
YY_RULE_SETUP
-#line 214 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 214 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return NULL_TOK; }
YY_BREAK
case 24:
YY_RULE_SETUP
-#line 215 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 215 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return TO; }
YY_BREAK
case 25:
YY_RULE_SETUP
-#line 216 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 216 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return TAIL; }
YY_BREAK
case 26:
YY_RULE_SETUP
-#line 217 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 217 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return TARGET; }
YY_BREAK
case 27:
YY_RULE_SETUP
-#line 218 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 218 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return TRIPLE; }
YY_BREAK
case 28:
YY_RULE_SETUP
-#line 219 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 219 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return DEPLIBS; }
YY_BREAK
case 29:
YY_RULE_SETUP
-#line 220 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 220 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return DATALAYOUT; }
YY_BREAK
case 30:
YY_RULE_SETUP
-#line 221 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 221 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return VOLATILE; }
YY_BREAK
case 31:
YY_RULE_SETUP
-#line 222 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 222 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return ALIGN; }
YY_BREAK
case 32:
YY_RULE_SETUP
-#line 223 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 223 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return SECTION; }
YY_BREAK
case 33:
YY_RULE_SETUP
-#line 224 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 224 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return MODULE; }
YY_BREAK
case 34:
YY_RULE_SETUP
-#line 225 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 225 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return ASM_TOK; }
YY_BREAK
case 35:
YY_RULE_SETUP
-#line 226 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 226 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return SIDEEFFECT; }
YY_BREAK
case 36:
YY_RULE_SETUP
-#line 228 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 228 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return CC_TOK; }
YY_BREAK
case 37:
YY_RULE_SETUP
-#line 229 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 229 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return CCC_TOK; }
YY_BREAK
case 38:
YY_RULE_SETUP
-#line 230 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 230 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return FASTCC_TOK; }
YY_BREAK
case 39:
YY_RULE_SETUP
-#line 231 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 231 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return COLDCC_TOK; }
YY_BREAK
case 40:
YY_RULE_SETUP
-#line 232 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 232 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return X86_STDCALLCC_TOK; }
YY_BREAK
case 41:
YY_RULE_SETUP
-#line 233 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 233 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return X86_FASTCALLCC_TOK; }
YY_BREAK
case 42:
YY_RULE_SETUP
-#line 235 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 235 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return INREG; }
YY_BREAK
case 43:
YY_RULE_SETUP
-#line 236 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 236 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return SRET; }
YY_BREAK
case 44:
YY_RULE_SETUP
-#line 238 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 238 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TY(Type::VoidTy, VOID); }
YY_BREAK
case 45:
YY_RULE_SETUP
-#line 239 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 239 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TY(Type::FloatTy, FLOAT); }
YY_BREAK
case 46:
YY_RULE_SETUP
-#line 240 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 240 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TY(Type::DoubleTy,DOUBLE);}
YY_BREAK
case 47:
YY_RULE_SETUP
-#line 241 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 241 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TY(Type::LabelTy, LABEL); }
YY_BREAK
case 48:
YY_RULE_SETUP
-#line 242 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 242 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return TYPE; }
YY_BREAK
case 49:
YY_RULE_SETUP
-#line 243 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 243 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return OPAQUE; }
YY_BREAK
case 50:
YY_RULE_SETUP
-#line 244 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 244 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ uint64_t NumBits = atoull(yytext+1);
if (NumBits < IntegerType::MIN_INT_BITS ||
NumBits > IntegerType::MAX_INT_BITS)
@@ -1520,347 +1520,347 @@
YY_BREAK
case 51:
YY_RULE_SETUP
-#line 252 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 252 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(BinaryOpVal, Add, ADD); }
YY_BREAK
case 52:
YY_RULE_SETUP
-#line 253 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 253 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(BinaryOpVal, Sub, SUB); }
YY_BREAK
case 53:
YY_RULE_SETUP
-#line 254 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 254 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(BinaryOpVal, Mul, MUL); }
YY_BREAK
case 54:
YY_RULE_SETUP
-#line 255 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 255 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(BinaryOpVal, UDiv, UDIV); }
YY_BREAK
case 55:
YY_RULE_SETUP
-#line 256 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 256 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(BinaryOpVal, SDiv, SDIV); }
YY_BREAK
case 56:
YY_RULE_SETUP
-#line 257 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 257 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(BinaryOpVal, FDiv, FDIV); }
YY_BREAK
case 57:
YY_RULE_SETUP
-#line 258 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 258 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(BinaryOpVal, URem, UREM); }
YY_BREAK
case 58:
YY_RULE_SETUP
-#line 259 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 259 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(BinaryOpVal, SRem, SREM); }
YY_BREAK
case 59:
YY_RULE_SETUP
-#line 260 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 260 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(BinaryOpVal, FRem, FREM); }
YY_BREAK
case 60:
YY_RULE_SETUP
-#line 261 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 261 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(BinaryOpVal, Shl, SHL); }
YY_BREAK
case 61:
YY_RULE_SETUP
-#line 262 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 262 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(BinaryOpVal, LShr, LSHR); }
YY_BREAK
case 62:
YY_RULE_SETUP
-#line 263 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 263 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(BinaryOpVal, AShr, ASHR); }
YY_BREAK
case 63:
YY_RULE_SETUP
-#line 264 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 264 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(BinaryOpVal, And, AND); }
YY_BREAK
case 64:
YY_RULE_SETUP
-#line 265 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 265 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(BinaryOpVal, Or , OR ); }
YY_BREAK
case 65:
YY_RULE_SETUP
-#line 266 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 266 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(BinaryOpVal, Xor, XOR); }
YY_BREAK
case 66:
YY_RULE_SETUP
-#line 267 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 267 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(OtherOpVal, ICmp, ICMP); }
YY_BREAK
case 67:
YY_RULE_SETUP
-#line 268 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 268 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(OtherOpVal, FCmp, FCMP); }
YY_BREAK
case 68:
YY_RULE_SETUP
-#line 270 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 270 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return EQ; }
YY_BREAK
case 69:
YY_RULE_SETUP
-#line 271 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 271 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return NE; }
YY_BREAK
case 70:
YY_RULE_SETUP
-#line 272 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 272 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return SLT; }
YY_BREAK
case 71:
YY_RULE_SETUP
-#line 273 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 273 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return SGT; }
YY_BREAK
case 72:
YY_RULE_SETUP
-#line 274 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 274 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return SLE; }
YY_BREAK
case 73:
YY_RULE_SETUP
-#line 275 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 275 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return SGE; }
YY_BREAK
case 74:
YY_RULE_SETUP
-#line 276 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 276 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return ULT; }
YY_BREAK
case 75:
YY_RULE_SETUP
-#line 277 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 277 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return UGT; }
YY_BREAK
case 76:
YY_RULE_SETUP
-#line 278 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 278 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return ULE; }
YY_BREAK
case 77:
YY_RULE_SETUP
-#line 279 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 279 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return UGE; }
YY_BREAK
case 78:
YY_RULE_SETUP
-#line 280 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 280 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return OEQ; }
YY_BREAK
case 79:
YY_RULE_SETUP
-#line 281 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 281 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return ONE; }
YY_BREAK
case 80:
YY_RULE_SETUP
-#line 282 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 282 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return OLT; }
YY_BREAK
case 81:
YY_RULE_SETUP
-#line 283 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 283 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return OGT; }
YY_BREAK
case 82:
YY_RULE_SETUP
-#line 284 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 284 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return OLE; }
YY_BREAK
case 83:
YY_RULE_SETUP
-#line 285 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 285 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return OGE; }
YY_BREAK
case 84:
YY_RULE_SETUP
-#line 286 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 286 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return ORD; }
YY_BREAK
case 85:
YY_RULE_SETUP
-#line 287 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 287 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return UNO; }
YY_BREAK
case 86:
YY_RULE_SETUP
-#line 288 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 288 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return UEQ; }
YY_BREAK
case 87:
YY_RULE_SETUP
-#line 289 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 289 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return UNE; }
YY_BREAK
case 88:
YY_RULE_SETUP
-#line 291 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 291 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(OtherOpVal, PHI, PHI_TOK); }
YY_BREAK
case 89:
YY_RULE_SETUP
-#line 292 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 292 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(OtherOpVal, Call, CALL); }
YY_BREAK
case 90:
YY_RULE_SETUP
-#line 293 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 293 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(CastOpVal, Trunc, TRUNC); }
YY_BREAK
case 91:
YY_RULE_SETUP
-#line 294 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 294 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(CastOpVal, ZExt, ZEXT); }
YY_BREAK
case 92:
YY_RULE_SETUP
-#line 295 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 295 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(CastOpVal, SExt, SEXT); }
YY_BREAK
case 93:
YY_RULE_SETUP
-#line 296 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 296 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(CastOpVal, FPTrunc, FPTRUNC); }
YY_BREAK
case 94:
YY_RULE_SETUP
-#line 297 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 297 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(CastOpVal, FPExt, FPEXT); }
YY_BREAK
case 95:
YY_RULE_SETUP
-#line 298 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 298 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(CastOpVal, UIToFP, UITOFP); }
YY_BREAK
case 96:
YY_RULE_SETUP
-#line 299 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 299 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(CastOpVal, SIToFP, SITOFP); }
YY_BREAK
case 97:
YY_RULE_SETUP
-#line 300 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 300 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(CastOpVal, FPToUI, FPTOUI); }
YY_BREAK
case 98:
YY_RULE_SETUP
-#line 301 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 301 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(CastOpVal, FPToSI, FPTOSI); }
YY_BREAK
case 99:
YY_RULE_SETUP
-#line 302 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 302 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(CastOpVal, IntToPtr, INTTOPTR); }
YY_BREAK
case 100:
YY_RULE_SETUP
-#line 303 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 303 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(CastOpVal, PtrToInt, PTRTOINT); }
YY_BREAK
case 101:
YY_RULE_SETUP
-#line 304 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 304 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(CastOpVal, BitCast, BITCAST); }
YY_BREAK
case 102:
YY_RULE_SETUP
-#line 305 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 305 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(OtherOpVal, Select, SELECT); }
YY_BREAK
case 103:
YY_RULE_SETUP
-#line 306 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 306 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(OtherOpVal, VAArg , VAARG); }
YY_BREAK
case 104:
YY_RULE_SETUP
-#line 307 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 307 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(TermOpVal, Ret, RET); }
YY_BREAK
case 105:
YY_RULE_SETUP
-#line 308 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 308 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(TermOpVal, Br, BR); }
YY_BREAK
case 106:
YY_RULE_SETUP
-#line 309 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 309 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(TermOpVal, Switch, SWITCH); }
YY_BREAK
case 107:
YY_RULE_SETUP
-#line 310 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 310 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(TermOpVal, Invoke, INVOKE); }
YY_BREAK
case 108:
YY_RULE_SETUP
-#line 311 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 311 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(TermOpVal, Unwind, UNWIND); }
YY_BREAK
case 109:
YY_RULE_SETUP
-#line 312 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 312 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(TermOpVal, Unreachable, UNREACHABLE); }
YY_BREAK
case 110:
YY_RULE_SETUP
-#line 314 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 314 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(MemOpVal, Malloc, MALLOC); }
YY_BREAK
case 111:
YY_RULE_SETUP
-#line 315 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 315 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(MemOpVal, Alloca, ALLOCA); }
YY_BREAK
case 112:
YY_RULE_SETUP
-#line 316 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 316 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(MemOpVal, Free, FREE); }
YY_BREAK
case 113:
YY_RULE_SETUP
-#line 317 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 317 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(MemOpVal, Load, LOAD); }
YY_BREAK
case 114:
YY_RULE_SETUP
-#line 318 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 318 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(MemOpVal, Store, STORE); }
YY_BREAK
case 115:
YY_RULE_SETUP
-#line 319 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 319 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(MemOpVal, GetElementPtr, GETELEMENTPTR); }
YY_BREAK
case 116:
YY_RULE_SETUP
-#line 321 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 321 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(OtherOpVal, ExtractElement, EXTRACTELEMENT); }
YY_BREAK
case 117:
YY_RULE_SETUP
-#line 322 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 322 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(OtherOpVal, InsertElement, INSERTELEMENT); }
YY_BREAK
case 118:
YY_RULE_SETUP
-#line 323 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 323 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(OtherOpVal, ShuffleVector, SHUFFLEVECTOR); }
YY_BREAK
case 119:
YY_RULE_SETUP
-#line 326 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 326 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{
UnEscapeLexed(yytext+1);
llvmAsmlval.StrVal = strdup(yytext+1); // Skip %
@@ -1869,7 +1869,7 @@
YY_BREAK
case 120:
YY_RULE_SETUP
-#line 331 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 331 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{
UnEscapeLexed(yytext+1);
llvmAsmlval.StrVal = strdup(yytext+1); // Skip @
@@ -1878,7 +1878,7 @@
YY_BREAK
case 121:
YY_RULE_SETUP
-#line 336 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 336 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{
yytext[strlen(yytext)-1] = 0; // nuke colon
UnEscapeLexed(yytext);
@@ -1888,7 +1888,7 @@
YY_BREAK
case 122:
YY_RULE_SETUP
-#line 342 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 342 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{
yytext[strlen(yytext)-2] = 0; // nuke colon, end quote
UnEscapeLexed(yytext+1);
@@ -1898,7 +1898,7 @@
YY_BREAK
case 123:
YY_RULE_SETUP
-#line 349 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 349 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ // Note that we cannot unescape a string constant here! The
// string constant might contain a \00 which would not be
// understood by the string stuff. It is valid to make a
@@ -1911,7 +1911,7 @@
YY_BREAK
case 124:
YY_RULE_SETUP
-#line 358 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 358 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{
yytext[strlen(yytext)-1] = 0; // nuke end quote
llvmAsmlval.StrVal = strdup(yytext+2); // Nuke @, quote
@@ -1920,12 +1920,12 @@
YY_BREAK
case 125:
YY_RULE_SETUP
-#line 366 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 366 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ llvmAsmlval.UInt64Val = atoull(yytext); return EUINT64VAL; }
YY_BREAK
case 126:
YY_RULE_SETUP
-#line 367 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 367 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{
uint64_t Val = atoull(yytext+1);
// +1: we have bigger negative range
@@ -1937,7 +1937,7 @@
YY_BREAK
case 127:
YY_RULE_SETUP
-#line 375 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 375 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{
llvmAsmlval.UInt64Val = HexIntToVal(yytext+3);
return yytext[0] == 's' ? ESINT64VAL : EUINT64VAL;
@@ -1945,7 +1945,7 @@
YY_BREAK
case 128:
YY_RULE_SETUP
-#line 380 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 380 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{
uint64_t Val = atoull(yytext+1);
if ((unsigned)Val != Val)
@@ -1956,7 +1956,7 @@
YY_BREAK
case 129:
YY_RULE_SETUP
-#line 387 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 387 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{
uint64_t Val = atoull(yytext+1);
if ((unsigned)Val != Val)
@@ -1967,16 +1967,16 @@
YY_BREAK
case 130:
YY_RULE_SETUP
-#line 395 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 395 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ llvmAsmlval.FPVal = atof(yytext); return FPVAL; }
YY_BREAK
case 131:
YY_RULE_SETUP
-#line 396 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 396 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ llvmAsmlval.FPVal = HexToFP(yytext); return FPVAL; }
YY_BREAK
case YY_STATE_EOF(INITIAL):
-#line 398 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 398 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{
/* Make sure to free the internal buffers for flex when we are
* done reading our input!
@@ -1987,17 +1987,17 @@
YY_BREAK
case 132:
YY_RULE_SETUP
-#line 406 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 406 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ /* Ignore whitespace */ }
YY_BREAK
case 133:
YY_RULE_SETUP
-#line 407 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 407 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return yytext[0]; }
YY_BREAK
case 134:
YY_RULE_SETUP
-#line 409 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 409 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
YY_FATAL_ERROR( "flex scanner jammed" );
YY_BREAK
#line 2004 "Lexer.cpp"
@@ -2878,5 +2878,5 @@
return 0;
}
#endif
-#line 409 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 409 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
diff --git a/lib/AsmParser/llvmAsmParser.cpp.cvs b/lib/AsmParser/llvmAsmParser.cpp.cvs
index 02abfbb..b34c534 100644
--- a/lib/AsmParser/llvmAsmParser.cpp.cvs
+++ b/lib/AsmParser/llvmAsmParser.cpp.cvs
@@ -330,14 +330,14 @@
/* Copy the first part of user declarations. */
-#line 14 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 14 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
#include "ParserInternals.h"
#include "llvm/CallingConv.h"
#include "llvm/InlineAsm.h"
#include "llvm/Instructions.h"
#include "llvm/Module.h"
-#include "llvm/SymbolTable.h"
+#include "llvm/ValueSymbolTable.h"
#include "llvm/Support/GetElementPtrTypeIterator.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/ADT/SmallVector.h"
@@ -529,7 +529,7 @@
std::map<const Type*, ValueList> Values; // Keep track of #'d definitions
std::map<const Type*, ValueList> LateResolveValues;
- bool isDeclare; // Is this function a forward declararation?
+ bool isDeclare; // Is this function a forward declararation?
GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
GlobalValue::VisibilityTypes Visibility;
@@ -661,24 +661,33 @@
// Module constants occupy the lowest numbered slots...
std::map<const Type*,ValueList>::iterator VI = CurModule.Values.find(Ty);
- if (VI == CurModule.Values.end()) return 0;
- if (D.Num >= VI->second.size()) return 0;
+ if (VI == CurModule.Values.end())
+ return 0;
+ if (D.Num >= VI->second.size())
+ return 0;
return VI->second[Num];
}
case ValID::LocalName: { // Is it a named definition?
- if (!inFunctionScope()) return 0;
- SymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
- Value *N = SymTab.lookup(Ty, D.Name);
- if (N == 0) return 0;
+ if (!inFunctionScope())
+ return 0;
+ ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
+ Value *N = SymTab.lookup(D.Name);
+ if (N == 0)
+ return 0;
+ if (N->getType() != Ty)
+ return 0;
D.destroy(); // Free old strdup'd memory...
return N;
}
case ValID::GlobalName: { // Is it a named definition?
- SymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
- Value *N = SymTab.lookup(Ty, D.Name);
- if (N == 0) return 0;
+ ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
+ Value *N = SymTab.lookup(D.Name);
+ if (N == 0)
+ return 0;
+ if (N->getType() != Ty)
+ return 0;
D.destroy(); // Free old strdup'd memory...
return N;
@@ -819,8 +828,8 @@
break;
case ValID::LocalName: // Is it a named definition?
Name = ID.Name;
- if (Value *N = CurFun.CurrentFunction->
- getValueSymbolTable().lookup(Type::LabelTy, Name))
+ Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name);
+ if (N && N->getType()->getTypeID() == Type::LabelTyID)
BB = cast<BasicBlock>(N);
break;
}
@@ -960,8 +969,8 @@
}
assert(inFunctionScope() && "Must be in function scope!");
- SymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
- if (ST.lookup(V->getType(), Name)) {
+ ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
+ if (ST.lookup(Name)) {
GenerateError("Redefinition of value '" + Name + "' of type '" +
V->getType()->getDescription() + "'");
return;
@@ -1015,16 +1024,21 @@
return GV;
}
- // If this global has a name, check to see if there is already a definition
- // of this global in the module. If so, it is an error.
+ // If this global has a name
if (!Name.empty()) {
- // We are a simple redefinition of a value, check to see if it is defined
- // the same as the old one.
- if (CurModule.CurrentModule->getGlobalVariable(Name, Ty)) {
- GenerateError("Redefinition of global variable named '" + Name +
- "' of type '" + Ty->getDescription() + "'");
- return 0;
- }
+ // if the global we're parsing has an initializer (is a definition) and
+ // has external linkage.
+ if (Initializer && Linkage != GlobalValue::InternalLinkage)
+ // If there is already a global with external linkage with this name
+ if (CurModule.CurrentModule->getGlobalVariable(Name, false)) {
+ // If we allow this GVar to get created, it will be renamed in the
+ // symbol table because it conflicts with an existing GVar. We can't
+ // allow redefinition of GVars whose linking indicates that their name
+ // must stay the same. Issue the error.
+ GenerateError("Redefinition of global variable named '" + Name +
+ "' of type '" + Ty->getDescription() + "'");
+ return 0;
+ }
}
// Otherwise there is no existing GV to use, create one now.
@@ -1222,7 +1236,7 @@
#endif
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
-#line 886 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 900 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
typedef union YYSTYPE {
llvm::Module *ModuleVal;
llvm::Function *FunctionVal;
@@ -1269,7 +1283,7 @@
llvm::FCmpInst::Predicate FPredicate;
} YYSTYPE;
/* Line 196 of yacc.c. */
-#line 1273 "llvmAsmParser.tab.c"
+#line 1287 "llvmAsmParser.tab.c"
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1
@@ -1281,7 +1295,7 @@
/* Line 219 of yacc.c. */
-#line 1285 "llvmAsmParser.tab.c"
+#line 1299 "llvmAsmParser.tab.c"
#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
# define YYSIZE_T __SIZE_TYPE__
@@ -1629,35 +1643,35 @@
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const unsigned short int yyrline[] =
{
- 0, 1033, 1033, 1033, 1033, 1033, 1033, 1033, 1033, 1033,
- 1033, 1034, 1034, 1034, 1034, 1034, 1034, 1035, 1035, 1035,
- 1035, 1035, 1035, 1036, 1036, 1036, 1036, 1036, 1036, 1039,
- 1039, 1040, 1040, 1041, 1041, 1042, 1042, 1043, 1043, 1047,
- 1047, 1048, 1048, 1049, 1049, 1050, 1050, 1051, 1051, 1052,
- 1052, 1053, 1053, 1054, 1055, 1060, 1061, 1061, 1063, 1063,
- 1064, 1064, 1068, 1072, 1077, 1077, 1079, 1083, 1089, 1090,
- 1091, 1092, 1093, 1097, 1098, 1099, 1103, 1104, 1108, 1109,
- 1110, 1114, 1115, 1116, 1117, 1118, 1121, 1122, 1123, 1124,
- 1125, 1126, 1127, 1134, 1135, 1136, 1137, 1140, 1141, 1146,
- 1147, 1150, 1151, 1158, 1159, 1165, 1166, 1174, 1182, 1183,
- 1188, 1189, 1190, 1195, 1208, 1208, 1208, 1208, 1211, 1215,
- 1219, 1226, 1231, 1239, 1257, 1275, 1280, 1292, 1302, 1306,
- 1316, 1323, 1330, 1337, 1342, 1347, 1354, 1355, 1362, 1369,
- 1377, 1382, 1393, 1421, 1437, 1466, 1494, 1519, 1538, 1563,
- 1582, 1594, 1601, 1667, 1677, 1687, 1693, 1699, 1704, 1709,
- 1717, 1729, 1750, 1758, 1764, 1775, 1780, 1785, 1791, 1797,
- 1806, 1810, 1818, 1818, 1829, 1834, 1842, 1843, 1847, 1847,
- 1851, 1851, 1854, 1857, 1869, 1893, 1904, 1904, 1914, 1914,
- 1922, 1922, 1932, 1935, 1941, 1954, 1958, 1963, 1965, 1970,
- 1975, 1984, 1994, 2005, 2009, 2018, 2027, 2032, 2138, 2138,
- 2140, 2149, 2149, 2151, 2156, 2168, 2172, 2177, 2181, 2185,
- 2189, 2193, 2197, 2201, 2205, 2209, 2234, 2238, 2252, 2256,
- 2260, 2264, 2270, 2270, 2276, 2285, 2289, 2298, 2309, 2318,
- 2330, 2343, 2347, 2351, 2356, 2366, 2385, 2394, 2461, 2465,
- 2472, 2483, 2496, 2505, 2516, 2526, 2534, 2542, 2545, 2546,
- 2553, 2557, 2562, 2583, 2600, 2613, 2626, 2638, 2646, 2653,
- 2659, 2665, 2671, 2686, 2750, 2755, 2759, 2766, 2773, 2781,
- 2788, 2796, 2804, 2818, 2835
+ 0, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047,
+ 1047, 1048, 1048, 1048, 1048, 1048, 1048, 1049, 1049, 1049,
+ 1049, 1049, 1049, 1050, 1050, 1050, 1050, 1050, 1050, 1053,
+ 1053, 1054, 1054, 1055, 1055, 1056, 1056, 1057, 1057, 1061,
+ 1061, 1062, 1062, 1063, 1063, 1064, 1064, 1065, 1065, 1066,
+ 1066, 1067, 1067, 1068, 1069, 1074, 1075, 1075, 1077, 1077,
+ 1078, 1078, 1082, 1086, 1091, 1091, 1093, 1097, 1103, 1104,
+ 1105, 1106, 1107, 1111, 1112, 1113, 1117, 1118, 1122, 1123,
+ 1124, 1128, 1129, 1130, 1131, 1132, 1135, 1136, 1137, 1138,
+ 1139, 1140, 1141, 1148, 1149, 1150, 1151, 1154, 1155, 1160,
+ 1161, 1164, 1165, 1172, 1173, 1179, 1180, 1188, 1196, 1197,
+ 1202, 1203, 1204, 1209, 1222, 1222, 1222, 1222, 1225, 1229,
+ 1233, 1240, 1245, 1253, 1271, 1289, 1294, 1306, 1316, 1320,
+ 1330, 1337, 1344, 1351, 1356, 1361, 1368, 1369, 1376, 1383,
+ 1391, 1396, 1407, 1435, 1451, 1480, 1508, 1533, 1552, 1577,
+ 1596, 1608, 1615, 1681, 1691, 1701, 1707, 1713, 1718, 1723,
+ 1731, 1743, 1764, 1772, 1778, 1789, 1794, 1799, 1805, 1811,
+ 1820, 1824, 1832, 1832, 1843, 1848, 1856, 1857, 1861, 1861,
+ 1865, 1865, 1868, 1871, 1883, 1907, 1918, 1918, 1928, 1928,
+ 1936, 1936, 1946, 1949, 1955, 1968, 1972, 1977, 1979, 1984,
+ 1989, 1998, 2008, 2019, 2023, 2032, 2041, 2046, 2158, 2158,
+ 2160, 2169, 2169, 2171, 2176, 2188, 2192, 2197, 2201, 2205,
+ 2209, 2213, 2217, 2221, 2225, 2229, 2254, 2258, 2272, 2276,
+ 2280, 2284, 2290, 2290, 2296, 2305, 2309, 2318, 2328, 2337,
+ 2349, 2362, 2366, 2370, 2375, 2385, 2404, 2413, 2480, 2484,
+ 2491, 2502, 2515, 2525, 2536, 2546, 2554, 2562, 2565, 2566,
+ 2573, 2577, 2582, 2603, 2620, 2633, 2646, 2658, 2666, 2673,
+ 2679, 2685, 2691, 2706, 2770, 2775, 2779, 2786, 2793, 2801,
+ 2808, 2816, 2824, 2838, 2855
};
#endif
@@ -2981,142 +2995,142 @@
switch (yyn)
{
case 29:
-#line 1039 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1053 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
break;
case 30:
-#line 1039 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1053 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
break;
case 31:
-#line 1040 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1054 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
break;
case 32:
-#line 1040 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1054 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
break;
case 33:
-#line 1041 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1055 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
break;
case 34:
-#line 1041 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1055 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
break;
case 35:
-#line 1042 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1056 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
break;
case 36:
-#line 1042 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1056 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
break;
case 37:
-#line 1043 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1057 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
break;
case 38:
-#line 1043 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1057 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
break;
case 39:
-#line 1047 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1061 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
break;
case 40:
-#line 1047 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1061 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
break;
case 41:
-#line 1048 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1062 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
break;
case 42:
-#line 1048 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1062 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
break;
case 43:
-#line 1049 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1063 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
break;
case 44:
-#line 1049 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1063 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
break;
case 45:
-#line 1050 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1064 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
break;
case 46:
-#line 1050 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1064 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
break;
case 47:
-#line 1051 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1065 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
break;
case 48:
-#line 1051 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1065 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
break;
case 49:
-#line 1052 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1066 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
break;
case 50:
-#line 1052 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1066 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
break;
case 51:
-#line 1053 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1067 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
break;
case 52:
-#line 1053 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1067 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
break;
case 53:
-#line 1054 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1068 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
break;
case 54:
-#line 1055 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1069 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
break;
case 61:
-#line 1064 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1078 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.StrVal) = 0; ;}
break;
case 62:
-#line 1068 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1082 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
(yyval.StrVal) = (yyvsp[-1].StrVal);
CHECK_FOR_ERROR
@@ -3124,7 +3138,7 @@
break;
case 63:
-#line 1072 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1086 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
(yyval.StrVal) = 0;
CHECK_FOR_ERROR
@@ -3132,7 +3146,7 @@
break;
case 66:
-#line 1079 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1093 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
(yyval.StrVal) = (yyvsp[-1].StrVal);
CHECK_FOR_ERROR
@@ -3140,7 +3154,7 @@
break;
case 67:
-#line 1083 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1097 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
(yyval.StrVal) = 0;
CHECK_FOR_ERROR
@@ -3148,127 +3162,127 @@
break;
case 68:
-#line 1089 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1103 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
break;
case 69:
-#line 1090 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1104 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
break;
case 70:
-#line 1091 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1105 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
break;
case 71:
-#line 1092 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1106 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
break;
case 72:
-#line 1093 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1107 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
break;
case 73:
-#line 1097 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1111 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
break;
case 74:
-#line 1098 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1112 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
break;
case 75:
-#line 1099 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1113 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
break;
case 76:
-#line 1103 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1117 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
break;
case 77:
-#line 1104 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1118 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.Visibility) = GlobalValue::HiddenVisibility; ;}
break;
case 78:
-#line 1108 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1122 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
break;
case 79:
-#line 1109 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1123 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
break;
case 80:
-#line 1110 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1124 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
break;
case 81:
-#line 1114 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1128 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
break;
case 82:
-#line 1115 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1129 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
break;
case 83:
-#line 1116 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1130 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
break;
case 84:
-#line 1117 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1131 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
break;
case 85:
-#line 1118 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1132 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
break;
case 86:
-#line 1121 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1135 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.UIntVal) = CallingConv::C; ;}
break;
case 87:
-#line 1122 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1136 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.UIntVal) = CallingConv::C; ;}
break;
case 88:
-#line 1123 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1137 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.UIntVal) = CallingConv::Fast; ;}
break;
case 89:
-#line 1124 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1138 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.UIntVal) = CallingConv::Cold; ;}
break;
case 90:
-#line 1125 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1139 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
break;
case 91:
-#line 1126 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1140 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
break;
case 92:
-#line 1127 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1141 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
if ((unsigned)(yyvsp[0].UInt64Val) != (yyvsp[0].UInt64Val))
GEN_ERROR("Calling conv too large");
@@ -3278,61 +3292,61 @@
break;
case 93:
-#line 1134 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1148 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.ParamAttrs) = FunctionType::ZExtAttribute; ;}
break;
case 94:
-#line 1135 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1149 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.ParamAttrs) = FunctionType::SExtAttribute; ;}
break;
case 95:
-#line 1136 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1150 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.ParamAttrs) = FunctionType::InRegAttribute; ;}
break;
case 96:
-#line 1137 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1151 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.ParamAttrs) = FunctionType::StructRetAttribute; ;}
break;
case 97:
-#line 1140 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1154 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.ParamAttrs) = FunctionType::NoAttributeSet; ;}
break;
case 98:
-#line 1141 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1155 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
(yyval.ParamAttrs) = FunctionType::ParameterAttributes((yyvsp[-1].ParamAttrs) | (yyvsp[0].ParamAttrs));
;}
break;
case 99:
-#line 1146 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1160 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.ParamAttrs) = FunctionType::NoReturnAttribute; ;}
break;
case 101:
-#line 1150 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1164 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.ParamAttrs) = FunctionType::NoAttributeSet; ;}
break;
case 102:
-#line 1151 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1165 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
(yyval.ParamAttrs) = FunctionType::ParameterAttributes((yyvsp[-1].ParamAttrs) | (yyvsp[0].ParamAttrs));
;}
break;
case 103:
-#line 1158 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1172 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.UIntVal) = 0; ;}
break;
case 104:
-#line 1159 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1173 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
(yyval.UIntVal) = (yyvsp[0].UInt64Val);
if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
@@ -3342,12 +3356,12 @@
break;
case 105:
-#line 1165 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1179 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.UIntVal) = 0; ;}
break;
case 106:
-#line 1166 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1180 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
(yyval.UIntVal) = (yyvsp[0].UInt64Val);
if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
@@ -3357,7 +3371,7 @@
break;
case 107:
-#line 1174 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1188 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
for (unsigned i = 0, e = strlen((yyvsp[0].StrVal)); i != e; ++i)
if ((yyvsp[0].StrVal)[i] == '"' || (yyvsp[0].StrVal)[i] == '\\')
@@ -3368,27 +3382,27 @@
break;
case 108:
-#line 1182 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1196 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.StrVal) = 0; ;}
break;
case 109:
-#line 1183 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1197 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.StrVal) = (yyvsp[0].StrVal); ;}
break;
case 110:
-#line 1188 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1202 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{;}
break;
case 111:
-#line 1189 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1203 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{;}
break;
case 112:
-#line 1190 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1204 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
CurGV->setSection((yyvsp[0].StrVal));
free((yyvsp[0].StrVal));
@@ -3397,7 +3411,7 @@
break;
case 113:
-#line 1195 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1209 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
if ((yyvsp[0].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[0].UInt64Val)))
GEN_ERROR("Alignment must be a power of two");
@@ -3407,7 +3421,7 @@
break;
case 118:
-#line 1211 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1225 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
(yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
CHECK_FOR_ERROR
@@ -3415,7 +3429,7 @@
break;
case 119:
-#line 1215 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1229 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
(yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType));
CHECK_FOR_ERROR
@@ -3423,7 +3437,7 @@
break;
case 120:
-#line 1219 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1233 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ // Pointer type?
if (*(yyvsp[-1].TypeVal) == Type::LabelTy)
GEN_ERROR("Cannot form a pointer to a basic block");
@@ -3434,7 +3448,7 @@
break;
case 121:
-#line 1226 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1240 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ // Named types are also simple types...
const Type* tmp = getTypeVal((yyvsp[0].ValIDVal));
CHECK_FOR_ERROR
@@ -3443,7 +3457,7 @@
break;
case 122:
-#line 1231 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1245 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ // Type UpReference
if ((yyvsp[0].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range");
OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
@@ -3455,7 +3469,7 @@
break;
case 123:
-#line 1239 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1253 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
std::vector<const Type*> Params;
std::vector<FunctionType::ParameterAttributes> Attrs;
@@ -3477,7 +3491,7 @@
break;
case 124:
-#line 1257 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1271 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
std::vector<const Type*> Params;
std::vector<FunctionType::ParameterAttributes> Attrs;
@@ -3498,7 +3512,7 @@
break;
case 125:
-#line 1275 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1289 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ // Sized array type?
(yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val))));
delete (yyvsp[-1].TypeVal);
@@ -3507,7 +3521,7 @@
break;
case 126:
-#line 1280 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1294 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ // Packed array type?
const llvm::Type* ElemTy = (yyvsp[-1].TypeVal)->get();
if ((unsigned)(yyvsp[-3].UInt64Val) != (yyvsp[-3].UInt64Val))
@@ -3523,7 +3537,7 @@
break;
case 127:
-#line 1292 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1306 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ // Structure type?
std::vector<const Type*> Elements;
for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-1].TypeList)->begin(),
@@ -3537,7 +3551,7 @@
break;
case 128:
-#line 1302 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1316 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ // Empty structure type?
(yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
CHECK_FOR_ERROR
@@ -3545,7 +3559,7 @@
break;
case 129:
-#line 1306 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1320 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
std::vector<const Type*> Elements;
for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-2].TypeList)->begin(),
@@ -3559,7 +3573,7 @@
break;
case 130:
-#line 1316 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1330 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ // Empty structure type?
(yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
CHECK_FOR_ERROR
@@ -3567,7 +3581,7 @@
break;
case 131:
-#line 1323 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1337 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
(yyval.TypeWithAttrs).Ty = (yyvsp[-1].TypeVal);
(yyval.TypeWithAttrs).Attrs = (yyvsp[0].ParamAttrs);
@@ -3575,7 +3589,7 @@
break;
case 132:
-#line 1330 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1344 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
if (!UpRefs.empty())
GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
@@ -3586,14 +3600,14 @@
break;
case 133:
-#line 1337 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1351 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
(yyval.TypeVal) = new PATypeHolder(Type::VoidTy);
;}
break;
case 134:
-#line 1342 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1356 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
(yyval.TypeWithAttrsList) = new TypeWithAttrsList();
(yyval.TypeWithAttrsList)->push_back((yyvsp[0].TypeWithAttrs));
@@ -3602,7 +3616,7 @@
break;
case 135:
-#line 1347 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1361 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
((yyval.TypeWithAttrsList)=(yyvsp[-2].TypeWithAttrsList))->push_back((yyvsp[0].TypeWithAttrs));
CHECK_FOR_ERROR
@@ -3610,7 +3624,7 @@
break;
case 137:
-#line 1355 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1369 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
(yyval.TypeWithAttrsList)=(yyvsp[-2].TypeWithAttrsList);
TypeWithAttrs TWA; TWA.Attrs = FunctionType::NoAttributeSet;
@@ -3621,7 +3635,7 @@
break;
case 138:
-#line 1362 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1376 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
(yyval.TypeWithAttrsList) = new TypeWithAttrsList;
TypeWithAttrs TWA; TWA.Attrs = FunctionType::NoAttributeSet;
@@ -3632,7 +3646,7 @@
break;
case 139:
-#line 1369 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1383 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
(yyval.TypeWithAttrsList) = new TypeWithAttrsList();
CHECK_FOR_ERROR
@@ -3640,7 +3654,7 @@
break;
case 140:
-#line 1377 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1391 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
(yyval.TypeList) = new std::list<PATypeHolder>();
(yyval.TypeList)->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal);
@@ -3649,7 +3663,7 @@
break;
case 141:
-#line 1382 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1396 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal);
CHECK_FOR_ERROR
@@ -3657,7 +3671,7 @@
break;
case 142:
-#line 1393 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1407 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ // Nonempty unsized arr
if (!UpRefs.empty())
GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
@@ -3689,7 +3703,7 @@
break;
case 143:
-#line 1421 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1435 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
if (!UpRefs.empty())
GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
@@ -3709,7 +3723,7 @@
break;
case 144:
-#line 1437 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1451 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
if (!UpRefs.empty())
GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
@@ -3742,7 +3756,7 @@
break;
case 145:
-#line 1466 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1480 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ // Nonempty unsized arr
if (!UpRefs.empty())
GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
@@ -3774,7 +3788,7 @@
break;
case 146:
-#line 1494 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1508 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
const StructType *STy = dyn_cast<StructType>((yyvsp[-3].TypeVal)->get());
if (STy == 0)
@@ -3803,7 +3817,7 @@
break;
case 147:
-#line 1519 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1533 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
if (!UpRefs.empty())
GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
@@ -3826,7 +3840,7 @@
break;
case 148:
-#line 1538 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1552 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
const StructType *STy = dyn_cast<StructType>((yyvsp[-5].TypeVal)->get());
if (STy == 0)
@@ -3855,7 +3869,7 @@
break;
case 149:
-#line 1563 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1577 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
if (!UpRefs.empty())
GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription());
@@ -3878,7 +3892,7 @@
break;
case 150:
-#line 1582 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1596 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
if (!UpRefs.empty())
GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
@@ -3894,7 +3908,7 @@
break;
case 151:
-#line 1594 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1608 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
if (!UpRefs.empty())
GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
@@ -3905,7 +3919,7 @@
break;
case 152:
-#line 1601 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1615 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
if (!UpRefs.empty())
GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
@@ -3975,7 +3989,7 @@
break;
case 153:
-#line 1667 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1681 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
if (!UpRefs.empty())
GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
@@ -3989,7 +4003,7 @@
break;
case 154:
-#line 1677 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1691 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
if (!UpRefs.empty())
GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
@@ -4003,7 +4017,7 @@
break;
case 155:
-#line 1687 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1701 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ // integral constants
if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val)))
GEN_ERROR("Constant value doesn't fit in type");
@@ -4013,7 +4027,7 @@
break;
case 156:
-#line 1693 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1707 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ // integral constants
if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val)))
GEN_ERROR("Constant value doesn't fit in type");
@@ -4023,7 +4037,7 @@
break;
case 157:
-#line 1699 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1713 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ // Boolean constants
assert(cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth() == 1 && "Not Bool?");
(yyval.ConstVal) = ConstantInt::getTrue();
@@ -4032,7 +4046,7 @@
break;
case 158:
-#line 1704 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1718 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ // Boolean constants
assert(cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth() == 1 && "Not Bool?");
(yyval.ConstVal) = ConstantInt::getFalse();
@@ -4041,7 +4055,7 @@
break;
case 159:
-#line 1709 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1723 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ // Float & Double constants
if (!ConstantFP::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].FPVal)))
GEN_ERROR("Floating point constant invalid for type");
@@ -4051,7 +4065,7 @@
break;
case 160:
-#line 1717 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1731 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
if (!UpRefs.empty())
GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
@@ -4067,7 +4081,7 @@
break;
case 161:
-#line 1729 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1743 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
if (!isa<PointerType>((yyvsp[-2].ConstVal)->getType()))
GEN_ERROR("GetElementPtr requires a pointer operand");
@@ -4092,7 +4106,7 @@
break;
case 162:
-#line 1750 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1764 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
if ((yyvsp[-5].ConstVal)->getType() != Type::Int1Ty)
GEN_ERROR("Select condition must be of boolean type");
@@ -4104,7 +4118,7 @@
break;
case 163:
-#line 1758 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1772 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
GEN_ERROR("Binary operator types must match");
@@ -4114,7 +4128,7 @@
break;
case 164:
-#line 1764 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1778 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
GEN_ERROR("Logical operator types must match");
@@ -4129,7 +4143,7 @@
break;
case 165:
-#line 1775 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1789 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
GEN_ERROR("icmp operand types must match");
@@ -4138,7 +4152,7 @@
break;
case 166:
-#line 1780 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1794 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
GEN_ERROR("fcmp operand types must match");
@@ -4147,7 +4161,7 @@
break;
case 167:
-#line 1785 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1799 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
if (!ExtractElementInst::isValidOperands((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
GEN_ERROR("Invalid extractelement operands");
@@ -4157,7 +4171,7 @@
break;
case 168:
-#line 1791 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1805 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
if (!InsertElementInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
GEN_ERROR("Invalid insertelement operands");
@@ -4167,7 +4181,7 @@
break;
case 169:
-#line 1797 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1811 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
if (!ShuffleVectorInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
GEN_ERROR("Invalid shufflevector operands");
@@ -4177,7 +4191,7 @@
break;
case 170:
-#line 1806 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1820 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
((yyval.ConstVector) = (yyvsp[-2].ConstVector))->push_back((yyvsp[0].ConstVal));
CHECK_FOR_ERROR
@@ -4185,7 +4199,7 @@
break;
case 171:
-#line 1810 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1824 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
(yyval.ConstVector) = new std::vector<Constant*>();
(yyval.ConstVector)->push_back((yyvsp[0].ConstVal));
@@ -4194,17 +4208,17 @@
break;
case 172:
-#line 1818 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1832 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.BoolVal) = false; ;}
break;
case 173:
-#line 1818 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1832 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.BoolVal) = true; ;}
break;
case 174:
-#line 1829 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1843 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
(yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
CurModule.ModuleDone();
@@ -4213,7 +4227,7 @@
break;
case 175:
-#line 1834 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1848 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
(yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
CurModule.ModuleDone();
@@ -4222,12 +4236,12 @@
break;
case 178:
-#line 1847 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1861 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ CurFun.isDeclare = false; ;}
break;
case 179:
-#line 1847 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1861 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
CurFun.FunctionDone();
CHECK_FOR_ERROR
@@ -4235,26 +4249,26 @@
break;
case 180:
-#line 1851 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1865 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ CurFun.isDeclare = true; ;}
break;
case 181:
-#line 1851 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1865 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
CHECK_FOR_ERROR
;}
break;
case 182:
-#line 1854 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1868 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
CHECK_FOR_ERROR
;}
break;
case 183:
-#line 1857 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1871 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
// Emit an error if there are any unresolved types left.
if (!CurModule.LateResolveTypes.empty()) {
@@ -4270,7 +4284,7 @@
break;
case 184:
-#line 1869 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1883 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
if (!UpRefs.empty())
GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
@@ -4298,7 +4312,7 @@
break;
case 185:
-#line 1893 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1907 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
ResolveTypeTo((yyvsp[-2].StrVal), (yyvsp[0].PrimType));
@@ -4313,7 +4327,7 @@
break;
case 186:
-#line 1904 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1918 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
/* "Externally Visible" Linkage */
if ((yyvsp[0].ConstVal) == 0)
@@ -4325,14 +4339,14 @@
break;
case 187:
-#line 1911 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1925 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
CurGV = 0;
;}
break;
case 188:
-#line 1914 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1928 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
if ((yyvsp[0].ConstVal) == 0)
GEN_ERROR("Global value initializer is not a constant");
@@ -4342,14 +4356,14 @@
break;
case 189:
-#line 1919 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1933 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
CurGV = 0;
;}
break;
case 190:
-#line 1922 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1936 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
if (!UpRefs.empty())
GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
@@ -4360,7 +4374,7 @@
break;
case 191:
-#line 1928 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1942 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
CurGV = 0;
CHECK_FOR_ERROR
@@ -4368,21 +4382,21 @@
break;
case 192:
-#line 1932 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1946 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
CHECK_FOR_ERROR
;}
break;
case 193:
-#line 1935 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1949 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
CHECK_FOR_ERROR
;}
break;
case 194:
-#line 1941 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1955 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true);
@@ -4398,7 +4412,7 @@
break;
case 195:
-#line 1954 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1968 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
CurModule.CurrentModule->setTargetTriple((yyvsp[0].StrVal));
free((yyvsp[0].StrVal));
@@ -4406,7 +4420,7 @@
break;
case 196:
-#line 1958 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1972 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
CurModule.CurrentModule->setDataLayout((yyvsp[0].StrVal));
free((yyvsp[0].StrVal));
@@ -4414,7 +4428,7 @@
break;
case 198:
-#line 1965 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1979 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal));
free((yyvsp[0].StrVal));
@@ -4423,7 +4437,7 @@
break;
case 199:
-#line 1970 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1984 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal));
free((yyvsp[0].StrVal));
@@ -4432,14 +4446,14 @@
break;
case 200:
-#line 1975 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1989 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
CHECK_FOR_ERROR
;}
break;
case 201:
-#line 1984 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 1998 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
if (!UpRefs.empty())
GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
@@ -4453,7 +4467,7 @@
break;
case 202:
-#line 1994 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2008 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
if (!UpRefs.empty())
GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
@@ -4467,7 +4481,7 @@
break;
case 203:
-#line 2005 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2019 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
(yyval.ArgList) = (yyvsp[0].ArgList);
CHECK_FOR_ERROR
@@ -4475,7 +4489,7 @@
break;
case 204:
-#line 2009 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2023 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
(yyval.ArgList) = (yyvsp[-2].ArgList);
struct ArgListEntry E;
@@ -4488,7 +4502,7 @@
break;
case 205:
-#line 2018 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2032 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
(yyval.ArgList) = new ArgListType;
struct ArgListEntry E;
@@ -4501,7 +4515,7 @@
break;
case 206:
-#line 2027 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2041 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
(yyval.ArgList) = 0;
CHECK_FOR_ERROR
@@ -4509,7 +4523,7 @@
break;
case 207:
-#line 2033 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2047 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
UnEscapeLexed((yyvsp[-6].StrVal));
std::string FunctionName((yyvsp[-6].StrVal));
@@ -4558,17 +4572,21 @@
CurModule.CurrentModule->getFunctionList().remove(Fn);
CurModule.CurrentModule->getFunctionList().push_back(Fn);
} else if (!FunctionName.empty() && // Merge with an earlier prototype?
- (Fn = CurModule.CurrentModule->getFunction(FunctionName, FT))) {
- // If this is the case, either we need to be a forward decl, or it needs
- // to be.
- if (!CurFun.isDeclare && !Fn->isDeclaration())
+ (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
+ if (Fn->getFunctionType() != FT ) {
+ // The existing function doesn't have the same type. This is an overload
+ // error.
+ GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
+ } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
+ // Neither the existing or the current function is a declaration and they
+ // have the same name and same type. Clearly this is a redefinition.
GEN_ERROR("Redefinition of function '" + FunctionName + "'");
-
- // Make sure to strip off any argument names so we can't get conflicts.
- if (Fn->isDeclaration())
+ } if (Fn->isDeclaration()) {
+ // Make sure to strip off any argument names so we can't get conflicts.
for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
AI != AE; ++AI)
AI->setName("");
+ }
} else { // Not already defined?
Fn = new Function(FT, GlobalValue::ExternalLinkage, FunctionName,
CurModule.CurrentModule);
@@ -4595,16 +4613,18 @@
// Add all of the arguments we parsed to the function...
if ((yyvsp[-4].ArgList)) { // Is null if empty...
if (isVarArg) { // Nuke the last entry
- assert((yyvsp[-4].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[-4].ArgList)->back().Name == 0&&
+ assert((yyvsp[-4].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[-4].ArgList)->back().Name == 0 &&
"Not a varargs marker!");
delete (yyvsp[-4].ArgList)->back().Ty;
(yyvsp[-4].ArgList)->pop_back(); // Delete the last entry
}
Function::arg_iterator ArgIt = Fn->arg_begin();
+ Function::arg_iterator ArgEnd = Fn->arg_end();
unsigned Idx = 1;
- for (ArgListType::iterator I = (yyvsp[-4].ArgList)->begin(); I != (yyvsp[-4].ArgList)->end(); ++I, ++ArgIt) {
+ for (ArgListType::iterator I = (yyvsp[-4].ArgList)->begin();
+ I != (yyvsp[-4].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
delete I->Ty; // Delete the typeholder...
- setValueName(ArgIt, I->Name); // Insert arg into symtab...
+ setValueName(ArgIt, I->Name); // Insert arg into symtab...
CHECK_FOR_ERROR
InsertValue(ArgIt);
Idx++;
@@ -4617,7 +4637,7 @@
break;
case 210:
-#line 2140 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2160 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
(yyval.FunctionVal) = CurFun.CurrentFunction;
@@ -4629,7 +4649,7 @@
break;
case 213:
-#line 2151 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2171 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
(yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
CHECK_FOR_ERROR
@@ -4637,7 +4657,7 @@
break;
case 214:
-#line 2156 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2176 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
CurFun.CurrentFunction->setLinkage((yyvsp[-2].Linkage));
CurFun.CurrentFunction->setVisibility((yyvsp[-1].Visibility));
@@ -4648,7 +4668,7 @@
break;
case 215:
-#line 2168 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2188 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
(yyval.BoolVal) = false;
CHECK_FOR_ERROR
@@ -4656,7 +4676,7 @@
break;
case 216:
-#line 2172 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2192 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
(yyval.BoolVal) = true;
CHECK_FOR_ERROR
@@ -4664,7 +4684,7 @@
break;
case 217:
-#line 2177 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2197 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ // A reference to a direct constant
(yyval.ValIDVal) = ValID::create((yyvsp[0].SInt64Val));
CHECK_FOR_ERROR
@@ -4672,7 +4692,7 @@
break;
case 218:
-#line 2181 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2201 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
(yyval.ValIDVal) = ValID::create((yyvsp[0].UInt64Val));
CHECK_FOR_ERROR
@@ -4680,7 +4700,7 @@
break;
case 219:
-#line 2185 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2205 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ // Perhaps it's an FP constant?
(yyval.ValIDVal) = ValID::create((yyvsp[0].FPVal));
CHECK_FOR_ERROR
@@ -4688,7 +4708,7 @@
break;
case 220:
-#line 2189 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2209 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
(yyval.ValIDVal) = ValID::create(ConstantInt::getTrue());
CHECK_FOR_ERROR
@@ -4696,7 +4716,7 @@
break;
case 221:
-#line 2193 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2213 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
(yyval.ValIDVal) = ValID::create(ConstantInt::getFalse());
CHECK_FOR_ERROR
@@ -4704,7 +4724,7 @@
break;
case 222:
-#line 2197 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2217 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
(yyval.ValIDVal) = ValID::createNull();
CHECK_FOR_ERROR
@@ -4712,7 +4732,7 @@
break;
case 223:
-#line 2201 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2221 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
(yyval.ValIDVal) = ValID::createUndef();
CHECK_FOR_ERROR
@@ -4720,7 +4740,7 @@
break;
case 224:
-#line 2205 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2225 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ // A vector zero constant.
(yyval.ValIDVal) = ValID::createZeroInit();
CHECK_FOR_ERROR
@@ -4728,7 +4748,7 @@
break;
case 225:
-#line 2209 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2229 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ // Nonempty unsized packed vector
const Type *ETy = (*(yyvsp[-1].ConstVector))[0]->getType();
int NumElements = (yyvsp[-1].ConstVector)->size();
@@ -4757,7 +4777,7 @@
break;
case 226:
-#line 2234 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2254 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
(yyval.ValIDVal) = ValID::create((yyvsp[0].ConstVal));
CHECK_FOR_ERROR
@@ -4765,7 +4785,7 @@
break;
case 227:
-#line 2238 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2258 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
char *End = UnEscapeLexed((yyvsp[-2].StrVal), true);
std::string AsmStr = std::string((yyvsp[-2].StrVal), End);
@@ -4779,7 +4799,7 @@
break;
case 228:
-#line 2252 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2272 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ // Is it an integer reference...?
(yyval.ValIDVal) = ValID::createLocalID((yyvsp[0].UIntVal));
CHECK_FOR_ERROR
@@ -4787,7 +4807,7 @@
break;
case 229:
-#line 2256 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2276 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
(yyval.ValIDVal) = ValID::createGlobalID((yyvsp[0].UIntVal));
CHECK_FOR_ERROR
@@ -4795,7 +4815,7 @@
break;
case 230:
-#line 2260 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2280 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ // Is it a named reference...?
(yyval.ValIDVal) = ValID::createLocalName((yyvsp[0].StrVal));
CHECK_FOR_ERROR
@@ -4803,7 +4823,7 @@
break;
case 231:
-#line 2264 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2284 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ // Is it a named reference...?
(yyval.ValIDVal) = ValID::createGlobalName((yyvsp[0].StrVal));
CHECK_FOR_ERROR
@@ -4811,7 +4831,7 @@
break;
case 234:
-#line 2276 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2296 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
if (!UpRefs.empty())
GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
@@ -4822,7 +4842,7 @@
break;
case 235:
-#line 2285 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2305 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
(yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
CHECK_FOR_ERROR
@@ -4830,7 +4850,7 @@
break;
case 236:
-#line 2289 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2309 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ // Do not allow functions with 0 basic blocks
(yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
CHECK_FOR_ERROR
@@ -4838,12 +4858,11 @@
break;
case 237:
-#line 2298 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2318 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
setValueName((yyvsp[0].TermInstVal), (yyvsp[-1].StrVal));
CHECK_FOR_ERROR
InsertValue((yyvsp[0].TermInstVal));
-
(yyvsp[-2].BasicBlockVal)->getInstList().push_back((yyvsp[0].TermInstVal));
InsertValue((yyvsp[-2].BasicBlockVal));
(yyval.BasicBlockVal) = (yyvsp[-2].BasicBlockVal);
@@ -4852,7 +4871,7 @@
break;
case 238:
-#line 2309 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2328 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[0].InstVal)))
if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
@@ -4865,7 +4884,7 @@
break;
case 239:
-#line 2318 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2337 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
(yyval.BasicBlockVal) = getBBVal(ValID::createLocalID(CurFun.NextBBNum++), true);
CHECK_FOR_ERROR
@@ -4881,7 +4900,7 @@
break;
case 240:
-#line 2330 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2349 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
(yyval.BasicBlockVal) = getBBVal(ValID::createLocalName((yyvsp[0].StrVal)), true);
CHECK_FOR_ERROR
@@ -4897,7 +4916,7 @@
break;
case 241:
-#line 2343 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2362 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ // Return with a result...
(yyval.TermInstVal) = new ReturnInst((yyvsp[0].ValueVal));
CHECK_FOR_ERROR
@@ -4905,7 +4924,7 @@
break;
case 242:
-#line 2347 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2366 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ // Return with no result...
(yyval.TermInstVal) = new ReturnInst();
CHECK_FOR_ERROR
@@ -4913,7 +4932,7 @@
break;
case 243:
-#line 2351 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2370 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ // Unconditional Branch...
BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
CHECK_FOR_ERROR
@@ -4922,7 +4941,7 @@
break;
case 244:
-#line 2356 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2375 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
assert(cast<IntegerType>((yyvsp[-7].PrimType))->getBitWidth() == 1 && "Not Bool?");
BasicBlock* tmpBBA = getBBVal((yyvsp[-3].ValIDVal));
@@ -4936,7 +4955,7 @@
break;
case 245:
-#line 2366 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2385 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
Value* tmpVal = getVal((yyvsp[-7].PrimType), (yyvsp[-6].ValIDVal));
CHECK_FOR_ERROR
@@ -4959,7 +4978,7 @@
break;
case 246:
-#line 2385 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2404 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
Value* tmpVal = getVal((yyvsp[-6].PrimType), (yyvsp[-5].ValIDVal));
CHECK_FOR_ERROR
@@ -4972,7 +4991,7 @@
break;
case 247:
-#line 2395 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2414 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
// Handle the short syntax
@@ -5042,7 +5061,7 @@
break;
case 248:
-#line 2461 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2480 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
(yyval.TermInstVal) = new UnwindInst();
CHECK_FOR_ERROR
@@ -5050,7 +5069,7 @@
break;
case 249:
-#line 2465 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2484 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
(yyval.TermInstVal) = new UnreachableInst();
CHECK_FOR_ERROR
@@ -5058,7 +5077,7 @@
break;
case 250:
-#line 2472 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2491 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
(yyval.JumpTable) = (yyvsp[-5].JumpTable);
Constant *V = cast<Constant>(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal)));
@@ -5073,7 +5092,7 @@
break;
case 251:
-#line 2483 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2502 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
(yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
Constant *V = cast<Constant>(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal)));
@@ -5089,19 +5108,19 @@
break;
case 252:
-#line 2496 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2515 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- // Is this definition named?? if so, assign the name...
- setValueName((yyvsp[0].InstVal), (yyvsp[-1].StrVal));
- CHECK_FOR_ERROR
- InsertValue((yyvsp[0].InstVal));
- (yyval.InstVal) = (yyvsp[0].InstVal);
- CHECK_FOR_ERROR
-;}
+ // Is this definition named?? if so, assign the name...
+ setValueName((yyvsp[0].InstVal), (yyvsp[-1].StrVal));
+ CHECK_FOR_ERROR
+ InsertValue((yyvsp[0].InstVal));
+ (yyval.InstVal) = (yyvsp[0].InstVal);
+ CHECK_FOR_ERROR
+ ;}
break;
case 253:
-#line 2505 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2525 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ // Used for PHI nodes
if (!UpRefs.empty())
GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-5].TypeVal))->getDescription());
@@ -5116,7 +5135,7 @@
break;
case 254:
-#line 2516 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2536 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
(yyval.PHIList) = (yyvsp[-6].PHIList);
Value* tmpVal = getVal((yyvsp[-6].PHIList)->front().first->getType(), (yyvsp[-3].ValIDVal));
@@ -5128,7 +5147,7 @@
break;
case 255:
-#line 2526 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2546 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
if (!UpRefs.empty())
GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
@@ -5140,7 +5159,7 @@
break;
case 256:
-#line 2534 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2554 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
if (!UpRefs.empty())
GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
@@ -5152,17 +5171,17 @@
break;
case 257:
-#line 2542 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2562 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.ValueRefList) = new ValueRefList(); ;}
break;
case 258:
-#line 2545 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2565 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ (yyval.ValueList) = new std::vector<Value*>(); ;}
break;
case 259:
-#line 2546 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2566 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
(yyval.ValueList) = (yyvsp[-2].ValueList);
(yyval.ValueList)->push_back((yyvsp[0].ValueVal));
@@ -5171,7 +5190,7 @@
break;
case 260:
-#line 2553 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2573 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
(yyval.BoolVal) = true;
CHECK_FOR_ERROR
@@ -5179,7 +5198,7 @@
break;
case 261:
-#line 2557 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2577 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
(yyval.BoolVal) = false;
CHECK_FOR_ERROR
@@ -5187,7 +5206,7 @@
break;
case 262:
-#line 2562 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2582 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
if (!UpRefs.empty())
GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
@@ -5199,7 +5218,7 @@
((yyvsp[-4].BinaryOpVal) == Instruction::URem ||
(yyvsp[-4].BinaryOpVal) == Instruction::SRem ||
(yyvsp[-4].BinaryOpVal) == Instruction::FRem))
- GEN_ERROR("U/S/FRem not supported on packed types");
+ GEN_ERROR("Remainder not supported on packed types");
Value* val1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
CHECK_FOR_ERROR
Value* val2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
@@ -5212,7 +5231,7 @@
break;
case 263:
-#line 2583 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2603 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
if (!UpRefs.empty())
GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
@@ -5233,7 +5252,7 @@
break;
case 264:
-#line 2600 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2620 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
if (!UpRefs.empty())
GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
@@ -5250,7 +5269,7 @@
break;
case 265:
-#line 2613 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2633 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
if (!UpRefs.empty())
GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
@@ -5267,7 +5286,7 @@
break;
case 266:
-#line 2626 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2646 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
if (!UpRefs.empty())
GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
@@ -5283,7 +5302,7 @@
break;
case 267:
-#line 2638 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2658 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
if ((yyvsp[-4].ValueVal)->getType() != Type::Int1Ty)
GEN_ERROR("select condition must be boolean");
@@ -5295,7 +5314,7 @@
break;
case 268:
-#line 2646 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2666 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
if (!UpRefs.empty())
GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
@@ -5306,7 +5325,7 @@
break;
case 269:
-#line 2653 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2673 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
if (!ExtractElementInst::isValidOperands((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
GEN_ERROR("Invalid extractelement operands");
@@ -5316,7 +5335,7 @@
break;
case 270:
-#line 2659 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2679 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
if (!InsertElementInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
GEN_ERROR("Invalid insertelement operands");
@@ -5326,7 +5345,7 @@
break;
case 271:
-#line 2665 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2685 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
if (!ShuffleVectorInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
GEN_ERROR("Invalid shufflevector operands");
@@ -5336,7 +5355,7 @@
break;
case 272:
-#line 2671 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2691 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
const Type *Ty = (yyvsp[0].PHIList)->front().first->getType();
if (!Ty->isFirstClassType())
@@ -5355,7 +5374,7 @@
break;
case 273:
-#line 2687 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2707 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
// Handle the short syntax
@@ -5422,7 +5441,7 @@
break;
case 274:
-#line 2750 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2770 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
(yyval.InstVal) = (yyvsp[0].InstVal);
CHECK_FOR_ERROR
@@ -5430,7 +5449,7 @@
break;
case 275:
-#line 2755 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2775 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
(yyval.BoolVal) = true;
CHECK_FOR_ERROR
@@ -5438,7 +5457,7 @@
break;
case 276:
-#line 2759 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2779 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
(yyval.BoolVal) = false;
CHECK_FOR_ERROR
@@ -5446,7 +5465,7 @@
break;
case 277:
-#line 2766 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2786 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
if (!UpRefs.empty())
GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
@@ -5457,7 +5476,7 @@
break;
case 278:
-#line 2773 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2793 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
if (!UpRefs.empty())
GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription());
@@ -5469,7 +5488,7 @@
break;
case 279:
-#line 2781 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2801 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
if (!UpRefs.empty())
GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
@@ -5480,7 +5499,7 @@
break;
case 280:
-#line 2788 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2808 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
if (!UpRefs.empty())
GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription());
@@ -5492,7 +5511,7 @@
break;
case 281:
-#line 2796 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2816 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
if (!isa<PointerType>((yyvsp[0].ValueVal)->getType()))
GEN_ERROR("Trying to free nonpointer type " +
@@ -5503,7 +5522,7 @@
break;
case 282:
-#line 2804 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2824 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
if (!UpRefs.empty())
GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
@@ -5521,7 +5540,7 @@
break;
case 283:
-#line 2818 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2838 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
if (!UpRefs.empty())
GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
@@ -5542,7 +5561,7 @@
break;
case 284:
-#line 2835 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2855 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
if (!UpRefs.empty())
GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
@@ -5565,7 +5584,7 @@
}
/* Line 1126 of yacc.c. */
-#line 5569 "llvmAsmParser.tab.c"
+#line 5588 "llvmAsmParser.tab.c"
yyvsp -= yylen;
yyssp -= yylen;
@@ -5833,7 +5852,7 @@
}
-#line 2852 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 2872 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
// common code from the two 'RunVMAsmParser' functions
@@ -5875,11 +5894,10 @@
std::string where
= std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
+ ":" + utostr((unsigned) llvmAsmlineno) + ": ";
- std::string errMsg = std::string(ErrorMsg) + "\n" + where + " while reading ";
- if (yychar == YYEMPTY || yychar == 0)
- errMsg += "end-of-file.";
- else
- errMsg += "token: '" + std::string(llvmAsmtext, llvmAsmleng) + "'";
+ std::string errMsg = where + "error: " + std::string(ErrorMsg);
+ if (yychar != YYEMPTY && yychar != 0)
+ errMsg += " while reading token: '" + std::string(llvmAsmtext, llvmAsmleng)+
+ "'";
GenerateError(errMsg);
return 0;
}
diff --git a/lib/AsmParser/llvmAsmParser.h.cvs b/lib/AsmParser/llvmAsmParser.h.cvs
index 295a7b8..fa6e8af 100644
--- a/lib/AsmParser/llvmAsmParser.h.cvs
+++ b/lib/AsmParser/llvmAsmParser.h.cvs
@@ -295,7 +295,7 @@
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
-#line 886 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
+#line 900 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
typedef union YYSTYPE {
llvm::Module *ModuleVal;
llvm::Function *FunctionVal;
diff --git a/lib/AsmParser/llvmAsmParser.y b/lib/AsmParser/llvmAsmParser.y
index 186a93f..24b0abf 100644
--- a/lib/AsmParser/llvmAsmParser.y
+++ b/lib/AsmParser/llvmAsmParser.y
@@ -17,7 +17,7 @@
#include "llvm/InlineAsm.h"
#include "llvm/Instructions.h"
#include "llvm/Module.h"
-#include "llvm/SymbolTable.h"
+#include "llvm/ValueSymbolTable.h"
#include "llvm/Support/GetElementPtrTypeIterator.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/ADT/SmallVector.h"
@@ -209,7 +209,7 @@
std::map<const Type*, ValueList> Values; // Keep track of #'d definitions
std::map<const Type*, ValueList> LateResolveValues;
- bool isDeclare; // Is this function a forward declararation?
+ bool isDeclare; // Is this function a forward declararation?
GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
GlobalValue::VisibilityTypes Visibility;
@@ -341,24 +341,33 @@
// Module constants occupy the lowest numbered slots...
std::map<const Type*,ValueList>::iterator VI = CurModule.Values.find(Ty);
- if (VI == CurModule.Values.end()) return 0;
- if (D.Num >= VI->second.size()) return 0;
+ if (VI == CurModule.Values.end())
+ return 0;
+ if (D.Num >= VI->second.size())
+ return 0;
return VI->second[Num];
}
case ValID::LocalName: { // Is it a named definition?
- if (!inFunctionScope()) return 0;
- SymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
- Value *N = SymTab.lookup(Ty, D.Name);
- if (N == 0) return 0;
+ if (!inFunctionScope())
+ return 0;
+ ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
+ Value *N = SymTab.lookup(D.Name);
+ if (N == 0)
+ return 0;
+ if (N->getType() != Ty)
+ return 0;
D.destroy(); // Free old strdup'd memory...
return N;
}
case ValID::GlobalName: { // Is it a named definition?
- SymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
- Value *N = SymTab.lookup(Ty, D.Name);
- if (N == 0) return 0;
+ ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
+ Value *N = SymTab.lookup(D.Name);
+ if (N == 0)
+ return 0;
+ if (N->getType() != Ty)
+ return 0;
D.destroy(); // Free old strdup'd memory...
return N;
@@ -499,8 +508,8 @@
break;
case ValID::LocalName: // Is it a named definition?
Name = ID.Name;
- if (Value *N = CurFun.CurrentFunction->
- getValueSymbolTable().lookup(Type::LabelTy, Name))
+ Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name);
+ if (N && N->getType()->getTypeID() == Type::LabelTyID)
BB = cast<BasicBlock>(N);
break;
}
@@ -640,8 +649,8 @@
}
assert(inFunctionScope() && "Must be in function scope!");
- SymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
- if (ST.lookup(V->getType(), Name)) {
+ ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
+ if (ST.lookup(Name)) {
GenerateError("Redefinition of value '" + Name + "' of type '" +
V->getType()->getDescription() + "'");
return;
@@ -695,16 +704,21 @@
return GV;
}
- // If this global has a name, check to see if there is already a definition
- // of this global in the module. If so, it is an error.
+ // If this global has a name
if (!Name.empty()) {
- // We are a simple redefinition of a value, check to see if it is defined
- // the same as the old one.
- if (CurModule.CurrentModule->getGlobalVariable(Name, Ty)) {
- GenerateError("Redefinition of global variable named '" + Name +
- "' of type '" + Ty->getDescription() + "'");
- return 0;
- }
+ // if the global we're parsing has an initializer (is a definition) and
+ // has external linkage.
+ if (Initializer && Linkage != GlobalValue::InternalLinkage)
+ // If there is already a global with external linkage with this name
+ if (CurModule.CurrentModule->getGlobalVariable(Name, false)) {
+ // If we allow this GVar to get created, it will be renamed in the
+ // symbol table because it conflicts with an existing GVar. We can't
+ // allow redefinition of GVars whose linking indicates that their name
+ // must stay the same. Issue the error.
+ GenerateError("Redefinition of global variable named '" + Name +
+ "' of type '" + Ty->getDescription() + "'");
+ return 0;
+ }
}
// Otherwise there is no existing GV to use, create one now.
@@ -2078,17 +2092,21 @@
CurModule.CurrentModule->getFunctionList().remove(Fn);
CurModule.CurrentModule->getFunctionList().push_back(Fn);
} else if (!FunctionName.empty() && // Merge with an earlier prototype?
- (Fn = CurModule.CurrentModule->getFunction(FunctionName, FT))) {
- // If this is the case, either we need to be a forward decl, or it needs
- // to be.
- if (!CurFun.isDeclare && !Fn->isDeclaration())
+ (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
+ if (Fn->getFunctionType() != FT ) {
+ // The existing function doesn't have the same type. This is an overload
+ // error.
+ GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
+ } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
+ // Neither the existing or the current function is a declaration and they
+ // have the same name and same type. Clearly this is a redefinition.
GEN_ERROR("Redefinition of function '" + FunctionName + "'");
-
- // Make sure to strip off any argument names so we can't get conflicts.
- if (Fn->isDeclaration())
+ } if (Fn->isDeclaration()) {
+ // Make sure to strip off any argument names so we can't get conflicts.
for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
AI != AE; ++AI)
AI->setName("");
+ }
} else { // Not already defined?
Fn = new Function(FT, GlobalValue::ExternalLinkage, FunctionName,
CurModule.CurrentModule);
@@ -2115,16 +2133,18 @@
// Add all of the arguments we parsed to the function...
if ($5) { // Is null if empty...
if (isVarArg) { // Nuke the last entry
- assert($5->back().Ty->get() == Type::VoidTy && $5->back().Name == 0&&
+ assert($5->back().Ty->get() == Type::VoidTy && $5->back().Name == 0 &&
"Not a varargs marker!");
delete $5->back().Ty;
$5->pop_back(); // Delete the last entry
}
Function::arg_iterator ArgIt = Fn->arg_begin();
+ Function::arg_iterator ArgEnd = Fn->arg_end();
unsigned Idx = 1;
- for (ArgListType::iterator I = $5->begin(); I != $5->end(); ++I, ++ArgIt) {
+ for (ArgListType::iterator I = $5->begin();
+ I != $5->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
delete I->Ty; // Delete the typeholder...
- setValueName(ArgIt, I->Name); // Insert arg into symtab...
+ setValueName(ArgIt, I->Name); // Insert arg into symtab...
CHECK_FOR_ERROR
InsertValue(ArgIt);
Idx++;
@@ -2299,7 +2319,6 @@
setValueName($3, $2);
CHECK_FOR_ERROR
InsertValue($3);
-
$1->getInstList().push_back($3);
InsertValue($1);
$$ = $1;
@@ -2494,13 +2513,14 @@
};
Inst : OptLocalAssign InstVal {
- // Is this definition named?? if so, assign the name...
- setValueName($2, $1);
- CHECK_FOR_ERROR
- InsertValue($2);
- $$ = $2;
- CHECK_FOR_ERROR
-};
+ // Is this definition named?? if so, assign the name...
+ setValueName($2, $1);
+ CHECK_FOR_ERROR
+ InsertValue($2);
+ $$ = $2;
+ CHECK_FOR_ERROR
+ };
+
PHIList : Types '[' ValueRef ',' ValueRef ']' { // Used for PHI nodes
if (!UpRefs.empty())
@@ -2570,7 +2590,7 @@
($1 == Instruction::URem ||
$1 == Instruction::SRem ||
$1 == Instruction::FRem))
- GEN_ERROR("U/S/FRem not supported on packed types");
+ GEN_ERROR("Remainder not supported on packed types");
Value* val1 = getVal(*$2, $3);
CHECK_FOR_ERROR
Value* val2 = getVal(*$2, $5);
@@ -2890,11 +2910,10 @@
std::string where
= std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
+ ":" + utostr((unsigned) llvmAsmlineno) + ": ";
- std::string errMsg = std::string(ErrorMsg) + "\n" + where + " while reading ";
- if (yychar == YYEMPTY || yychar == 0)
- errMsg += "end-of-file.";
- else
- errMsg += "token: '" + std::string(llvmAsmtext, llvmAsmleng) + "'";
+ std::string errMsg = where + "error: " + std::string(ErrorMsg);
+ if (yychar != YYEMPTY && yychar != 0)
+ errMsg += " while reading token: '" + std::string(llvmAsmtext, llvmAsmleng)+
+ "'";
GenerateError(errMsg);
return 0;
}
diff --git a/lib/AsmParser/llvmAsmParser.y.cvs b/lib/AsmParser/llvmAsmParser.y.cvs
index 186a93f..24b0abf 100644
--- a/lib/AsmParser/llvmAsmParser.y.cvs
+++ b/lib/AsmParser/llvmAsmParser.y.cvs
@@ -17,7 +17,7 @@
#include "llvm/InlineAsm.h"
#include "llvm/Instructions.h"
#include "llvm/Module.h"
-#include "llvm/SymbolTable.h"
+#include "llvm/ValueSymbolTable.h"
#include "llvm/Support/GetElementPtrTypeIterator.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/ADT/SmallVector.h"
@@ -209,7 +209,7 @@
std::map<const Type*, ValueList> Values; // Keep track of #'d definitions
std::map<const Type*, ValueList> LateResolveValues;
- bool isDeclare; // Is this function a forward declararation?
+ bool isDeclare; // Is this function a forward declararation?
GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
GlobalValue::VisibilityTypes Visibility;
@@ -341,24 +341,33 @@
// Module constants occupy the lowest numbered slots...
std::map<const Type*,ValueList>::iterator VI = CurModule.Values.find(Ty);
- if (VI == CurModule.Values.end()) return 0;
- if (D.Num >= VI->second.size()) return 0;
+ if (VI == CurModule.Values.end())
+ return 0;
+ if (D.Num >= VI->second.size())
+ return 0;
return VI->second[Num];
}
case ValID::LocalName: { // Is it a named definition?
- if (!inFunctionScope()) return 0;
- SymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
- Value *N = SymTab.lookup(Ty, D.Name);
- if (N == 0) return 0;
+ if (!inFunctionScope())
+ return 0;
+ ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
+ Value *N = SymTab.lookup(D.Name);
+ if (N == 0)
+ return 0;
+ if (N->getType() != Ty)
+ return 0;
D.destroy(); // Free old strdup'd memory...
return N;
}
case ValID::GlobalName: { // Is it a named definition?
- SymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
- Value *N = SymTab.lookup(Ty, D.Name);
- if (N == 0) return 0;
+ ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
+ Value *N = SymTab.lookup(D.Name);
+ if (N == 0)
+ return 0;
+ if (N->getType() != Ty)
+ return 0;
D.destroy(); // Free old strdup'd memory...
return N;
@@ -499,8 +508,8 @@
break;
case ValID::LocalName: // Is it a named definition?
Name = ID.Name;
- if (Value *N = CurFun.CurrentFunction->
- getValueSymbolTable().lookup(Type::LabelTy, Name))
+ Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name);
+ if (N && N->getType()->getTypeID() == Type::LabelTyID)
BB = cast<BasicBlock>(N);
break;
}
@@ -640,8 +649,8 @@
}
assert(inFunctionScope() && "Must be in function scope!");
- SymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
- if (ST.lookup(V->getType(), Name)) {
+ ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
+ if (ST.lookup(Name)) {
GenerateError("Redefinition of value '" + Name + "' of type '" +
V->getType()->getDescription() + "'");
return;
@@ -695,16 +704,21 @@
return GV;
}
- // If this global has a name, check to see if there is already a definition
- // of this global in the module. If so, it is an error.
+ // If this global has a name
if (!Name.empty()) {
- // We are a simple redefinition of a value, check to see if it is defined
- // the same as the old one.
- if (CurModule.CurrentModule->getGlobalVariable(Name, Ty)) {
- GenerateError("Redefinition of global variable named '" + Name +
- "' of type '" + Ty->getDescription() + "'");
- return 0;
- }
+ // if the global we're parsing has an initializer (is a definition) and
+ // has external linkage.
+ if (Initializer && Linkage != GlobalValue::InternalLinkage)
+ // If there is already a global with external linkage with this name
+ if (CurModule.CurrentModule->getGlobalVariable(Name, false)) {
+ // If we allow this GVar to get created, it will be renamed in the
+ // symbol table because it conflicts with an existing GVar. We can't
+ // allow redefinition of GVars whose linking indicates that their name
+ // must stay the same. Issue the error.
+ GenerateError("Redefinition of global variable named '" + Name +
+ "' of type '" + Ty->getDescription() + "'");
+ return 0;
+ }
}
// Otherwise there is no existing GV to use, create one now.
@@ -2078,17 +2092,21 @@
CurModule.CurrentModule->getFunctionList().remove(Fn);
CurModule.CurrentModule->getFunctionList().push_back(Fn);
} else if (!FunctionName.empty() && // Merge with an earlier prototype?
- (Fn = CurModule.CurrentModule->getFunction(FunctionName, FT))) {
- // If this is the case, either we need to be a forward decl, or it needs
- // to be.
- if (!CurFun.isDeclare && !Fn->isDeclaration())
+ (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
+ if (Fn->getFunctionType() != FT ) {
+ // The existing function doesn't have the same type. This is an overload
+ // error.
+ GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
+ } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
+ // Neither the existing or the current function is a declaration and they
+ // have the same name and same type. Clearly this is a redefinition.
GEN_ERROR("Redefinition of function '" + FunctionName + "'");
-
- // Make sure to strip off any argument names so we can't get conflicts.
- if (Fn->isDeclaration())
+ } if (Fn->isDeclaration()) {
+ // Make sure to strip off any argument names so we can't get conflicts.
for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
AI != AE; ++AI)
AI->setName("");
+ }
} else { // Not already defined?
Fn = new Function(FT, GlobalValue::ExternalLinkage, FunctionName,
CurModule.CurrentModule);
@@ -2115,16 +2133,18 @@
// Add all of the arguments we parsed to the function...
if ($5) { // Is null if empty...
if (isVarArg) { // Nuke the last entry
- assert($5->back().Ty->get() == Type::VoidTy && $5->back().Name == 0&&
+ assert($5->back().Ty->get() == Type::VoidTy && $5->back().Name == 0 &&
"Not a varargs marker!");
delete $5->back().Ty;
$5->pop_back(); // Delete the last entry
}
Function::arg_iterator ArgIt = Fn->arg_begin();
+ Function::arg_iterator ArgEnd = Fn->arg_end();
unsigned Idx = 1;
- for (ArgListType::iterator I = $5->begin(); I != $5->end(); ++I, ++ArgIt) {
+ for (ArgListType::iterator I = $5->begin();
+ I != $5->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
delete I->Ty; // Delete the typeholder...
- setValueName(ArgIt, I->Name); // Insert arg into symtab...
+ setValueName(ArgIt, I->Name); // Insert arg into symtab...
CHECK_FOR_ERROR
InsertValue(ArgIt);
Idx++;
@@ -2299,7 +2319,6 @@
setValueName($3, $2);
CHECK_FOR_ERROR
InsertValue($3);
-
$1->getInstList().push_back($3);
InsertValue($1);
$$ = $1;
@@ -2494,13 +2513,14 @@
};
Inst : OptLocalAssign InstVal {
- // Is this definition named?? if so, assign the name...
- setValueName($2, $1);
- CHECK_FOR_ERROR
- InsertValue($2);
- $$ = $2;
- CHECK_FOR_ERROR
-};
+ // Is this definition named?? if so, assign the name...
+ setValueName($2, $1);
+ CHECK_FOR_ERROR
+ InsertValue($2);
+ $$ = $2;
+ CHECK_FOR_ERROR
+ };
+
PHIList : Types '[' ValueRef ',' ValueRef ']' { // Used for PHI nodes
if (!UpRefs.empty())
@@ -2570,7 +2590,7 @@
($1 == Instruction::URem ||
$1 == Instruction::SRem ||
$1 == Instruction::FRem))
- GEN_ERROR("U/S/FRem not supported on packed types");
+ GEN_ERROR("Remainder not supported on packed types");
Value* val1 = getVal(*$2, $3);
CHECK_FOR_ERROR
Value* val2 = getVal(*$2, $5);
@@ -2890,11 +2910,10 @@
std::string where
= std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
+ ":" + utostr((unsigned) llvmAsmlineno) + ": ";
- std::string errMsg = std::string(ErrorMsg) + "\n" + where + " while reading ";
- if (yychar == YYEMPTY || yychar == 0)
- errMsg += "end-of-file.";
- else
- errMsg += "token: '" + std::string(llvmAsmtext, llvmAsmleng) + "'";
+ std::string errMsg = where + "error: " + std::string(ErrorMsg);
+ if (yychar != YYEMPTY && yychar != 0)
+ errMsg += " while reading token: '" + std::string(llvmAsmtext, llvmAsmleng)+
+ "'";
GenerateError(errMsg);
return 0;
}
diff --git a/lib/Bytecode/Reader/Analyzer.cpp b/lib/Bytecode/Reader/Analyzer.cpp
index 64907a8..71cb4b2 100644
--- a/lib/Bytecode/Reader/Analyzer.cpp
+++ b/lib/Bytecode/Reader/Analyzer.cpp
@@ -270,19 +270,15 @@
*os << " } END BLOCK: CompactionTable\n";
}
- virtual void handleSymbolTableBegin(Function* CF, SymbolTable* ST) {
+ virtual void handleTypeSymbolTableBegin(TypeSymbolTable* ST) {
bca.numSymTab++;
if (os)
- *os << " BLOCK: SymbolTable {\n";
+ *os << " BLOCK: TypeSymbolTable {\n";
}
-
- virtual void handleSymbolTablePlane(unsigned Ty, unsigned NumEntries,
- const Type* Typ) {
- if (os) {
- *os << " Plane: Ty=" << Ty << " Size=" << NumEntries << " Type: ";
- WriteTypeSymbolic(*os,Typ,M);
- *os << "\n";
- }
+ virtual void handleValueSymbolTableBegin(Function* CF, ValueSymbolTable* ST) {
+ bca.numSymTab++;
+ if (os)
+ *os << " BLOCK: ValueSymbolTable {\n";
}
virtual void handleSymbolTableType(unsigned i, unsigned TypSlot,
@@ -292,18 +288,23 @@
<< " Name: " << name << "\n";
}
- virtual void handleSymbolTableValue(unsigned i, unsigned ValSlot,
- const std::string& name ) {
+ virtual void handleSymbolTableValue(unsigned TySlot, unsigned ValSlot,
+ const std::string& name) {
if (os)
- *os << " Value " << i << " Slot=" << ValSlot
+ *os << " Value " << TySlot << " Slot=" << ValSlot
<< " Name: " << name << "\n";
if (ValSlot > bca.maxValueSlot)
bca.maxValueSlot = ValSlot;
}
- virtual void handleSymbolTableEnd() {
+ virtual void handleValueSymbolTableEnd() {
if (os)
- *os << " } END BLOCK: SymbolTable\n";
+ *os << " } END BLOCK: ValueSymbolTable\n";
+ }
+
+ virtual void handleTypeSymbolTableEnd() {
+ if (os)
+ *os << " } END BLOCK: TypeSymbolTable\n";
}
virtual void handleFunctionBegin(Function* Func, unsigned Size) {
@@ -358,15 +359,15 @@
}
virtual bool handleInstruction( unsigned Opcode, const Type* iType,
- std::vector<unsigned>& Operands, unsigned Size){
+ std::vector<unsigned>& Operands,
+ Instruction *Inst,
+ unsigned Size){
if (os) {
*os << " INST: OpCode="
- << Instruction::getOpcodeName(Opcode) << " Type=\"";
- WriteTypeSymbolic(*os,iType,M);
- *os << "\"";
+ << Instruction::getOpcodeName(Opcode);
for ( unsigned i = 0; i < Operands.size(); ++i )
- *os << " Op(" << i << ")=Slot(" << Operands[i] << ")";
- *os << "\n";
+ *os << " Op(" << Operands[i] << ")";
+ *os << *Inst;
}
bca.numInstructions++;
diff --git a/lib/Bytecode/Reader/Reader.cpp b/lib/Bytecode/Reader/Reader.cpp
index e2505cc..ff6d8f0 100644
--- a/lib/Bytecode/Reader/Reader.cpp
+++ b/lib/Bytecode/Reader/Reader.cpp
@@ -23,7 +23,6 @@
#include "llvm/Constants.h"
#include "llvm/InlineAsm.h"
#include "llvm/Instructions.h"
-#include "llvm/SymbolTable.h"
#include "llvm/TypeSymbolTable.h"
#include "llvm/Bytecode/Format.h"
#include "llvm/Config/alloca.h"
@@ -55,6 +54,7 @@
inline void BytecodeReader::error(const std::string& err) {
ErrorMsg = err + " (Vers=" + itostr(RevisionNum) + ", Pos="
+ itostr(At-MemStart) + ")";
+ if (Handler) Handler->handleError(ErrorMsg);
longjmp(context,1);
}
@@ -443,10 +443,6 @@
// of opcodes.
Instruction* Result = 0;
- // We have enough info to inform the handler now.
- if (Handler)
- Handler->handleInstruction(Opcode, InstTy, Oprnds, At-SaveAt);
-
// First, handle the easy binary operators case
if (Opcode >= Instruction::BinaryOpsBegin &&
Opcode < Instruction::BinaryOpsEnd && Oprnds.size() == 2) {
@@ -861,6 +857,10 @@
else
TypeSlot = getTypeSlot(Result->getType());
+ // We have enough info to inform the handler now.
+ if (Handler)
+ Handler->handleInstruction(Opcode, InstTy, Oprnds, Result, At-SaveAt);
+
insertValue(Result, TypeSlot, FunctionValues);
}
@@ -936,9 +936,9 @@
/// CurrentFunction's symbol table. For Module level symbol tables, the
/// CurrentFunction argument must be zero.
void BytecodeReader::ParseValueSymbolTable(Function *CurrentFunction,
- SymbolTable *ST) {
+ ValueSymbolTable *VST) {
- if (Handler) Handler->handleSymbolTableBegin(CurrentFunction,ST);
+ if (Handler) Handler->handleValueSymbolTableBegin(CurrentFunction,VST);
// Allow efficient basic block lookup by number.
std::vector<BasicBlock*> BBMap;
@@ -963,13 +963,15 @@
} else {
V = getValue(Typ, slot, false); // Find mapping...
}
+ if (Handler) Handler->handleSymbolTableValue(Typ, slot, Name);
if (V == 0)
- error("Failed value look-up for name '" + Name + "'");
+ error("Failed value look-up for name '" + Name + "', type #" +
+ utostr(Typ) + " slot #" + utostr(slot));
V->setName(Name);
}
}
checkPastBlockEnd("Symbol Table");
- if (Handler) Handler->handleSymbolTableEnd();
+ if (Handler) Handler->handleValueSymbolTableEnd();
}
// Parse a single type. The typeid is read in first. If its a primitive type
diff --git a/lib/Bytecode/Reader/Reader.h b/lib/Bytecode/Reader/Reader.h
index 92c8fa0..b881f9d 100644
--- a/lib/Bytecode/Reader/Reader.h
+++ b/lib/Bytecode/Reader/Reader.h
@@ -28,8 +28,10 @@
namespace llvm {
-class BytecodeHandler; ///< Forward declare the handler interface
-class TypeSymbolTable; ///< Forward declare
+// Forward declarations
+class BytecodeHandler;
+class TypeSymbolTable;
+class ValueSymbolTable;
/// This class defines the interface for parsing a buffer of bytecode. The
/// parser itself takes no action except to call the various functions of
@@ -204,7 +206,7 @@
void ParseTypeSymbolTable(TypeSymbolTable *ST);
/// @brief Parse a value symbol table
- void ParseValueSymbolTable(Function* Func, SymbolTable *ST);
+ void ParseValueSymbolTable(Function* Func, ValueSymbolTable *ST);
/// @brief Parse functions lazily.
void ParseFunctionLazily();
diff --git a/lib/Bytecode/Writer/SlotCalculator.cpp b/lib/Bytecode/Writer/SlotCalculator.cpp
index 9115ddb..197f206 100644
--- a/lib/Bytecode/Writer/SlotCalculator.cpp
+++ b/lib/Bytecode/Writer/SlotCalculator.cpp
@@ -21,9 +21,9 @@
#include "llvm/InlineAsm.h"
#include "llvm/Instructions.h"
#include "llvm/Module.h"
-#include "llvm/SymbolTable.h"
#include "llvm/TypeSymbolTable.h"
#include "llvm/Type.h"
+#include "llvm/ValueSymbolTable.h"
#include "llvm/Analysis/ConstantsScanner.h"
#include "llvm/ADT/PostOrderIterator.h"
#include "llvm/ADT/STLExtras.h"
@@ -218,8 +218,8 @@
// processTypeSymbolTable - Insert all of the type sin the specified symbol
// table.
-void SlotCalculator::processTypeSymbolTable(const TypeSymbolTable *ST) {
- for (TypeSymbolTable::const_iterator TI = ST->begin(), TE = ST->end();
+void SlotCalculator::processTypeSymbolTable(const TypeSymbolTable *TST) {
+ for (TypeSymbolTable::const_iterator TI = TST->begin(), TE = TST->end();
TI != TE; ++TI )
getOrCreateSlot(TI->second);
}
@@ -227,23 +227,18 @@
// processSymbolTable - Insert all of the values in the specified symbol table
// into the values table...
//
-void SlotCalculator::processValueSymbolTable(const SymbolTable *ST) {
- for (SymbolTable::plane_const_iterator PI = ST->plane_begin(),
- PE = ST->plane_end(); PI != PE; ++PI)
- for (SymbolTable::value_const_iterator VI = PI->second.begin(),
- VE = PI->second.end(); VI != VE; ++VI)
- getOrCreateSlot(VI->second);
+void SlotCalculator::processValueSymbolTable(const ValueSymbolTable *VST) {
+ for (ValueSymbolTable::const_iterator VI = VST->begin(), VE = VST->end();
+ VI != VE; ++VI)
+ getOrCreateSlot(VI->second);
}
-void SlotCalculator::processSymbolTableConstants(const SymbolTable *ST) {
+void SlotCalculator::processSymbolTableConstants(const ValueSymbolTable *VST) {
// Now do the constant values in all planes
- for (SymbolTable::plane_const_iterator PI = ST->plane_begin(),
- PE = ST->plane_end(); PI != PE; ++PI)
- for (SymbolTable::value_const_iterator VI = PI->second.begin(),
- VE = PI->second.end(); VI != VE; ++VI)
- if (isa<Constant>(VI->second) &&
- !isa<GlobalValue>(VI->second))
- getOrCreateSlot(VI->second);
+ for (ValueSymbolTable::const_iterator VI = VST->begin(), VE = VST->end();
+ VI != VE; ++VI)
+ if (isa<Constant>(VI->second) && !isa<GlobalValue>(VI->second))
+ getOrCreateSlot(VI->second);
}
diff --git a/lib/Bytecode/Writer/SlotCalculator.h b/lib/Bytecode/Writer/SlotCalculator.h
index 8200992..6cddb30 100644
--- a/lib/Bytecode/Writer/SlotCalculator.h
+++ b/lib/Bytecode/Writer/SlotCalculator.h
@@ -31,6 +31,7 @@
class Function;
class SymbolTable;
class TypeSymbolTable;
+class ValueSymbolTable;
class ConstantArray;
class SlotCalculator {
@@ -130,8 +131,8 @@
// into the values table...
//
void processTypeSymbolTable(const TypeSymbolTable *ST);
- void processValueSymbolTable(const SymbolTable *ST);
- void processSymbolTableConstants(const SymbolTable *ST);
+ void processValueSymbolTable(const ValueSymbolTable *ST);
+ void processSymbolTableConstants(const ValueSymbolTable *ST);
// insertPrimitives - helper for constructors to insert primitive types.
void insertPrimitives();
diff --git a/lib/Bytecode/Writer/Writer.cpp b/lib/Bytecode/Writer/Writer.cpp
index 0d4ccbd..a2e8fe5 100644
--- a/lib/Bytecode/Writer/Writer.cpp
+++ b/lib/Bytecode/Writer/Writer.cpp
@@ -26,8 +26,8 @@
#include "llvm/InlineAsm.h"
#include "llvm/Instructions.h"
#include "llvm/Module.h"
-#include "llvm/SymbolTable.h"
#include "llvm/TypeSymbolTable.h"
+#include "llvm/ValueSymbolTable.h"
#include "llvm/Support/GetElementPtrTypeIterator.h"
#include "llvm/Support/Compressor.h"
#include "llvm/Support/MathExtras.h"
@@ -1144,21 +1144,31 @@
}
}
-void BytecodeWriter::outputValueSymbolTable(const SymbolTable &MST) {
+void BytecodeWriter::outputValueSymbolTable(const ValueSymbolTable &VST) {
// Do not output the Bytecode block for an empty symbol table, it just wastes
// space!
- if (MST.isEmpty()) return;
+ if (VST.empty()) return;
BytecodeBlock SymTabBlock(BytecodeFormat::ValueSymbolTableBlockID, *this,
true/*ElideIfEmpty*/);
- // Now do each of the type planes in order.
- for (SymbolTable::plane_const_iterator PI = MST.plane_begin(),
- PE = MST.plane_end(); PI != PE; ++PI) {
- SymbolTable::value_const_iterator I = MST.value_begin(PI->first);
- SymbolTable::value_const_iterator End = MST.value_end(PI->first);
+ // Organize the symbol table by type
+ typedef std::pair<std::string, const Value*> PlaneMapEntry;
+ typedef std::vector<PlaneMapEntry> PlaneMapVector;
+ typedef std::map<const Type*, PlaneMapVector > PlaneMap;
+ PlaneMap Planes;
+ for (ValueSymbolTable::const_iterator SI = VST.begin(), SE = VST.end();
+ SI != SE; ++SI)
+ Planes[SI->second->getType()].push_back(
+ std::make_pair(SI->first,SI->second));
+
+ for (PlaneMap::const_iterator PI = Planes.begin(), PE = Planes.end();
+ PI != PE; ++PI) {
int Slot;
+ PlaneMapVector::const_iterator I = PI->second.begin();
+ PlaneMapVector::const_iterator End = PI->second.end();
+
if (I == End) continue; // Don't mess with an absent type...
// Write the number of values in this plane
diff --git a/lib/Bytecode/Writer/WriterInternals.h b/lib/Bytecode/Writer/WriterInternals.h
index c518c01..f3c59f3 100644
--- a/lib/Bytecode/Writer/WriterInternals.h
+++ b/lib/Bytecode/Writer/WriterInternals.h
@@ -26,6 +26,7 @@
namespace llvm {
class InlineAsm;
class TypeSymbolTable;
+ class ValueSymbolTable;
class BytecodeWriter {
std::vector<unsigned char> &Out;
@@ -66,7 +67,7 @@
void outputModuleInfoBlock(const Module *C);
void outputTypeSymbolTable(const TypeSymbolTable &TST);
- void outputValueSymbolTable(const SymbolTable &ST);
+ void outputValueSymbolTable(const ValueSymbolTable &ST);
void outputTypes(unsigned StartNo);
void outputConstantsInPlane(const std::vector<const Value*> &Plane,
unsigned StartNo);
diff --git a/lib/Linker/LinkModules.cpp b/lib/Linker/LinkModules.cpp
index 2d16495..8376534 100644
--- a/lib/Linker/LinkModules.cpp
+++ b/lib/Linker/LinkModules.cpp
@@ -20,8 +20,8 @@
#include "llvm/Constants.h"
#include "llvm/DerivedTypes.h"
#include "llvm/Module.h"
-#include "llvm/SymbolTable.h"
#include "llvm/TypeSymbolTable.h"
+#include "llvm/ValueSymbolTable.h"
#include "llvm/Instructions.h"
#include "llvm/Assembly/Writer.h"
#include "llvm/Support/Streams.h"
@@ -273,7 +273,8 @@
static Value *RemapOperand(const Value *In,
std::map<const Value*, Value*> &ValueMap) {
std::map<const Value*,Value*>::const_iterator I = ValueMap.find(In);
- if (I != ValueMap.end()) return I->second;
+ if (I != ValueMap.end())
+ return I->second;
// Check to see if it's a constant that we are interested in transforming.
Value *Result = 0;
@@ -333,20 +334,34 @@
/// through the trouble to force this back.
static void ForceRenaming(GlobalValue *GV, const std::string &Name) {
assert(GV->getName() != Name && "Can't force rename to self");
- SymbolTable &ST = GV->getParent()->getValueSymbolTable();
+ ValueSymbolTable &ST = GV->getParent()->getValueSymbolTable();
// If there is a conflict, rename the conflict.
- Value *ConflictVal = ST.lookup(GV->getType(), Name);
- assert(ConflictVal&&"Why do we have to force rename if there is no conflic?");
- GlobalValue *ConflictGV = cast<GlobalValue>(ConflictVal);
- assert(ConflictGV->hasInternalLinkage() &&
- "Not conflicting with a static global, should link instead!");
+ GlobalValue *ConflictGV = cast_or_null<GlobalValue>(ST.lookup(Name));
+ if (ConflictGV) {
+ assert(ConflictGV->hasInternalLinkage() &&
+ "Not conflicting with a static global, should link instead!");
+ ConflictGV->setName(""); // Eliminate the conflict
+ }
+ GV->setName(Name); // Force the name back
+ if (ConflictGV) {
+ ConflictGV->setName(Name); // This will cause ConflictGV to get renamed
+ assert(ConflictGV->getName() != Name && "ForceRenaming didn't work");
+ }
+ assert(GV->getName() == Name && "ForceRenaming didn't work");
+}
- ConflictGV->setName(""); // Eliminate the conflict
- GV->setName(Name); // Force the name back
- ConflictGV->setName(Name); // This will cause ConflictGV to get renamed
- assert(GV->getName() == Name && ConflictGV->getName() != Name &&
- "ForceRenaming didn't work");
+/// CopyGVAttributes - copy additional attributes (those not needed to construct
+/// a GlobalValue) from the SrcGV to the DestGV.
+static void CopyGVAttributes(GlobalValue *DestGV, const GlobalValue *SrcGV) {
+ // Propagate alignment, visibility and section info.
+ DestGV->setAlignment(std::max(DestGV->getAlignment(), SrcGV->getAlignment()));
+ DestGV->setSection(SrcGV->getSection());
+ DestGV->setVisibility(SrcGV->getVisibility());
+ if (const Function *SrcF = dyn_cast<Function>(SrcGV)) {
+ Function *DestF = cast<Function>(DestGV);
+ DestF->setCallingConv(SrcF->getCallingConv());
+ }
}
/// GetLinkageResult - This analyzes the two global values and determines what
@@ -431,29 +446,20 @@
static bool LinkGlobals(Module *Dest, Module *Src,
std::map<const Value*, Value*> &ValueMap,
std::multimap<std::string, GlobalVariable *> &AppendingVars,
- std::map<std::string, GlobalValue*> &GlobalsByName,
std::string *Err) {
- // We will need a module level symbol table if the src module has a module
- // level symbol table...
- TypeSymbolTable *TST = &Dest->getTypeSymbolTable();
-
// Loop over all of the globals in the src module, mapping them over as we go
for (Module::global_iterator I = Src->global_begin(), E = Src->global_end();
I != E; ++I) {
GlobalVariable *SGV = I;
GlobalVariable *DGV = 0;
// Check to see if may have to link the global.
- if (SGV->hasName() && !SGV->hasInternalLinkage())
- if (!(DGV = Dest->getGlobalVariable(SGV->getName(),
- SGV->getType()->getElementType()))) {
- std::map<std::string, GlobalValue*>::iterator EGV =
- GlobalsByName.find(SGV->getName());
- if (EGV != GlobalsByName.end())
- DGV = dyn_cast<GlobalVariable>(EGV->second);
- if (DGV)
- // If types don't agree due to opaque types, try to resolve them.
- RecursiveResolveTypes(SGV->getType(), DGV->getType(), TST, "");
- }
+ if (SGV->hasName() && !SGV->hasInternalLinkage()) {
+ DGV = Dest->getGlobalVariable(SGV->getName());
+ if (DGV && DGV->getType() != SGV->getType())
+ // If types don't agree due to opaque types, try to resolve them.
+ RecursiveResolveTypes(SGV->getType(), DGV->getType(),
+ &Dest->getTypeSymbolTable(), "");
+ }
if (DGV && DGV->hasInternalLinkage())
DGV = 0;
@@ -476,9 +482,7 @@
SGV->isConstant(), SGV->getLinkage(), /*init*/0,
SGV->getName(), Dest);
// Propagate alignment, visibility and section info.
- NewDGV->setAlignment(SGV->getAlignment());
- NewDGV->setSection(SGV->getSection());
- NewDGV->setVisibility(SGV->getVisibility());
+ CopyGVAttributes(NewDGV, SGV);
// If the LLVM runtime renamed the global, but it is an externally visible
// symbol, DGV must be an existing global with internal linkage. Rename
@@ -502,9 +506,8 @@
"", Dest);
// Propagate alignment, section and visibility info.
- NewDGV->setAlignment(std::max(DGV->getAlignment(), SGV->getAlignment()));
- NewDGV->setSection(SGV->getSection());
- NewDGV->setVisibility(SGV->getVisibility());
+ NewDGV->setAlignment(DGV->getAlignment());
+ CopyGVAttributes(NewDGV, SGV);
// Make sure to remember this mapping...
ValueMap.insert(std::make_pair(SGV, NewDGV));
@@ -513,9 +516,7 @@
AppendingVars.insert(std::make_pair(SGV->getName(), NewDGV));
} else {
// Propagate alignment, section, and visibility info.
- DGV->setAlignment(std::max(DGV->getAlignment(), SGV->getAlignment()));
- DGV->setSection(SGV->getSection());
- DGV->setVisibility(SGV->getVisibility());
+ CopyGVAttributes(DGV, SGV);
// Otherwise, perform the mapping as instructed by GetLinkageResult. If
// the types don't match, and if we are to link from the source, nuke DGV
@@ -524,9 +525,7 @@
GlobalVariable *NewDGV =
new GlobalVariable(SGV->getType()->getElementType(),
DGV->isConstant(), DGV->getLinkage());
- NewDGV->setAlignment(DGV->getAlignment());
- NewDGV->setSection(DGV->getSection());
- NewDGV->setVisibility(DGV->getVisibility());
+ CopyGVAttributes(NewDGV, DGV);
Dest->getGlobalList().insert(DGV, NewDGV);
DGV->replaceAllUsesWith(
ConstantExpr::getBitCast(NewDGV, DGV->getType()));
@@ -607,33 +606,64 @@
//
static bool LinkFunctionProtos(Module *Dest, const Module *Src,
std::map<const Value*, Value*> &ValueMap,
- std::map<std::string,
- GlobalValue*> &GlobalsByName,
std::string *Err) {
- TypeSymbolTable *TST = &Dest->getTypeSymbolTable();
-
// Loop over all of the functions in the src module, mapping them over
for (Module::const_iterator I = Src->begin(), E = Src->end(); I != E; ++I) {
const Function *SF = I; // SrcFunction
Function *DF = 0;
if (SF->hasName() && !SF->hasInternalLinkage()) {
// Check to see if may have to link the function.
- if (!(DF = Dest->getFunction(SF->getName(), SF->getFunctionType()))) {
- std::map<std::string, GlobalValue*>::iterator EF =
- GlobalsByName.find(SF->getName());
- if (EF != GlobalsByName.end())
- DF = dyn_cast<Function>(EF->second);
- if (DF && RecursiveResolveTypes(SF->getType(), DF->getType(), TST, ""))
- DF = 0; // FIXME: gross.
- }
+ DF = Dest->getFunction(SF->getName());
+ if (DF && SF->getType() != DF->getType())
+ // If types don't agree because of opaque, try to resolve them
+ RecursiveResolveTypes(SF->getType(), DF->getType(),
+ &Dest->getTypeSymbolTable(), "");
}
+
+ if (DF && DF->getType() != SF->getType()) {
+ if (DF->isDeclaration() && !SF->isDeclaration()) {
+ // We have a definition of the same name but different type in the
+ // source module. Copy the prototype to the destination and replace
+ // uses of the destination's prototype with the new prototype.
+ Function *NewDF = new Function(SF->getFunctionType(), SF->getLinkage(),
+ SF->getName(), Dest);
+ CopyGVAttributes(NewDF, SF);
- if (!DF || SF->hasInternalLinkage() || DF->hasInternalLinkage()) {
+ // Any uses of DF need to change to NewDF, with cast
+ DF->replaceAllUsesWith(ConstantExpr::getBitCast(NewDF, DF->getType()));
+
+ // DF will conflict with NewDF because they both had the same. We must
+ // erase this now so ForceRenaming doesn't assert because DF might
+ // not have internal linkage.
+ DF->eraseFromParent();
+
+ // If the symbol table renamed the function, but it is an externally
+ // visible symbol, DF must be an existing function with internal
+ // linkage. Rename it.
+ if (NewDF->getName() != SF->getName() && !NewDF->hasInternalLinkage())
+ ForceRenaming(NewDF, SF->getName());
+
+ // Remember this mapping so uses in the source module get remapped
+ // later by RemapOperand.
+ ValueMap[SF] = NewDF;
+ } else if (SF->isDeclaration()) {
+ // We have two functions of the same name but different type and the
+ // source is a declaration while the destination is not. Any use of
+ // the source must be mapped to the destination, with a cast.
+ ValueMap[SF] = ConstantExpr::getBitCast(DF, SF->getType());
+ } else {
+ // We have two functions of the same name but different types and they
+ // are both definitions. This is an error.
+ return Error(Err, "Function '" + DF->getName() + "' defined as both '" +
+ ToStr(SF->getFunctionType(), Src) + "' and '" +
+ ToStr(DF->getFunctionType(), Dest) + "'");
+ }
+ } else if (!DF || SF->hasInternalLinkage() || DF->hasInternalLinkage()) {
// Function does not already exist, simply insert an function signature
// identical to SF into the dest module...
Function *NewDF = new Function(SF->getFunctionType(), SF->getLinkage(),
SF->getName(), Dest);
- NewDF->setCallingConv(SF->getCallingConv());
+ CopyGVAttributes(NewDF, SF);
// If the LLVM runtime renamed the function, but it is an externally
// visible symbol, DF must be an existing function with internal linkage.
@@ -644,8 +674,8 @@
// ... and remember this mapping...
ValueMap.insert(std::make_pair(SF, NewDF));
} else if (SF->isDeclaration()) {
- // If SF is external or if both SF & DF are external.. Just link the
- // external functions, we aren't adding anything.
+ // If SF is a declaration or if both SF & DF are declarations, just link
+ // the declarations, we aren't adding anything.
if (SF->hasDLLImportLinkage()) {
if (DF->isDeclaration()) {
ValueMap.insert(std::make_pair(SF, DF));
@@ -668,8 +698,6 @@
if ((DF->hasLinkOnceLinkage() && SF->hasWeakLinkage()) ||
DF->hasExternalWeakLinkage())
DF->setLinkage(SF->getLinkage());
-
-
} else if (DF->hasWeakLinkage() || DF->hasLinkOnceLinkage()) {
// At this point we know that SF has LinkOnce or External* linkage.
ValueMap.insert(std::make_pair(SF, DF));
@@ -677,10 +705,10 @@
// Don't inherit linkonce & external weak linkage
DF->setLinkage(SF->getLinkage());
} else if (SF->getLinkage() != DF->getLinkage()) {
- return Error(Err, "Functions named '" + SF->getName() +
- "' have different linkage specifiers!");
+ return Error(Err, "Functions named '" + SF->getName() +
+ "' have different linkage specifiers!");
} else if (SF->hasExternalLinkage()) {
- // The function is defined in both modules!!
+ // The function is defined identically in both modules!!
return Error(Err, "Function '" +
ToStr(SF->getFunctionType(), Src) + "':\"" +
SF->getName() + "\" - Function is already defined!");
@@ -695,7 +723,7 @@
// fix up references to values. At this point we know that Dest is an external
// function, and that Src is not.
static bool LinkFunctionBody(Function *Dest, Function *Src,
- std::map<const Value*, Value*> &GlobalMap,
+ std::map<const Value*, Value*> &ValueMap,
std::string *Err) {
assert(Src && Dest && Dest->isDeclaration() && !Src->isDeclaration());
@@ -706,7 +734,7 @@
DI->setName(I->getName()); // Copy the name information over...
// Add a mapping to our local map
- GlobalMap.insert(std::make_pair(I, DI));
+ ValueMap.insert(std::make_pair(I, DI));
}
// Splice the body of the source function into the dest function.
@@ -722,12 +750,12 @@
for (Instruction::op_iterator OI = I->op_begin(), OE = I->op_end();
OI != OE; ++OI)
if (!isa<Instruction>(*OI) && !isa<BasicBlock>(*OI))
- *OI = RemapOperand(*OI, GlobalMap);
+ *OI = RemapOperand(*OI, ValueMap);
// There is no need to map the arguments anymore.
for (Function::arg_iterator I = Src->arg_begin(), E = Src->arg_end();
I != E; ++I)
- GlobalMap.erase(I);
+ ValueMap.erase(I);
return false;
}
@@ -747,11 +775,10 @@
Function *DF = cast<Function>(ValueMap[SF]); // Destination function
// DF not external SF external?
- if (DF->isDeclaration()) {
+ if (DF->isDeclaration())
// Only provide the function body if there isn't one already.
if (LinkFunctionBody(DF, SF, ValueMap, Err))
return true;
- }
}
}
return false;
@@ -919,32 +946,17 @@
// with appending linkage. After the module is linked together, they are
// appended and the module is rewritten.
std::multimap<std::string, GlobalVariable *> AppendingVars;
-
- // GlobalsByName - The LLVM SymbolTable class fights our best efforts at
- // linking by separating globals by type. Until PR411 is fixed, we replicate
- // it's functionality here.
- std::map<std::string, GlobalValue*> GlobalsByName;
-
for (Module::global_iterator I = Dest->global_begin(), E = Dest->global_end();
I != E; ++I) {
// Add all of the appending globals already in the Dest module to
// AppendingVars.
if (I->hasAppendingLinkage())
AppendingVars.insert(std::make_pair(I->getName(), I));
-
- // Keep track of all globals by name.
- if (!I->hasInternalLinkage() && I->hasName())
- GlobalsByName[I->getName()] = I;
}
- // Keep track of all globals by name.
- for (Module::iterator I = Dest->begin(), E = Dest->end(); I != E; ++I)
- if (!I->hasInternalLinkage() && I->hasName())
- GlobalsByName[I->getName()] = I;
-
// Insert all of the globals in src into the Dest module... without linking
// initializers (which could refer to functions not yet mapped over).
- if (LinkGlobals(Dest, Src, ValueMap, AppendingVars, GlobalsByName, ErrorMsg))
+ if (LinkGlobals(Dest, Src, ValueMap, AppendingVars, ErrorMsg))
return true;
// Link the functions together between the two modules, without doing function
@@ -952,7 +964,7 @@
// function... We do this so that when we begin processing function bodies,
// all of the global values that may be referenced are available in our
// ValueMap.
- if (LinkFunctionProtos(Dest, Src, ValueMap, GlobalsByName, ErrorMsg))
+ if (LinkFunctionProtos(Dest, Src, ValueMap, ErrorMsg))
return true;
// Update the initializers in the Dest module now that all globals that may
diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp
index 6116bcd..ffa3b1e 100644
--- a/lib/Target/CBackend/CBackend.cpp
+++ b/lib/Target/CBackend/CBackend.cpp
@@ -20,7 +20,6 @@
#include "llvm/Instructions.h"
#include "llvm/Pass.h"
#include "llvm/PassManager.h"
-#include "llvm/SymbolTable.h"
#include "llvm/TypeSymbolTable.h"
#include "llvm/Intrinsics.h"
#include "llvm/IntrinsicInst.h"
diff --git a/lib/Transforms/IPO/LoopExtractor.cpp b/lib/Transforms/IPO/LoopExtractor.cpp
index 5a6e767..7169b50 100644
--- a/lib/Transforms/IPO/LoopExtractor.cpp
+++ b/lib/Transforms/IPO/LoopExtractor.cpp
@@ -167,7 +167,8 @@
Function *F = BB->getParent();
// Map the corresponding function in this module.
- Function *MF = M.getFunction(F->getName(), F->getFunctionType());
+ Function *MF = M.getFunction(F->getName());
+ assert(MF->getFunctionType() == F->getFunctionType() && "Wrong function?");
// Figure out which index the basic block is in its function.
Function::iterator BBI = MF->begin();
diff --git a/lib/Transforms/IPO/RaiseAllocations.cpp b/lib/Transforms/IPO/RaiseAllocations.cpp
index 6082780..c5a9cbf 100644
--- a/lib/Transforms/IPO/RaiseAllocations.cpp
+++ b/lib/Transforms/IPO/RaiseAllocations.cpp
@@ -65,47 +65,65 @@
// function into the appropriate instruction.
//
void RaiseAllocations::doInitialization(Module &M) {
- const FunctionType *MallocType = // Get the type for malloc
- FunctionType::get(PointerType::get(Type::Int8Ty),
- std::vector<const Type*>(1, Type::Int64Ty), false);
-
- const FunctionType *FreeType = // Get the type for free
- FunctionType::get(Type::VoidTy,
- std::vector<const Type*>(1, PointerType::get(Type::Int8Ty)),
- false);
// Get Malloc and free prototypes if they exist!
- MallocFunc = M.getFunction("malloc", MallocType);
- FreeFunc = M.getFunction("free" , FreeType);
+ MallocFunc = M.getFunction("malloc");
+ if (MallocFunc) {
+ const FunctionType* TyWeHave = MallocFunc->getFunctionType();
- // Check to see if the prototype is wrong, giving us sbyte*(uint) * malloc
- // This handles the common declaration of: 'void *malloc(unsigned);'
- if (MallocFunc == 0) {
- MallocType = FunctionType::get(PointerType::get(Type::Int8Ty),
- std::vector<const Type*>(1, Type::Int32Ty), false);
- MallocFunc = M.getFunction("malloc", MallocType);
+ // Get the expected prototype for malloc
+ const FunctionType *Malloc1Type =
+ FunctionType::get(PointerType::get(Type::Int8Ty),
+ std::vector<const Type*>(1, Type::Int64Ty), false);
+
+ // Chck to see if we got the expected malloc
+ if (TyWeHave != Malloc1Type) {
+ // Check to see if the prototype is wrong, giving us sbyte*(uint) * malloc
+ // This handles the common declaration of: 'void *malloc(unsigned);'
+ const FunctionType *Malloc2Type =
+ FunctionType::get(PointerType::get(Type::Int8Ty),
+ std::vector<const Type*>(1, Type::Int32Ty), false);
+ if (TyWeHave != Malloc2Type) {
+ // Check to see if the prototype is missing, giving us
+ // sbyte*(...) * malloc
+ // This handles the common declaration of: 'void *malloc();'
+ const FunctionType *Malloc3Type =
+ FunctionType::get(PointerType::get(Type::Int8Ty),
+ std::vector<const Type*>(), true);
+ if (TyWeHave != Malloc3Type)
+ // Give up
+ MallocFunc = 0;
+ }
+ }
}
- // Check to see if the prototype is missing, giving us sbyte*(...) * malloc
- // This handles the common declaration of: 'void *malloc();'
- if (MallocFunc == 0) {
- MallocType = FunctionType::get(PointerType::get(Type::Int8Ty),
- std::vector<const Type*>(), true);
- MallocFunc = M.getFunction("malloc", MallocType);
- }
+ FreeFunc = M.getFunction("free");
+ if (FreeFunc) {
+ const FunctionType* TyWeHave = FreeFunc->getFunctionType();
+
+ // Get the expected prototype for void free(i8*)
+ const FunctionType *Free1Type = FunctionType::get(Type::VoidTy,
+ std::vector<const Type*>(1, PointerType::get(Type::Int8Ty)), false);
- // Check to see if the prototype was forgotten, giving us void (...) * free
- // This handles the common forward declaration of: 'void free();'
- if (FreeFunc == 0) {
- FreeType = FunctionType::get(Type::VoidTy, std::vector<const Type*>(),true);
- FreeFunc = M.getFunction("free", FreeType);
- }
+ if (TyWeHave != Free1Type) {
+ // Check to see if the prototype was forgotten, giving us
+ // void (...) * free
+ // This handles the common forward declaration of: 'void free();'
+ const FunctionType* Free2Type = FunctionType::get(Type::VoidTy,
+ std::vector<const Type*>(),true);
- // One last try, check to see if we can find free as 'int (...)* free'. This
- // handles the case where NOTHING was declared.
- if (FreeFunc == 0) {
- FreeType = FunctionType::get(Type::Int32Ty, std::vector<const Type*>(),true);
- FreeFunc = M.getFunction("free", FreeType);
+ if (TyWeHave != Free2Type) {
+ // One last try, check to see if we can find free as
+ // int (...)* free. This handles the case where NOTHING was declared.
+ const FunctionType* Free3Type = FunctionType::get(Type::Int32Ty,
+ std::vector<const Type*>(),true);
+
+ if (TyWeHave != Free3Type) {
+ // Give up.
+ FreeFunc = 0;
+ }
+ }
+ }
}
// Don't mess with locally defined versions of these functions...
diff --git a/lib/Transforms/IPO/StripSymbols.cpp b/lib/Transforms/IPO/StripSymbols.cpp
index 12cd7fe..db4387f 100644
--- a/lib/Transforms/IPO/StripSymbols.cpp
+++ b/lib/Transforms/IPO/StripSymbols.cpp
@@ -28,7 +28,7 @@
#include "llvm/Instructions.h"
#include "llvm/Module.h"
#include "llvm/Pass.h"
-#include "llvm/SymbolTable.h"
+#include "llvm/ValueSymbolTable.h"
#include "llvm/TypeSymbolTable.h"
using namespace llvm;
diff --git a/lib/Transforms/Utils/CloneModule.cpp b/lib/Transforms/Utils/CloneModule.cpp
index d481aea..669b4b2 100644
--- a/lib/Transforms/Utils/CloneModule.cpp
+++ b/lib/Transforms/Utils/CloneModule.cpp
@@ -15,7 +15,6 @@
#include "llvm/Transforms/Utils/Cloning.h"
#include "llvm/Module.h"
#include "llvm/DerivedTypes.h"
-#include "llvm/SymbolTable.h"
#include "llvm/TypeSymbolTable.h"
#include "llvm/Constant.h"
#include "ValueMapper.h"
diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp
index f13a140..e834c53 100644
--- a/lib/VMCore/AsmWriter.cpp
+++ b/lib/VMCore/AsmWriter.cpp
@@ -24,7 +24,7 @@
#include "llvm/Instruction.h"
#include "llvm/Instructions.h"
#include "llvm/Module.h"
-#include "llvm/SymbolTable.h"
+#include "llvm/ValueSymbolTable.h"
#include "llvm/TypeSymbolTable.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/STLExtras.h"
diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp
index 79673f0..8a6e11d 100644
--- a/lib/VMCore/Constants.cpp
+++ b/lib/VMCore/Constants.cpp
@@ -16,7 +16,6 @@
#include "llvm/DerivedTypes.h"
#include "llvm/GlobalValue.h"
#include "llvm/Instructions.h"
-#include "llvm/SymbolTable.h"
#include "llvm/Module.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/Compiler.h"
@@ -24,6 +23,7 @@
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/MathExtras.h"
#include <algorithm>
+#include <map>
using namespace llvm;
//===----------------------------------------------------------------------===//
diff --git a/lib/VMCore/Function.cpp b/lib/VMCore/Function.cpp
index cf8fcde..cc0cefa 100644
--- a/lib/VMCore/Function.cpp
+++ b/lib/VMCore/Function.cpp
@@ -7,8 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
-// This file implements the Function & GlobalVariable classes for the VMCore
-// library.
+// This file implements the Function class for the VMCore library.
//
//===----------------------------------------------------------------------===//
@@ -82,7 +81,7 @@
BasicBlocks.setParent(this);
ArgumentList.setItemParent(this);
ArgumentList.setParent(this);
- SymTab = new SymbolTable();
+ SymTab = new ValueSymbolTable();
assert((getReturnType()->isFirstClassType() ||getReturnType() == Type::VoidTy)
&& "LLVM functions cannot return aggregate values!");
@@ -138,7 +137,6 @@
getParent()->getFunctionList().erase(this);
}
-
// dropAllReferences() - This function causes all the subinstructions to "let
// go" of all references that they are maintaining. This allows one to
// 'delete' a whole class at a time, even though there may be circular
diff --git a/lib/VMCore/Globals.cpp b/lib/VMCore/Globals.cpp
index e49f477..327e2ad 100644
--- a/lib/VMCore/Globals.cpp
+++ b/lib/VMCore/Globals.cpp
@@ -15,7 +15,6 @@
#include "llvm/GlobalVariable.h"
#include "llvm/DerivedTypes.h"
#include "llvm/Module.h"
-#include "llvm/SymbolTable.h"
#include "llvm/Support/LeakDetector.h"
using namespace llvm;
diff --git a/lib/VMCore/Instruction.cpp b/lib/VMCore/Instruction.cpp
index b2eb87d..6b2baba 100644
--- a/lib/VMCore/Instruction.cpp
+++ b/lib/VMCore/Instruction.cpp
@@ -14,7 +14,6 @@
#include "llvm/Type.h"
#include "llvm/Instructions.h"
#include "llvm/Function.h"
-#include "llvm/SymbolTable.h"
#include "llvm/Support/LeakDetector.h"
using namespace llvm;
diff --git a/lib/VMCore/Module.cpp b/lib/VMCore/Module.cpp
index efa6e6c..163d8d2 100644
--- a/lib/VMCore/Module.cpp
+++ b/lib/VMCore/Module.cpp
@@ -69,7 +69,7 @@
FunctionList.setParent(this);
GlobalList.setItemParent(this);
GlobalList.setParent(this);
- ValSymTab = new SymbolTable();
+ ValSymTab = new ValueSymbolTable();
TypeSymTab = new TypeSymbolTable();
}
@@ -132,15 +132,19 @@
// Methods for easy access to the functions in the module.
//
+// getOrInsertFunction - Look up the specified function in the module symbol
+// table. If it does not exist, add a prototype for the function and return
+// it. This is nice because it allows most passes to get away with not handling
+// the symbol table directly for this common task.
+//
Constant *Module::getOrInsertFunction(const std::string &Name,
const FunctionType *Ty) {
- SymbolTable &SymTab = getValueSymbolTable();
+ ValueSymbolTable &SymTab = getValueSymbolTable();
- // See if we have a definitions for the specified function already.
- Function *F =
- dyn_cast_or_null<Function>(SymTab.lookup(PointerType::get(Ty), Name));
+ // See if we have a definition for the specified function already.
+ Function *F = dyn_cast_or_null<Function>(SymTab.lookup(Name));
if (F == 0) {
- // Nope, add it.
+ // Nope, add it
Function *New = new Function(Ty, GlobalVariable::ExternalLinkage, Name);
FunctionList.push_back(New);
return New; // Return the new prototype.
@@ -149,7 +153,7 @@
// Okay, the function exists. Does it have externally visible linkage?
if (F->hasInternalLinkage()) {
// Rename the function.
- F->setName(SymTab.getUniqueName(F->getType(), F->getName()));
+ F->setName(SymTab.getUniqueName(F->getName()));
// Retry, now there won't be a conflict.
return getOrInsertFunction(Name, Ty);
}
@@ -188,73 +192,9 @@
// getFunction - Look up the specified function in the module symbol table.
// If it does not exist, return null.
//
-Function *Module::getFunction(const std::string &Name, const FunctionType *Ty) {
- SymbolTable &SymTab = getValueSymbolTable();
- return cast_or_null<Function>(SymTab.lookup(PointerType::get(Ty), Name));
-}
-
-
-/// getMainFunction - This function looks up main efficiently. This is such a
-/// common case, that it is a method in Module. If main cannot be found, a
-/// null pointer is returned.
-///
-Function *Module::getMainFunction() {
- std::vector<const Type*> Params;
-
- // int main(void)...
- if (Function *F = getFunction("main", FunctionType::get(Type::Int32Ty,
- Params, false)))
- return F;
-
- // void main(void)...
- if (Function *F = getFunction("main", FunctionType::get(Type::VoidTy,
- Params, false)))
- return F;
-
- Params.push_back(Type::Int32Ty);
-
- // int main(int argc)...
- if (Function *F = getFunction("main", FunctionType::get(Type::Int32Ty,
- Params, false)))
- return F;
-
- // void main(int argc)...
- if (Function *F = getFunction("main", FunctionType::get(Type::VoidTy,
- Params, false)))
- return F;
-
- for (unsigned i = 0; i != 2; ++i) { // Check argv and envp
- Params.push_back(PointerType::get(PointerType::get(Type::Int8Ty)));
-
- // int main(int argc, char **argv)...
- if (Function *F = getFunction("main", FunctionType::get(Type::Int32Ty,
- Params, false)))
- return F;
-
- // void main(int argc, char **argv)...
- if (Function *F = getFunction("main", FunctionType::get(Type::VoidTy,
- Params, false)))
- return F;
- }
-
- // Ok, try to find main the hard way...
- return getNamedFunction("main");
-}
-
-/// getNamedFunction - Return the first function in the module with the
-/// specified name, of arbitrary type. This method returns null if a function
-/// with the specified name is not found.
-///
-Function *Module::getNamedFunction(const std::string &Name) const {
- // Loop over all of the functions, looking for the function desired
- const Function *Found = 0;
- for (const_iterator I = begin(), E = end(); I != E; ++I)
- if (I->getName() == Name)
- if (I->isDeclaration())
- Found = I;
- else
- return const_cast<Function*>(&(*I));
- return const_cast<Function*>(Found); // Non-external function not found...
+Function *Module::getFunction(const std::string &Name) const {
+ const ValueSymbolTable &SymTab = getValueSymbolTable();
+ return dyn_cast_or_null<Function>(SymTab.lookup(Name));
}
//===----------------------------------------------------------------------===//
@@ -269,31 +209,15 @@
/// have InternalLinkage. By default, these types are not returned.
///
GlobalVariable *Module::getGlobalVariable(const std::string &Name,
- const Type *Ty, bool AllowInternal) {
- if (Value *V = getValueSymbolTable().lookup(PointerType::get(Ty), Name)) {
- GlobalVariable *Result = cast<GlobalVariable>(V);
- if (AllowInternal || !Result->hasInternalLinkage())
+ bool AllowInternal) const {
+ if (Value *V = ValSymTab->lookup(Name)) {
+ GlobalVariable *Result = dyn_cast<GlobalVariable>(V);
+ if (Result && (AllowInternal || !Result->hasInternalLinkage()))
return Result;
}
return 0;
}
-/// getNamedGlobal - Return the first global variable in the module with the
-/// specified name, of arbitrary type. This method returns null if a global
-/// with the specified name is not found.
-///
-GlobalVariable *Module::getNamedGlobal(const std::string &Name) const {
- // FIXME: This would be much faster with a symbol table that doesn't
- // discriminate based on type!
- for (const_global_iterator I = global_begin(), E = global_end();
- I != E; ++I)
- if (I->getName() == Name)
- return const_cast<GlobalVariable*>(&(*I));
- return 0;
-}
-
-
-
//===----------------------------------------------------------------------===//
// Methods for easy access to the types in the module.
//
diff --git a/lib/VMCore/SymbolTable.cpp b/lib/VMCore/SymbolTable.cpp
deleted file mode 100644
index 2edd3eb..0000000
--- a/lib/VMCore/SymbolTable.cpp
+++ /dev/null
@@ -1,336 +0,0 @@
-//===-- SymbolTable.cpp - Implement the SymbolTable class -----------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file was developed by the LLVM research group and revised by Reid
-// Spencer. It is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements the SymbolTable class for the VMCore library.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/SymbolTable.h"
-#include "llvm/DerivedTypes.h"
-#include "llvm/Module.h"
-#include "llvm/ADT/StringExtras.h"
-#include "llvm/Support/Debug.h"
-#include <algorithm>
-using namespace llvm;
-
-#define DEBUG_SYMBOL_TABLE 0
-#define DEBUG_ABSTYPE 0
-
-SymbolTable::~SymbolTable() {
- // TODO: FIXME: BIG ONE: This doesn't unreference abstract types for the
- // planes that could still have entries!
-
-#ifndef NDEBUG // Only do this in -g mode...
- bool LeftoverValues = true;
- for (plane_iterator PI = pmap.begin(); PI != pmap.end(); ++PI) {
- for (value_iterator VI = PI->second.begin(); VI != PI->second.end(); ++VI)
- if (!isa<Constant>(VI->second) ) {
- DOUT << "Value still in symbol table! Type = '"
- << PI->first->getDescription() << "' Name = '"
- << VI->first << "'\n";
- LeftoverValues = false;
- }
- }
-
- assert(LeftoverValues && "Values remain in symbol table!");
-#endif
-}
-
-// getUniqueName - Given a base name, return a string that is either equal to
-// it (or derived from it) that does not already occur in the symbol table for
-// the specified type.
-//
-std::string SymbolTable::getUniqueName(const Type *Ty,
- const std::string &BaseName) const {
- // Find the plane
- plane_const_iterator PI = pmap.find(Ty);
- if (PI == pmap.end()) return BaseName;
-
- std::string TryName = BaseName;
- const ValueMap& vmap = PI->second;
- value_const_iterator End = vmap.end();
-
- // See if the name exists
- while (vmap.find(TryName) != End) // Loop until we find a free
- TryName = BaseName + utostr(++LastUnique); // name in the symbol table
- return TryName;
-}
-
-
-// lookup a value - Returns null on failure...
-Value *SymbolTable::lookup(const Type *Ty, const std::string &Name) const {
- plane_const_iterator PI = pmap.find(Ty);
- if (PI != pmap.end()) { // We have symbols in that plane.
- value_const_iterator VI = PI->second.find(Name);
- if (VI != PI->second.end()) // and the name is in our hash table.
- return VI->second;
- }
- return 0;
-}
-
-
-/// changeName - Given a value with a non-empty name, remove its existing entry
-/// from the symbol table and insert a new one for Name. This is equivalent to
-/// doing "remove(V), V->Name = Name, insert(V)", but is faster, and will not
-/// temporarily remove the symbol table plane if V is the last value in the
-/// symtab with that name (which could invalidate iterators to that plane).
-void SymbolTable::changeName(Value *V, const std::string &name) {
- assert(!V->getName().empty() && !name.empty() && V->getName() != name &&
- "Illegal use of this method!");
-
- plane_iterator PI = pmap.find(V->getType());
- assert(PI != pmap.end() && "Value doesn't have an entry in this table?");
- ValueMap &VM = PI->second;
-
- value_iterator VI = VM.find(V->getName());
- assert(VI != VM.end() && "Value does have an entry in this table?");
-
- // Remove the old entry.
- VM.erase(VI);
-
- // See if we can insert the new name.
- VI = VM.lower_bound(name);
-
- // Is there a naming conflict?
- if (VI != VM.end() && VI->first == name) {
- V->Name = getUniqueName(V->getType(), name);
- VM.insert(make_pair(V->Name, V));
- } else {
- V->Name = name;
- VM.insert(VI, make_pair(name, V));
- }
-}
-
-// Remove a value
-void SymbolTable::remove(Value *N) {
- assert(N->hasName() && "Value doesn't have name!");
-
- plane_iterator PI = pmap.find(N->getType());
- assert(PI != pmap.end() &&
- "Trying to remove a value that doesn't have a type plane yet!");
- ValueMap &VM = PI->second;
- value_iterator Entry = VM.find(N->getName());
- assert(Entry != VM.end() && "Invalid entry to remove!");
-
-#if DEBUG_SYMBOL_TABLE
- dump();
- DOUT << " Removing Value: " << Entry->second->getName() << "\n";
-#endif
-
- // Remove the value from the plane...
- VM.erase(Entry);
-
- // If the plane is empty, remove it now!
- if (VM.empty()) {
- // If the plane represented an abstract type that we were interested in,
- // unlink ourselves from this plane.
- //
- if (N->getType()->isAbstract()) {
-#if DEBUG_ABSTYPE
- DOUT << "Plane Empty: Removing type: "
- << N->getType()->getDescription() << "\n";
-#endif
- cast<DerivedType>(N->getType())->removeAbstractTypeUser(this);
- }
-
- pmap.erase(PI);
- }
-}
-
-
-// insertEntry - Insert a value into the symbol table with the specified name.
-void SymbolTable::insertEntry(const std::string &Name, const Type *VTy,
- Value *V) {
- plane_iterator PI = pmap.find(VTy); // Plane iterator
- value_iterator VI; // Actual value iterator
- ValueMap *VM; // The plane we care about.
-
-#if DEBUG_SYMBOL_TABLE
- dump();
- DOUT << " Inserting definition: " << Name << ": "
- << VTy->getDescription() << "\n";
-#endif
-
- if (PI == pmap.end()) { // Not in collection yet... insert dummy entry
- // Insert a new empty element. I points to the new elements.
- VM = &pmap.insert(make_pair(VTy, ValueMap())).first->second;
- VI = VM->end();
-
- // Check to see if the type is abstract. If so, it might be refined in the
- // future, which would cause the plane of the old type to get merged into
- // a new type plane.
- //
- if (VTy->isAbstract()) {
- cast<DerivedType>(VTy)->addAbstractTypeUser(this);
-#if DEBUG_ABSTYPE
- DOUT << "Added abstract type value: " << VTy->getDescription()
- << "\n";
-#endif
- }
-
- } else {
- // Check to see if there is a naming conflict. If so, rename this value!
- VM = &PI->second;
- VI = VM->lower_bound(Name);
- if (VI != VM->end() && VI->first == Name) {
- V->Name = getUniqueName(VTy, Name);
- VM->insert(make_pair(V->Name, V));
- return;
- }
- }
-
- VM->insert(VI, make_pair(Name, V));
-}
-
-
-
-// Strip the symbol table of its names.
-bool SymbolTable::strip() {
- bool RemovedSymbol = false;
- for (plane_iterator I = pmap.begin(); I != pmap.end();) {
- // Removing items from the plane can cause the plane itself to get deleted.
- // If this happens, make sure we incremented our plane iterator already!
- ValueMap &Plane = (I++)->second;
- value_iterator B = Plane.begin(), Bend = Plane.end();
- while (B != Bend) { // Found nonempty type plane!
- Value *V = B->second;
- ++B;
- if (!isa<GlobalValue>(V) || cast<GlobalValue>(V)->hasInternalLinkage()) {
- // Set name to "", removing from symbol table!
- V->setName("");
- RemovedSymbol = true;
- }
- }
- }
-
- return RemovedSymbol;
-}
-
-
-// This function is called when one of the types in the type plane are refined
-void SymbolTable::refineAbstractType(const DerivedType *OldType,
- const Type *NewType) {
-
- // Search to see if we have any values of the type Oldtype. If so, we need to
- // move them into the newtype plane...
- plane_iterator PI = pmap.find(OldType);
- if (PI != pmap.end()) {
- // Get a handle to the new type plane...
- plane_iterator NewTypeIt = pmap.find(NewType);
- if (NewTypeIt == pmap.end()) { // If no plane exists, add one
- NewTypeIt = pmap.insert(make_pair(NewType, ValueMap())).first;
-
- if (NewType->isAbstract()) {
- cast<DerivedType>(NewType)->addAbstractTypeUser(this);
-#if DEBUG_ABSTYPE
- DOUT << "[Added] refined to abstype: " << NewType->getDescription()
- << "\n";
-#endif
- }
- }
-
- ValueMap &NewPlane = NewTypeIt->second;
- ValueMap &OldPlane = PI->second;
- while (!OldPlane.empty()) {
- std::pair<const std::string, Value*> V = *OldPlane.begin();
-
- // Check to see if there is already a value in the symbol table that this
- // would collide with.
- value_iterator VI = NewPlane.find(V.first);
- if (VI != NewPlane.end() && VI->second == V.second) {
- // No action
-
- } else if (VI != NewPlane.end()) {
- // The only thing we are allowing for now is two external global values
- // folded into one.
- //
- GlobalValue *ExistGV = dyn_cast<GlobalValue>(VI->second);
- GlobalValue *NewGV = dyn_cast<GlobalValue>(V.second);
-
- if (ExistGV && NewGV) {
- assert((ExistGV->isDeclaration() || NewGV->isDeclaration()) &&
- "Two planes folded together with overlapping value names!");
-
- // Make sure that ExistGV is the one we want to keep!
- if (!NewGV->isDeclaration())
- std::swap(NewGV, ExistGV);
-
- // Ok we have two external global values. Make all uses of the new
- // one use the old one...
- NewGV->uncheckedReplaceAllUsesWith(ExistGV);
-
- // Update NewGV's name, we're about the remove it from the symbol
- // table.
- NewGV->Name = "";
-
- // Now we can remove this global from the module entirely...
- Module *M = NewGV->getParent();
- if (Function *F = dyn_cast<Function>(NewGV))
- M->getFunctionList().remove(F);
- else
- M->getGlobalList().remove(cast<GlobalVariable>(NewGV));
- delete NewGV;
- } else {
- // If they are not global values, they must be just random values who
- // happen to conflict now that types have been resolved. If this is
- // the case, reinsert the value into the new plane, allowing it to get
- // renamed.
- assert(V.second->getType() == NewType &&"Type resolution is broken!");
- insert(V.second);
- }
- } else {
- insertEntry(V.first, NewType, V.second);
- }
- // Remove the item from the old type plane
- OldPlane.erase(OldPlane.begin());
- }
-
- // Ok, now we are not referencing the type anymore... take me off your user
- // list please!
-#if DEBUG_ABSTYPE
- DOUT << "Removing type " << OldType->getDescription() << "\n";
-#endif
- OldType->removeAbstractTypeUser(this);
-
- // Remove the plane that is no longer used
- pmap.erase(PI);
- }
-}
-
-
-// Handle situation where type becomes Concreate from Abstract
-void SymbolTable::typeBecameConcrete(const DerivedType *AbsTy) {
- plane_iterator PI = pmap.find(AbsTy);
-
- // If there are any values in the symbol table of this type, then the type
- // plane is a use of the abstract type which must be dropped.
- if (PI != pmap.end())
- AbsTy->removeAbstractTypeUser(this);
-}
-
-static void DumpVal(const std::pair<const std::string, Value *> &V) {
- DOUT << " '" << V.first << "' = ";
- V.second->dump();
- DOUT << "\n";
-}
-
-static void DumpPlane(const std::pair<const Type *,
- std::map<const std::string, Value *> >&P){
- P.first->dump();
- DOUT << "\n";
- for_each(P.second.begin(), P.second.end(), DumpVal);
-}
-
-void SymbolTable::dump() const {
- DOUT << "Symbol table dump:\n Plane:";
- for_each(pmap.begin(), pmap.end(), DumpPlane);
-}
-
-// vim: sw=2 ai
diff --git a/lib/VMCore/SymbolTableListTraitsImpl.h b/lib/VMCore/SymbolTableListTraitsImpl.h
index 81849dd..f4ee13f 100644
--- a/lib/VMCore/SymbolTableListTraitsImpl.h
+++ b/lib/VMCore/SymbolTableListTraitsImpl.h
@@ -17,7 +17,7 @@
#define LLVM_SYMBOLTABLELISTTRAITS_IMPL_H
#include "llvm/SymbolTableListTraits.h"
-#include "llvm/SymbolTable.h"
+#include "llvm/ValueSymbolTable.h"
namespace llvm {
@@ -29,7 +29,7 @@
// Remove all of the items from the old symtab..
if (SymTabObject && !List.empty()) {
- SymbolTable &SymTab = SymTabObject->getValueSymbolTable();
+ ValueSymbolTable &SymTab = SymTabObject->getValueSymbolTable();
for (typename iplist<ValueSubClass>::iterator I = List.begin();
I != List.end(); ++I)
if (I->hasName()) SymTab.remove(I);
@@ -39,7 +39,7 @@
// Add all of the items to the new symtab...
if (SymTabObject && !List.empty()) {
- SymbolTable &SymTab = SymTabObject->getValueSymbolTable();
+ ValueSymbolTable &SymTab = SymTabObject->getValueSymbolTable();
for (typename iplist<ValueSubClass>::iterator I = List.begin();
I != List.end(); ++I)
if (I->hasName()) SymTab.insert(I);
diff --git a/lib/VMCore/Type.cpp b/lib/VMCore/Type.cpp
index 3733d2a..a6e5797 100644
--- a/lib/VMCore/Type.cpp
+++ b/lib/VMCore/Type.cpp
@@ -13,7 +13,6 @@
#include "llvm/AbstractTypeUser.h"
#include "llvm/DerivedTypes.h"
-#include "llvm/SymbolTable.h"
#include "llvm/Constants.h"
#include "llvm/ADT/DepthFirstIterator.h"
#include "llvm/ADT/StringExtras.h"
diff --git a/lib/VMCore/Value.cpp b/lib/VMCore/Value.cpp
index 94c03b8..0218e57 100644
--- a/lib/VMCore/Value.cpp
+++ b/lib/VMCore/Value.cpp
@@ -15,7 +15,7 @@
#include "llvm/DerivedTypes.h"
#include "llvm/InstrTypes.h"
#include "llvm/Module.h"
-#include "llvm/SymbolTable.h"
+#include "llvm/ValueSymbolTable.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/LeakDetector.h"
#include <algorithm>
@@ -97,17 +97,20 @@
if (Name == name) return; // Name is already set.
// Get the symbol table to update for this object.
- SymbolTable *ST = 0;
+ ValueSymbolTable *ST = 0;
if (Instruction *I = dyn_cast<Instruction>(this)) {
if (BasicBlock *P = I->getParent())
if (Function *PP = P->getParent())
ST = &PP->getValueSymbolTable();
} else if (BasicBlock *BB = dyn_cast<BasicBlock>(this)) {
- if (Function *P = BB->getParent()) ST = &P->getValueSymbolTable();
+ if (Function *P = BB->getParent())
+ ST = &P->getValueSymbolTable();
} else if (GlobalValue *GV = dyn_cast<GlobalValue>(this)) {
- if (Module *P = GV->getParent()) ST = &P->getValueSymbolTable();
+ if (Module *P = GV->getParent())
+ ST = &P->getValueSymbolTable();
} else if (Argument *A = dyn_cast<Argument>(this)) {
- if (Function *P = A->getParent()) ST = &P->getValueSymbolTable();
+ if (Function *P = A->getParent())
+ ST = &P->getValueSymbolTable();
} else {
assert(isa<Constant>(this) && "Unknown value type!");
return; // no name is setable for this.
@@ -117,7 +120,7 @@
Name = name;
else if (hasName()) {
if (!name.empty()) { // Replacing name.
- ST->changeName(this, name);
+ ST->rename(this, name);
} else { // Transitioning from hasName -> noname.
ST->remove(this);
Name.clear();
diff --git a/lib/VMCore/ValueSymbolTable.cpp b/lib/VMCore/ValueSymbolTable.cpp
index 6efb998..51197b6 100644
--- a/lib/VMCore/ValueSymbolTable.cpp
+++ b/lib/VMCore/ValueSymbolTable.cpp
@@ -11,6 +11,7 @@
//
//===----------------------------------------------------------------------===//
+#define DEBUG_TYPE "valuesymtab"
#include "llvm/GlobalValue.h"
#include "llvm/Type.h"
#include "llvm/ValueSymbolTable.h"
@@ -19,18 +20,15 @@
#include <algorithm>
using namespace llvm;
-#define DEBUG_SYMBOL_TABLE 0
-#define DEBUG_ABSTYPE 0
-
// Class destructor
ValueSymbolTable::~ValueSymbolTable() {
#ifndef NDEBUG // Only do this in -g mode...
bool LeftoverValues = true;
for (iterator VI = vmap.begin(), VE = vmap.end(); VI != VE; ++VI)
if (!isa<Constant>(VI->second) ) {
- DOUT << "Value still in symbol table! Type = '"
+ DEBUG(DOUT << "Value still in symbol table! Type = '"
<< VI->second->getType()->getDescription() << "' Name = '"
- << VI->first << "'\n";
+ << VI->first << "'\n");
LeftoverValues = false;
}
assert(LeftoverValues && "Values remain in symbol table!");
@@ -83,29 +81,24 @@
assert(V && "Can't insert null Value into symbol table!");
assert(V->hasName() && "Can't insert nameless Value into symbol table");
- // Check to see if there is a naming conflict. If so, rename this type!
+ // Check to see if there is a naming conflict. If so, rename this value
std::string UniqueName = getUniqueName(V->getName());
-#if DEBUG_SYMBOL_TABLE
- dump();
- DOUT << " Inserting value: " << UniqueName << ": " << V->dump() << "\n";
-#endif
+ DEBUG(DOUT << " Inserting value: " << UniqueName << ": " << *V << "\n");
// Insert the vmap entry
- vmap.insert(make_pair(UniqueName, V));
+ V->Name = UniqueName;
+ vmap.insert(make_pair(V->Name, V));
}
// Remove a value
-bool ValueSymbolTable::erase(Value *V) {
+bool ValueSymbolTable::remove(Value *V) {
assert(V->hasName() && "Value doesn't have name!");
iterator Entry = vmap.find(V->getName());
if (Entry == vmap.end())
return false;
-#if DEBUG_SYMBOL_TABLE
- dump();
- DOUT << " Removing Value: " << Entry->second->getName() << "\n";
-#endif
+ DEBUG(DOUT << " Removing Value: " << Entry->second->getName() << "\n");
// Remove the value from the plane...
vmap.erase(Entry);
@@ -143,7 +136,7 @@
vmap.insert(make_pair(V->Name, V));
} else {
V->Name = name;
- vmap.insert(VI, make_pair(name, V));
+ vmap.insert(VI, make_pair(V->Name, V));
}
return true;
diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp
index 9dc892e..f5b0550 100644
--- a/lib/VMCore/Verifier.cpp
+++ b/lib/VMCore/Verifier.cpp
@@ -51,7 +51,7 @@
#include "llvm/Instructions.h"
#include "llvm/Intrinsics.h"
#include "llvm/PassManager.h"
-#include "llvm/SymbolTable.h"
+#include "llvm/ValueSymbolTable.h"
#include "llvm/Analysis/Dominators.h"
#include "llvm/Support/CFG.h"
#include "llvm/Support/InstVisitor.h"
@@ -175,7 +175,7 @@
// Verification methods...
void verifyTypeSymbolTable(TypeSymbolTable &ST);
- void verifyValueSymbolTable(SymbolTable &ST);
+ void verifyValueSymbolTable(ValueSymbolTable &ST);
void visitGlobalValue(GlobalValue &GV);
void visitGlobalVariable(GlobalVariable &GV);
void visitFunction(Function &F);
@@ -307,20 +307,18 @@
// verifySymbolTable - Verify that a function or module symbol table is ok
//
-void Verifier::verifyValueSymbolTable(SymbolTable &ST) {
+void Verifier::verifyValueSymbolTable(ValueSymbolTable &ST) {
- // Loop over all of the values in all type planes in the symbol table.
- for (SymbolTable::plane_const_iterator PI = ST.plane_begin(),
- PE = ST.plane_end(); PI != PE; ++PI)
- for (SymbolTable::value_const_iterator VI = PI->second.begin(),
- VE = PI->second.end(); VI != VE; ++VI) {
- Value *V = VI->second;
- // Check that there are no void typed values in the symbol table. Values
- // with a void type cannot be put into symbol tables because they cannot
- // have names!
- Assert1(V->getType() != Type::VoidTy,
- "Values with void type are not allowed to have names!", V);
- }
+ // Loop over all of the values in the symbol table.
+ for (ValueSymbolTable::const_iterator VI = ST.begin(), VE = ST.end();
+ VI != VE; ++VI) {
+ Value *V = VI->second;
+ // Check that there are no void typed values in the symbol table. Values
+ // with a void type cannot be put into symbol tables because they cannot
+ // have names!
+ Assert1(V->getType() != Type::VoidTy,
+ "Values with void type are not allowed to have names!", V);
+ }
}
// visitFunction - Verify that a function is ok.