[llvm-commits] [llvm] r166440 - /llvm/trunk/lib/MC/MCParser/AsmParser.cpp
Eli Friedman
eli.friedman at gmail.com
Mon Oct 22 13:50:26 PDT 2012
Author: efriedma
Date: Mon Oct 22 15:50:25 2012
New Revision: 166440
URL: http://llvm.org/viewvc/llvm-project?rev=166440&view=rev
Log:
[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.
Modified:
llvm/trunk/lib/MC/MCParser/AsmParser.cpp
Modified: llvm/trunk/lib/MC/MCParser/AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/AsmParser.cpp?rev=166440&r1=166439&r2=166440&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCParser/AsmParser.cpp (original)
+++ llvm/trunk/lib/MC/MCParser/AsmParser.cpp Mon Oct 22 15:50:25 2012
@@ -3579,8 +3579,7 @@
AOK_Imm,
AOK_Input,
AOK_Output,
- AOK_SizeDirective,
- AOK_Skip
+ AOK_SizeDirective
};
struct AsmRewrite {
@@ -3620,24 +3619,9 @@
// 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 @@
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;
More information about the llvm-commits
mailing list