Skip to content

Commit

Permalink
[MC] Implement EmitRawText in MCNullStreamer
Browse files Browse the repository at this point in the history
Summary:
This adds dummy implementation of `EmitRawText` in `MCNullStreamer`.

This fixes the behavior of `AsmPrinter` with `MCNullStreamer` on targets
on which no integrated assembler is used. An attempt to emit inline asm
on such a target would previously lead to a crash, since `AsmPrinter` does not
check for `hasRawTextSupport` in `EmitInlineAsm` and calls `EmitRawText`
anyway if integrated assembler is disabled (the behavior has changed
in D2686).

Error message printed by MCStreamer:

> EmitRawText called on an MCStreamer that doesn't support it, something
> must not be fully mc'ized

Patch by Eugene Sharygin

Reviewers: dsanders, echristo

Reviewed By: dsanders

Subscribers: eraman, llvm-commits

Differential Revision: https://reviews.llvm.org/D53938

llvm-svn: 345841
  • Loading branch information
dsandersllvm committed Nov 1, 2018
1 parent 84a2f8b commit 29ca764
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions llvm/lib/MC/MCNullStreamer.cpp
Expand Up @@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//

#include "llvm/ADT/StringRef.h"
#include "llvm/MC/MCInst.h"
#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCSymbol.h"
Expand All @@ -22,6 +23,9 @@ namespace {
/// @name MCStreamer Interface
/// @{

bool hasRawTextSupport() const override { return true; }
void EmitRawTextImpl(StringRef String) override {}

bool EmitSymbolAttribute(MCSymbol *Symbol,
MCSymbolAttr Attribute) override {
return true;
Expand Down
8 changes: 8 additions & 0 deletions llvm/test/CodeGen/Hexagon/inline-asm-filetype-null.ll
@@ -0,0 +1,8 @@
; RUN: llc -filetype=null < %s

target triple = "hexagon"

define void @foo() {
tail call void asm sideeffect "//", ""()
ret void
}

0 comments on commit 29ca764

Please sign in to comment.