bool EmitRelocDirective(const MCExpr &Offset, StringRef Name,
const MCExpr *Expr, SMLoc Loc) override;
using MCStreamer::emitFill;
- void emitFill(uint64_t NumBytes, uint8_t FillValue) override;
void emitFill(const MCExpr &NumBytes, uint64_t FillValue,
SMLoc Loc = SMLoc()) override;
void emitFill(const MCExpr &NumValues, int64_t Size, int64_t Expr,
/// \brief 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);
+ void emitFill(uint64_t NumBytes, uint8_t FillValue);
/// \brief Emit \p Size bytes worth of the value specified by \p FillValue.
///
void EmitGPRel32Value(const MCExpr *Value) override;
-
- void emitFill(uint64_t NumBytes, uint8_t FillValue) override;
-
void emitFill(const MCExpr &NumBytes, uint64_t FillValue,
SMLoc Loc = SMLoc()) override;
EmitEOL();
}
-/// 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 (NumBytes == 0) return;
-
- const MCExpr *E = MCConstantExpr::create(NumBytes, getContext());
- emitFill(*E, FillValue);
-}
-
void MCAsmStreamer::emitFill(const MCExpr &NumBytes, uint64_t FillValue,
SMLoc Loc) {
+ int64_t IntNumBytes;
+ if (NumBytes.evaluateAsAbsolute(IntNumBytes) && IntNumBytes == 0)
+ return;
+
if (const char *ZeroDirective = MAI->getZeroDirective()) {
// FIXME: Emit location directives
OS << ZeroDirective;
return false;
}
-void MCObjectStreamer::emitFill(uint64_t NumBytes, uint8_t FillValue) {
- assert(getCurrentSectionOnly() && "need a section");
- insert(new MCFillFragment(FillValue, NumBytes));
-}
-
void MCObjectStreamer::emitFill(const MCExpr &NumBytes, uint64_t FillValue,
SMLoc Loc) {
MCDataFragment *DF = getOrCreateDataFragment();
return;
}
- if (IntNumBytes <= 0) {
+ if (IntNumBytes < 0) {
getContext().reportError(Loc, "invalid number of bytes");
return;
}
- emitFill(IntNumBytes, FillValue);
+ assert(getCurrentSectionOnly() && "need a section");
+ insert(new MCFillFragment(FillValue, IntNumBytes));
}
void MCObjectStreamer::emitFill(const MCExpr &NumValues, int64_t Size,
/// 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) {
- for (uint64_t i = 0, e = NumBytes; i != e; ++i)
- EmitIntValue(FillValue, 1);
+ emitFill(*MCConstantExpr::create(NumBytes, getContext()), FillValue);
}
void MCStreamer::emitFill(uint64_t NumValues, int64_t Size, int64_t Expr) {