[llvm] [RISCV] Add symbol parsing support for Xqcilb long branch instructions (PR #135044)

Sudharsan Veeravalli via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 10 22:01:30 PDT 2025


================
@@ -2136,6 +2148,38 @@ ParseStatus RISCVAsmParser::parseCallSymbol(OperandVector &Operands) {
   return ParseStatus::Success;
 }
 
+ParseStatus RISCVAsmParser::parsePseudoQCJumpSymbol(OperandVector &Operands) {
+  SMLoc S = getLoc();
+  const MCExpr *Res;
+
+  if (getLexer().getKind() != AsmToken::Identifier)
+    return ParseStatus::NoMatch;
+
+  std::string Identifier(getTok().getIdentifier());
+  SMLoc E = SMLoc::getFromPointer(S.getPointer() + Identifier.size());
+
+  if (getLexer().peekTok().is(AsmToken::At)) {
+    Lex();
+    Lex();
+    SMLoc PLTLoc = getLoc();
+    StringRef PLT;
+    if (getParser().parseIdentifier(PLT) || PLT != "plt")
+      return Error(PLTLoc,
+                   "'@plt' is the only valid operand for this instruction");
+    E = SMLoc::getFromPointer(S.getPointer() + /*@plt*/ 4);
----------------
svs-quic wrote:

> Aren't we now missing the size of the part before the `@`?

Yeah I had meant to use E.getPointer().


> And technically I think the Lexer would allow whitespace around the `@`. So we really should call `getEndLoc()` on the `plt` identifier token.

Thanks I have made the change to use this.



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


More information about the llvm-commits mailing list