[llvm] MC: Store fragment content and fixups out-of-line (PR #146307)
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 29 23:59:44 PDT 2025
================
@@ -125,6 +119,13 @@ class MCEncodedFragment : public MCFragment {
/// It must be non-null for instructions.
const MCSubtargetInfo *STI = nullptr;
+private:
+ uint32_t ContentStart = 0;
+ uint32_t ContentSize = 0;
----------------
MaskRay wrote:
The content size is limited to 2^32-1, which is somewhat restrictive but necessary to keep the MCDataFragment class size smaller. This is a makeshift. In the future we should try allocating the content as the trailing object of MCDataFragment and adjusting `allocFragment`. GNU Assembler uses gnulib [obstack](https://www.gnu.org/software/libc/manual/html_node/Obstacks.html) to allocate content as part of its fragment structure.
(BTW, `BundlePadding` (due to deprecated NaCl) is at offset 56. If we remove NaCl, we can likely make MCDataFragment smaller.)
https://github.com/llvm/llvm-project/pull/146307
More information about the llvm-commits
mailing list