[PATCH] D52258: Fix for bug 34002

Maya Madhavan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 19 08:35:59 PDT 2018


maya.madhavan updated this revision to Diff 166135.
maya.madhavan added a comment.

Updated test case and call per Oliver Stannard's suggestion.


https://reviews.llvm.org/D52258

Files:
  include/llvm/MC/MCParser/MCTargetAsmParser.h
  lib/MC/MCParser/AsmParser.cpp
  lib/Target/ARM/AsmParser/ARMAsmParser.cpp
  test/MC/ARM/implicit-it-generation.s


Index: test/MC/ARM/implicit-it-generation.s
===================================================================
--- test/MC/ARM/implicit-it-generation.s
+++ test/MC/ARM/implicit-it-generation.s
@@ -73,12 +73,14 @@
   addeq r0, #1
 label:
   addeq r0, #1
-5:
+five:
   addeq r0, #1
 @ CHECK: it eq
 @ CHECK: addeq
+@ CHECK: label
 @ CHECK: it eq
 @ CHECK: addeq
+@ CHECK: five
 @ CHECK: it eq
 @ CHECK: addeq
 
Index: lib/Target/ARM/AsmParser/ARMAsmParser.cpp
===================================================================
--- lib/Target/ARM/AsmParser/ARMAsmParser.cpp
+++ lib/Target/ARM/AsmParser/ARMAsmParser.cpp
@@ -631,6 +631,8 @@
   void ReportNearMisses(SmallVectorImpl<NearMissInfo> &NearMisses, SMLoc IDLoc,
                         OperandVector &Operands);
 
+  void doBeforeLabelEmit(MCSymbol *Symbol) override;
+
   void onLabelParsed(MCSymbol *Symbol) override;
 };
 
@@ -9443,10 +9445,13 @@
   return false;
 }
 
-void ARMAsmParser::onLabelParsed(MCSymbol *Symbol) {
+void ARMAsmParser::doBeforeLabelEmit(MCSymbol *Symbol) {
   // We need to flush the current implicit IT block on a label, because it is
   // not legal to branch into an IT block.
   flushPendingInstructions(getStreamer());
+}
+
+void ARMAsmParser::onLabelParsed(MCSymbol *Symbol) {
   if (NextSymbolIsThumb) {
     getParser().getStreamer().EmitThumbFunc(Symbol);
     NextSymbolIsThumb = false;
Index: lib/MC/MCParser/AsmParser.cpp
===================================================================
--- lib/MC/MCParser/AsmParser.cpp
+++ lib/MC/MCParser/AsmParser.cpp
@@ -1808,6 +1808,8 @@
       Lex();
     }
 
+    getTargetParser().doBeforeLabelEmit(Sym);
+
     // Emit the label.
     if (!getTargetParser().isParsingInlineAsm())
       Out.EmitLabel(Sym, IDLoc);
Index: include/llvm/MC/MCParser/MCTargetAsmParser.h
===================================================================
--- include/llvm/MC/MCParser/MCTargetAsmParser.h
+++ include/llvm/MC/MCParser/MCTargetAsmParser.h
@@ -476,6 +476,9 @@
     return nullptr;
   }
 
+  // For actions that have to be performed before a label is emitted
+  virtual void doBeforeLabelEmit(MCSymbol *Symbol) {}
+  
   virtual void onLabelParsed(MCSymbol *Symbol) {}
 
   /// Ensure that all previously parsed instructions have been emitted to the


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52258.166135.patch
Type: text/x-patch
Size: 2285 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180919/2a7c3939/attachment.bin>


More information about the llvm-commits mailing list