aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/MC/MCObjectStreamer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/MC/MCObjectStreamer.cpp')
-rw-r--r--llvm/lib/MC/MCObjectStreamer.cpp29
1 files changed, 18 insertions, 11 deletions
diff --git a/llvm/lib/MC/MCObjectStreamer.cpp b/llvm/lib/MC/MCObjectStreamer.cpp
index bf1ce76..24bed31 100644
--- a/llvm/lib/MC/MCObjectStreamer.cpp
+++ b/llvm/lib/MC/MCObjectStreamer.cpp
@@ -225,7 +225,7 @@ MCDataFragment *
MCObjectStreamer::getOrCreateDataFragment(const MCSubtargetInfo *STI) {
MCDataFragment *F = dyn_cast_or_null<MCDataFragment>(getCurrentFragment());
if (!F || !canReuseDataFragment(*F, *Assembler, STI)) {
- F = new MCDataFragment();
+ F = getContext().allocFragment<MCDataFragment>();
insert(F);
}
return F;
@@ -343,7 +343,7 @@ void MCObjectStreamer::emitULEB128Value(const MCExpr *Value) {
emitULEB128IntValue(IntValue);
return;
}
- insert(new MCLEBFragment(*Value, false));
+ insert(getContext().allocFragment<MCLEBFragment>(*Value, false));
}
void MCObjectStreamer::emitSLEB128Value(const MCExpr *Value) {
@@ -352,7 +352,7 @@ void MCObjectStreamer::emitSLEB128Value(const MCExpr *Value) {
emitSLEB128IntValue(IntValue);
return;
}
- insert(new MCLEBFragment(*Value, true));
+ insert(getContext().allocFragment<MCLEBFragment>(*Value, true));
}
void MCObjectStreamer::emitWeakReference(MCSymbol *Alias,
@@ -470,7 +470,8 @@ void MCObjectStreamer::emitInstToFragment(const MCInst &Inst,
// Always create a new, separate fragment here, because its size can change
// during relaxation.
- MCRelaxableFragment *IF = new MCRelaxableFragment(Inst, STI);
+ MCRelaxableFragment *IF =
+ getContext().allocFragment<MCRelaxableFragment>(Inst, STI);
insert(IF);
SmallString<128> Code;
@@ -544,7 +545,8 @@ void MCObjectStreamer::emitDwarfAdvanceLineAddr(int64_t LineDelta,
return;
}
const MCExpr *AddrDelta = buildSymbolDiff(*this, Label, LastLabel, SMLoc());
- insert(new MCDwarfLineAddrFragment(LineDelta, *AddrDelta));
+ insert(getContext().allocFragment<MCDwarfLineAddrFragment>(LineDelta,
+ *AddrDelta));
}
void MCObjectStreamer::emitDwarfLineEndEntry(MCSection *Section,
@@ -569,7 +571,8 @@ void MCObjectStreamer::emitDwarfAdvanceFrameAddr(const MCSymbol *LastLabel,
const MCSymbol *Label,
SMLoc Loc) {
const MCExpr *AddrDelta = buildSymbolDiff(*this, Label, LastLabel, Loc);
- insert(new MCDwarfCallFrameFragment(*AddrDelta, nullptr));
+ insert(getContext().allocFragment<MCDwarfCallFrameFragment>(*AddrDelta,
+ nullptr));
}
void MCObjectStreamer::emitCVLocDirective(unsigned FunctionId, unsigned FileNo,
@@ -640,7 +643,8 @@ void MCObjectStreamer::emitValueToAlignment(Align Alignment, int64_t Value,
unsigned MaxBytesToEmit) {
if (MaxBytesToEmit == 0)
MaxBytesToEmit = Alignment.value();
- insert(new MCAlignFragment(Alignment, Value, ValueSize, MaxBytesToEmit));
+ insert(getContext().allocFragment<MCAlignFragment>(
+ Alignment, Value, ValueSize, MaxBytesToEmit));
// Update the maximum alignment on the current section if necessary.
MCSection *CurSec = getCurrentSectionOnly();
@@ -657,7 +661,7 @@ void MCObjectStreamer::emitCodeAlignment(Align Alignment,
void MCObjectStreamer::emitValueToOffset(const MCExpr *Offset,
unsigned char Value,
SMLoc Loc) {
- insert(new MCOrgFragment(*Offset, Value, Loc));
+ insert(getContext().allocFragment<MCOrgFragment>(*Offset, Value, Loc));
}
// Associate DTPRel32 fixup with data and resize data area
@@ -844,7 +848,8 @@ void MCObjectStreamer::emitFill(const MCExpr &NumBytes, uint64_t FillValue,
flushPendingLabels(DF, DF->getContents().size());
assert(getCurrentSectionOnly() && "need a section");
- insert(new MCFillFragment(FillValue, 1, NumBytes, Loc));
+ insert(
+ getContext().allocFragment<MCFillFragment>(FillValue, 1, NumBytes, Loc));
}
void MCObjectStreamer::emitFill(const MCExpr &NumValues, int64_t Size,
@@ -874,7 +879,8 @@ void MCObjectStreamer::emitFill(const MCExpr &NumValues, int64_t Size,
flushPendingLabels(DF, DF->getContents().size());
assert(getCurrentSectionOnly() && "need a section");
- insert(new MCFillFragment(Expr, Size, NumValues, Loc));
+ insert(
+ getContext().allocFragment<MCFillFragment>(Expr, Size, NumValues, Loc));
}
void MCObjectStreamer::emitNops(int64_t NumBytes, int64_t ControlledNopLength,
@@ -885,7 +891,8 @@ void MCObjectStreamer::emitNops(int64_t NumBytes, int64_t ControlledNopLength,
assert(getCurrentSectionOnly() && "need a section");
- insert(new MCNopsFragment(NumBytes, ControlledNopLength, Loc, STI));
+ insert(getContext().allocFragment<MCNopsFragment>(
+ NumBytes, ControlledNopLength, Loc, STI));
}
void MCObjectStreamer::emitFileDirective(StringRef Filename) {