@@ -1967,6 +1967,7 @@ struct FIRStmtParser : public FIRParser {
1967
1967
ParseResult parseRefRelease ();
1968
1968
ParseResult parseRefReleaseInitial ();
1969
1969
ParseResult parseRefRead (Value &result);
1970
+ ParseResult parseTagExtract (Value &result);
1970
1971
ParseResult parseProbe (Value &result);
1971
1972
ParseResult parsePropAssign ();
1972
1973
ParseResult parseRWProbe (Value &result);
@@ -2122,6 +2123,14 @@ ParseResult FIRStmtParser::parseExpImpl(Value &result, const Twine &message,
2122
2123
if (parseRefRead (result))
2123
2124
return failure ();
2124
2125
break ;
2126
+ case FIRToken::lp_tagExtract:
2127
+ if (requireFeature (missingSpecFIRVersion, " tagExtract" ))
2128
+ return failure ();
2129
+ if (isLeadingStmt)
2130
+ return emitError (" unexpected tagExtract() as start of statement" );
2131
+ if (parseTagExtract (result))
2132
+ return failure ();
2133
+ break ;
2125
2134
case FIRToken::lp_probe:
2126
2135
if (isLeadingStmt)
2127
2136
return emitError (" unexpected probe() as start of statement" );
@@ -2175,7 +2184,7 @@ ParseResult FIRStmtParser::parseExpImpl(Value &result, const Twine &message,
2175
2184
}
2176
2185
case FIRToken::kw_Bool: {
2177
2186
if (requireFeature (missingSpecFIRVersion, " Bools" ))
2178
- return failure ();
2187
+ return failurFeature (missingSpecFIRVersion, " Bools " )) e ();
2179
2188
locationProcessor.setLoc (getToken ().getLoc ());
2180
2189
consumeToken (FIRToken::kw_Bool);
2181
2190
if (parseToken (FIRToken::l_paren, " expected '(' in Bool expression" ))
@@ -3956,6 +3965,28 @@ ParseResult FIRStmtParser::parseRefRead(Value &result) {
3956
3965
return success ();
3957
3966
}
3958
3967
3968
+ // / tagExtract ::= 'tagExtract' '(' exp ')'
3969
+ ParseResult FIRStmtParser::parseTagExtract (Value &result) {
3970
+ auto startTok = consumeToken (FIRToken::lp_tagExtract);
3971
+
3972
+ Value input;
3973
+ if (parseExp (input, " expected expression in 'tagExtract'" ) ||
3974
+ parseToken (FIRToken::r_paren, " expected ')' in 'tagExtract'" ))
3975
+ return failure ();
3976
+
3977
+ locationProcessor.setLoc (startTok.getLoc ());
3978
+
3979
+ // Check argument is an enum-type value.
3980
+ if (!type_isa<FEnumType>(input.getType ()))
3981
+ return emitError (startTok.getLoc (),
3982
+ " expected enum-type expression in 'tagExtract', got " )
3983
+ << input.getType ();
3984
+
3985
+ result = builder.create <TagExtractOp>(input);
3986
+
3987
+ return success ();
3988
+ }
3989
+
3959
3990
// / probe ::= 'probe' '(' static_ref ')'
3960
3991
ParseResult FIRStmtParser::parseProbe (Value &result) {
3961
3992
auto startTok = consumeToken (FIRToken::lp_probe);
0 commit comments