diff options
author | Devang Patel <dpatel@apple.com> | 2008-09-02 20:52:40 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2008-09-02 20:52:40 +0000 |
commit | d49808184f1b01339921f3fa22077f0fabce407c (patch) | |
tree | 924cd3913c87e6cad4b7c7d704294e615b779c49 /lib/AsmParser/llvmAsmParser.y.cvs | |
parent | 81b2ab8a249c3652133a1dcc0209343cde9b499f (diff) |
Parse function notes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55646 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AsmParser/llvmAsmParser.y.cvs')
-rw-r--r-- | lib/AsmParser/llvmAsmParser.y.cvs | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/lib/AsmParser/llvmAsmParser.y.cvs b/lib/AsmParser/llvmAsmParser.y.cvs index 36b56eabc7..d004a4e399 100644 --- a/lib/AsmParser/llvmAsmParser.y.cvs +++ b/lib/AsmParser/llvmAsmParser.y.cvs @@ -995,6 +995,7 @@ Module *llvm::RunVMAsmParser(llvm::MemoryBuffer *MB) { llvm::GlobalValue::LinkageTypes Linkage; llvm::GlobalValue::VisibilityTypes Visibility; llvm::ParameterAttributes ParamAttrs; + llvm::FunctionNotes FunctionNotes; llvm::APInt *APIntVal; int64_t SInt64Val; uint64_t UInt64Val; @@ -1090,6 +1091,8 @@ Module *llvm::RunVMAsmParser(llvm::MemoryBuffer *MB) { %type <UIntVal> OptCallingConv LocalNumber %type <ParamAttrs> OptParamAttrs ParamAttr %type <ParamAttrs> OptFuncAttrs FuncAttr +%type <FunctionNotes> OptFuncNotes FuncNote +%type <FunctionNotes> FuncNoteList // Basic Block Terminating Operators %token <TermOpVal> RET BR SWITCH INVOKE UNWIND UNREACHABLE @@ -1123,6 +1126,9 @@ Module *llvm::RunVMAsmParser(llvm::MemoryBuffer *MB) { %token SIGNEXT ZEROEXT NORETURN INREG SRET NOUNWIND NOALIAS BYVAL NEST %token READNONE READONLY GC +// Function Notes +%token FNNOTE INLINE ALWAYS NEVER OPTIMIZEFORSIZE + // Visibility Styles %token DEFAULT HIDDEN PROTECTED @@ -1288,6 +1294,29 @@ OptFuncAttrs : /* empty */ { $$ = ParamAttr::None; } } ; +FuncNoteList : FuncNote { $$ = $1; } + | FuncNoteList ',' FuncNote { + FunctionNotes tmp = $1 | $3; + if ($3 == FP_NoInline && ($1 & FP_AlwaysInline)) + GEN_ERROR("Function Notes may include only one inline notes!") + if ($3 == FP_AlwaysInline && ($1 & FP_NoInline)) + GEN_ERROR("Function Notes may include only one inline notes!") + $$ = tmp; + CHECK_FOR_ERROR + } + ; + +FuncNote : INLINE '=' NEVER { $$ = FP_NoInline; } + | INLINE '=' ALWAYS { $$ = FP_AlwaysInline; } + | OPTIMIZEFORSIZE { $$ = FP_OptimizeForSize; } + ; + +OptFuncNotes : /* empty */ { $$ = FP_None; } + | FNNOTE '(' FuncNoteList ')' { + $$ = $3; + } + ; + OptGC : /* empty */ { $$ = 0; } | GC STRINGCONSTANT { $$ = $2; @@ -2303,7 +2332,7 @@ ArgList : ArgListH { }; FunctionHeaderH : OptCallingConv ResultTypes GlobalName '(' ArgList ')' - OptFuncAttrs OptSection OptAlign OptGC { + OptFuncAttrs OptSection OptAlign OptGC OptFuncNotes { std::string FunctionName(*$3); delete $3; // Free strdup'd memory! @@ -2405,6 +2434,9 @@ FunctionHeaderH : OptCallingConv ResultTypes GlobalName '(' ArgList ')' Fn->setGC($10->c_str()); delete $10; } + if ($11) { + Fn->setNotes($11); + } // Add all of the arguments we parsed to the function... if ($5) { // Is null if empty... |