[llvm] [Xtensa] Implement base CallConvention. (PR #83280)
Sergei Barannikov via llvm-commits
llvm-commits at lists.llvm.org
Sat Mar 23 17:04:26 PDT 2024
================
@@ -686,6 +763,57 @@ bool XtensaAsmParser::ParseInstruction(ParseInstructionInfo &Info,
return false;
}
+bool XtensaAsmParser::parseLiteralDirective(SMLoc L) {
+ MCAsmParser &Parser = getParser();
+ const MCExpr *Value;
+ SMLoc LiteralLoc = getLexer().getLoc();
+ XtensaTargetStreamer &TS = this->getTargetStreamer();
+
+ if (Parser.parseExpression(Value))
+ return true;
+
+ const MCSymbolRefExpr *SE = dyn_cast<MCSymbolRefExpr>(Value);
+
+ if (!SE)
+ return Error(LiteralLoc, "literal label must be a symbol");
+
+ if (Parser.parseToken(AsmToken::Comma, "expected comma"))
+ return true;
+
+ SMLoc OpcodeLoc = getLexer().getLoc();
+ if (parseOptionalToken(AsmToken::EndOfStatement))
+ return Error(OpcodeLoc, "expected value");
+
+ if (Parser.parseExpression(Value))
+ return true;
+
+ MCSymbol *Sym = getContext().getOrCreateSymbol(SE->getSymbol().getName());
+
+ TS.emitLiteral(Sym, Value, LiteralLoc);
+
+ return false;
----------------
s-barannikov wrote:
The method should consume the terminating newline.
https://github.com/llvm/llvm-project/pull/83280
More information about the llvm-commits
mailing list