mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-24 22:24:54 +00:00
Parse function notes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55646 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -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...
|
||||
|
Reference in New Issue
Block a user