[llvm-commits] [llvm] r93888 - in /llvm/trunk: include/llvm/MC/MCStreamer.h lib/MC/MCStreamer.cpp tools/llvm-mc/AsmParser.cpp
Chris Lattner
sabre at nondot.org
Tue Jan 19 10:45:47 PST 2010
Author: lattner
Date: Tue Jan 19 12:45:47 2010
New Revision: 93888
URL: http://llvm.org/viewvc/llvm-project?rev=93888&view=rev
Log:
add a "MCStreamer::EmitFill" method, and move the default implementation
(which just iteratively emits bytes) to MCStreamer.
Modified:
llvm/trunk/include/llvm/MC/MCStreamer.h
llvm/trunk/lib/MC/MCStreamer.cpp
llvm/trunk/tools/llvm-mc/AsmParser.cpp
Modified: llvm/trunk/include/llvm/MC/MCStreamer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCStreamer.h?rev=93888&r1=93887&r2=93888&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCStreamer.h (original)
+++ llvm/trunk/include/llvm/MC/MCStreamer.h Tue Jan 19 12:45:47 2010
@@ -168,6 +168,11 @@
/// match a native machine width.
virtual void EmitValue(const MCExpr *Value, unsigned Size) = 0;
+ /// EmitFill - Emit NumBytes bytes worth of the value specified by
+ /// FillValue. This implements directives such as '.space'.
+ virtual void EmitFill(uint64_t NumBytes, uint8_t FillValue = 0);
+
+
/// EmitValueToAlignment - Emit some number of copies of @param Value until
/// the byte alignment @param ByteAlignment is reached.
///
Modified: llvm/trunk/lib/MC/MCStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCStreamer.cpp?rev=93888&r1=93887&r2=93888&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCStreamer.cpp (original)
+++ llvm/trunk/lib/MC/MCStreamer.cpp Tue Jan 19 12:45:47 2010
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
#include "llvm/MC/MCStreamer.h"
+#include "llvm/MC/MCExpr.h"
using namespace llvm;
@@ -16,3 +17,11 @@
MCStreamer::~MCStreamer() {
}
+
+/// EmitFill - Emit NumBytes bytes worth of the value specified by
+/// FillValue. This implements directives such as '.space'.
+void MCStreamer::EmitFill(uint64_t NumBytes, uint8_t FillValue) {
+ const MCExpr *E = MCConstantExpr::Create(FillValue, getContext());
+ for (uint64_t i = 0, e = NumBytes; i != e; ++i)
+ EmitValue(E, 1);
+}
Modified: llvm/trunk/tools/llvm-mc/AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.cpp?rev=93888&r1=93887&r2=93888&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mc/AsmParser.cpp (original)
+++ llvm/trunk/tools/llvm-mc/AsmParser.cpp Tue Jan 19 12:45:47 2010
@@ -1041,8 +1041,7 @@
return TokError("invalid number of bytes in '.space' directive");
// FIXME: Sometimes the fill expr is 'nop' if it isn't supplied, instead of 0.
- for (uint64_t i = 0, e = NumBytes; i != e; ++i)
- Out.EmitValue(MCConstantExpr::Create(FillExpr, getContext()), 1);
+ Out.EmitFill(NumBytes, FillExpr);
return false;
}
More information about the llvm-commits
mailing list