summaryrefslogtreecommitdiff
path: root/lib/AsmParser/llvmAsmParser.y
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2008-12-15 01:34:58 +0000
committerNick Lewycky <nicholas@mxc.ca>2008-12-15 01:34:58 +0000
commite642658480ed0c9cde023a165edca237ba90bd31 (patch)
treeedaaf7d65af6cc9b3c06311be66b9cf764f65902 /lib/AsmParser/llvmAsmParser.y
parent30baa95afdf1199c2c5514310907b01ce5584cf5 (diff)
downloadllvm-e642658480ed0c9cde023a165edca237ba90bd31.tar.gz
llvm-e642658480ed0c9cde023a165edca237ba90bd31.tar.bz2
llvm-e642658480ed0c9cde023a165edca237ba90bd31.tar.xz
Introducing nocapture, a parameter attribute for pointers to indicate that the
callee will not introduce any new aliases of that pointer. The attributes had all bits allocated already, so I decided to collapse alignment. Alignment was previously stored as a 16-bit integer from bits 16 to 32 of the attribute, but it was required to be a power of 2. Now it's stored in log2 encoded form in five bits from 16 to 21. That gives us 11 more bits of space. You may have already noticed that you only need four bits to encode a 16-bit power of two, so why five bits? Because the AsmParser accepted 32-bit alignments, even though we couldn't store them (they were silently discarded). Now we can store them in memory, but not in the bitcode. The bitcode format was already storing these as 64-bit VBR integers. So, the bitcode format stays the same, keeping the alignment values stored as 16 bit raw values. There's some hideous code in the reader and writer that deals with this, waiting to be ripped out the moment we run out of bits again and have to replace the parameter attributes table encoding. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61019 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AsmParser/llvmAsmParser.y')
-rw-r--r--lib/AsmParser/llvmAsmParser.y23
1 files changed, 12 insertions, 11 deletions
diff --git a/lib/AsmParser/llvmAsmParser.y b/lib/AsmParser/llvmAsmParser.y
index 8b54251c65..350584f432 100644
--- a/lib/AsmParser/llvmAsmParser.y
+++ b/lib/AsmParser/llvmAsmParser.y
@@ -1136,8 +1136,8 @@ Module *llvm::RunVMAsmParser(llvm::MemoryBuffer *MB) {
%token <OtherOpVal> EXTRACTVALUE INSERTVALUE
// Function Attributes
-%token SIGNEXT ZEROEXT NORETURN INREG SRET NOUNWIND NOALIAS BYVAL NEST
-%token READNONE READONLY GC OPTSIZE NOINLINE ALWAYSINLINE SSP SSPREQ
+%token SIGNEXT ZEROEXT NORETURN INREG SRET NOUNWIND NOALIAS NOCAPTURE BYVAL
+%token READNONE READONLY GC OPTSIZE NOINLINE ALWAYSINLINE SSP SSPREQ NEST
// Visibility Styles
%token DEFAULT HIDDEN PROTECTED
@@ -1265,15 +1265,16 @@ OptCallingConv : /*empty*/ { $$ = CallingConv::C; } |
CHECK_FOR_ERROR
};
-Attribute : ZEROEXT { $$ = Attribute::ZExt; }
- | ZEXT { $$ = Attribute::ZExt; }
- | SIGNEXT { $$ = Attribute::SExt; }
- | SEXT { $$ = Attribute::SExt; }
- | INREG { $$ = Attribute::InReg; }
- | SRET { $$ = Attribute::StructRet; }
- | NOALIAS { $$ = Attribute::NoAlias; }
- | BYVAL { $$ = Attribute::ByVal; }
- | NEST { $$ = Attribute::Nest; }
+Attribute : ZEROEXT { $$ = Attribute::ZExt; }
+ | ZEXT { $$ = Attribute::ZExt; }
+ | SIGNEXT { $$ = Attribute::SExt; }
+ | SEXT { $$ = Attribute::SExt; }
+ | INREG { $$ = Attribute::InReg; }
+ | SRET { $$ = Attribute::StructRet; }
+ | NOALIAS { $$ = Attribute::NoAlias; }
+ | NOCAPTURE { $$ = Attribute::NoCapture; }
+ | BYVAL { $$ = Attribute::ByVal; }
+ | NEST { $$ = Attribute::Nest; }
| ALIGN EUINT64VAL { $$ =
Attribute::constructAlignmentFromInt($2); }
;