[llvm] a3808d9 - MC: Remove unused MCEncodedFragment

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 2 09:53:37 PDT 2025


Author: Fangrui Song
Date: 2025-08-02T09:53:31-07:00
New Revision: a3808d9a67649a091f459c66db787d78ef6778df

URL: https://github.com/llvm/llvm-project/commit/a3808d9a67649a091f459c66db787d78ef6778df
DIFF: https://github.com/llvm/llvm-project/commit/a3808d9a67649a091f459c66db787d78ef6778df.diff

LOG: MC: Remove unused MCEncodedFragment

Added: 
    

Modified: 
    llvm/include/llvm/MC/MCSection.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/MC/MCSection.h b/llvm/include/llvm/MC/MCSection.h
index df8f617b610ad..ce7f364959533 100644
--- a/llvm/include/llvm/MC/MCSection.h
+++ b/llvm/include/llvm/MC/MCSection.h
@@ -309,13 +309,8 @@ class MCFragment {
   }
 };
 
-/// Interface implemented by fragments that contain encoded instructions and/or
-/// data.
-class MCEncodedFragment : public MCFragment {
-protected:
-  MCEncodedFragment(MCFragment::FragmentType FType, bool HasInstructions)
-      : MCFragment(FType, HasInstructions) {}
-};
+// MCFragment subclasses do not use the fixed-size part or variable-size tail of
+// MCFragment. Instead, they encode content in a specialized way.
 
 class MCFillFragment : public MCFragment {
   uint8_t ValueSize;
@@ -331,7 +326,7 @@ class MCFillFragment : public MCFragment {
 public:
   MCFillFragment(uint64_t Value, uint8_t VSize, const MCExpr &NumValues,
                  SMLoc Loc)
-      : MCFragment(FT_Fill, false), ValueSize(VSize), Value(Value),
+      : MCFragment(FT_Fill), ValueSize(VSize), Value(Value),
         NumValues(NumValues), Loc(Loc) {}
 
   uint64_t getValue() const { return Value; }
@@ -362,7 +357,7 @@ class MCNopsFragment : public MCFragment {
 public:
   MCNopsFragment(int64_t NumBytes, int64_t ControlledNopLength, SMLoc L,
                  const MCSubtargetInfo &STI)
-      : MCFragment(FT_Nops, false), Size(NumBytes),
+      : MCFragment(FT_Nops), Size(NumBytes),
         ControlledNopLength(ControlledNopLength), Loc(L), STI(STI) {}
 
   int64_t getNumBytes() const { return Size; }
@@ -389,7 +384,7 @@ class MCOrgFragment : public MCFragment {
 
 public:
   MCOrgFragment(const MCExpr &Offset, int8_t Value, SMLoc Loc)
-      : MCFragment(FT_Org, false), Value(Value), Offset(&Offset), Loc(Loc) {}
+      : MCFragment(FT_Org), Value(Value), Offset(&Offset), Loc(Loc) {}
 
   const MCExpr &getOffset() const { return *Offset; }
 
@@ -407,8 +402,7 @@ class MCSymbolIdFragment : public MCFragment {
   const MCSymbol *Sym;
 
 public:
-  MCSymbolIdFragment(const MCSymbol *Sym)
-      : MCFragment(FT_SymbolId, false), Sym(Sym) {}
+  MCSymbolIdFragment(const MCSymbol *Sym) : MCFragment(FT_SymbolId), Sym(Sym) {}
 
   const MCSymbol *getSymbol() { return Sym; }
   const MCSymbol *getSymbol() const { return Sym; }
@@ -420,7 +414,7 @@ class MCSymbolIdFragment : public MCFragment {
 
 /// Fragment representing the binary annotations produced by the
 /// .cv_inline_linetable directive.
-class MCCVInlineLineTableFragment : public MCEncodedFragment {
+class MCCVInlineLineTableFragment : public MCFragment {
   unsigned SiteFuncId;
   unsigned StartFileId;
   unsigned StartLineNum;
@@ -435,7 +429,7 @@ class MCCVInlineLineTableFragment : public MCEncodedFragment {
   MCCVInlineLineTableFragment(unsigned SiteFuncId, unsigned StartFileId,
                               unsigned StartLineNum, const MCSymbol *FnStartSym,
                               const MCSymbol *FnEndSym)
-      : MCEncodedFragment(FT_CVInlineLines, false), SiteFuncId(SiteFuncId),
+      : MCFragment(FT_CVInlineLines), SiteFuncId(SiteFuncId),
         StartFileId(StartFileId), StartLineNum(StartLineNum),
         FnStartSym(FnStartSym), FnEndSym(FnEndSym) {}
 
@@ -448,7 +442,7 @@ class MCCVInlineLineTableFragment : public MCEncodedFragment {
 };
 
 /// Fragment representing the .cv_def_range directive.
-class MCCVDefRangeFragment : public MCEncodedFragment {
+class MCCVDefRangeFragment : public MCFragment {
   ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges;
   StringRef FixedSizePortion;
 
@@ -460,8 +454,7 @@ class MCCVDefRangeFragment : public MCEncodedFragment {
   MCCVDefRangeFragment(
       ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges,
       StringRef FixedSizePortion)
-      : MCEncodedFragment(FT_CVDefRange, false),
-        Ranges(Ranges.begin(), Ranges.end()),
+      : MCFragment(FT_CVDefRange), Ranges(Ranges.begin(), Ranges.end()),
         FixedSizePortion(FixedSizePortion) {}
 
   ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> getRanges() const {
@@ -492,8 +485,7 @@ class MCBoundaryAlignFragment : public MCFragment {
 
 public:
   MCBoundaryAlignFragment(Align AlignBoundary, const MCSubtargetInfo &STI)
-      : MCFragment(FT_BoundaryAlign, false), AlignBoundary(AlignBoundary),
-        STI(STI) {}
+      : MCFragment(FT_BoundaryAlign), AlignBoundary(AlignBoundary), STI(STI) {}
 
   uint64_t getSize() const { return Size; }
   void setSize(uint64_t Value) { Size = Value; }


        


More information about the llvm-commits mailing list