[llvm] MC: Restructure MCFragment as a fixed part and a variable tail (PR #148544)

Alexis Engelke via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 13 12:23:17 PDT 2025


================
@@ -409,65 +445,91 @@ class MCEncodedFragment : public MCFragment {
         .slice(FixupStart, FixupEnd - FixupStart);
   }
 
-  size_t getSize() const { return ContentEnd - ContentStart; }
-};
-
-/// Fragment for data and encoded instructions.
-///
-class MCDataFragment : public MCEncodedFragment {
-public:
-  MCDataFragment() : MCEncodedFragment(FT_Data, false) {}
-
-  static bool classof(const MCFragment *F) {
-    return F->getKind() == MCFragment::FT_Data;
+  // Source fixup offsets are relative to the variable part's start.
+  // Stored fixup offsets are relative to the fixed part's start.
+  void setVarFixups(ArrayRef<MCFixup> Fixups);
----------------
aengelke wrote:

This change in semantics also feels like something someone's going to trip on.. but it's better than duplicating the transform code at call sites, so ok.

https://github.com/llvm/llvm-project/pull/148544


More information about the llvm-commits mailing list