[llvm] MC: Restructure MCAlignFragment as a fixed part an alignment tail (PR #149030)
Alexis Engelke via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 16 01:27:32 PDT 2025
https://github.com/aengelke commented:
We can do this, but I'm unsure about the direction.
Right now we have FT_Data, FT_Align, FT_Data, FT_Align, FT_Data, this changes it to FT_Align, FT_Align, FT_Data.
For targets that rarely use relaxable fragments, e.g. AArch64, we probably want to end up with a single fragment per text section (as opposed to one fragment per function). emitValueToAlignment could check the current alignment and eagerly emit the value/nops if the new alignment is <= previous alignment. With this approach, emitValueToAlignment would need to check the previous fragment for the current alignment, which is not easily accessible, or we would need to cache the current alignment.
I thought about putting the alignment at the beginning of a fragment. Unfortunately, this would likely require to increase the size of MCFragment. We could optimize for the common case (zero fill or nops, no max bytes), we could add this bit and the alignment into existing padding.
https://github.com/llvm/llvm-project/pull/149030
More information about the llvm-commits
mailing list