[llvm-commits] CVS: llvm/lib/AsmParser/Lexer.l llvmAsmParser.y
Changes in directory llvm/lib/AsmParser: Lexer.l updated: 1.112 - 1.113 llvmAsmParser.y updated: 1.358 - 1.359 --- Log message: Commit first round work of PR1373: http://llvm.org/PR1373 . noalias is now fully supported in VMCore, BitCode, and Assembly. Documentation and test case paramattrs.ll updated also. --- Diffs of the changes: (+7 -5) Lexer.l |1 + llvmAsmParser.y | 11 ++- 2 files changed, 7 insertions(+), 5 deletions(-) Index: llvm/lib/AsmParser/Lexer.l diff -u llvm/lib/AsmParser/Lexer.l:1.112 llvm/lib/AsmParser/Lexer.l:1.113 --- llvm/lib/AsmParser/Lexer.l:1.112Tue May 22 14:07:45 2007 +++ llvm/lib/AsmParser/Lexer.l Tue Jun 5 00:28:25 2007 @@ -229,6 +229,7 @@ sret{ return SRET; } nounwind{ return NOUNWIND; } noreturn{ return NORETURN; } +noalias { return NOALIAS; } void{ RET_TY(Type::VoidTy, VOID); } float { RET_TY(Type::FloatTy, FLOAT); } Index: llvm/lib/AsmParser/llvmAsmParser.y diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.358 llvm/lib/AsmParser/llvmAsmParser.y:1.359 --- llvm/lib/AsmParser/llvmAsmParser.y:1.358Tue May 22 13:52:21 2007 +++ llvm/lib/AsmParser/llvmAsmParser.y Tue Jun 5 00:28:25 2007 @@ -1101,7 +1101,7 @@ %token OtherOpVal EXTRACTELEMENT INSERTELEMENT SHUFFLEVECTOR // Function Attributes -%token NORETURN INREG SRET NOUNWIND +%token NORETURN INREG SRET NOUNWIND NOALIAS // Visibility Styles %token DEFAULT HIDDEN PROTECTED @@ -1224,10 +1224,11 @@ CHECK_FOR_ERROR }; -ParamAttr : ZEXT { $$ = ParamAttr::ZExt; } - | SEXT { $$ = ParamAttr::SExt; } - | INREG { $$ = ParamAttr::InReg; } - | SRET { $$ = ParamAttr::StructRet; } +ParamAttr : ZEXT{ $$ = ParamAttr::ZExt; } + | SEXT{ $$ = ParamAttr::SExt; } + | INREG { $$ = ParamAttr::InReg; } + | SRET{ $$ = ParamAttr::StructRet; } + | NOALIAS { $$ = ParamAttr::NoAlias; } ; OptParamAttrs : /* empty */ { $$ = ParamAttr::None; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/AsmParser/Lexer.l
Changes in directory llvm/lib/AsmParser: Lexer.l updated: 1.108 - 1.109 --- Log message: simplify code --- Diffs of the changes: (+2 -11) Lexer.l | 13 ++--- 1 files changed, 2 insertions(+), 11 deletions(-) Index: llvm/lib/AsmParser/Lexer.l diff -u llvm/lib/AsmParser/Lexer.l:1.108 llvm/lib/AsmParser/Lexer.l:1.109 --- llvm/lib/AsmParser/Lexer.l:1.108Sat May 19 02:21:26 2007 +++ llvm/lib/AsmParser/Lexer.l Tue May 22 01:47:11 2007 @@ -27,6 +27,7 @@ %{ #include ParserInternals.h #include llvm/Module.h +#include llvm/Support/MathExtras.h #include list #include llvmAsmParser.h #include cctype @@ -95,17 +96,7 @@ // point representation of it. // static double HexToFP(const char *Buffer) { - // Behave nicely in the face of C TBAA rules... see: - // http://www.nullstone.com/htmls/category/aliastyp.htm - union { -uint64_t UI; -double FP; - } UIntToFP; - UIntToFP.UI = HexIntToVal(Buffer); - - assert(sizeof(double) == sizeof(uint64_t) - Data sizes incompatible on this target!); - return UIntToFP.FP; // Cast Hex constant to double + return BitsToDouble(HexIntToVal(Buffer)); // Cast Hex constant to double } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/AsmParser/Lexer.l
Changes in directory llvm/lib/AsmParser: Lexer.l updated: 1.111 - 1.112 --- Log message: Don't allow the UnEscape code to read or write beyond the end of yytext. Make sure we convert \\ into \. --- Diffs of the changes: (+20 -11) Lexer.l | 31 --- 1 files changed, 20 insertions(+), 11 deletions(-) Index: llvm/lib/AsmParser/Lexer.l diff -u llvm/lib/AsmParser/Lexer.l:1.111 llvm/lib/AsmParser/Lexer.l:1.112 --- llvm/lib/AsmParser/Lexer.l:1.111Tue May 22 13:52:21 2007 +++ llvm/lib/AsmParser/Lexer.l Tue May 22 14:07:45 2007 @@ -102,15 +102,22 @@ // UnEscapeLexed - Run through the specified buffer and change \xx codes to the // appropriate character. -char *UnEscapeLexed(char *Buffer) { +char *UnEscapeLexed(char *Buffer, char* EndBuffer) { char *BOut = Buffer; for (char *BIn = Buffer; *BIn; ) { -if (BIn[0] == '\\' isxdigit(BIn[1]) isxdigit(BIn[2])) { - char Tmp = BIn[3]; BIn[3] = 0; // Terminate string - *BOut = (char)strtol(BIn+1, 0, 16); // Convert to number - BIn[3] = Tmp; // Restore character - BIn += 3; // Skip over handled chars - ++BOut; +if (BIn[0] == '\\') { + if (BIn EndBuffer-1 BIn[1] == '\\') { +*BOut++ = '\\'; // Two \ becomes one +BIn += 2; + } else if (BIn EndBuffer-2 isxdigit(BIn[1]) isxdigit(BIn[2])) { +char Tmp = BIn[3]; BIn[3] = 0; // Terminate string +*BOut = (char)strtol(BIn+1, 0, 16); // Convert to number +BIn[3] = Tmp; // Restore character +BIn += 3; // Skip over handled chars +++BOut; + } else { +*BOut++ = *BIn++; + } } else { *BOut++ = *BIn++; } @@ -326,28 +333,30 @@ } {QuoteLabel}{ yytext[yyleng-2] = 0; // nuke colon, end quote - const char* EndChar = UnEscapeLexed(yytext+1); + const char* EndChar = UnEscapeLexed(yytext+1, yytext+yyleng); llvmAsmlval.StrVal = new std::string(yytext+1, EndChar - yytext - 1); return LABELSTR; } {StringConstant} { yytext[yyleng-1] = 0; // nuke end quote - const char* EndChar = UnEscapeLexed(yytext+1); + const char* EndChar = UnEscapeLexed(yytext+1, yytext+yyleng); llvmAsmlval.StrVal = new std::string(yytext+1, EndChar - yytext - 1); return STRINGCONSTANT; } {AtStringConstant} { yytext[yyleng-1] = 0; // nuke end quote - const char* EndChar = UnEscapeLexed(yytext+2); + const char* EndChar = + UnEscapeLexed(yytext+2, yytext+yyleng); llvmAsmlval.StrVal = new std::string(yytext+2, EndChar - yytext - 2); return ATSTRINGCONSTANT; } {PctStringConstant} { yytext[yyleng-1] = 0; // nuke end quote - const char* EndChar = UnEscapeLexed(yytext+2); + const char* EndChar = + UnEscapeLexed(yytext+2, yytext+yyleng); llvmAsmlval.StrVal = new std::string(yytext+2, EndChar - yytext - 2); return PCTSTRINGCONSTANT; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/AsmParser/Lexer.l llvmAsmParser.y
Changes in directory llvm/lib/AsmParser: Lexer.l updated: 1.107 - 1.108 llvmAsmParser.y updated: 1.356 - 1.357 --- Log message: Make the %... syntax legal for local name. This just makes it symmetric with global names which can already be @... --- Diffs of the changes: (+9 -2) Lexer.l |6 ++ llvmAsmParser.y |5 +++-- 2 files changed, 9 insertions(+), 2 deletions(-) Index: llvm/lib/AsmParser/Lexer.l diff -u llvm/lib/AsmParser/Lexer.l:1.107 llvm/lib/AsmParser/Lexer.l:1.108 --- llvm/lib/AsmParser/Lexer.l:1.107Sun Apr 29 13:35:00 2007 +++ llvm/lib/AsmParser/Lexer.l Sat May 19 02:21:26 2007 @@ -161,6 +161,7 @@ /* Quoted names can contain any character except and \ */ StringConstant \[^\]*\ AtStringConstant @\[^\]*\ +PctStringConstant %\[^\]*\ /* LocalVarID/GlobalVarID: match an unnamed local variable slot ID. */ LocalVarID %[0-9]+ @@ -366,6 +367,11 @@ return ATSTRINGCONSTANT; } +{PctStringConstant} { + yytext[strlen(yytext)-1] = 0; // nuke end quote + llvmAsmlval.StrVal = strdup(yytext+2); // Nuke @, quote + return PCTSTRINGCONSTANT; + } {PInteger} { int len = strlen(yytext); uint32_t numBits = ((len * 64) / 19) + 1; APInt Tmp(numBits, yytext, len, 10); Index: llvm/lib/AsmParser/llvmAsmParser.y diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.356 llvm/lib/AsmParser/llvmAsmParser.y:1.357 --- llvm/lib/AsmParser/llvmAsmParser.y:1.356Thu May 3 23:01:07 2007 +++ llvm/lib/AsmParser/llvmAsmParser.y Sat May 19 02:21:26 2007 @@ -1051,7 +1051,8 @@ %token PrimType FLOAT DOUBLE LABEL %token TYPE -%tokenStrVal LOCALVAR GLOBALVAR LABELSTR STRINGCONSTANT ATSTRINGCONSTANT +%tokenStrVal LOCALVAR GLOBALVAR LABELSTR +%tokenStrVal STRINGCONSTANT ATSTRINGCONSTANT PCTSTRINGCONSTANT %type StrVal LocalName OptLocalName OptLocalAssign %type StrVal GlobalName OptGlobalAssign GlobalAssign %type UIntVal OptAlign OptCAlign @@ -1138,7 +1139,7 @@ IntType : INTTYPE; FPType : FLOAT | DOUBLE; -LocalName : LOCALVAR | STRINGCONSTANT; +LocalName : LOCALVAR | STRINGCONSTANT | PCTSTRINGCONSTANT OptLocalName : LocalName | /*empty*/ { $$ = 0; }; /// OptLocalAssign - Value producing statements have an optional assignment ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/AsmParser/Lexer.l Lexer.l.cvs llvmAsmParser.y llvmAsmParser.y.cvs
Changes in directory llvm/lib/AsmParser: Lexer.l updated: 1.106 - 1.107 Lexer.l.cvs updated: 1.33 - 1.34 llvmAsmParser.y updated: 1.354 - 1.355 llvmAsmParser.y.cvs updated: 1.96 - 1.97 --- Log message: Implement protected visibility. This partly implements PR1363: http://llvm.org/PR1363 . Linker should be taught to deal with protected symbols. --- Diffs of the changes: (+12 -8) Lexer.l |1 + Lexer.l.cvs |1 + llvmAsmParser.y |9 + llvmAsmParser.y.cvs |9 + 4 files changed, 12 insertions(+), 8 deletions(-) Index: llvm/lib/AsmParser/Lexer.l diff -u llvm/lib/AsmParser/Lexer.l:1.106 llvm/lib/AsmParser/Lexer.l:1.107 --- llvm/lib/AsmParser/Lexer.l:1.106Wed Apr 25 09:27:10 2007 +++ llvm/lib/AsmParser/Lexer.l Sun Apr 29 13:35:00 2007 @@ -206,6 +206,7 @@ dllimport { return DLLIMPORT; } dllexport { return DLLEXPORT; } hidden { return HIDDEN; } +protected { return PROTECTED; } extern_weak { return EXTERN_WEAK; } external{ return EXTERNAL; } thread_local{ return THREAD_LOCAL; } Index: llvm/lib/AsmParser/Lexer.l.cvs diff -u llvm/lib/AsmParser/Lexer.l.cvs:1.33 llvm/lib/AsmParser/Lexer.l.cvs:1.34 --- llvm/lib/AsmParser/Lexer.l.cvs:1.33 Wed Apr 25 09:29:12 2007 +++ llvm/lib/AsmParser/Lexer.l.cvs Sun Apr 29 13:35:00 2007 @@ -206,6 +206,7 @@ dllimport { return DLLIMPORT; } dllexport { return DLLEXPORT; } hidden { return HIDDEN; } +protected { return PROTECTED; } extern_weak { return EXTERN_WEAK; } external{ return EXTERNAL; } thread_local{ return THREAD_LOCAL; } Index: llvm/lib/AsmParser/llvmAsmParser.y diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.354 llvm/lib/AsmParser/llvmAsmParser.y:1.355 --- llvm/lib/AsmParser/llvmAsmParser.y:1.354Sat Apr 28 11:06:50 2007 +++ llvm/lib/AsmParser/llvmAsmParser.y Sun Apr 29 13:35:00 2007 @@ -1099,7 +1099,7 @@ %token NORETURN INREG SRET NOUNWIND // Visibility Styles -%token DEFAULT HIDDEN +%token DEFAULT HIDDEN PROTECTED %start Module %% @@ -1180,9 +1180,10 @@ ; GVVisibilityStyle - : /*empty*/ { $$ = GlobalValue::DefaultVisibility; } - | DEFAULT { $$ = GlobalValue::DefaultVisibility; } - | HIDDEN{ $$ = GlobalValue::HiddenVisibility; } + : /*empty*/ { $$ = GlobalValue::DefaultVisibility; } + | DEFAULT { $$ = GlobalValue::DefaultVisibility; } + | HIDDEN{ $$ = GlobalValue::HiddenVisibility;} + | PROTECTED { $$ = GlobalValue::ProtectedVisibility; } ; FunctionDeclareLinkage Index: llvm/lib/AsmParser/llvmAsmParser.y.cvs diff -u llvm/lib/AsmParser/llvmAsmParser.y.cvs:1.96 llvm/lib/AsmParser/llvmAsmParser.y.cvs:1.97 --- llvm/lib/AsmParser/llvmAsmParser.y.cvs:1.96 Sat Apr 28 11:07:31 2007 +++ llvm/lib/AsmParser/llvmAsmParser.y.cvs Sun Apr 29 13:35:00 2007 @@ -1099,7 +1099,7 @@ %token NORETURN INREG SRET NOUNWIND // Visibility Styles -%token DEFAULT HIDDEN +%token DEFAULT HIDDEN PROTECTED %start Module %% @@ -1180,9 +1180,10 @@ ; GVVisibilityStyle - : /*empty*/ { $$ = GlobalValue::DefaultVisibility; } - | DEFAULT { $$ = GlobalValue::DefaultVisibility; } - | HIDDEN{ $$ = GlobalValue::HiddenVisibility; } + : /*empty*/ { $$ = GlobalValue::DefaultVisibility; } + | DEFAULT { $$ = GlobalValue::DefaultVisibility; } + | HIDDEN{ $$ = GlobalValue::HiddenVisibility;} + | PROTECTED { $$ = GlobalValue::ProtectedVisibility; } ; FunctionDeclareLinkage ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/AsmParser/Lexer.l llvmAsmParser.y
Changes in directory llvm/lib/AsmParser: Lexer.l updated: 1.103 - 1.104 llvmAsmParser.y updated: 1.335 - 1.336 --- Log message: Drop the implementation keyword. --- Diffs of the changes: (+1 -14) Lexer.l |1 - llvmAsmParser.y | 14 +- 2 files changed, 1 insertion(+), 14 deletions(-) Index: llvm/lib/AsmParser/Lexer.l diff -u llvm/lib/AsmParser/Lexer.l:1.103 llvm/lib/AsmParser/Lexer.l:1.104 --- llvm/lib/AsmParser/Lexer.l:1.103Thu Mar 29 13:49:28 2007 +++ llvm/lib/AsmParser/Lexer.l Sun Apr 8 20:55:42 2007 @@ -208,7 +208,6 @@ hidden { return HIDDEN; } extern_weak { return EXTERN_WEAK; } external{ return EXTERNAL; } -implementation { return IMPLEMENTATION; } zeroinitializer { return ZEROINITIALIZER; } \.\.\. { return DOTDOTDOT; } undef { return UNDEF; } Index: llvm/lib/AsmParser/llvmAsmParser.y diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.335 llvm/lib/AsmParser/llvmAsmParser.y:1.336 --- llvm/lib/AsmParser/llvmAsmParser.y:1.335Thu Mar 29 20:37:13 2007 +++ llvm/lib/AsmParser/llvmAsmParser.y Sun Apr 8 20:55:42 2007 @@ -1039,7 +1039,7 @@ %type UIntVal OptAlign OptCAlign %type StrVal OptSection SectionString -%token IMPLEMENTATION ZEROINITIALIZER TRUETOK FALSETOK BEGINTOK ENDTOK +%token ZEROINITIALIZER TRUETOK FALSETOK BEGINTOK ENDTOK %token DECLARE DEFINE GLOBAL CONSTANT SECTION VOLATILE %token TO DOTDOTDOT NULL_TOK UNDEF INTERNAL LINKONCE WEAK APPENDING %token DLLIMPORT DLLEXPORT EXTERN_WEAK @@ -1942,18 +1942,6 @@ | MODULE ASM_TOK AsmBlock { CHECK_FOR_ERROR } - | IMPLEMENTATION { -// Emit an error if there are any unresolved types left. -if (!CurModule.LateResolveTypes.empty()) { - const ValID DID = CurModule.LateResolveTypes.begin()-first; - if (DID.Type == ValID::LocalName) { -GEN_ERROR(Reference to an undefined type: '+DID.getName() + '); - } else { -GEN_ERROR(Reference to an undefined type: # + itostr(DID.Num)); - } -} -CHECK_FOR_ERROR - } | OptLocalAssign TYPE Types { if (!UpRefs.empty()) GEN_ERROR(Invalid upreference in type: + (*$3)-getDescription()); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/AsmParser/Lexer.l llvmAsmParser.y
Changes in directory llvm/lib/AsmParser: Lexer.l updated: 1.100 - 1.101 llvmAsmParser.y updated: 1.331 - 1.332 --- Log message: Add support for the noreturn and nounwind function attributes. --- Diffs of the changes: (+4 -1) Lexer.l |2 ++ llvmAsmParser.y |3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) Index: llvm/lib/AsmParser/Lexer.l diff -u llvm/lib/AsmParser/Lexer.l:1.100 llvm/lib/AsmParser/Lexer.l:1.101 --- llvm/lib/AsmParser/Lexer.l:1.100Fri Mar 9 13:26:52 2007 +++ llvm/lib/AsmParser/Lexer.l Wed Mar 21 21:13:23 2007 @@ -235,6 +235,8 @@ inreg { return INREG; } sret{ return SRET; } +nounwind{ return NOUNWIND; } +noreturn{ return NORETURN; } void{ RET_TY(Type::VoidTy, VOID); } float { RET_TY(Type::FloatTy, FLOAT); } Index: llvm/lib/AsmParser/llvmAsmParser.y diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.331 llvm/lib/AsmParser/llvmAsmParser.y:1.332 --- llvm/lib/AsmParser/llvmAsmParser.y:1.331Tue Mar 20 12:18:33 2007 +++ llvm/lib/AsmParser/llvmAsmParser.y Wed Mar 21 21:13:23 2007 @@ -1078,7 +1078,7 @@ %token OtherOpVal EXTRACTELEMENT INSERTELEMENT SHUFFLEVECTOR // Function Attributes -%token NORETURN INREG SRET +%token NORETURN INREG SRET NOUNWIND // Visibility Styles %token DEFAULT HIDDEN @@ -1204,6 +1204,7 @@ ; FuncAttr : NORETURN { $$ = FunctionType::NoReturnAttribute; } + | NOUNWIND { $$ = FunctionType::NoUnwindAttribute; } | ParamAttr ; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/AsmParser/Lexer.l
Changes in directory llvm/lib/AsmParser: Lexer.l updated: 1.99 - 1.100 --- Log message: For PR1245: http://llvm.org/PR1245 : Account for the sign bit when computing the number of bits required for a negative integer literal constant. --- Diffs of the changes: (+1 -1) Lexer.l |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/AsmParser/Lexer.l diff -u llvm/lib/AsmParser/Lexer.l:1.99 llvm/lib/AsmParser/Lexer.l:1.100 --- llvm/lib/AsmParser/Lexer.l:1.99 Tue Feb 27 20:24:27 2007 +++ llvm/lib/AsmParser/Lexer.l Fri Mar 9 13:26:52 2007 @@ -377,7 +377,7 @@ } } {NInteger} { int len = strlen(yytext); - uint32_t numBits = (((len-1) * 64) / 19) + 1; + uint32_t numBits = (((len-1) * 64) / 19) + 2; APInt Tmp(numBits, yytext, len, 10); uint32_t minBits = Tmp.getMinSignedBits(); if (minBits 0 minBits numBits) ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/AsmParser/Lexer.l
Changes in directory llvm/lib/AsmParser: Lexer.l updated: 1.98 - 1.99 --- Log message: Implement arbitrary integer constants through the use of APInt values. Positive, negative, and hexadecimal integer constants will now return an APInt for values having 64 bits of precision. --- Diffs of the changes: (+46 -14) Lexer.l | 60 ++-- 1 files changed, 46 insertions(+), 14 deletions(-) Index: llvm/lib/AsmParser/Lexer.l diff -u llvm/lib/AsmParser/Lexer.l:1.98 llvm/lib/AsmParser/Lexer.l:1.99 --- llvm/lib/AsmParser/Lexer.l:1.98 Thu Feb 1 20:16:22 2007 +++ llvm/lib/AsmParser/Lexer.l Tue Feb 27 20:24:27 2007 @@ -186,6 +186,7 @@ * it to deal with 64 bit numbers. */ HexIntConstant [us]0x[0-9A-Fa-f]+ + %% {Comment} { /* Ignore comments for now */ } @@ -361,20 +362,51 @@ return ATSTRINGCONSTANT; } - - -{PInteger} { llvmAsmlval.UInt64Val = atoull(yytext); return EUINT64VAL; } -{NInteger} { - uint64_t Val = atoull(yytext+1); - // +1: we have bigger negative range - if (Val (uint64_t)INT64_MAX+1) -GenerateError(Constant too large for signed 64 bits!); - llvmAsmlval.SInt64Val = -Val; - return ESINT64VAL; -} -{HexIntConstant} { - llvmAsmlval.UInt64Val = HexIntToVal(yytext+3); - return yytext[0] == 's' ? ESINT64VAL : EUINT64VAL; +{PInteger} { int len = strlen(yytext); + uint32_t numBits = ((len * 64) / 19) + 1; + APInt Tmp(numBits, yytext, len, 10); + uint32_t activeBits = Tmp.getActiveBits(); + if (activeBits 0 activeBits numBits) +Tmp.trunc(activeBits); + if (Tmp.getBitWidth() 64) { +llvmAsmlval.APIntVal = new APInt(Tmp); +return EUAPINTVAL; + } else { +llvmAsmlval.UInt64Val = Tmp.getZExtValue(); +return EUINT64VAL; + } +} +{NInteger} { int len = strlen(yytext); + uint32_t numBits = (((len-1) * 64) / 19) + 1; + APInt Tmp(numBits, yytext, len, 10); + uint32_t minBits = Tmp.getMinSignedBits(); + if (minBits 0 minBits numBits) +Tmp.trunc(minBits); + if (Tmp.getBitWidth() 64) { +llvmAsmlval.APIntVal = new APInt(Tmp); +return ESAPINTVAL; + } else { +llvmAsmlval.SInt64Val = Tmp.getSExtValue(); +return ESINT64VAL; + } +} + +{HexIntConstant} { int len = strlen(yytext+3) - 3; + uint32_t bits = len * 4; + APInt Tmp(bits, yytext+3, len, 16); + uint32_t activeBits = Tmp.getActiveBits(); + if (activeBits 0 activeBits bits) + Tmp.trunc(activeBits); + if (Tmp.getBitWidth() 64) { + llvmAsmlval.APIntVal = new APInt(Tmp); + return yytext[0] == 's' ? ESAPINTVAL : EUAPINTVAL; + } else if (yytext[0] == 's') { + llvmAsmlval.SInt64Val = Tmp.getSExtValue(); + return ESINT64VAL; + } else { + llvmAsmlval.UInt64Val = Tmp.getZExtValue(); + return EUINT64VAL; + } } {LocalVarID} { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/AsmParser/Lexer.l Lexer.l.cvs llvmAsmParser.y llvmAsmParser.y.cvs
Changes in directory llvm/lib/AsmParser: Lexer.l updated: 1.96 - 1.97 Lexer.l.cvs updated: 1.23 - 1.24 llvmAsmParser.y updated: 1.313 - 1.314 llvmAsmParser.y.cvs updated: 1.59 - 1.60 --- Log message: Propagate changes from my local tree. This patch includes: 1. New parameter attribute called 'inreg'. It has meaning place this parameter in registers, if possible. This is some generalization of gcc's regparm(n) attribute. It's currently used only in X86-32 backend. 2. Completely rewritten CC handling/lowering code inside X86 backend. Merged stdcall + c CCs and fastcall + fast CC. 3. Dropped CSRET CC. We cannot add struct return variant for each target-specific CC (e.g. stdcall + csretcc and so on). 4. Instead of CSRET CC introduced 'sret' parameter attribute. Setting in on first attribute has meaning 'This is hidden pointer to structure return. Handle it gently'. 5. Fixed small bug in llvm-extract + add new feature to FunctionExtraction pass, which relinks all internal-linkaged callees from deleted function to external linkage. This will allow further linking everything together. NOTEs: 1. Documentation will be updated soon. 2. llvm-upgrade should be improved to translate csret = sret. Before this, there will be some unexpected test fails. --- Diffs of the changes: (+16 -14) Lexer.l |3 ++- Lexer.l.cvs |3 ++- llvmAsmParser.y | 12 ++-- llvmAsmParser.y.cvs | 12 ++-- 4 files changed, 16 insertions(+), 14 deletions(-) Index: llvm/lib/AsmParser/Lexer.l diff -u llvm/lib/AsmParser/Lexer.l:1.96 llvm/lib/AsmParser/Lexer.l:1.97 --- llvm/lib/AsmParser/Lexer.l:1.96 Fri Jan 26 02:04:51 2007 +++ llvm/lib/AsmParser/Lexer.l Sun Jan 28 07:31:35 2007 @@ -227,7 +227,6 @@ cc { return CC_TOK; } ccc { return CCC_TOK; } -csretcc { return CSRETCC_TOK; } fastcc { return FASTCC_TOK; } coldcc { return COLDCC_TOK; } x86_stdcallcc { return X86_STDCALLCC_TOK; } @@ -287,6 +286,8 @@ trunc { RET_TOK(CastOpVal, Trunc, TRUNC); } zext{ RET_TOK(CastOpVal, ZExt, ZEXT); } sext{ RET_TOK(CastOpVal, SExt, SEXT); } +inreg { return INREG; } +sret{ return SRET; } fptrunc { RET_TOK(CastOpVal, FPTrunc, FPTRUNC); } fpext { RET_TOK(CastOpVal, FPExt, FPEXT); } uitofp { RET_TOK(CastOpVal, UIToFP, UITOFP); } Index: llvm/lib/AsmParser/Lexer.l.cvs diff -u llvm/lib/AsmParser/Lexer.l.cvs:1.23 llvm/lib/AsmParser/Lexer.l.cvs:1.24 --- llvm/lib/AsmParser/Lexer.l.cvs:1.23 Fri Jan 26 02:05:27 2007 +++ llvm/lib/AsmParser/Lexer.l.cvs Sun Jan 28 07:31:35 2007 @@ -227,7 +227,6 @@ cc { return CC_TOK; } ccc { return CCC_TOK; } -csretcc { return CSRETCC_TOK; } fastcc { return FASTCC_TOK; } coldcc { return COLDCC_TOK; } x86_stdcallcc { return X86_STDCALLCC_TOK; } @@ -287,6 +286,8 @@ trunc { RET_TOK(CastOpVal, Trunc, TRUNC); } zext{ RET_TOK(CastOpVal, ZExt, ZEXT); } sext{ RET_TOK(CastOpVal, SExt, SEXT); } +inreg { return INREG; } +sret{ return SRET; } fptrunc { RET_TOK(CastOpVal, FPTrunc, FPTRUNC); } fpext { RET_TOK(CastOpVal, FPExt, FPEXT); } uitofp { RET_TOK(CastOpVal, UIToFP, UITOFP); } Index: llvm/lib/AsmParser/llvmAsmParser.y diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.313 llvm/lib/AsmParser/llvmAsmParser.y:1.314 --- llvm/lib/AsmParser/llvmAsmParser.y:1.313Fri Jan 26 02:04:51 2007 +++ llvm/lib/AsmParser/llvmAsmParser.y Sun Jan 28 07:31:35 2007 @@ -984,8 +984,7 @@ %token DLLIMPORT DLLEXPORT EXTERN_WEAK %token OPAQUE EXTERNAL TARGET TRIPLE ALIGN %token DEPLIBS CALL TAIL ASM_TOK MODULE SIDEEFFECT -%token CC_TOK CCC_TOK CSRETCC_TOK FASTCC_TOK COLDCC_TOK -%token X86_STDCALLCC_TOK X86_FASTCALLCC_TOK +%token CC_TOK CCC_TOK FASTCC_TOK COLDCC_TOK X86_STDCALLCC_TOK X86_FASTCALLCC_TOK %token DATALAYOUT %type UIntVal OptCallingConv %type ParamAttrs OptParamAttrs ParamAttr @@ -1017,7 +1016,7 @@ %token OtherOpVal EXTRACTELEMENT INSERTELEMENT SHUFFLEVECTOR // Function Attributes -%token NORETURN +%token NORETURN INREG SRET // Visibility Styles %token DEFAULT HIDDEN @@ -1119,7 +1118,6 @@ OptCallingConv : /*empty*/ { $$ = CallingConv::C; } | CCC_TOK{ $$ = CallingConv::C; } | - CSRETCC_TOK{ $$ = CallingConv::CSRet; } | FASTCC_TOK { $$ = CallingConv::Fast; } | COLDCC_TOK { $$ = CallingConv::Cold; } | X86_STDCALLCC_TOK { $$ = CallingConv::X86_StdCall; } | @@ -1131,8 +1129,10 @@ CHECK_FOR_ERROR }; -ParamAttr : ZEXT { $$ = FunctionType::ZExtAttribute; } - | SEXT { $$ = FunctionType::SExtAttribute; } +ParamAttr : ZEXT { $$ = FunctionType::ZExtAttribute; } + |
[llvm-commits] CVS: llvm/lib/AsmParser/Lexer.l Lexer.l.cvs llvmAsmParser.y llvmAsmParser.y.cvs
Changes in directory llvm/lib/AsmParser: Lexer.l updated: 1.93 - 1.94 Lexer.l.cvs updated: 1.20 - 1.21 llvmAsmParser.y updated: 1.306 - 1.307 llvmAsmParser.y.cvs updated: 1.52 - 1.53 --- Log message: * PIC codegen for X86/Linux has been implemented * PIC-aware internal structures in X86 Codegen have been refactored * Visibility (default/weak) has been added * Docs fixes (external weak linkage, visibility, formatting) --- Diffs of the changes: (+74 -32) Lexer.l |1 + Lexer.l.cvs |1 + llvmAsmParser.y | 52 llvmAsmParser.y.cvs | 52 4 files changed, 74 insertions(+), 32 deletions(-) Index: llvm/lib/AsmParser/Lexer.l diff -u llvm/lib/AsmParser/Lexer.l:1.93 llvm/lib/AsmParser/Lexer.l:1.94 --- llvm/lib/AsmParser/Lexer.l:1.93 Fri Jan 12 01:27:59 2007 +++ llvm/lib/AsmParser/Lexer.l Fri Jan 12 13:20:46 2007 @@ -203,6 +203,7 @@ appending { return APPENDING; } dllimport { return DLLIMPORT; } dllexport { return DLLEXPORT; } +hidden { return HIDDEN; } extern_weak { return EXTERN_WEAK; } external{ return EXTERNAL; } implementation { return IMPLEMENTATION; } Index: llvm/lib/AsmParser/Lexer.l.cvs diff -u llvm/lib/AsmParser/Lexer.l.cvs:1.20 llvm/lib/AsmParser/Lexer.l.cvs:1.21 --- llvm/lib/AsmParser/Lexer.l.cvs:1.20 Fri Jan 12 01:28:27 2007 +++ llvm/lib/AsmParser/Lexer.l.cvs Fri Jan 12 13:20:46 2007 @@ -203,6 +203,7 @@ appending { return APPENDING; } dllimport { return DLLIMPORT; } dllexport { return DLLEXPORT; } +hidden { return HIDDEN; } extern_weak { return EXTERN_WEAK; } external{ return EXTERNAL; } implementation { return IMPLEMENTATION; } Index: llvm/lib/AsmParser/llvmAsmParser.y diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.306 llvm/lib/AsmParser/llvmAsmParser.y:1.307 --- llvm/lib/AsmParser/llvmAsmParser.y:1.306Fri Jan 12 12:32:39 2007 +++ llvm/lib/AsmParser/llvmAsmParser.y Fri Jan 12 13:20:46 2007 @@ -210,6 +210,7 @@ std::mapconst Type*, ValueList LateResolveValues; bool isDeclare;// Is this function a forward declararation? GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration. + GlobalValue::VisibilityTypes Visibility; /// BBForwardRefs - When we see forward references to basic blocks, keep /// track of them here. @@ -220,7 +221,8 @@ inline PerFunctionInfo() { CurrentFunction = 0; isDeclare = false; -Linkage = GlobalValue::ExternalLinkage; +Linkage = GlobalValue::ExternalLinkage; +Visibility = GlobalValue::DefaultVisibility; } inline void FunctionStart(Function *M) { @@ -245,6 +247,7 @@ CurrentFunction = 0; isDeclare = false; Linkage = GlobalValue::ExternalLinkage; +Visibility = GlobalValue::DefaultVisibility; } } CurFun; // Info for the current function... @@ -648,7 +651,9 @@ /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null, /// this is a declaration, otherwise it is a definition. static GlobalVariable * -ParseGlobalVariable(char *NameStr,GlobalValue::LinkageTypes Linkage, +ParseGlobalVariable(char *NameStr, +GlobalValue::LinkageTypes Linkage, +GlobalValue::VisibilityTypes Visibility, bool isConstantGlobal, const Type *Ty, Constant *Initializer) { if (isaFunctionType(Ty)) { @@ -681,6 +686,7 @@ CurModule.CurrentModule-getGlobalList().push_back(GV); GV-setInitializer(Initializer); GV-setLinkage(Linkage); +GV-setVisibility(Visibility); GV-setConstant(isConstantGlobal); InsertValue(GV, CurModule.Values); return GV; @@ -702,6 +708,7 @@ GlobalVariable *GV = new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name, CurModule.CurrentModule); + GV-setVisibility(Visibility); InsertValue(GV, CurModule.Values); return GV; } @@ -898,6 +905,7 @@ std::vectorllvm::Constant* *ConstVector; llvm::GlobalValue::LinkageTypes Linkage; + llvm::GlobalValue::VisibilityTypes Visibility; llvm::FunctionType::ParameterAttributes ParamAttrs; int64_t SInt64Val; uint64_t UInt64Val; @@ -940,6 +948,7 @@ %type BoolVal OptSideEffect // 'sideeffect' or not. %type Linkage GVInternalLinkage GVExternalLinkage %type Linkage FunctionDefineLinkage FunctionDeclareLinkage +%type VisibilityGVVisibilityStyle %type EndiannessBigOrLittle // ValueRef - Unresolved reference to a definition or BB @@ -1011,6 +1020,9 @@ // Function Attributes %token NORETURN +// Visibility Styles +%token DEFAULT HIDDEN + %start Module %% @@ -1081,6 +1093,11 @@ | EXTERNAL{ $$ = GlobalValue::ExternalLinkage; } ; +GVVisibilityStyle + : /*empty*/ { $$ =
[llvm-commits] CVS: llvm/lib/AsmParser/Lexer.l llvmAsmParser.y
Changes in directory llvm/lib/AsmParser: Lexer.l updated: 1.94 - 1.95 llvmAsmParser.y updated: 1.307 - 1.308 --- Log message: Bye bye bool. AsmWriter doesn't generate it any more so AsmParser shouldn't read it any more. This is consistent with the new IR as well. --- Diffs of the changes: (+8 -6) Lexer.l |1 - llvmAsmParser.y | 13 - 2 files changed, 8 insertions(+), 6 deletions(-) Index: llvm/lib/AsmParser/Lexer.l diff -u llvm/lib/AsmParser/Lexer.l:1.94 llvm/lib/AsmParser/Lexer.l:1.95 --- llvm/lib/AsmParser/Lexer.l:1.94 Fri Jan 12 13:20:46 2007 +++ llvm/lib/AsmParser/Lexer.l Fri Jan 12 23:00:20 2007 @@ -237,7 +237,6 @@ x86_fastcallcc { return X86_FASTCALLCC_TOK; } void{ RET_TY(Type::VoidTy, VOID); } -bool{ RET_TY(Type::Int1Ty, BOOL); } float { RET_TY(Type::FloatTy, FLOAT); } double { RET_TY(Type::DoubleTy,DOUBLE);} label { RET_TY(Type::LabelTy, LABEL); } Index: llvm/lib/AsmParser/llvmAsmParser.y diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.307 llvm/lib/AsmParser/llvmAsmParser.y:1.308 --- llvm/lib/AsmParser/llvmAsmParser.y:1.307Fri Jan 12 13:20:46 2007 +++ llvm/lib/AsmParser/llvmAsmParser.y Fri Jan 12 23:00:20 2007 @@ -970,7 +970,7 @@ // Built in types... %type TypeVal Types ResultTypes %type PrimType IntType FPType PrimType // Classifications -%token PrimType VOID BOOL INTTYPE +%token PrimType VOID INTTYPE %token PrimType FLOAT DOUBLE LABEL %token TYPE @@ -1198,7 +1198,7 @@ // Derived types are added later... // -PrimType : BOOL | INTTYPE | FLOAT | DOUBLE | LABEL ; +PrimType : INTTYPE | FLOAT | DOUBLE | LABEL ; Types : OPAQUE { @@ -1686,11 +1686,13 @@ $$ = ConstantInt::get($1, $2); CHECK_FOR_ERROR } - | BOOL TRUETOK { // Boolean constants + | INTTYPE TRUETOK { // Boolean constants +assert(castIntegerType($1)-getBitWidth() == 1 Not Bool?); $$ = ConstantInt::getTrue(); CHECK_FOR_ERROR } - | BOOL FALSETOK { // Boolean constants + | INTTYPE FALSETOK { // Boolean constants +assert(castIntegerType($1)-getBitWidth() == 1 Not Bool?); $$ = ConstantInt::getFalse(); CHECK_FOR_ERROR } @@ -2362,7 +2364,8 @@ CHECK_FOR_ERROR $$ = new BranchInst(tmpBB); } // Conditional Branch... - | BR BOOL ValueRef ',' LABEL ValueRef ',' LABEL ValueRef { + | BR INTTYPE ValueRef ',' LABEL ValueRef ',' LABEL ValueRef { +assert(castIntegerType($2)-getBitWidth() == 1 Not Bool?); BasicBlock* tmpBBA = getBBVal($6); CHECK_FOR_ERROR BasicBlock* tmpBBB = getBBVal($9); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/AsmParser/Lexer.l
Changes in directory llvm/lib/AsmParser: Lexer.l updated: 1.92 - 1.93 --- Log message: Integer type names need 1 or more digits, not zero or more. --- Diffs of the changes: (+1 -1) Lexer.l |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/AsmParser/Lexer.l diff -u llvm/lib/AsmParser/Lexer.l:1.92 llvm/lib/AsmParser/Lexer.l:1.93 --- llvm/lib/AsmParser/Lexer.l:1.92 Fri Jan 12 01:05:13 2007 +++ llvm/lib/AsmParser/Lexer.l Fri Jan 12 01:27:59 2007 @@ -165,7 +165,7 @@ EPInteger %[0-9]+ ENInteger%-[0-9]+ -IntegerType i[0-9]* +IntegerType i[0-9]+ /* E[PN]Integer: match positive and negative literal integer values */ ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/lib/AsmParser/Lexer.l llvmAsmParser.y
A semi-colon appears to be in the wrong place, as marked below. Some versions of bison complain, while others silently accept it (including the newest ones)--though how they interpret the grammar is not clear. Reid Spencer wrote: Changes in directory llvm/lib/AsmParser: Lexer.l updated: 1.89 - 1.90 llvmAsmParser.y updated: 1.292 - 1.293 --- Log message: For PR950: http://llvm.org/PR950 : Major reorganization. This patch introduces the signedness changes for the new integer types (i8, i16, i32, i64) which replace the old signed versions (ubyte, sbyte, ushort, short, etc). This patch also implements the function type parameter attributes feature. Together these conspired to introduce new reduce/reduce errors into the grammar. Consequently, it was necessary to introduce a new keyword into the grammar in order to disambiguate. Without this, yacc would make incorrect shift/reduce and reduce/reduce decisions and fail to parse the intended assembly. Changes in assembly: 1. The implementation keyword is superfluous but still supported. You can use it as a sentry which will ensure there are no remaining up reference types. However, this is optional as those checks are also performed elsewhere. 2. Parameter attributes are now implemented using an at sign to indicate the attribute. The attributes are placed after the type in a function declaration or after the argument value in a function call. For example: i8 @sext %myfunc(i16 @zext) call i8 @sext %myfunc(i16 @zext %someVal) The facility is available for supporting additional attributes and they can be combined using the @(attr1,attr2,attr3) syntax. Right now the only two supported are @sext and @zext 3. Functions must now be defined with the define keyword which is analagous to the declare keyword for function declarations. The introduction of this keyword disambiguates situations where a named result type is confused with a new type or gvar definition. For example: %MyType = type i16 %MyType %func(%MyType) { ... } With the introduction of optional parameter attributes between the function name and the function result type, yacc will pick the wrong rule to reduce unless it is disambiguated with define before the function definition, as in: define %MyType @zext %func(%MyType %someArg) { ... } --- Diffs of the changes: (+413 -253) Lexer.l | 12 - llvmAsmParser.y | 654 +++- 2 files changed, 413 insertions(+), 253 deletions(-) Index: llvm/lib/AsmParser/llvmAsmParser.y diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.292 llvm/lib/AsmParser/llvmAsmParser.y:1.293 --- llvm/lib/AsmParser/llvmAsmParser.y:1.292 Fri Dec 29 14:29:48 2006 +++ llvm/lib/AsmParser/llvmAsmParser.ySat Dec 30 23:40:12 2006 @@ -2307,18 +2412,31 @@ }; -ValueRefList : ResolvedVal {// Used for call statements, and memory insts... -$$ = new std::vectorValue*(); -$$-push_back($1); +ValueRefList : Types ValueRef OptParamAttrs { +if (!UpRefs.empty()) + GEN_ERROR(Invalid upreference in type: + (*$1)-getDescription()); +// Used for call and invoke instructions +$$ = new ValueRefList(); +ValueRefListEntry E; E.Attrs = $3; E.Val = getVal($1-get(), $2); +$$-push_back(E); } - | ValueRefList ',' ResolvedVal { + | ValueRefList ',' Types ValueRef OptParamAttrs { +if (!UpRefs.empty()) + GEN_ERROR(Invalid upreference in type: + (*$3)-getDescription()); $$ = $1; -$1-push_back($3); +ValueRefListEntry E; E.Attrs = $5; E.Val = getVal($3-get(), $4); +$$-push_back(E); CHECK_FOR_ERROR - }; + } + | /*empty*/ { $$ = new ValueRefList(); }; -// ValueRefListE - Just like ValueRefList, except that it may also be empty! -ValueRefListE : ValueRefList | /*empty*/ { $$ = 0; }; +IndexList // Used for gep instructions and constant expressions + : /*empty*/ { $$ = new std::vectorValue*(); }; == bad semi-colon + | IndexList ',' ResolvedVal { +$$ = $1; +$$-push_back($3); +CHECK_FOR_ERROR + } == missing semi-colon ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/lib/AsmParser/Lexer.l llvmAsmParser.y
Jeff, This is now fixed. I wish the newer versions of bison would at least warn about this! Reid. On Sun, 2006-12-31 at 12:42 -0800, Jeff Cohen wrote: A semi-colon appears to be in the wrong place, as marked below. Some versions of bison complain, while others silently accept it (including the newest ones)--though how they interpret the grammar is not clear. Reid Spencer wrote: Changes in directory llvm/lib/AsmParser: Lexer.l updated: 1.89 - 1.90 llvmAsmParser.y updated: 1.292 - 1.293 --- Log message: For PR950: http://llvm.org/PR950 : Major reorganization. This patch introduces the signedness changes for the new integer types (i8, i16, i32, i64) which replace the old signed versions (ubyte, sbyte, ushort, short, etc). This patch also implements the function type parameter attributes feature. Together these conspired to introduce new reduce/reduce errors into the grammar. Consequently, it was necessary to introduce a new keyword into the grammar in order to disambiguate. Without this, yacc would make incorrect shift/reduce and reduce/reduce decisions and fail to parse the intended assembly. Changes in assembly: 1. The implementation keyword is superfluous but still supported. You can use it as a sentry which will ensure there are no remaining up reference types. However, this is optional as those checks are also performed elsewhere. 2. Parameter attributes are now implemented using an at sign to indicate the attribute. The attributes are placed after the type in a function declaration or after the argument value in a function call. For example: i8 @sext %myfunc(i16 @zext) call i8 @sext %myfunc(i16 @zext %someVal) The facility is available for supporting additional attributes and they can be combined using the @(attr1,attr2,attr3) syntax. Right now the only two supported are @sext and @zext 3. Functions must now be defined with the define keyword which is analagous to the declare keyword for function declarations. The introduction of this keyword disambiguates situations where a named result type is confused with a new type or gvar definition. For example: %MyType = type i16 %MyType %func(%MyType) { ... } With the introduction of optional parameter attributes between the function name and the function result type, yacc will pick the wrong rule to reduce unless it is disambiguated with define before the function definition, as in: define %MyType @zext %func(%MyType %someArg) { ... } --- Diffs of the changes: (+413 -253) Lexer.l | 12 - llvmAsmParser.y | 654 +++- 2 files changed, 413 insertions(+), 253 deletions(-) Index: llvm/lib/AsmParser/llvmAsmParser.y diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.292 llvm/lib/AsmParser/llvmAsmParser.y:1.293 --- llvm/lib/AsmParser/llvmAsmParser.y:1.292Fri Dec 29 14:29:48 2006 +++ llvm/lib/AsmParser/llvmAsmParser.y Sat Dec 30 23:40:12 2006 @@ -2307,18 +2412,31 @@ }; -ValueRefList : ResolvedVal {// Used for call statements, and memory insts... -$$ = new std::vectorValue*(); -$$-push_back($1); +ValueRefList : Types ValueRef OptParamAttrs { +if (!UpRefs.empty()) + GEN_ERROR(Invalid upreference in type: + (*$1)-getDescription()); +// Used for call and invoke instructions +$$ = new ValueRefList(); +ValueRefListEntry E; E.Attrs = $3; E.Val = getVal($1-get(), $2); +$$-push_back(E); } - | ValueRefList ',' ResolvedVal { + | ValueRefList ',' Types ValueRef OptParamAttrs { +if (!UpRefs.empty()) + GEN_ERROR(Invalid upreference in type: + (*$3)-getDescription()); $$ = $1; -$1-push_back($3); +ValueRefListEntry E; E.Attrs = $5; E.Val = getVal($3-get(), $4); +$$-push_back(E); CHECK_FOR_ERROR - }; + } + | /*empty*/ { $$ = new ValueRefList(); }; -// ValueRefListE - Just like ValueRefList, except that it may also be empty! -ValueRefListE : ValueRefList | /*empty*/ { $$ = 0; }; +IndexList // Used for gep instructions and constant expressions + : /*empty*/ { $$ = new std::vectorValue*(); }; == bad semi-colon + | IndexList ',' ResolvedVal { +$$ = $1; +$$-push_back($3); +CHECK_FOR_ERROR + } == missing semi-colon ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/lib/AsmParser/Lexer.l llvmAsmParser.y
Only half-fixed. The extra semi-colon is still there. Reid Spencer wrote: Jeff, This is now fixed. I wish the newer versions of bison would at least warn about this! Reid. On Sun, 2006-12-31 at 12:42 -0800, Jeff Cohen wrote: A semi-colon appears to be in the wrong place, as marked below. Some versions of bison complain, while others silently accept it (including the newest ones)--though how they interpret the grammar is not clear. Reid Spencer wrote: Changes in directory llvm/lib/AsmParser: Lexer.l updated: 1.89 - 1.90 llvmAsmParser.y updated: 1.292 - 1.293 --- Log message: For PR950: http://llvm.org/PR950 : Major reorganization. This patch introduces the signedness changes for the new integer types (i8, i16, i32, i64) which replace the old signed versions (ubyte, sbyte, ushort, short, etc). This patch also implements the function type parameter attributes feature. Together these conspired to introduce new reduce/reduce errors into the grammar. Consequently, it was necessary to introduce a new keyword into the grammar in order to disambiguate. Without this, yacc would make incorrect shift/reduce and reduce/reduce decisions and fail to parse the intended assembly. Changes in assembly: 1. The implementation keyword is superfluous but still supported. You can use it as a sentry which will ensure there are no remaining up reference types. However, this is optional as those checks are also performed elsewhere. 2. Parameter attributes are now implemented using an at sign to indicate the attribute. The attributes are placed after the type in a function declaration or after the argument value in a function call. For example: i8 @sext %myfunc(i16 @zext) call i8 @sext %myfunc(i16 @zext %someVal) The facility is available for supporting additional attributes and they can be combined using the @(attr1,attr2,attr3) syntax. Right now the only two supported are @sext and @zext 3. Functions must now be defined with the define keyword which is analagous to the declare keyword for function declarations. The introduction of this keyword disambiguates situations where a named result type is confused with a new type or gvar definition. For example: %MyType = type i16 %MyType %func(%MyType) { ... } With the introduction of optional parameter attributes between the function name and the function result type, yacc will pick the wrong rule to reduce unless it is disambiguated with define before the function definition, as in: define %MyType @zext %func(%MyType %someArg) { ... } --- Diffs of the changes: (+413 -253) Lexer.l | 12 - llvmAsmParser.y | 654 +++- 2 files changed, 413 insertions(+), 253 deletions(-) Index: llvm/lib/AsmParser/llvmAsmParser.y diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.292 llvm/lib/AsmParser/llvmAsmParser.y:1.293 --- llvm/lib/AsmParser/llvmAsmParser.y:1.292Fri Dec 29 14:29:48 2006 +++ llvm/lib/AsmParser/llvmAsmParser.y Sat Dec 30 23:40:12 2006 @@ -2307,18 +2412,31 @@ }; -ValueRefList : ResolvedVal {// Used for call statements, and memory insts... -$$ = new std::vectorValue*(); -$$-push_back($1); +ValueRefList : Types ValueRef OptParamAttrs { +if (!UpRefs.empty()) + GEN_ERROR(Invalid upreference in type: + (*$1)-getDescription()); +// Used for call and invoke instructions +$$ = new ValueRefList(); +ValueRefListEntry E; E.Attrs = $3; E.Val = getVal($1-get(), $2); +$$-push_back(E); } - | ValueRefList ',' ResolvedVal { + | ValueRefList ',' Types ValueRef OptParamAttrs { +if (!UpRefs.empty()) + GEN_ERROR(Invalid upreference in type: + (*$3)-getDescription()); $$ = $1; -$1-push_back($3); +ValueRefListEntry E; E.Attrs = $5; E.Val = getVal($3-get(), $4); +$$-push_back(E); CHECK_FOR_ERROR - }; + } + | /*empty*/ { $$ = new ValueRefList(); }; -// ValueRefListE - Just like ValueRefList, except that it may also be empty! -ValueRefListE : ValueRefList | /*empty*/ { $$ = 0; }; +IndexList // Used for gep instructions and constant expressions + : /*empty*/ { $$ = new std::vectorValue*(); }; == bad semi-colon + | IndexList ',' ResolvedVal { +$$ = $1; +$$-push_back($3); +CHECK_FOR_ERROR + } == missing semi-colon ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/lib/AsmParser/Lexer.l llvmAsmParser.y
Oops. Sorry, missed that. Its fixed and regenerated now. Reid. On Sun, 2006-12-31 at 13:43 -0800, Jeff Cohen wrote: Only half-fixed. The extra semi-colon is still there. Reid Spencer wrote: Jeff, This is now fixed. I wish the newer versions of bison would at least warn about this! Reid. On Sun, 2006-12-31 at 12:42 -0800, Jeff Cohen wrote: A semi-colon appears to be in the wrong place, as marked below. Some versions of bison complain, while others silently accept it (including the newest ones)--though how they interpret the grammar is not clear. Reid Spencer wrote: Changes in directory llvm/lib/AsmParser: Lexer.l updated: 1.89 - 1.90 llvmAsmParser.y updated: 1.292 - 1.293 --- Log message: For PR950: http://llvm.org/PR950 : Major reorganization. This patch introduces the signedness changes for the new integer types (i8, i16, i32, i64) which replace the old signed versions (ubyte, sbyte, ushort, short, etc). This patch also implements the function type parameter attributes feature. Together these conspired to introduce new reduce/reduce errors into the grammar. Consequently, it was necessary to introduce a new keyword into the grammar in order to disambiguate. Without this, yacc would make incorrect shift/reduce and reduce/reduce decisions and fail to parse the intended assembly. Changes in assembly: 1. The implementation keyword is superfluous but still supported. You can use it as a sentry which will ensure there are no remaining up reference types. However, this is optional as those checks are also performed elsewhere. 2. Parameter attributes are now implemented using an at sign to indicate the attribute. The attributes are placed after the type in a function declaration or after the argument value in a function call. For example: i8 @sext %myfunc(i16 @zext) call i8 @sext %myfunc(i16 @zext %someVal) The facility is available for supporting additional attributes and they can be combined using the @(attr1,attr2,attr3) syntax. Right now the only two supported are @sext and @zext 3. Functions must now be defined with the define keyword which is analagous to the declare keyword for function declarations. The introduction of this keyword disambiguates situations where a named result type is confused with a new type or gvar definition. For example: %MyType = type i16 %MyType %func(%MyType) { ... } With the introduction of optional parameter attributes between the function name and the function result type, yacc will pick the wrong rule to reduce unless it is disambiguated with define before the function definition, as in: define %MyType @zext %func(%MyType %someArg) { ... } --- Diffs of the changes: (+413 -253) Lexer.l | 12 - llvmAsmParser.y | 654 +++- 2 files changed, 413 insertions(+), 253 deletions(-) Index: llvm/lib/AsmParser/llvmAsmParser.y diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.292 llvm/lib/AsmParser/llvmAsmParser.y:1.293 --- llvm/lib/AsmParser/llvmAsmParser.y:1.292 Fri Dec 29 14:29:48 2006 +++ llvm/lib/AsmParser/llvmAsmParser.ySat Dec 30 23:40:12 2006 @@ -2307,18 +2412,31 @@ }; -ValueRefList : ResolvedVal {// Used for call statements, and memory insts... -$$ = new std::vectorValue*(); -$$-push_back($1); +ValueRefList : Types ValueRef OptParamAttrs { +if (!UpRefs.empty()) + GEN_ERROR(Invalid upreference in type: + (*$1)-getDescription()); +// Used for call and invoke instructions +$$ = new ValueRefList(); +ValueRefListEntry E; E.Attrs = $3; E.Val = getVal($1-get(), $2); +$$-push_back(E); } - | ValueRefList ',' ResolvedVal { + | ValueRefList ',' Types ValueRef OptParamAttrs { +if (!UpRefs.empty()) + GEN_ERROR(Invalid upreference in type: + (*$3)-getDescription()); $$ = $1; -$1-push_back($3); +ValueRefListEntry E; E.Attrs = $5; E.Val = getVal($3-get(), $4); +$$-push_back(E); CHECK_FOR_ERROR - }; + } + | /*empty*/ { $$ = new ValueRefList(); }; -// ValueRefListE - Just like ValueRefList, except that it may also be empty! -ValueRefListE : ValueRefList | /*empty*/ { $$ = 0; }; +IndexList // Used for gep instructions and constant expressions + : /*empty*/ { $$ = new std::vectorValue*(); }; == bad semi-colon + | IndexList ',' ResolvedVal { +$$ = $1; +$$-push_back($3); +CHECK_FOR_ERROR + } == missing semi-colon ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits ___
[llvm-commits] CVS: llvm/lib/AsmParser/Lexer.l llvmAsmParser.y
Changes in directory llvm/lib/AsmParser: Lexer.l updated: 1.89 - 1.90 llvmAsmParser.y updated: 1.292 - 1.293 --- Log message: For PR950: http://llvm.org/PR950 : Major reorganization. This patch introduces the signedness changes for the new integer types (i8, i16, i32, i64) which replace the old signed versions (ubyte, sbyte, ushort, short, etc). This patch also implements the function type parameter attributes feature. Together these conspired to introduce new reduce/reduce errors into the grammar. Consequently, it was necessary to introduce a new keyword into the grammar in order to disambiguate. Without this, yacc would make incorrect shift/reduce and reduce/reduce decisions and fail to parse the intended assembly. Changes in assembly: 1. The implementation keyword is superfluous but still supported. You can use it as a sentry which will ensure there are no remaining up reference types. However, this is optional as those checks are also performed elsewhere. 2. Parameter attributes are now implemented using an at sign to indicate the attribute. The attributes are placed after the type in a function declaration or after the argument value in a function call. For example: i8 @sext %myfunc(i16 @zext) call i8 @sext %myfunc(i16 @zext %someVal) The facility is available for supporting additional attributes and they can be combined using the @(attr1,attr2,attr3) syntax. Right now the only two supported are @sext and @zext 3. Functions must now be defined with the define keyword which is analagous to the declare keyword for function declarations. The introduction of this keyword disambiguates situations where a named result type is confused with a new type or gvar definition. For example: %MyType = type i16 %MyType %func(%MyType) { ... } With the introduction of optional parameter attributes between the function name and the function result type, yacc will pick the wrong rule to reduce unless it is disambiguated with define before the function definition, as in: define %MyType @zext %func(%MyType %someArg) { ... } --- Diffs of the changes: (+413 -253) Lexer.l | 12 - llvmAsmParser.y | 654 +++- 2 files changed, 413 insertions(+), 253 deletions(-) Index: llvm/lib/AsmParser/Lexer.l diff -u llvm/lib/AsmParser/Lexer.l:1.89 llvm/lib/AsmParser/Lexer.l:1.90 --- llvm/lib/AsmParser/Lexer.l:1.89 Fri Dec 29 14:29:48 2006 +++ llvm/lib/AsmParser/Lexer.l Sat Dec 30 23:40:12 2006 @@ -235,14 +235,10 @@ void{ RET_TY(Type::VoidTy, VOID); } bool{ RET_TY(Type::BoolTy, BOOL); } -sbyte { RET_TY(Type::SByteTy, SBYTE); } -ubyte { RET_TY(Type::UByteTy, UBYTE); } -short { RET_TY(Type::ShortTy, SHORT); } -ushort { RET_TY(Type::UShortTy,USHORT);} -int { RET_TY(Type::IntTy, INT); } -uint{ RET_TY(Type::UIntTy, UINT); } -long{ RET_TY(Type::LongTy, LONG); } -ulong { RET_TY(Type::ULongTy, ULONG); } +i8 { RET_TY(Type::Int8Ty, INT8); } +i16 { RET_TY(Type::Int16Ty, INT16); } +i32 { RET_TY(Type::Int32Ty, INT32); } +i64 { RET_TY(Type::Int64Ty, INT64); } float { RET_TY(Type::FloatTy, FLOAT); } double { RET_TY(Type::DoubleTy,DOUBLE);} label { RET_TY(Type::LabelTy, LABEL); } Index: llvm/lib/AsmParser/llvmAsmParser.y diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.292 llvm/lib/AsmParser/llvmAsmParser.y:1.293 --- llvm/lib/AsmParser/llvmAsmParser.y:1.292Fri Dec 29 14:29:48 2006 +++ llvm/lib/AsmParser/llvmAsmParser.y Sat Dec 30 23:40:12 2006 @@ -19,12 +19,16 @@ #include llvm/Module.h #include llvm/SymbolTable.h #include llvm/Support/GetElementPtrTypeIterator.h +#include llvm/Support/CommandLine.h #include llvm/ADT/STLExtras.h #include llvm/Support/MathExtras.h #include llvm/Support/Streams.h #include algorithm #include list #include utility +#ifndef NDEBUG +#define YYDEBUG 1 +#endif // The following is a gross hack. In order to rid the libAsmParser library of // exceptions, we have to have a way of getting the yyparse function to go into @@ -47,6 +51,11 @@ namespace llvm { std::string CurFilename; +#if YYDEBUG +static cl::optbool +Debug(debug-yacc, cl::desc(Print yacc debug state changes), + cl::Hidden, cl::init(false)); +#endif } using namespace llvm; @@ -71,6 +80,7 @@ // destroyed when the function is completed. // typedef std::vectorValue * ValueList; // Numbered defs + static void ResolveDefinitions(std::mapconst Type *,ValueList LateResolvers, std::mapconst Type *,ValueList *FutureLateResolvers = 0); @@ -804,34 +814,12 @@ return Ty; } -// common code from the two 'RunVMAsmParser' functions -static Module* RunParser(Module * M) { - - llvmAsmlineno = 1; // Reset the current line number... -
[llvm-commits] CVS: llvm/lib/AsmParser/Lexer.l llvmAsmParser.y
Changes in directory llvm/lib/AsmParser: Lexer.l updated: 1.86 - 1.87 llvmAsmParser.y updated: 1.281 - 1.282 --- Log message: Shorten the FCmp and ICmp mnemonics to 3 letters. Make the parser disambiguate them. --- Diffs of the changes: (+41 -34) Lexer.l | 48 llvmAsmParser.y | 27 +-- 2 files changed, 41 insertions(+), 34 deletions(-) Index: llvm/lib/AsmParser/Lexer.l diff -u llvm/lib/AsmParser/Lexer.l:1.86 llvm/lib/AsmParser/Lexer.l:1.87 --- llvm/lib/AsmParser/Lexer.l:1.86 Sat Dec 2 23:45:44 2006 +++ llvm/lib/AsmParser/Lexer.l Sun Dec 3 00:58:07 2006 @@ -44,10 +44,6 @@ llvmAsmlval.type = Instruction::Enum; \ return sym -#define RET_ENUM(type, Enum, sym) \ - llvmAsmlval.type = Enum; \ - return sym - // Construct a token value for an obsolete token #define RET_TY(CTYPE, SYM) \ llvmAsmlval.PrimType = CTYPE;\ @@ -272,30 +268,26 @@ setge { RET_TOK(BinaryOpVal, SetGE, SETGE); } icmp{ RET_TOK(OtherOpVal, ICmp, ICMP); } fcmp{ RET_TOK(OtherOpVal, FCmp, FCMP); } -eq { RET_ENUM(IPredicate, ICmpInst::ICMP_EQ, EQ); } -ne { RET_ENUM(IPredicate, ICmpInst::ICMP_NE, NE); } -slt { RET_ENUM(IPredicate, ICmpInst::ICMP_SLT, SLT); } -sgt { RET_ENUM(IPredicate, ICmpInst::ICMP_SGT, SGT); } -sle { RET_ENUM(IPredicate, ICmpInst::ICMP_SLE, SLE); } -sge { RET_ENUM(IPredicate, ICmpInst::ICMP_SGE, SGE); } -ult { RET_ENUM(IPredicate, ICmpInst::ICMP_ULT, ULT); } -ugt { RET_ENUM(IPredicate, ICmpInst::ICMP_UGT, UGT); } -ule { RET_ENUM(IPredicate, ICmpInst::ICMP_ULE, ULE); } -uge { RET_ENUM(IPredicate, ICmpInst::ICMP_UGE, UGE); } -ordeq { RET_ENUM(FPredicate, FCmpInst::FCMP_OEQ, ORDEQ); } -ordne { RET_ENUM(FPredicate, FCmpInst::FCMP_ONE, ORDNE); } -ordlt { RET_ENUM(FPredicate, FCmpInst::FCMP_OLT, ORDLT); } -ordgt { RET_ENUM(FPredicate, FCmpInst::FCMP_OGT, ORDGT); } -ordle { RET_ENUM(FPredicate, FCmpInst::FCMP_OLE, ORDLE); } -ordge { RET_ENUM(FPredicate, FCmpInst::FCMP_OGE, ORDGE); } -ord { RET_ENUM(FPredicate, FCmpInst::FCMP_ORD, ORD); } -uno { RET_ENUM(FPredicate, FCmpInst::FCMP_UNO, UNO); } -unoeq { RET_ENUM(FPredicate, FCmpInst::FCMP_UEQ, UNOEQ); } -unone { RET_ENUM(FPredicate, FCmpInst::FCMP_UNE, UNONE); } -unolt { RET_ENUM(FPredicate, FCmpInst::FCMP_ULT, UNOLT); } -unogt { RET_ENUM(FPredicate, FCmpInst::FCMP_UGT, UNOGT); } -unole { RET_ENUM(FPredicate, FCmpInst::FCMP_ULE, UNOLE); } -unoge { RET_ENUM(FPredicate, FCmpInst::FCMP_UGE, UNOGE); } +eq { return EQ; } +ne { return NE; } +slt { return SLT; } +sgt { return SGT; } +sle { return SLE; } +sge { return SGE; } +ult { return ULT; } +ugt { return UGT; } +ule { return ULE; } +uge { return UGE; } +oeq { return OEQ; } +one { return ONE; } +olt { return OLT; } +ogt { return OGT; } +ole { return OLE; } +oge { return OGE; } +ord { return ORD; } +uno { return UNO; } +ueq { return UEQ; } +une { return UNE; } phi { RET_TOK(OtherOpVal, PHI, PHI_TOK); } call{ RET_TOK(OtherOpVal, Call, CALL); } Index: llvm/lib/AsmParser/llvmAsmParser.y diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.281 llvm/lib/AsmParser/llvmAsmParser.y:1.282 --- llvm/lib/AsmParser/llvmAsmParser.y:1.281Sat Dec 2 23:45:44 2006 +++ llvm/lib/AsmParser/llvmAsmParser.y Sun Dec 3 00:58:07 2006 @@ -1076,11 +1076,10 @@ %token BinaryOpVal ADD SUB MUL UDIV SDIV FDIV UREM SREM FREM AND OR XOR %token BinaryOpVal SETLE SETGE SETLT SETGT SETEQ SETNE // Binary Comparators %token OtherOpVal ICMP FCMP -%token IPredicate EQ NE SLT SGT SLE SGE ULT UGT ULE UGE %type IPredicate IPredicates -%token FPredicate ORDEQ ORDNE ORDLT ORDGT ORDLE ORDGE ORD UNO UNOEQ UNONE -%token FPredicate UNOLT UNOGT UNOLE UNOGE %type FPredicate FPredicates +%token EQ NE SLT SGT SLE SGE ULT UGT ULE UGE +%token OEQ ONE OLT OGT OLE OGE ORD UNO UEQ UNE // Memory Instructions %token MemOpVal MALLOC ALLOCA FREE LOAD STORE GETELEMENTPTR @@ -1128,9 +1127,25 @@ CastOps : TRUNC | ZEXT | SEXT | FPTRUNC | FPEXT | BITCAST | UITOFP | SITOFP | FPTOUI | FPTOSI | INTTOPTR | PTRTOINT; ShiftOps : SHL | LSHR | ASHR; -IPredicates : EQ | NE | SLT | SGT | SLE | SGE | ULT | UGT | ULE | UGE ; -FPredicates : ORDEQ | ORDNE | ORDLT | ORDGT | ORDLE | ORDGE | ORD | UNO - | UNOEQ | UNONE | UNOLT | UNOGT | UNOLE | UNOGE ; +IPredicates + : EQ { $$ = ICmpInst::ICMP_EQ; } | NE { $$ = ICmpInst::ICMP_NE; } + | SLT { $$ = ICmpInst::ICMP_SLT; } | SGT {
[llvm-commits] CVS: llvm/lib/AsmParser/Lexer.l llvmAsmParser.y ParserInternals.h
Changes in directory llvm/lib/AsmParser: Lexer.l updated: 1.84 - 1.85 llvmAsmParser.y updated: 1.277 - 1.278 ParserInternals.h updated: 1.48 - 1.49 --- Log message: Implement signedness caching for values, value lists, constants and constant lists. This is just an internal change to the parser in preparation for some backwards compatibility code that is to follow. This will allow things like uint 40 to retain the unsignedness of the integer constant as the value moves through the parser. In the future, all integer types will be signless but parsing uint and friends will be retained for backwards compatibility. --- Diffs of the changes: (+250 -202) Lexer.l | 40 ++--- ParserInternals.h | 23 ++- llvmAsmParser.y | 389 ++ 3 files changed, 250 insertions(+), 202 deletions(-) Index: llvm/lib/AsmParser/Lexer.l diff -u llvm/lib/AsmParser/Lexer.l:1.84 llvm/lib/AsmParser/Lexer.l:1.85 --- llvm/lib/AsmParser/Lexer.l:1.84 Sun Nov 26 19:05:09 2006 +++ llvm/lib/AsmParser/Lexer.l Tue Nov 28 01:28:14 2006 @@ -51,17 +51,11 @@ llvmAsmlval.type.obsolete = true; \ return sym -// Construct a token value for a non-obsolete type -#define RET_TY(CType, sym) \ - llvmAsmlval.TypeVal.type = new PATypeHolder(CType); \ - llvmAsmlval.TypeVal.signedness = isSignless; \ - return sym - // Construct a token value for an obsolete token -#define RET_TY_OBSOLETE(CType, sign, sym) \ - llvmAsmlval.TypeVal.type = new PATypeHolder(CType); \ - llvmAsmlval.TypeVal.signedness = sign; \ - return sym +#define RET_TY(CTYPE, SIGN, SYM) \ + llvmAsmlval.TypeVal.type = new PATypeHolder(CTYPE); \ + llvmAsmlval.TypeVal.signedness = SIGN; \ + return SYM namespace llvm { @@ -249,19 +243,19 @@ x86_stdcallcc { return X86_STDCALLCC_TOK; } x86_fastcallcc { return X86_FASTCALLCC_TOK; } -void{ RET_TY(Type::VoidTy, VOID); } -bool{ RET_TY(Type::BoolTy, BOOL); } -sbyte { RET_TY_OBSOLETE(Type::SByteTy, isSigned, SBYTE); } -ubyte { RET_TY_OBSOLETE(Type::UByteTy, isUnsigned, UBYTE); } -short { RET_TY_OBSOLETE(Type::ShortTy, isSigned, SHORT); } -ushort { RET_TY_OBSOLETE(Type::UShortTy,isUnsigned, USHORT); } -int { RET_TY_OBSOLETE(Type::IntTy, isSigned, INT);} -uint{ RET_TY_OBSOLETE(Type::UIntTy, isUnsigned, UINT); } -long{ RET_TY_OBSOLETE(Type::LongTy, isSigned, LONG); } -ulong { RET_TY_OBSOLETE(Type::ULongTy, isUnsigned, ULONG); } -float { RET_TY(Type::FloatTy, FLOAT); } -double { RET_TY(Type::DoubleTy, DOUBLE); } -label { RET_TY(Type::LabelTy, LABEL); } +void{ RET_TY(Type::VoidTy, isSignless, VOID); } +bool{ RET_TY(Type::BoolTy, isSignless, BOOL); } +sbyte { RET_TY(Type::SByteTy, isSigned, SBYTE); } +ubyte { RET_TY(Type::UByteTy, isUnsigned, UBYTE); } +short { RET_TY(Type::ShortTy, isSigned, SHORT); } +ushort { RET_TY(Type::UShortTy,isUnsigned, USHORT);} +int { RET_TY(Type::IntTy, isSigned, INT); } +uint{ RET_TY(Type::UIntTy, isUnsigned, UINT); } +long{ RET_TY(Type::LongTy, isSigned, LONG); } +ulong { RET_TY(Type::ULongTy, isUnsigned, ULONG); } +float { RET_TY(Type::FloatTy, isSignless, FLOAT); } +double { RET_TY(Type::DoubleTy,isSignless, DOUBLE);} +label { RET_TY(Type::LabelTy, isSignless, LABEL); } type{ return TYPE; } opaque { return OPAQUE; } Index: llvm/lib/AsmParser/llvmAsmParser.y diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.277 llvm/lib/AsmParser/llvmAsmParser.y:1.278 --- llvm/lib/AsmParser/llvmAsmParser.y:1.277Sun Nov 26 19:05:09 2006 +++ llvm/lib/AsmParser/llvmAsmParser.y Tue Nov 28 01:28:14 2006 @@ -83,8 +83,8 @@ Module *CurrentModule; std::mapconst Type *, ValueList Values; // Module level numbered definitions std::mapconst Type *,ValueList LateResolveValues; - std::vectorTypeInfoTypes; - std::mapValID, TypeInfo LateResolveTypes; + std::vectorPATypeHolderTypes; + std::mapValID, PATypeHolder LateResolveTypes; /// PlaceHolderInfo - When temporary placeholder objects are created, remember /// how they were referenced and on which line of the input they came from so @@ -217,7 +217,7 @@ case ValID::NumberVal: // Is it a numbered definition? // Module constants occupy the lowest numbered slots... if ((unsigned)D.Num CurModule.Types.size()) - return CurModule.Types[(unsigned)D.Num].type-get(); + return CurModule.Types[(unsigned)D.Num]; break; case ValID::NameVal: // Is it a named definition? if (const Type *N = CurModule.CurrentModule-getTypeByName(D.Name)) { @@ -247,16 +247,14 @@ } } - std::mapValID, TypeInfo::iterator I =CurModule.LateResolveTypes.find(D); + std::mapValID,
[llvm-commits] CVS: llvm/lib/AsmParser/Lexer.l ParserInternals.h llvmAsmParser.y
Changes in directory llvm/lib/AsmParser: Lexer.l updated: 1.82 - 1.83 ParserInternals.h updated: 1.46 - 1.47 llvmAsmParser.y updated: 1.275 - 1.276 --- Log message: For PR950: http://llvm.org/PR950 : Retain the signedness of the old integer types in a new TypeInfo structure so that it can be used in the grammar to implement auto-upgrade of things that depended on signedness of types. This doesn't implement any new functionality in the AsmParser, its just plumbing for future changes. --- Diffs of the changes: (+277 -215) Lexer.l | 37 +++- ParserInternals.h | 26 +++ llvmAsmParser.y | 429 -- 3 files changed, 277 insertions(+), 215 deletions(-) Index: llvm/lib/AsmParser/Lexer.l diff -u llvm/lib/AsmParser/Lexer.l:1.82 llvm/lib/AsmParser/Lexer.l:1.83 --- llvm/lib/AsmParser/Lexer.l:1.82 Wed Nov 8 00:47:33 2006 +++ llvm/lib/AsmParser/Lexer.l Sun Nov 19 17:07:00 2006 @@ -51,6 +51,17 @@ llvmAsmlval.type.obsolete = true; \ return sym +// Construct a token value for a non-obsolete type +#define RET_TY(CType, sym) \ + llvmAsmlval.TypeVal.type = new PATypeHolder(CType); \ + llvmAsmlval.TypeVal.signedness = isSignless; \ + return sym + +// Construct a token value for an obsolete token +#define RET_TY_OBSOLETE(CType, sign, sym) \ + llvmAsmlval.TypeVal.type = new PATypeHolder(CType); \ + llvmAsmlval.TypeVal.signedness = sign; \ + return sym namespace llvm { @@ -238,19 +249,19 @@ x86_stdcallcc { return X86_STDCALLCC_TOK; } x86_fastcallcc { return X86_FASTCALLCC_TOK; } -void{ llvmAsmlval.PrimType = Type::VoidTy ; return VOID; } -bool{ llvmAsmlval.PrimType = Type::BoolTy ; return BOOL; } -sbyte { llvmAsmlval.PrimType = Type::SByteTy ; return SBYTE; } -ubyte { llvmAsmlval.PrimType = Type::UByteTy ; return UBYTE; } -short { llvmAsmlval.PrimType = Type::ShortTy ; return SHORT; } -ushort { llvmAsmlval.PrimType = Type::UShortTy; return USHORT; } -int { llvmAsmlval.PrimType = Type::IntTy ; return INT;} -uint{ llvmAsmlval.PrimType = Type::UIntTy ; return UINT; } -long{ llvmAsmlval.PrimType = Type::LongTy ; return LONG; } -ulong { llvmAsmlval.PrimType = Type::ULongTy ; return ULONG; } -float { llvmAsmlval.PrimType = Type::FloatTy ; return FLOAT; } -double { llvmAsmlval.PrimType = Type::DoubleTy; return DOUBLE; } -label { llvmAsmlval.PrimType = Type::LabelTy ; return LABEL; } +void{ RET_TY(Type::VoidTy, VOID); } +bool{ RET_TY(Type::BoolTy, BOOL); } +sbyte { RET_TY_OBSOLETE(Type::SByteTy, isSigned, SBYTE); } +ubyte { RET_TY_OBSOLETE(Type::UByteTy, isUnsigned, UBYTE); } +short { RET_TY_OBSOLETE(Type::ShortTy, isSigned, SHORT); } +ushort { RET_TY_OBSOLETE(Type::UShortTy,isUnsigned, USHORT); } +int { RET_TY_OBSOLETE(Type::IntTy, isSigned, INT);} +uint{ RET_TY_OBSOLETE(Type::UIntTy, isUnsigned, UINT); } +long{ RET_TY_OBSOLETE(Type::LongTy, isSigned, LONG); } +ulong { RET_TY_OBSOLETE(Type::ULongTy, isUnsigned, ULONG); } +float { RET_TY(Type::FloatTy, FLOAT); } +double { RET_TY(Type::DoubleTy, DOUBLE); } +label { RET_TY(Type::LabelTy, LABEL); } type{ return TYPE; } opaque { return OPAQUE; } Index: llvm/lib/AsmParser/ParserInternals.h diff -u llvm/lib/AsmParser/ParserInternals.h:1.46 llvm/lib/AsmParser/ParserInternals.h:1.47 --- llvm/lib/AsmParser/ParserInternals.h:1.46 Thu Oct 26 01:15:43 2006 +++ llvm/lib/AsmParser/ParserInternals.hSun Nov 19 17:07:00 2006 @@ -217,4 +217,30 @@ typedef OpcodeInfollvm::Instruction::MemoryOps MemOpInfo; typedef OpcodeInfollvm::Instruction::OtherOps OtherOpInfo; +/// This enumeration is used to indicate if a type is signed, signless or +/// unsigned. It is used for backwards compatibility with assembly code that +/// pre-dates the signless types conversion. +enum Signedness { + isSigned, + isUnsigned, + isSignless +}; + +/// This structure is used to keep track of the signedness of the obsolete +/// integer types. Instead of creating an llvm::Type directly, the Lexer will +/// create instances of TypeInfo which retains the signedness indication so +/// it can be used by the parser for upgrade decisions. +/// For example if uint is encountered then the type will be set int32 +/// and the signedness will be isUnsigned. If the type is not obsolete +/// then signedness will be isSignless. +struct TypeInfo { + llvm::PATypeHolder *type; + Signedness signedness; +}; + +struct ValueInfo { + std::vectorllvm::Value* valuelist; + std::vectorSignedness signlist; +}; + #endif Index: llvm/lib/AsmParser/llvmAsmParser.y diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.275 llvm/lib/AsmParser/llvmAsmParser.y:1.276 ---
[llvm-commits] CVS: llvm/lib/AsmParser/Lexer.l llvmAsmParser.y
Changes in directory llvm/lib/AsmParser: Lexer.l updated: 1.80 - 1.81 llvmAsmParser.y updated: 1.271 - 1.272 --- Log message: For PR950: http://llvm.org/PR950 : Replace the REM instruction with UREM, SREM and FREM. --- Diffs of the changes: (+19 -8) Lexer.l |5 - llvmAsmParser.y | 22 +++--- 2 files changed, 19 insertions(+), 8 deletions(-) Index: llvm/lib/AsmParser/Lexer.l diff -u llvm/lib/AsmParser/Lexer.l:1.80 llvm/lib/AsmParser/Lexer.l:1.81 --- llvm/lib/AsmParser/Lexer.l:1.80 Thu Oct 26 01:15:43 2006 +++ llvm/lib/AsmParser/Lexer.l Wed Nov 1 19:53:58 2006 @@ -261,7 +261,10 @@ udiv{ RET_TOK(BinaryOpVal, UDiv, UDIV); } sdiv{ RET_TOK(BinaryOpVal, SDiv, SDIV); } fdiv{ RET_TOK(BinaryOpVal, FDiv, FDIV); } -rem { RET_TOK(BinaryOpVal, Rem, REM); } +rem { RET_TOK_OBSOLETE(BinaryOpVal, URem, UREM); } +urem{ RET_TOK(BinaryOpVal, URem, UREM); } +srem{ RET_TOK(BinaryOpVal, SRem, SREM); } +frem{ RET_TOK(BinaryOpVal, FRem, FREM); } and { RET_TOK(BinaryOpVal, And, AND); } or { RET_TOK(BinaryOpVal, Or , OR ); } xor { RET_TOK(BinaryOpVal, Xor, XOR); } Index: llvm/lib/AsmParser/llvmAsmParser.y diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.271 llvm/lib/AsmParser/llvmAsmParser.y:1.272 --- llvm/lib/AsmParser/llvmAsmParser.y:1.271Thu Oct 26 01:15:43 2006 +++ llvm/lib/AsmParser/llvmAsmParser.y Wed Nov 1 19:53:58 2006 @@ -836,7 +836,7 @@ // Depending on the opcode .. switch (OI.opcode) { default: - GenerateError(Invalid Obsolete OpCode); + GenerateError(Invalid obsolete opCode (check Lexer.l)); break; case Instruction::UDiv: // Handle cases where the opcode needs to change @@ -845,12 +845,17 @@ else if (Ty-isSigned()) OI.opcode = Instruction::SDiv; break; +case Instruction::URem: + if (Ty-isFloatingPoint()) +OI.opcode = Instruction::FRem; + else if (Ty-isSigned()) +OI.opcode = Instruction::SRem; + break; } // Its not obsolete any more, we fixed it. OI.obsolete = false; } - - + // common code from the two 'RunVMAsmParser' functions static Module* RunParser(Module * M) { @@ -1113,7 +1118,7 @@ // Binary Operators %type BinaryOpVal ArithmeticOps LogicalOps SetCondOps // Binops Subcatagories -%token BinaryOpVal ADD SUB MUL UDIV SDIV FDIV REM AND OR XOR +%token BinaryOpVal ADD SUB MUL UDIV SDIV FDIV UREM SREM FREM AND OR XOR %token BinaryOpVal SETLE SETGE SETLT SETGT SETEQ SETNE // Binary Comparators // Memory Instructions @@ -1151,7 +1156,7 @@ // Operations that are notably excluded from this list include: // RET, BR, SWITCH because they end basic blocks and are treated specially. // -ArithmeticOps: ADD | SUB | MUL | UDIV | SDIV | FDIV | REM ; +ArithmeticOps: ADD | SUB | MUL | UDIV | SDIV | FDIV | UREM | SREM | FREM; LogicalOps : AND | OR | XOR; SetCondOps : SETLE | SETGE | SETLT | SETGT | SETEQ | SETNE; @@ -2465,8 +2470,11 @@ !isaPackedType((*$2).get())) GEN_ERROR( Arithmetic operator requires integer, FP, or packed operands!); -if (isaPackedType((*$2).get()) $1.opcode == Instruction::Rem) - GEN_ERROR(Rem not supported on packed types!); +if (isaPackedType((*$2).get()) +($1.opcode == Instruction::URem || + $1.opcode == Instruction::SRem || + $1.opcode == Instruction::FRem)) + GEN_ERROR(U/S/FRem not supported on packed types!); // Upgrade the opcode from obsolete versions before we do anything with it. sanitizeOpCode($1,*$2); CHECK_FOR_ERROR; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/AsmParser/Lexer.l llvmAsmParser.y
Changes in directory llvm/lib/AsmParser: Lexer.l updated: 1.78 - 1.79 llvmAsmParser.y updated: 1.267 - 1.268 --- Log message: change keyword to datalayout --- Diffs of the changes: (+3 -3) Lexer.l |2 +- llvmAsmParser.y |4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) Index: llvm/lib/AsmParser/Lexer.l diff -u llvm/lib/AsmParser/Lexer.l:1.78 llvm/lib/AsmParser/Lexer.l:1.79 --- llvm/lib/AsmParser/Lexer.l:1.78 Tue Oct 17 21:19:55 2006 +++ llvm/lib/AsmParser/Lexer.l Sun Oct 22 01:07:41 2006 @@ -210,7 +210,7 @@ deplibs { return DEPLIBS; } endian { return ENDIAN; } pointersize { return POINTERSIZE; } -data { return DATA; } +datalayout { return DATALAYOUT; } little { return LITTLE; } big { return BIG; } volatile{ return VOLATILE; } Index: llvm/lib/AsmParser/llvmAsmParser.y diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.267 llvm/lib/AsmParser/llvmAsmParser.y:1.268 --- llvm/lib/AsmParser/llvmAsmParser.y:1.267Fri Oct 20 02:07:24 2006 +++ llvm/lib/AsmParser/llvmAsmParser.y Sun Oct 22 01:07:41 2006 @@ -1068,7 +1068,7 @@ %token DEPLIBS CALL TAIL ASM_TOK MODULE SIDEEFFECT %token CC_TOK CCC_TOK CSRETCC_TOK FASTCC_TOK COLDCC_TOK %token X86_STDCALLCC_TOK X86_FASTCALLCC_TOK -%token DATA +%token DATALAYOUT %type UIntVal OptCallingConv // Basic Block Terminating Operators @@ -1874,7 +1874,7 @@ free($3); CHECK_FOR_ERROR }; - | DATA '=' STRINGCONSTANT { + | DATALAYOUT '=' STRINGCONSTANT { CurModule.CurrentModule-setDataLayout($3); free($3); CHECK_FOR_ERROR ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/AsmParser/Lexer.l Lexer.l.cvs llvmAsmParser.y llvmAsmParser.y.cvs
Changes in directory llvm/lib/AsmParser: Lexer.l updated: 1.75 - 1.76 Lexer.l.cvs updated: 1.5 - 1.6 llvmAsmParser.y updated: 1.258 - 1.259 llvmAsmParser.y.cvs updated: 1.10 - 1.11 --- Log message: Adding dllimport, dllexport and external weak linkage types. DLL* linkages got full (I hope) codegeneration support in C both x86 assembler backends. External weak linkage added for future use, we don't provide any codegeneration, etc. support for it. --- Diffs of the changes: (+106 -30) Lexer.l |3 ++ Lexer.l.cvs |3 ++ llvmAsmParser.y | 65 llvmAsmParser.y.cvs | 65 4 files changed, 106 insertions(+), 30 deletions(-) Index: llvm/lib/AsmParser/Lexer.l diff -u llvm/lib/AsmParser/Lexer.l:1.75 llvm/lib/AsmParser/Lexer.l:1.76 --- llvm/lib/AsmParser/Lexer.l:1.75 Fri Aug 18 03:43:06 2006 +++ llvm/lib/AsmParser/Lexer.l Thu Sep 14 13:23:26 2006 @@ -191,6 +191,9 @@ linkonce{ return LINKONCE; } weak{ return WEAK; } appending { return APPENDING; } +dllimport { return DLLIMPORT; } +dllexport { return DLLEXPORT; } +extern_weak { return EXTERN_WEAK; } uninitialized { return EXTERNAL; }/* Deprecated, turn into external */ external{ return EXTERNAL; } implementation { return IMPLEMENTATION; } Index: llvm/lib/AsmParser/Lexer.l.cvs diff -u llvm/lib/AsmParser/Lexer.l.cvs:1.5 llvm/lib/AsmParser/Lexer.l.cvs:1.6 --- llvm/lib/AsmParser/Lexer.l.cvs:1.5 Fri Aug 18 03:43:06 2006 +++ llvm/lib/AsmParser/Lexer.l.cvs Thu Sep 14 13:23:26 2006 @@ -191,6 +191,9 @@ linkonce{ return LINKONCE; } weak{ return WEAK; } appending { return APPENDING; } +dllimport { return DLLIMPORT; } +dllexport { return DLLEXPORT; } +extern_weak { return EXTERN_WEAK; } uninitialized { return EXTERNAL; }/* Deprecated, turn into external */ external{ return EXTERNAL; } implementation { return IMPLEMENTATION; } Index: llvm/lib/AsmParser/llvmAsmParser.y diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.258 llvm/lib/AsmParser/llvmAsmParser.y:1.259 --- llvm/lib/AsmParser/llvmAsmParser.y:1.258Fri Aug 18 12:34:24 2006 +++ llvm/lib/AsmParser/llvmAsmParser.y Thu Sep 14 13:23:26 2006 @@ -150,9 +150,10 @@ static struct PerFunctionInfo { Function *CurrentFunction; // Pointer to current function being created - std::mapconst Type*, ValueList Values; // Keep track of #'d definitions + std::mapconst Type*, ValueList Values; // Keep track of #'d definitions std::mapconst 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. /// BBForwardRefs - When we see forward references to basic blocks, keep /// track of them here. @@ -163,6 +164,7 @@ inline PerFunctionInfo() { CurrentFunction = 0; isDeclare = false; +Linkage = GlobalValue::ExternalLinkage; } inline void FunctionStart(Function *M) { @@ -184,6 +186,7 @@ Values.clear(); // Clear out function local definitions CurrentFunction = 0; isDeclare = false; +Linkage = GlobalValue::ExternalLinkage; } } CurFun; // Info for the current function... @@ -998,7 +1001,8 @@ %token IMPLEMENTATION ZEROINITIALIZER TRUETOK FALSETOK BEGINTOK ENDTOK %token DECLARE GLOBAL CONSTANT SECTION VOLATILE -%token TO DOTDOTDOT NULL_TOK UNDEF CONST INTERNAL LINKONCE WEAK APPENDING +%token TO DOTDOTDOT NULL_TOK UNDEF CONST INTERNAL LINKONCE WEAK APPENDING +%token DLLIMPORT DLLEXPORT EXTERN_WEAK %token OPAQUE NOT EXTERNAL TARGET TRIPLE ENDIAN POINTERSIZE LITTLE BIG ALIGN %token DEPLIBS CALL TAIL ASM_TOK MODULE SIDEEFFECT %token CC_TOK CCC_TOK CSRETCC_TOK FASTCC_TOK COLDCC_TOK @@ -1070,11 +1074,14 @@ CHECK_FOR_ERROR }; -OptLinkage : INTERNAL { $$ = GlobalValue::InternalLinkage; } | - LINKONCE { $$ = GlobalValue::LinkOnceLinkage; } | - WEAK { $$ = GlobalValue::WeakLinkage; } | - APPENDING { $$ = GlobalValue::AppendingLinkage; } | - /*empty*/ { $$ = GlobalValue::ExternalLinkage; }; +OptLinkage : INTERNAL{ $$ = GlobalValue::InternalLinkage; } | + LINKONCE{ $$ = GlobalValue::LinkOnceLinkage; } | + WEAK{ $$ = GlobalValue::WeakLinkage; } | + APPENDING { $$ = GlobalValue::AppendingLinkage; } | + DLLIMPORT { $$ = GlobalValue::DLLImportLinkage; } | + DLLEXPORT { $$ = GlobalValue::DLLExportLinkage; } | + EXTERN_WEAK { $$ = GlobalValue::ExternalWeakLinkage; } | + /*empty*/ { $$ = GlobalValue::ExternalLinkage; }; OptCallingConv : /*empty*/ { $$ = CallingConv::C; } | CCC_TOK{
[llvm-commits] CVS: llvm/lib/AsmParser/Lexer.l llvmAsmParser.y
Changes in directory llvm/lib/AsmParser: Lexer.l updated: 1.72 - 1.73 llvmAsmParser.y updated: 1.250 - 1.251 --- Log message: Parse shufflevector --- Diffs of the changes: (+7 -1) Lexer.l |1 + llvmAsmParser.y |7 ++- 2 files changed, 7 insertions(+), 1 deletion(-) Index: llvm/lib/AsmParser/Lexer.l diff -u llvm/lib/AsmParser/Lexer.l:1.72 llvm/lib/AsmParser/Lexer.l:1.73 --- llvm/lib/AsmParser/Lexer.l:1.72 Wed Feb 15 01:02:59 2006 +++ llvm/lib/AsmParser/Lexer.l Fri Apr 7 20:18:35 2006 @@ -277,6 +277,7 @@ extractelement { RET_TOK(OtherOpVal, ExtractElement, EXTRACTELEMENT); } insertelement { RET_TOK(OtherOpVal, InsertElement, INSERTELEMENT); } +shufflevector { RET_TOK(OtherOpVal, ShuffleVector, SHUFFLEVECTOR); } {VarID} { Index: llvm/lib/AsmParser/llvmAsmParser.y diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.250 llvm/lib/AsmParser/llvmAsmParser.y:1.251 --- llvm/lib/AsmParser/llvmAsmParser.y:1.250Sat Mar 4 01:53:16 2006 +++ llvm/lib/AsmParser/llvmAsmParser.y Fri Apr 7 20:18:35 2006 @@ -998,7 +998,7 @@ // Other Operators %type OtherOpVal ShiftOps %token OtherOpVal PHI_TOK CAST SELECT SHL SHR VAARG -%token OtherOpVal EXTRACTELEMENT INSERTELEMENT +%token OtherOpVal EXTRACTELEMENT INSERTELEMENT SHUFFLEVECTOR %token VAARG_old VANEXT_old //OBSOLETE @@ -2260,6 +2260,11 @@ ThrowException(Third operand of insertelement must be uint!); $$ = new InsertElementInst($2, $4, $6); } + | SHUFFLEVECTOR ResolvedVal ',' ResolvedVal ',' ResolvedVal { +if (!ShuffleVectorInst::isValidOperands($2, $4, $6)) + ThrowException(Invalid shufflevector operands!); +$$ = new ShuffleVectorInst($2, $4, $6); + } | PHI_TOK PHIList { const Type *Ty = $2-front().first-getType(); if (!Ty-isFirstClassType()) ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/AsmParser/Lexer.l llvmAsmParser.y
Changes in directory llvm/lib/AsmParser: Lexer.l updated: 1.68 - 1.69 llvmAsmParser.y updated: 1.245 - 1.246 --- Log message: Add support for parsing global asm blocks --- Diffs of the changes: (+22 -4) Lexer.l |1 + llvmAsmParser.y | 25 + 2 files changed, 22 insertions(+), 4 deletions(-) Index: llvm/lib/AsmParser/Lexer.l diff -u llvm/lib/AsmParser/Lexer.l:1.68 llvm/lib/AsmParser/Lexer.l:1.69 --- llvm/lib/AsmParser/Lexer.l:1.68 Tue Jan 17 14:06:24 2006 +++ llvm/lib/AsmParser/Lexer.l Mon Jan 23 17:05:15 2006 @@ -212,6 +212,7 @@ volatile{ return VOLATILE; } align { return ALIGN; } section { return SECTION; } +asm { return ASM_TOK; } cc { return CC_TOK; } ccc { return CCC_TOK; } Index: llvm/lib/AsmParser/llvmAsmParser.y diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.245 llvm/lib/AsmParser/llvmAsmParser.y:1.246 --- llvm/lib/AsmParser/llvmAsmParser.y:1.245Wed Jan 18 19:21:04 2006 +++ llvm/lib/AsmParser/llvmAsmParser.y Mon Jan 23 17:05:15 2006 @@ -967,7 +967,7 @@ %token DECLARE GLOBAL CONSTANT SECTION VOLATILE %token TO DOTDOTDOT NULL_TOK UNDEF CONST INTERNAL LINKONCE WEAK APPENDING %token OPAQUE NOT EXTERNAL TARGET TRIPLE ENDIAN POINTERSIZE LITTLE BIG ALIGN -%token DEPLIBS CALL TAIL +%token DEPLIBS CALL TAIL ASM_TOK %token CC_TOK CCC_TOK FASTCC_TOK COLDCC_TOK %type UIntVal OptCallingConv @@ -1256,11 +1256,12 @@ when array has size + itostr(NumElements) + !); std::vectorConstant* Vals; if (ETy == Type::SByteTy) { - for (char *C = $3; C != EndStr; ++C) + for (signed char *C = (signed char *)$3; C != (signed char *)EndStr; ++C) Vals.push_back(ConstantSInt::get(ETy, *C)); } else if (ETy == Type::UByteTy) { - for (char *C = $3; C != EndStr; ++C) -Vals.push_back(ConstantUInt::get(ETy, (unsigned char)*C)); + for (unsigned char *C = (unsigned char *)$3; + C != (unsigned char*)EndStr; ++C) +Vals.push_back(ConstantUInt::get(ETy, *C)); } else { free($3); ThrowException(Cannot build string arrays of non byte sized elements!); @@ -1570,6 +1571,9 @@ | FunctionList FunctionProto { $$ = $1; } + | FunctionList ASM_TOK AsmBlock { +$$ = $1; + } | FunctionList IMPLEMENTATION { $$ = $1; } @@ -1608,6 +1612,8 @@ } | ConstPool FunctionProto { // Function prototypes can be in const pool } + | ConstPool ASM_TOK AsmBlock {// Asm blocks can be in the const pool + } | ConstPool OptAssign OptLinkage GlobalType ConstVal { if ($5 == 0) ThrowException(Global value initializer is not a constant!); CurGV = ParseGlobalVariable($2, $3, $4, $5-getType(), $5); @@ -1629,6 +1635,17 @@ }; +AsmBlock : STRINGCONSTANT { + const std::string AsmSoFar = CurModule.CurrentModule-getInlineAsm(); + char *EndStr = UnEscapeLexed($1, true); + std::string NewAsm($1, EndStr); + free($1); + + if (AsmSoFar.empty()) +CurModule.CurrentModule-setInlineAsm(NewAsm); + else +CurModule.CurrentModule-setInlineAsm(AsmSoFar+\n+NewAsm); +}; BigOrLittle : BIG{ $$ = Module::BigEndian; }; BigOrLittle : LITTLE { $$ = Module::LittleEndian; }; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits