================
@@ -2655,6 +2679,85 @@ std::optional<MemoryEffects> LLParser::parseMemoryAttr()
{
return std::nullopt;
}
+std::optional<DenormalMode> LLParser::parseDenormalFPEnvEntry() {
+ std::optional<DenormalMode::DenormalModeKind> OutputMode =
+ keywordToDenormalModeKind(Lex.getKind());
+ if (!OutputMode) {
+ tokError("expected denormal behavior kind (ieee, preservesign, "
+ "positivezero, dynamic)");
+ return {};
+ }
+
+ Lex.Lex();
+
+ std::optional<DenormalMode::DenormalModeKind> InputMode;
+ if (EatIfPresent(lltok::bar)) {
+ InputMode = keywordToDenormalModeKind(Lex.getKind());
+ if (!InputMode) {
+ tokError("expected denormal behavior kind (ieee, preservesign, "
+ "positivezero, dynamic)");
+ return {};
+ }
+
+ Lex.Lex();
+ } else {
+ // Single item, input == output mode
+ InputMode = OutputMode;
+ }
+
+ return DenormalMode(*OutputMode, *InputMode);
+}
+
+std::optional<DenormalFPEnv> LLParser::parseDenormalFPEnvAttr() {
+ // We use syntax like denormal_fpenv(float: preservesign), so the colon
should
+ // not be interpreted as a label terminator.
+ Lex.setIgnoreColonInIdentifiers(true);
+ llvm::scope_exit _([&] { Lex.setIgnoreColonInIdentifiers(false); });
+
+ Lex.Lex();
+
+ if (!EatIfPresent(lltok::lparen)) {
+ tokError("expected '('");
----------------
nikic wrote:
Can combine these with parseToken().
https://github.com/llvm/llvm-project/pull/174293
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits