@@ -523,6 +523,7 @@ class MIParser {
523523 bool parsePreOrPostInstrSymbol (MCSymbol *&Symbol);
524524 bool parseHeapAllocMarker (MDNode *&Node);
525525 bool parsePCSections (MDNode *&Node);
526+ bool parseMMRA (MDNode *&Node);
526527
527528 bool parseTargetImmMnemonic (const unsigned OpCode, const unsigned OpIdx,
528529 MachineOperand &Dest, const MIRFormatter &MF);
@@ -1077,7 +1078,7 @@ bool MIParser::parse(MachineInstr *&MI) {
10771078 while (!Token.isNewlineOrEOF () && Token.isNot (MIToken::kw_pre_instr_symbol) &&
10781079 Token.isNot (MIToken::kw_post_instr_symbol) &&
10791080 Token.isNot (MIToken::kw_heap_alloc_marker) &&
1080- Token.isNot (MIToken::kw_pcsections) &&
1081+ Token.isNot (MIToken::kw_pcsections) && Token. isNot (MIToken::kw_mmra) &&
10811082 Token.isNot (MIToken::kw_cfi_type) &&
10821083 Token.isNot (MIToken::kw_deactivation_symbol) &&
10831084 Token.isNot (MIToken::kw_debug_location) &&
@@ -1113,7 +1114,9 @@ bool MIParser::parse(MachineInstr *&MI) {
11131114 if (Token.is (MIToken::kw_pcsections))
11141115 if (parsePCSections (PCSections))
11151116 return true ;
1116-
1117+ MDNode *MMRA = nullptr ;
1118+ if (Token.is (MIToken::kw_mmra) && parseMMRA (MMRA))
1119+ return true ;
11171120 unsigned CFIType = 0 ;
11181121 if (Token.is (MIToken::kw_cfi_type)) {
11191122 lex ();
@@ -1210,6 +1213,8 @@ bool MIParser::parse(MachineInstr *&MI) {
12101213 MI->setHeapAllocMarker (MF, HeapAllocMarker);
12111214 if (PCSections)
12121215 MI->setPCSections (MF, PCSections);
1216+ if (MMRA)
1217+ MI->setMMRAMetadata (MF, MMRA);
12131218 if (CFIType)
12141219 MI->setCFIType (MF, CFIType);
12151220 if (DS)
@@ -3614,6 +3619,20 @@ bool MIParser::parsePCSections(MDNode *&Node) {
36143619 return false ;
36153620}
36163621
3622+ bool MIParser::parseMMRA (MDNode *&Node) {
3623+ assert (Token.is (MIToken::kw_mmra) && " Invalid token for MMRA!" );
3624+ lex ();
3625+ if (parseMDNode (Node))
3626+ return true ;
3627+ if (Token.isNewlineOrEOF () || Token.is (MIToken::coloncolon) ||
3628+ Token.is (MIToken::lbrace))
3629+ return false ;
3630+ if (Token.isNot (MIToken::comma))
3631+ return error (" expected ',' before the next machine operand" );
3632+ lex ();
3633+ return false ;
3634+ }
3635+
36173636static void initSlots2BasicBlocks (
36183637 const Function &F,
36193638 DenseMap<unsigned , const BasicBlock *> &Slots2BasicBlocks) {
0 commit comments