[llvm-commits] [llvm] r93889 - in /llvm/trunk: lib/MC/MCAsmStreamer.cpp test/MC/AsmParser/directive_space.s
Chris Lattner
sabre at nondot.org
Tue Jan 19 10:52:28 PST 2010
Author: lattner
Date: Tue Jan 19 12:52:28 2010
New Revision: 93889
URL: http://llvm.org/viewvc/llvm-project?rev=93889&view=rev
Log:
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.
Modified:
llvm/trunk/lib/MC/MCAsmStreamer.cpp
llvm/trunk/test/MC/AsmParser/directive_space.s
Modified: llvm/trunk/lib/MC/MCAsmStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmStreamer.cpp?rev=93889&r1=93888&r2=93889&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCAsmStreamer.cpp (original)
+++ llvm/trunk/lib/MC/MCAsmStreamer.cpp Tue Jan 19 12:52:28 2010
@@ -61,6 +61,7 @@
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 @@
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) {
Modified: llvm/trunk/test/MC/AsmParser/directive_space.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/directive_space.s?rev=93889&r1=93888&r2=93889&view=diff
==============================================================================
--- llvm/trunk/test/MC/AsmParser/directive_space.s (original)
+++ llvm/trunk/test/MC/AsmParser/directive_space.s Tue Jan 19 12:52:28 2010
@@ -1,12 +1,11 @@
-# RUN: llvm-mc -triple i386-unknown-unknown %s | FileCheck %s
+# RUN: llvm-mc -triple i386-apple-darwin %s | FileCheck %s
# CHECK: TEST0:
-# CHECK: .byte 0
+# CHECK: .space 1
TEST0:
.space 1
# CHECK: TEST1:
-# CHECK: .byte 3
-# CHECK: .byte 3
+# CHECK: .space 2,3
TEST1:
.space 2, 3
More information about the llvm-commits
mailing list