diff options
author | Petr Hosek <phosek@chromium.org> | 2016-05-27 18:49:44 +0000 |
---|---|---|
committer | Petr Hosek <phosek@chromium.org> | 2016-05-27 18:49:44 +0000 |
commit | ec73d8b383a1b9868abdcd5910963331ae71e33c (patch) | |
tree | 78624c76c17eaf914811887c47643e71b3c35ecf /llvm/lib/MC/MCStreamer.cpp | |
parent | 1de49c9ffde764550981d5c65eccfe887aa38f08 (diff) | |
download | llvm-ec73d8b383a1b9868abdcd5910963331ae71e33c.zip llvm-ec73d8b383a1b9868abdcd5910963331ae71e33c.tar.gz llvm-ec73d8b383a1b9868abdcd5910963331ae71e33c.tar.bz2 |
[MC] Support symbolic expressions in assembly directives
This matches the behavior of GNU assembler which supports symbolic
expressions in absolute expressions used in assembly directives.
Differential Revision: http://reviews.llvm.org/D20656
llvm-svn: 271028
Diffstat (limited to 'llvm/lib/MC/MCStreamer.cpp')
-rw-r--r-- | llvm/lib/MC/MCStreamer.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/llvm/lib/MC/MCStreamer.cpp b/llvm/lib/MC/MCStreamer.cpp index 59bbc2e..9ed5a5f 100644 --- a/llvm/lib/MC/MCStreamer.cpp +++ b/llvm/lib/MC/MCStreamer.cpp @@ -135,9 +135,18 @@ void MCStreamer::EmitGPRel32Value(const MCExpr *Value) { /// 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); + EmitIntValue(FillValue, 1); +} + +void MCStreamer::emitFill(uint64_t NumValues, int64_t Size, int64_t Expr) { + int64_t NonZeroSize = Size > 4 ? 4 : Size; + Expr &= ~0ULL >> (64 - NonZeroSize * 8); + for (uint64_t i = 0, e = NumValues; i != e; ++i) { + EmitIntValue(Expr, NonZeroSize); + if (NonZeroSize < Size) + EmitIntValue(0, Size - NonZeroSize); + } } /// The implementation in this class just redirects to EmitFill. @@ -757,6 +766,9 @@ void MCStreamer::EmitValueImpl(const MCExpr *Value, unsigned Size, SMLoc Loc) { } void MCStreamer::EmitULEB128Value(const MCExpr *Value) {} void MCStreamer::EmitSLEB128Value(const MCExpr *Value) {} +void MCStreamer::emitFill(const MCExpr &NumBytes, uint64_t Value, SMLoc Loc) {} +void MCStreamer::emitFill(const MCExpr &NumValues, int64_t Size, int64_t Expr, + SMLoc Loc) {} void MCStreamer::EmitValueToAlignment(unsigned ByteAlignment, int64_t Value, unsigned ValueSize, unsigned MaxBytesToEmit) {} |