summaryrefslogtreecommitdiff
path: root/lib/MC
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-01-19 18:52:28 +0000
committerChris Lattner <sabre@nondot.org>2010-01-19 18:52:28 +0000
commit6113b3d32396168f8f390343d426baa9f64e9009 (patch)
treec3d23cc24f6f3bdf668a02c6a5a8317c4cc207d1 /lib/MC
parentddf6bdde44287b5b559bc403a02ff971e15e8303 (diff)
downloadllvm-6113b3d32396168f8f390343d426baa9f64e9009.tar.gz
llvm-6113b3d32396168f8f390343d426baa9f64e9009.tar.bz2
llvm-6113b3d32396168f8f390343d426baa9f64e9009.tar.xz
add an MCAsmStreamer::EmitFill specialization of EmitFill that
emits one directive instead of N. Not doing this would be a significant regression on the # bytes generated by .fill. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93889 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC')
-rw-r--r--lib/MC/MCAsmStreamer.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/MC/MCAsmStreamer.cpp b/lib/MC/MCAsmStreamer.cpp
index 4e571ff98c..317e74d5b3 100644
--- a/lib/MC/MCAsmStreamer.cpp
+++ b/lib/MC/MCAsmStreamer.cpp
@@ -61,6 +61,7 @@ public:
virtual void EmitBytes(StringRef Data);
virtual void EmitValue(const MCExpr *Value, unsigned Size);
+ virtual void EmitFill(uint64_t NumBytes, uint8_t FillValue);
virtual void EmitValueToAlignment(unsigned ByteAlignment, int64_t Value = 0,
unsigned ValueSize = 1,
@@ -199,6 +200,20 @@ void MCAsmStreamer::EmitValue(const MCExpr *Value, unsigned Size) {
OS << ' ' << *truncateToSize(Value, Size) << '\n';
}
+/// EmitFill - Emit NumBytes bytes worth of the value specified by
+/// FillValue. This implements directives such as '.space'.
+void MCAsmStreamer::EmitFill(uint64_t NumBytes, uint8_t FillValue) {
+ if (const char *ZeroDirective = MAI.getZeroDirective()) {
+ OS << ZeroDirective << NumBytes;
+ if (FillValue != 0)
+ OS << ',' << (int)FillValue;
+ OS << '\n';
+ } else {
+ // Emit a byte at a time.
+ MCStreamer::EmitFill(NumBytes, FillValue);
+ }
+}
+
void MCAsmStreamer::EmitValueToAlignment(unsigned ByteAlignment, int64_t Value,
unsigned ValueSize,
unsigned MaxBytesToEmit) {