diff options
author | Gordon Henriksen <gordonhenriksen@mac.com> | 2007-12-10 03:18:06 +0000 |
---|---|---|
committer | Gordon Henriksen <gordonhenriksen@mac.com> | 2007-12-10 03:18:06 +0000 |
commit | 71183b6739707a34464187adf1d7df8848415fe5 (patch) | |
tree | b7bd2cf8d1c8bdd828327ce015c3202b572e0de7 /llvm/lib/AsmParser/llvmAsmParser.y.cvs | |
parent | e31cd5b564d48240788dcd6b721236b6adc7e0fe (diff) | |
download | bcm5719-llvm-71183b6739707a34464187adf1d7df8848415fe5.tar.gz bcm5719-llvm-71183b6739707a34464187adf1d7df8848415fe5.zip |
Adding a collector name attribute to Function in the IR. These
methods are new to Function:
bool hasCollector() const;
const std::string &getCollector() const;
void setCollector(const std::string &);
void clearCollector();
The assembly representation is as such:
define void @f() gc "shadow-stack" { ...
The implementation uses an on-the-side table to map Functions to
collector names, such that there is no overhead. A StringPool is
further used to unique collector names, which are extremely
likely to be unique per process.
llvm-svn: 44769
Diffstat (limited to 'llvm/lib/AsmParser/llvmAsmParser.y.cvs')
-rw-r--r-- | llvm/lib/AsmParser/llvmAsmParser.y.cvs | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/llvm/lib/AsmParser/llvmAsmParser.y.cvs b/llvm/lib/AsmParser/llvmAsmParser.y.cvs index 16204ccf9b9..57b6f81d8fb 100644 --- a/llvm/lib/AsmParser/llvmAsmParser.y.cvs +++ b/llvm/lib/AsmParser/llvmAsmParser.y.cvs @@ -1046,7 +1046,7 @@ Module *llvm::RunVMAsmParser(llvm::MemoryBuffer *MB) { %token<StrVal> STRINGCONSTANT ATSTRINGCONSTANT PCTSTRINGCONSTANT %type <StrVal> LocalName OptLocalName OptLocalAssign %type <StrVal> GlobalName OptGlobalAssign GlobalAssign -%type <StrVal> OptSection SectionString +%type <StrVal> OptSection SectionString OptGC %type <UIntVal> OptAlign OptCAlign @@ -1090,7 +1090,7 @@ Module *llvm::RunVMAsmParser(llvm::MemoryBuffer *MB) { // Function Attributes %token SIGNEXT ZEROEXT NORETURN INREG SRET NOUNWIND NOALIAS BYVAL NEST -%token READNONE READONLY +%token READNONE READONLY GC // Visibility Styles %token DEFAULT HIDDEN PROTECTED @@ -1244,6 +1244,12 @@ OptFuncAttrs : /* empty */ { $$ = ParamAttr::None; } } ; +OptGC : /* empty */ { $$ = 0; } + | GC STRINGCONSTANT { + $$ = $2; + } + ; + // OptAlign/OptCAlign - An optional alignment, and an optional alignment with // a comma before it. OptAlign : /*empty*/ { $$ = 0; } | @@ -2225,7 +2231,7 @@ ArgList : ArgListH { }; FunctionHeaderH : OptCallingConv ResultTypes GlobalName '(' ArgList ')' - OptFuncAttrs OptSection OptAlign { + OptFuncAttrs OptSection OptAlign OptGC { std::string FunctionName(*$3); delete $3; // Free strdup'd memory! @@ -2328,6 +2334,10 @@ FunctionHeaderH : OptCallingConv ResultTypes GlobalName '(' ArgList ')' Fn->setSection(*$8); delete $8; } + if ($10) { + Fn->setCollector($10->c_str()); + delete $10; + } // Add all of the arguments we parsed to the function... if ($5) { // Is null if empty... |