llvm.org GIT mirror llvm / f68a67a
Fix for bug 34002 - label generated before it block is finalized. Differential Revision: https://reviews.llvm.org/D52258 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@342615 91177308-0d34-0410-b5e6-96231b3b80d8 Maya Madhavan 1 year, 10 months ago
4 changed file(s) with 19 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
475475 return nullptr;
476476 }
477477
478 // For actions that have to be performed before a label is emitted
479 virtual void doBeforeLabelEmit(MCSymbol *Symbol) {}
480
478481 virtual void onLabelParsed(MCSymbol *Symbol) {}
479482
480483 /// Ensure that all previously parsed instructions have been emitted to the
18061806 if (getTok().is(AsmToken::EndOfStatement)) {
18071807 Lex();
18081808 }
1809
1810 getTargetParser().doBeforeLabelEmit(Sym);
18091811
18101812 // Emit the label.
18111813 if (!getTargetParser().isParsingInlineAsm())
629629 SMLoc IDLoc, OperandVector &Operands);
630630 void ReportNearMisses(SmallVectorImpl &NearMisses, SMLoc IDLoc,
631631 OperandVector &Operands);
632
633 void doBeforeLabelEmit(MCSymbol *Symbol) override;
632634
633635 void onLabelParsed(MCSymbol *Symbol) override;
634636 };
94429444 return false;
94439445 }
94449446
9445 void ARMAsmParser::onLabelParsed(MCSymbol *Symbol) {
9447 void ARMAsmParser::doBeforeLabelEmit(MCSymbol *Symbol) {
94469448 // We need to flush the current implicit IT block on a label, because it is
94479449 // not legal to branch into an IT block.
94489450 flushPendingInstructions(getStreamer());
9451 }
9452
9453 void ARMAsmParser::onLabelParsed(MCSymbol *Symbol) {
94499454 if (NextSymbolIsThumb) {
94509455 getParser().getStreamer().EmitThumbFunc(Symbol);
94519456 NextSymbolIsThumb = false;
7272 addeq r0, #1
7373 label:
7474 addeq r0, #1
75 5:
76 addeq r0, #1
77 @ CHECK: it eq
78 @ CHECK: addeq
79 @ CHECK: it eq
80 @ CHECK: addeq
75 five:
76 addeq r0, #1
77 @ CHECK: it eq
78 @ CHECK: addeq
79 @ CHECK: label
80 @ CHECK: it eq
81 @ CHECK: addeq
82 @ CHECK: five
8183 @ CHECK: it eq
8284 @ CHECK: addeq
8385