diff options
author | Marina Yatsina <marina.yatsina@intel.com> | 2016-03-07 18:10:25 +0000 |
---|---|---|
committer | Marina Yatsina <marina.yatsina@intel.com> | 2016-03-07 18:10:25 +0000 |
commit | 770fdd38e937ce167626f902fc9d72c2b551b05d (patch) | |
tree | 077a2fd500c81791ad4ecb5d46a6b5750bb269c5 /lib/Parse/ParseStmtAsm.cpp | |
parent | 998d54500c7ee30e63f8ca29137103e12b7ca50d (diff) |
[ms-inline-asm][AVX512] Add ability to use k registers in MS inline asm + fix bag with curly braces
Until now curly braces could only be used in MS inline assembly to mark block start/end.
All curly braces were removed completely at a very early stage.
This approach caused bugs like:
"m{o}v eax, ebx" turned into "mov eax, ebx" without any error.
In addition, AVX-512 added special operands (e.g., k registers), which are also surrounded by curly braces that mark them as such.
Now, we need to keep the curly braces and identify at a later stage if they are marking block start/end (if so, ignore them), or surrounding special AVX-512 operands (if so, parse them as such).
This patch fixes the bug described above and enables the use of AVX-512 special operands.
This commit is the the clang part of the patch.
The clang part of the review is: http://reviews.llvm.org/D17766
The llvm part of the review is: http://reviews.llvm.org/D17767
Differential Revision: http://reviews.llvm.org/D17766
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@262842 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseStmtAsm.cpp')
-rw-r--r-- | lib/Parse/ParseStmtAsm.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Parse/ParseStmtAsm.cpp b/lib/Parse/ParseStmtAsm.cpp index 7acf324bbe..99b164d973 100644 --- a/lib/Parse/ParseStmtAsm.cpp +++ b/lib/Parse/ParseStmtAsm.cpp @@ -390,6 +390,7 @@ StmtResult Parser::ParseMicrosoftAsmStatement(SourceLocation AsmLoc) { if (!InAsmComment && Tok.is(tok::l_brace)) { // Consume the opening brace. SkippedStartOfLine = Tok.isAtStartOfLine(); + AsmToks.push_back(Tok); EndLoc = ConsumeBrace(); BraceNesting++; LBraceLocs.push_back(EndLoc); @@ -442,6 +443,11 @@ StmtResult Parser::ParseMicrosoftAsmStatement(SourceLocation AsmLoc) { BraceCount == (savedBraceCount + BraceNesting)) { // Consume the closing brace. SkippedStartOfLine = Tok.isAtStartOfLine(); + // Don't want to add the closing brace of the whole asm block + if (SingleLineMode || BraceNesting > 1) { + Tok.clearFlag(Token::LeadingSpace); + AsmToks.push_back(Tok); + } EndLoc = ConsumeBrace(); BraceNesting--; // Finish if all of the opened braces in the inline asm section were |