summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCAsmStreamer.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-04-03 21:35:55 +0000
committerChris Lattner <sabre@nondot.org>2010-04-03 21:35:55 +0000
commit8a87fb7633476e166cf8e7a2b4432d895a5cd3b7 (patch)
tree9edd3e47fcc1ce51646dec584127b30f902a55d6 /llvm/lib/MC/MCAsmStreamer.cpp
parentfed39fa7b3ec776dbdcd39460b039eeed5b80518 (diff)
downloadbcm5719-llvm-8a87fb7633476e166cf8e7a2b4432d895a5cd3b7.tar.gz
bcm5719-llvm-8a87fb7633476e166cf8e7a2b4432d895a5cd3b7.zip
add a new EmitInlineAsm function to asmprinter to handle inline asm.
If we have an MCAsmStreamer, we continue to emit asm textually, otherwise we (currently) emit an error to errs and ignore it. llvm-svn: 100289
Diffstat (limited to 'llvm/lib/MC/MCAsmStreamer.cpp')
-rw-r--r--llvm/lib/MC/MCAsmStreamer.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/llvm/lib/MC/MCAsmStreamer.cpp b/llvm/lib/MC/MCAsmStreamer.cpp
index 7a23aecf297..b92051791a0 100644
--- a/llvm/lib/MC/MCAsmStreamer.cpp
+++ b/llvm/lib/MC/MCAsmStreamer.cpp
@@ -68,6 +68,9 @@ public:
/// isVerboseAsm - Return true if this streamer supports verbose assembly at
/// all.
virtual bool isVerboseAsm() const { return IsVerboseAsm; }
+
+ /// hasRawTextSupport - We support EmitRawText.
+ virtual bool hasRawTextSupport() const { return true; }
/// AddComment - Add a comment that can be emitted to the generated .s
/// file if applicable as a QoI issue to make the output of the compiler
@@ -145,6 +148,11 @@ public:
virtual void EmitInstruction(const MCInst &Inst);
+ /// EmitRawText - If this file is backed by a assembly streamer, this dumps
+ /// the specified string in the output .s file. This capability is
+ /// indicated by the hasRawTextSupport() predicate.
+ virtual void EmitRawText(StringRef String);
+
virtual void Finish();
/// @}
@@ -195,7 +203,6 @@ void MCAsmStreamer::EmitCommentsAndEOL() {
CommentStream.resync();
}
-
static inline int64_t truncateToSize(int64_t Value, unsigned Bytes) {
assert(Bytes && "Invalid size!");
return Value & ((uint64_t) (int64_t) -1 >> (64 - Bytes * 8));
@@ -634,6 +641,19 @@ void MCAsmStreamer::EmitInstruction(const MCInst &Inst) {
EmitEOL();
}
+/// EmitRawText - If this file is backed by a assembly streamer, this dumps
+/// the specified string in the output .s file. This capability is
+/// indicated by the hasRawTextSupport() predicate.
+void MCAsmStreamer::EmitRawText(StringRef String) {
+ if (!CommentToEmit.empty() || CommentStream.GetNumBytesInBuffer() != 0)
+ EmitCommentsAndEOL();
+
+ OS << String;
+
+ if (!String.empty() && String.back() != '\n')
+ OS << '\n';
+}
+
void MCAsmStreamer::Finish() {
OS.flush();
}
OpenPOWER on IntegriCloud