[llvm] r345841 - [MC] Implement EmitRawText in MCNullStreamer
Daniel Sanders via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 1 08:41:12 PDT 2018
Author: dsanders
Date: Thu Nov 1 08:41:11 2018
New Revision: 345841
URL: http://llvm.org/viewvc/llvm-project?rev=345841&view=rev
Log:
[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
Added:
llvm/trunk/test/CodeGen/Hexagon/inline-asm-filetype-null.ll
Modified:
llvm/trunk/lib/MC/MCNullStreamer.cpp
Modified: llvm/trunk/lib/MC/MCNullStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCNullStreamer.cpp?rev=345841&r1=345840&r2=345841&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCNullStreamer.cpp (original)
+++ llvm/trunk/lib/MC/MCNullStreamer.cpp Thu Nov 1 08:41:11 2018
@@ -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;
Added: llvm/trunk/test/CodeGen/Hexagon/inline-asm-filetype-null.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Hexagon/inline-asm-filetype-null.ll?rev=345841&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/Hexagon/inline-asm-filetype-null.ll (added)
+++ llvm/trunk/test/CodeGen/Hexagon/inline-asm-filetype-null.ll Thu Nov 1 08:41:11 2018
@@ -0,0 +1,8 @@
+; RUN: llc -filetype=null < %s
+
+target triple = "hexagon"
+
+define void @foo() {
+ tail call void asm sideeffect "//", ""()
+ ret void
+}
More information about the llvm-commits
mailing list