summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorEhsan Akhgari <ehsan.akhgari@gmail.com>2014-09-22 20:40:36 +0000
committerEhsan Akhgari <ehsan.akhgari@gmail.com>2014-09-22 20:40:36 +0000
commitbb6bb07d18e2290f8451fe3c25b1107d3e3e14aa (patch)
tree80b2e0551c4387f59c1ebe33f8814556240f1895 /llvm/lib
parent6e9ae7804ba03ab3bf75985ebbd0cce154f25848 (diff)
downloadbcm5719-llvm-bb6bb07d18e2290f8451fe3c25b1107d3e3e14aa.tar.gz
bcm5719-llvm-bb6bb07d18e2290f8451fe3c25b1107d3e3e14aa.zip
ms-inline-asm: Fix parsing label names inside bracket expressions
Summary: This fixes a couple of issues. One is ensuring that AOK_Label rewrite rules have a lower priority than AOK_Skip rules, as AOK_Skip needs to be able to skip the brackets properly. The other part of the fix ensures that we don't overwrite Identifier when looking up the identifier, and that we use the locally available information to generate the AOK_Label rewrite in ParseIntelIdentifier. Doing that in CreateMemForInlineAsm would be problematic since the Start location there may point to the beginning of a bracket expression, and not necessarily the beginning of an identifier. This also means that we don't need to carry around the InternlName field, which helps simplify the code. Test Plan: This will be tested on the clang side. Reviewers: rnk Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D5445 llvm-svn: 218270
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
index 8fec1c3a49d..519ada2b4b9 100644
--- a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
+++ b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
@@ -1047,12 +1047,6 @@ std::unique_ptr<X86Operand> X86AsmParser::CreateMemForInlineAsm(
InstInfo->AsmRewrites->push_back(AsmRewrite(AOK_SizeDirective, Start,
/*Len=*/0, Size));
}
- if (!Info.InternalName.empty()) {
- // Push a rewrite for replacing the identifier name with the internal name.
- InstInfo->AsmRewrites->push_back(AsmRewrite(AOK_Label, Start,
- End.getPointer() - Start.getPointer(),
- Info.InternalName));
- }
}
// When parsing inline assembly we set the base register to a non-zero value
@@ -1347,9 +1341,14 @@ bool X86AsmParser::ParseIntelIdentifier(const MCExpr *&Val,
// If the identifier lookup was unsuccessful, assume that we are dealing with
// a label.
if (!Result) {
- Identifier = SemaCallback->LookupInlineAsmLabel(Identifier, getSourceManager(), Loc, false);
- assert(Identifier.size() && "We should have an internal name here.");
- Info.InternalName = Identifier;
+ StringRef InternalName =
+ SemaCallback->LookupInlineAsmLabel(Identifier, getSourceManager(),
+ Loc, false);
+ assert(InternalName.size() && "We should have an internal name here.");
+ // Push a rewrite for replacing the identifier name with the internal name.
+ InstInfo->AsmRewrites->push_back(AsmRewrite(AOK_Label, Loc,
+ Identifier.size(),
+ InternalName));
}
// Create the symbol reference.
OpenPOWER on IntegriCloud