[llvm-commits] [llvm] r40610 - in /llvm/trunk: lib/AsmParser/Lexer.l lib/AsmParser/llvmAsmParser.y test/Assembler/2007-07-30-AutoUpgradeZextSext.ll
Reid Spencer
rspencer at reidspencer.com
Mon Jul 30 19:57:38 PDT 2007
Author: reid
Date: Mon Jul 30 21:57:37 2007
New Revision: 40610
URL: http://llvm.org/viewvc/llvm-project?rev=40610&view=rev
Log:
For PR1553:
Make the AsmParser auto-upgrade the old zext and sext
keywords for parameter attributes and handle the
end-of-line ambiguity.
Added:
llvm/trunk/test/Assembler/2007-07-30-AutoUpgradeZextSext.ll
Modified:
llvm/trunk/lib/AsmParser/Lexer.l
llvm/trunk/lib/AsmParser/llvmAsmParser.y
Modified: llvm/trunk/lib/AsmParser/Lexer.l
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/Lexer.l?rev=40610&r1=40609&r2=40610&view=diff
==============================================================================
--- llvm/trunk/lib/AsmParser/Lexer.l (original)
+++ llvm/trunk/lib/AsmParser/Lexer.l Mon Jul 30 21:57:37 2007
@@ -177,6 +177,8 @@
*/
HexIntConstant [us]0x[0-9A-Fa-f]+
+/* WSNL - shorthand for newline followed by whitespace */
+WSNL [ \r\t\n]*$
%%
{Comment} { /* Ignore comments for now */ }
@@ -234,6 +236,10 @@
noalias { return NOALIAS; }
byval { return BYVAL; }
nest { return NEST; }
+sext{WSNL} { // For auto-upgrade only, drop in LLVM 3.0
+ return SIGNEXT; }
+zext{WSNL} { // For auto-upgrade only, drop in LLVM 3.0
+ return ZEROEXT; }
void { RET_TY(Type::VoidTy, VOID); }
float { RET_TY(Type::FloatTy, FLOAT); }
Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.y
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.y?rev=40610&r1=40609&r2=40610&view=diff
==============================================================================
--- llvm/trunk/lib/AsmParser/llvmAsmParser.y (original)
+++ llvm/trunk/lib/AsmParser/llvmAsmParser.y Mon Jul 30 21:57:37 2007
@@ -1225,7 +1225,9 @@
};
ParamAttr : ZEROEXT { $$ = ParamAttr::ZExt; }
+ | ZEXT { $$ = ParamAttr::ZExt; }
| SIGNEXT { $$ = ParamAttr::SExt; }
+ | SEXT { $$ = ParamAttr::SExt; }
| INREG { $$ = ParamAttr::InReg; }
| SRET { $$ = ParamAttr::StructRet; }
| NOALIAS { $$ = ParamAttr::NoAlias; }
Added: llvm/trunk/test/Assembler/2007-07-30-AutoUpgradeZextSext.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/2007-07-30-AutoUpgradeZextSext.ll?rev=40610&view=auto
==============================================================================
--- llvm/trunk/test/Assembler/2007-07-30-AutoUpgradeZextSext.ll (added)
+++ llvm/trunk/test/Assembler/2007-07-30-AutoUpgradeZextSext.ll Mon Jul 30 21:57:37 2007
@@ -0,0 +1,12 @@
+; Test that upgrading zext/sext attributes to zeroext and signext
+; works correctly.
+; PR1553
+; RUN: llvm-as < %s > /dev/null
+
+define i32 @bar() {
+ %t = call i8 @foo( i8 10 sext ) zext
+ %x = zext i8 %t to i32
+ ret i32 %x
+}
+
+declare i8 @foo(i8 signext ) zeroext
More information about the llvm-commits
mailing list