diff options
| author | Zhou Sheng <zhousheng00@gmail.com> | 2007-06-05 05:28:26 +0000 |
|---|---|---|
| committer | Zhou Sheng <zhousheng00@gmail.com> | 2007-06-05 05:28:26 +0000 |
| commit | 2444a9adeb18faef5c08486ea5174cdf8d039b03 (patch) | |
| tree | 2e8e43a36ee9a220ac75a108aec7bb34a13af823 | |
| parent | 59754300a87ec076c1456632a5c660a9d8985c97 (diff) | |
| download | bcm5719-llvm-2444a9adeb18faef5c08486ea5174cdf8d039b03.tar.gz bcm5719-llvm-2444a9adeb18faef5c08486ea5174cdf8d039b03.zip | |
Commit first round work of PR1373. "noalias" is now fully supported in
VMCore, BitCode, and Assembly. Documentation and test case paramattrs.ll
updated also.
llvm-svn: 37432
| -rw-r--r-- | llvm/docs/LangRef.html | 3 | ||||
| -rw-r--r-- | llvm/include/llvm/ParameterAttributes.h | 3 | ||||
| -rw-r--r-- | llvm/lib/AsmParser/Lexer.l | 1 | ||||
| -rw-r--r-- | llvm/lib/AsmParser/llvmAsmParser.y | 11 | ||||
| -rw-r--r-- | llvm/lib/VMCore/Function.cpp | 2 | ||||
| -rw-r--r-- | llvm/test/Feature/paramattrs.ll | 2 | ||||
| -rw-r--r-- | llvm/tools/llvm2cpp/CppWriter.cpp | 2 |
7 files changed, 18 insertions, 6 deletions
diff --git a/llvm/docs/LangRef.html b/llvm/docs/LangRef.html index e9b3c5601f1..8d2dc2f98a8 100644 --- a/llvm/docs/LangRef.html +++ b/llvm/docs/LangRef.html @@ -784,6 +784,9 @@ a power of 2.</p> <dt><tt>sret</tt></dt> <dd>This indicates that the parameter specifies the address of a structure that is the return value of the function in the source program.</dd> + <dt><tt>noalias</tt></dt> + <dd>This indicates that the parameter not alias any other object or any + other "noalias" objects during the function call. <dt><tt>noreturn</tt></dt> <dd>This function attribute indicates that the function never returns. This indicates to LLVM that every call to this function should be treated as if diff --git a/llvm/include/llvm/ParameterAttributes.h b/llvm/include/llvm/ParameterAttributes.h index 35d347690da..dcfe0951411 100644 --- a/llvm/include/llvm/ParameterAttributes.h +++ b/llvm/include/llvm/ParameterAttributes.h @@ -35,7 +35,8 @@ enum Attributes { NoReturn = 1 << 2, ///< mark the function as not returning InReg = 1 << 3, ///< force argument to be passed in register StructRet = 1 << 4, ///< hidden pointer to structure to return - NoUnwind = 1 << 5 ///< Function doesn't unwind stack + NoUnwind = 1 << 5, ///< Function doesn't unwind stack + NoAlias = 1 << 6 ///< Considered to not alias after call. }; } diff --git a/llvm/lib/AsmParser/Lexer.l b/llvm/lib/AsmParser/Lexer.l index ca6ee2cf73d..6391d17a52e 100644 --- a/llvm/lib/AsmParser/Lexer.l +++ b/llvm/lib/AsmParser/Lexer.l @@ -229,6 +229,7 @@ inreg { return INREG; } sret { return SRET; } nounwind { return NOUNWIND; } noreturn { return NORETURN; } +noalias { return NOALIAS; } void { RET_TY(Type::VoidTy, VOID); } float { RET_TY(Type::FloatTy, FLOAT); } diff --git a/llvm/lib/AsmParser/llvmAsmParser.y b/llvm/lib/AsmParser/llvmAsmParser.y index 01d67ed9803..94aeecaf831 100644 --- a/llvm/lib/AsmParser/llvmAsmParser.y +++ b/llvm/lib/AsmParser/llvmAsmParser.y @@ -1101,7 +1101,7 @@ Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) { %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 @@ OptCallingConv : /*empty*/ { $$ = CallingConv::C; } | 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; } diff --git a/llvm/lib/VMCore/Function.cpp b/llvm/lib/VMCore/Function.cpp index 8b91c18ffff..54ed25c7b7f 100644 --- a/llvm/lib/VMCore/Function.cpp +++ b/llvm/lib/VMCore/Function.cpp @@ -99,6 +99,8 @@ ParamAttrsList::getParamAttrsText(uint16_t Attrs) { Result += "nounwind "; if (Attrs & ParamAttr::InReg) Result += "inreg "; + if (Attrs & ParamAttr::NoAlias) + Result += "noalias "; if (Attrs & ParamAttr::StructRet) Result += "sret "; return Result; diff --git a/llvm/test/Feature/paramattrs.ll b/llvm/test/Feature/paramattrs.ll index 84116781f9e..01dc2fa93a8 100644 --- a/llvm/test/Feature/paramattrs.ll +++ b/llvm/test/Feature/paramattrs.ll @@ -8,6 +8,8 @@ declare i16 @"test"(i16 sext %arg) sext declare i8 @"test2" (i16 zext %a2) zext +declare i32 @"test3"(i32* noalias %p) + declare void @exit(i32) noreturn nounwind define i32 @main(i32 %argc, i8 **%argv) nounwind inreg { diff --git a/llvm/tools/llvm2cpp/CppWriter.cpp b/llvm/tools/llvm2cpp/CppWriter.cpp index 58c67b716e3..86e266147c0 100644 --- a/llvm/tools/llvm2cpp/CppWriter.cpp +++ b/llvm/tools/llvm2cpp/CppWriter.cpp @@ -473,6 +473,8 @@ CppWriter::printTypeInternal(const Type* Ty) { Out << " | ParamAttr::SExt"; if (attrs & ParamAttr::ZExt) Out << " | ParamAttr::ZExt"; + if (attrs & ParamAttr::NoAlias) + Out << " | ParamAttr::NoAlias"; if (attrs & ParamAttr::StructRet) Out << " | ParamAttr::StructRet"; if (attrs & ParamAttr::InReg) |

