Skip to content

Commit 51f4986

Browse files
author
git apple-llvm automerger
committed
Merge commit '9b44cfbdbf69' from llvm.org/main into next
2 parents b3ace1b + 9b44cfb commit 51f4986

File tree

3 files changed

+42
-59
lines changed

3 files changed

+42
-59
lines changed

llvm/include/llvm/MC/MCFragment.h

Lines changed: 39 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,7 @@ class MCFragment {
7272
bool HasInstructions : 1;
7373
bool LinkerRelaxable : 1;
7474

75-
MCFragment(FragmentType Kind, bool HasInstructions,
76-
MCSection *Parent = nullptr);
75+
MCFragment(FragmentType Kind, bool HasInstructions);
7776

7877
public:
7978
MCFragment() = delete;
@@ -122,9 +121,8 @@ class MCEncodedFragment : public MCFragment {
122121
uint8_t BundlePadding = 0;
123122

124123
protected:
125-
MCEncodedFragment(MCFragment::FragmentType FType, bool HasInstructions,
126-
MCSection *Sec)
127-
: MCFragment(FType, HasInstructions, Sec) {}
124+
MCEncodedFragment(MCFragment::FragmentType FType, bool HasInstructions)
125+
: MCFragment(FType, HasInstructions) {}
128126

129127
/// The MCSubtargetInfo in effect when the instruction was encoded.
130128
/// It must be non-null for instructions.
@@ -182,9 +180,8 @@ class MCEncodedFragmentWithContents : public MCEncodedFragment {
182180

183181
protected:
184182
MCEncodedFragmentWithContents(MCFragment::FragmentType FType,
185-
bool HasInstructions,
186-
MCSection *Sec)
187-
: MCEncodedFragment(FType, HasInstructions, Sec) {}
183+
bool HasInstructions)
184+
: MCEncodedFragment(FType, HasInstructions) {}
188185

189186
public:
190187
SmallVectorImpl<char> &getContents() { return Contents; }
@@ -203,10 +200,8 @@ class MCEncodedFragmentWithFixups :
203200

204201
protected:
205202
MCEncodedFragmentWithFixups(MCFragment::FragmentType FType,
206-
bool HasInstructions,
207-
MCSection *Sec)
208-
: MCEncodedFragmentWithContents<ContentsSize>(FType, HasInstructions,
209-
Sec) {}
203+
bool HasInstructions)
204+
: MCEncodedFragmentWithContents<ContentsSize>(FType, HasInstructions) {}
210205

211206
public:
212207

@@ -234,8 +229,7 @@ class MCEncodedFragmentWithFixups :
234229
///
235230
class MCDataFragment : public MCEncodedFragmentWithFixups<32, 4> {
236231
public:
237-
MCDataFragment(MCSection *Sec = nullptr)
238-
: MCEncodedFragmentWithFixups<32, 4>(FT_Data, false, Sec) {}
232+
MCDataFragment() : MCEncodedFragmentWithFixups<32, 4>(FT_Data, false) {}
239233

240234
static bool classof(const MCFragment *F) {
241235
return F->getKind() == MCFragment::FT_Data;
@@ -252,9 +246,8 @@ class MCDataFragment : public MCEncodedFragmentWithFixups<32, 4> {
252246
///
253247
class MCCompactEncodedInstFragment : public MCEncodedFragmentWithContents<4> {
254248
public:
255-
MCCompactEncodedInstFragment(MCSection *Sec = nullptr)
256-
: MCEncodedFragmentWithContents(FT_CompactEncodedInst, true, Sec) {
257-
}
249+
MCCompactEncodedInstFragment()
250+
: MCEncodedFragmentWithContents(FT_CompactEncodedInst, true) {}
258251

259252
static bool classof(const MCFragment *F) {
260253
return F->getKind() == MCFragment::FT_CompactEncodedInst;
@@ -272,10 +265,10 @@ class MCRelaxableFragment : public MCEncodedFragmentWithFixups<8, 1> {
272265
bool AllowAutoPadding = false;
273266

274267
public:
275-
MCRelaxableFragment(const MCInst &Inst, const MCSubtargetInfo &STI,
276-
MCSection *Sec = nullptr)
277-
: MCEncodedFragmentWithFixups(FT_Relaxable, true, Sec),
278-
Inst(Inst) { this->STI = &STI; }
268+
MCRelaxableFragment(const MCInst &Inst, const MCSubtargetInfo &STI)
269+
: MCEncodedFragmentWithFixups(FT_Relaxable, true), Inst(Inst) {
270+
this->STI = &STI;
271+
}
279272

280273
const MCInst &getInst() const { return Inst; }
281274
void setInst(const MCInst &Value) { Inst = Value; }
@@ -312,8 +305,8 @@ class MCAlignFragment : public MCFragment {
312305

313306
public:
314307
MCAlignFragment(Align Alignment, int64_t Value, unsigned ValueSize,
315-
unsigned MaxBytesToEmit, MCSection *Sec = nullptr)
316-
: MCFragment(FT_Align, false, Sec), Alignment(Alignment), EmitNops(false),
308+
unsigned MaxBytesToEmit)
309+
: MCFragment(FT_Align, false), Alignment(Alignment), EmitNops(false),
317310
Value(Value), ValueSize(ValueSize), MaxBytesToEmit(MaxBytesToEmit) {}
318311

319312
Align getAlignment() const { return Alignment; }
@@ -349,8 +342,8 @@ class MCFillFragment : public MCFragment {
349342

350343
public:
351344
MCFillFragment(uint64_t Value, uint8_t VSize, const MCExpr &NumValues,
352-
SMLoc Loc, MCSection *Sec = nullptr)
353-
: MCFragment(FT_Fill, false, Sec), ValueSize(VSize), Value(Value),
345+
SMLoc Loc)
346+
: MCFragment(FT_Fill, false), ValueSize(VSize), Value(Value),
354347
NumValues(NumValues), Loc(Loc) {}
355348

356349
uint64_t getValue() const { return Value; }
@@ -378,8 +371,8 @@ class MCNopsFragment : public MCFragment {
378371

379372
public:
380373
MCNopsFragment(int64_t NumBytes, int64_t ControlledNopLength, SMLoc L,
381-
const MCSubtargetInfo &STI, MCSection *Sec = nullptr)
382-
: MCFragment(FT_Nops, false, Sec), Size(NumBytes),
374+
const MCSubtargetInfo &STI)
375+
: MCFragment(FT_Nops, false), Size(NumBytes),
383376
ControlledNopLength(ControlledNopLength), Loc(L), STI(STI) {}
384377

385378
int64_t getNumBytes() const { return Size; }
@@ -405,10 +398,8 @@ class MCOrgFragment : public MCFragment {
405398
SMLoc Loc;
406399

407400
public:
408-
MCOrgFragment(const MCExpr &Offset, int8_t Value, SMLoc Loc,
409-
MCSection *Sec = nullptr)
410-
: MCFragment(FT_Org, false, Sec), Value(Value), Offset(&Offset),
411-
Loc(Loc) {}
401+
MCOrgFragment(const MCExpr &Offset, int8_t Value, SMLoc Loc)
402+
: MCFragment(FT_Org, false), Value(Value), Offset(&Offset), Loc(Loc) {}
412403

413404
const MCExpr &getOffset() const { return *Offset; }
414405

@@ -429,9 +420,9 @@ class MCLEBFragment final : public MCEncodedFragmentWithFixups<8, 0> {
429420
const MCExpr *Value;
430421

431422
public:
432-
MCLEBFragment(const MCExpr &Value, bool IsSigned, MCSection *Sec = nullptr)
433-
: MCEncodedFragmentWithFixups<8, 0>(FT_LEB, false, Sec),
434-
IsSigned(IsSigned), Value(&Value) {
423+
MCLEBFragment(const MCExpr &Value, bool IsSigned)
424+
: MCEncodedFragmentWithFixups<8, 0>(FT_LEB, false), IsSigned(IsSigned),
425+
Value(&Value) {
435426
getContents().push_back(0);
436427
}
437428

@@ -457,9 +448,8 @@ class MCDwarfLineAddrFragment : public MCEncodedFragmentWithFixups<8, 1> {
457448
const MCExpr *AddrDelta;
458449

459450
public:
460-
MCDwarfLineAddrFragment(int64_t LineDelta, const MCExpr &AddrDelta,
461-
MCSection *Sec = nullptr)
462-
: MCEncodedFragmentWithFixups<8, 1>(FT_Dwarf, false, Sec),
451+
MCDwarfLineAddrFragment(int64_t LineDelta, const MCExpr &AddrDelta)
452+
: MCEncodedFragmentWithFixups<8, 1>(FT_Dwarf, false),
463453
LineDelta(LineDelta), AddrDelta(&AddrDelta) {}
464454

465455
int64_t getLineDelta() const { return LineDelta; }
@@ -477,8 +467,8 @@ class MCDwarfCallFrameFragment : public MCEncodedFragmentWithFixups<8, 1> {
477467
const MCExpr *AddrDelta;
478468

479469
public:
480-
MCDwarfCallFrameFragment(const MCExpr &AddrDelta, MCSection *Sec = nullptr)
481-
: MCEncodedFragmentWithFixups<8, 1>(FT_DwarfFrame, false, Sec),
470+
MCDwarfCallFrameFragment(const MCExpr &AddrDelta)
471+
: MCEncodedFragmentWithFixups<8, 1>(FT_DwarfFrame, false),
482472
AddrDelta(&AddrDelta) {}
483473

484474
const MCExpr &getAddrDelta() const { return *AddrDelta; }
@@ -494,8 +484,8 @@ class MCSymbolIdFragment : public MCFragment {
494484
const MCSymbol *Sym;
495485

496486
public:
497-
MCSymbolIdFragment(const MCSymbol *Sym, MCSection *Sec = nullptr)
498-
: MCFragment(FT_SymbolId, false, Sec), Sym(Sym) {}
487+
MCSymbolIdFragment(const MCSymbol *Sym)
488+
: MCFragment(FT_SymbolId, false), Sym(Sym) {}
499489

500490
const MCSymbol *getSymbol() { return Sym; }
501491
const MCSymbol *getSymbol() const { return Sym; }
@@ -522,9 +512,8 @@ class MCCVInlineLineTableFragment : public MCFragment {
522512
public:
523513
MCCVInlineLineTableFragment(unsigned SiteFuncId, unsigned StartFileId,
524514
unsigned StartLineNum, const MCSymbol *FnStartSym,
525-
const MCSymbol *FnEndSym,
526-
MCSection *Sec = nullptr)
527-
: MCFragment(FT_CVInlineLines, false, Sec), SiteFuncId(SiteFuncId),
515+
const MCSymbol *FnEndSym)
516+
: MCFragment(FT_CVInlineLines, false), SiteFuncId(SiteFuncId),
528517
StartFileId(StartFileId), StartLineNum(StartLineNum),
529518
FnStartSym(FnStartSym), FnEndSym(FnEndSym) {}
530519

@@ -551,8 +540,8 @@ class MCCVDefRangeFragment : public MCEncodedFragmentWithFixups<32, 4> {
551540
public:
552541
MCCVDefRangeFragment(
553542
ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges,
554-
StringRef FixedSizePortion, MCSection *Sec = nullptr)
555-
: MCEncodedFragmentWithFixups<32, 4>(FT_CVDefRange, false, Sec),
543+
StringRef FixedSizePortion)
544+
: MCEncodedFragmentWithFixups<32, 4>(FT_CVDefRange, false),
556545
Ranges(Ranges.begin(), Ranges.end()),
557546
FixedSizePortion(FixedSizePortion) {}
558547

@@ -583,9 +572,8 @@ class MCBoundaryAlignFragment : public MCFragment {
583572
const MCSubtargetInfo &STI;
584573

585574
public:
586-
MCBoundaryAlignFragment(Align AlignBoundary, const MCSubtargetInfo &STI,
587-
MCSection *Sec = nullptr)
588-
: MCFragment(FT_BoundaryAlign, false, Sec), AlignBoundary(AlignBoundary),
575+
MCBoundaryAlignFragment(Align AlignBoundary, const MCSubtargetInfo &STI)
576+
: MCFragment(FT_BoundaryAlign, false), AlignBoundary(AlignBoundary),
589577
STI(STI) {}
590578

591579
uint64_t getSize() const { return Size; }
@@ -613,8 +601,8 @@ class MCPseudoProbeAddrFragment : public MCEncodedFragmentWithFixups<8, 1> {
613601
const MCExpr *AddrDelta;
614602

615603
public:
616-
MCPseudoProbeAddrFragment(const MCExpr *AddrDelta, MCSection *Sec = nullptr)
617-
: MCEncodedFragmentWithFixups<8, 1>(FT_PseudoProbe, false, Sec),
604+
MCPseudoProbeAddrFragment(const MCExpr *AddrDelta)
605+
: MCEncodedFragmentWithFixups<8, 1>(FT_PseudoProbe, false),
618606
AddrDelta(AddrDelta) {}
619607

620608
const MCExpr &getAddrDelta() const { return *AddrDelta; }

llvm/lib/MC/MCFragment.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -198,13 +198,9 @@ uint64_t llvm::computeBundlePadding(const MCAssembler &Assembler,
198198

199199
/* *** */
200200

201-
MCFragment::MCFragment(FragmentType Kind, bool HasInstructions,
202-
MCSection *Parent)
201+
MCFragment::MCFragment(FragmentType Kind, bool HasInstructions)
203202
: Parent(Parent), Kind(Kind), HasInstructions(HasInstructions),
204-
LinkerRelaxable(false) {
205-
if (Parent && !isa<MCDummyFragment>(*this))
206-
Parent->addFragment(*this);
207-
}
203+
LinkerRelaxable(false) {}
208204

209205
void MCFragment::destroy() {
210206
// First check if we are the sentinel.

llvm/lib/MC/MCWinCOFFStreamer.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,7 @@ void MCWinCOFFStreamer::emitCOFFSafeSEH(MCSymbol const *Symbol) {
196196
getAssembler().registerSection(*SXData);
197197
SXData->ensureMinAlignment(Align(4));
198198

199-
getContext().allocFragment<MCSymbolIdFragment>(Symbol, SXData);
200-
199+
insert(getContext().allocFragment<MCSymbolIdFragment>(Symbol));
201200
getAssembler().registerSymbol(*Symbol);
202201
CSymbol->setIsSafeSEH();
203202

0 commit comments

Comments
 (0)