[llvm] [MC,CodeGen] Update .prefalign for symbol-based preferred alignment (PR #184032)
Alexis Engelke via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 10 01:05:19 PDT 2026
================
@@ -3472,13 +3472,54 @@ bool AsmParser::parseDirectivePrefAlign() {
int64_t Alignment;
if (checkForValidSection() || parseAbsoluteExpression(Alignment))
return true;
- if (parseEOL())
- return true;
if (!isPowerOf2_64(Alignment))
return Error(AlignmentLoc, "alignment must be a power of 2");
- getStreamer().emitPrefAlign(Align(Alignment));
+ // Parse end symbol: .prefalign N, sym
+ SMLoc SymLoc = getLexer().getLoc();
+ if (!getLexer().is(AsmToken::Comma))
+ return Error(SymLoc, "expected ',' and end symbol");
+ Lex();
+ StringRef Name;
+ SymLoc = getLexer().getLoc();
+ if (parseIdentifier(Name))
+ return Error(SymLoc, "expected symbol name");
+ MCSymbol *End = getContext().getOrCreateSymbol(Name);
+
+ // Parse fill operand: integer byte [0, 255] or "nop".
+ SMLoc FillLoc = getLexer().getLoc();
+ if (!getLexer().is(AsmToken::Comma))
+ return Error(FillLoc, "expected ',' followed by 'nops' or fill byte");
----------------
aengelke wrote:
```suggestion
return Error(FillLoc, "expected ',' followed by 'nop' or fill byte");
```
https://github.com/llvm/llvm-project/pull/184032
More information about the llvm-commits
mailing list