[MC] Implement EmitRawText in MCNullStreamer

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
This commit is contained in:
Daniel Sanders 2018-11-01 15:41:11 +00:00
parent 84a2f8b364
commit 29ca764492
2 changed files with 12 additions and 0 deletions

View File

@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
#include "llvm/ADT/StringRef.h"
#include "llvm/MC/MCInst.h"
#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCSymbol.h"
@ -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;

View File

@ -0,0 +1,8 @@
; RUN: llc -filetype=null < %s
target triple = "hexagon"
define void @foo() {
tail call void asm sideeffect "//", ""()
ret void
}