diff options
author | Chris Lattner <sabre@nondot.org> | 2010-01-19 18:52:28 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-01-19 18:52:28 +0000 |
commit | 4340cb324665f7561cead81096c027e6bb9cdab5 (patch) | |
tree | f31de303402944afe6cee39f17d5bee7ab8fa4c0 /llvm/lib/MC/MCAsmStreamer.cpp | |
parent | 0c65fd49022849e1ba5d94459ea0128d7ab6c45f (diff) | |
download | bcm5719-llvm-4340cb324665f7561cead81096c027e6bb9cdab5.tar.gz bcm5719-llvm-4340cb324665f7561cead81096c027e6bb9cdab5.zip |
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.
llvm-svn: 93889
Diffstat (limited to 'llvm/lib/MC/MCAsmStreamer.cpp')
-rw-r--r-- | llvm/lib/MC/MCAsmStreamer.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/lib/MC/MCAsmStreamer.cpp b/llvm/lib/MC/MCAsmStreamer.cpp index 4e571ff98c5..317e74d5b32 100644 --- a/llvm/lib/MC/MCAsmStreamer.cpp +++ b/llvm/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) { |