[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:33 PDT 2025


================
@@ -441,6 +454,43 @@ class MCFragment {
     llvm::copy(Inst, S.begin() + u.relax.OperandStart);
   }
 
+  //== FT_Align functions
+  void makeAlign(Align Alignment, int64_t Fill, uint8_t FillLen,
+                 unsigned MaxBytesToEmit) {
+    Kind = FT_Align;
+    u.align.EmitNops = false;
+    u.align.Alignment = Alignment;
+    u.align.Fill = Fill;
+    u.align.FillLen = FillLen;
+    u.align.MaxBytesToEmit = MaxBytesToEmit;
+  }
+
+  Align getAlignment() const {
+    assert(Kind == FT_Align);
+    return u.align.Alignment;
+  }
+  int64_t getAlignFill() const {
+    assert(Kind == FT_Align);
+    return u.align.Fill;
+  }
+  uint8_t getAlignFillLen() const {
+    assert(Kind == FT_Align);
+    return u.align.FillLen;
+  }
+  unsigned getAlignMaxBytesToEmit() const {
+    assert(Kind == FT_Align);
+    return u.align.MaxBytesToEmit;
+  }
+  bool hasAlignEmitNops() const {
+    assert(Kind == FT_Align);
+    return u.align.EmitNops;
+  }
+  void setAlignEmitNops(bool Value, const MCSubtargetInfo *STI) {
+    assert(Kind == FT_Align);
+    u.align.EmitNops = Value;
+    this->STI = STI;
----------------
aengelke wrote:

Assert that STI didn't change?

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


More information about the llvm-commits mailing list