[PATCH] D53938: [MC] Implement EmitRawText in MCNullStreamer
Eugene Sharygin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 31 09:40:51 PDT 2018
eush created this revision.
eush added reviewers: dsanders, echristo.
Herald added a subscriber: eraman.
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 https://reviews.llvm.org/D2686).
Error message printed by MCStreamer:
> EmitRawText called on an MCStreamer that doesn't support it, something
> must not be fully mc'ized
Repository:
rL LLVM
https://reviews.llvm.org/D53938
Files:
lib/MC/MCNullStreamer.cpp
test/CodeGen/Hexagon/inline-asm-filetype-null.ll
Index: test/CodeGen/Hexagon/inline-asm-filetype-null.ll
===================================================================
--- /dev/null
+++ 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
+}
Index: lib/MC/MCNullStreamer.cpp
===================================================================
--- lib/MC/MCNullStreamer.cpp
+++ lib/MC/MCNullStreamer.cpp
@@ -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 @@
/// @name MCStreamer Interface
/// @{
+ bool hasRawTextSupport() const override { return true; }
+ void EmitRawTextImpl(StringRef String) override {}
+
bool EmitSymbolAttribute(MCSymbol *Symbol,
MCSymbolAttr Attribute) override {
return true;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53938.171946.patch
Type: text/x-patch
Size: 1063 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181031/ce08542c/attachment.bin>
More information about the llvm-commits
mailing list