summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCParser/AsmParser.cpp
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2012-10-22 20:50:25 +0000
committerEli Friedman <eli.friedman@gmail.com>2012-10-22 20:50:25 +0000
commit15e9b33678bc112658d6d1e47ad7fc59884d1d8b (patch)
treedd3b794690d0168a240ff3ce689fac5123624a18 /llvm/lib/MC/MCParser/AsmParser.cpp
parente4c1ef55cec60327e8e81e4df1b69dc473016578 (diff)
downloadbcm5719-llvm-15e9b33678bc112658d6d1e47ad7fc59884d1d8b.tar.gz
bcm5719-llvm-15e9b33678bc112658d6d1e47ad7fc59884d1d8b.zip
[ms-inline asm] Don't rewrite out parts of an inline-asm skipped by .if 0 and friends.
It's unnecessary and makes the generated assembly less faithful to the original source. llvm-svn: 166440
Diffstat (limited to 'llvm/lib/MC/MCParser/AsmParser.cpp')
-rw-r--r--llvm/lib/MC/MCParser/AsmParser.cpp25
1 files changed, 1 insertions, 24 deletions
diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp
index f22b2754f68..2f63fd46639 100644
--- a/llvm/lib/MC/MCParser/AsmParser.cpp
+++ b/llvm/lib/MC/MCParser/AsmParser.cpp
@@ -3579,8 +3579,7 @@ enum AsmRewriteKind {
AOK_Imm,
AOK_Input,
AOK_Output,
- AOK_SizeDirective,
- AOK_Skip
+ AOK_SizeDirective
};
struct AsmRewrite {
@@ -3620,24 +3619,9 @@ bool AsmParser::ParseMSInlineAsm(void *AsmLoc, std::string &AsmString,
// Clear the opcode.
setOpcode(~0x0);
- // Save the conditional ignore state of the parser prior to parsing the statement.
- bool PreParseCondStateIgnore = TheCondState.Ignore;
-
- // Save the starting point of this statement in case we need to skip it.
- SMLoc Start = getLexer().getLoc();
-
if (ParseStatement())
return true;
- // If PreParseCondStateIgnore is false, but TheCondState.Ignore is true, then we
- // just parsed a directive that changed the state to ignore. Don't skip
- // emitting this directive.
- if (PreParseCondStateIgnore && TheCondState.Ignore) {
- unsigned Len = getLexer().getLoc().getPointer() - Start.getPointer();
- AsmStrRewrites.push_back(AsmRewrite(AOK_Skip, Start, Len));
- continue;
- }
-
if (isInstruction()) {
const MCInstrDesc &Desc = MII->get(getOpcode());
@@ -3743,15 +3727,8 @@ bool AsmParser::ParseMSInlineAsm(void *AsmLoc, std::string &AsmString,
OS << StringRef(Start, Loc - Start);
PrevKind = Kind;
- // Skip the original expression.
- if (Kind == AOK_Skip) {
- Start = Loc + (*I).Len;
- continue;
- }
-
// Rewrite expressions in $N notation.
switch (Kind) {
- default: break;
case AOK_Imm:
OS << Twine("$$") + StringRef(Loc, (*I).Len);
break;
OpenPOWER on IntegriCloud