Lines Matching full:token
396 MIToken Token; member in __anon5566a6300111::MIParser
408 /// for the next token.
522 /// Convert the integer literal in the current token into an unsigned integer.
527 /// Convert the integer literal in the current token into an uint64.
532 /// Convert the hexadecimal literal in the current token into an unsigned
538 /// If the current token is of the given kind, consume it and return false.
542 /// If the current token is of the given kind, consume it and return true.
583 CurrentSource.slice(SkipChar, StringRef::npos), Token, in lex()
587 bool MIParser::error(const Twine &Msg) { return error(Token.location(), Msg); } in error()
629 return "<unknown token>"; in toString()
634 if (Token.isNot(TokenKind)) in expectAndConsume()
641 if (Token.isNot(TokenKind)) in consumeIfPresent()
649 assert(Token.is(MIToken::kw_bbsections)); in parseSectionID()
651 if (Token.is(MIToken::IntegerLiteral)) { in parseSectionID()
657 const StringRef &S = Token.stringValue(); in parseSectionID()
671 assert(Token.is(MIToken::kw_bb_id)); in parseBBID()
678 if (Token.is(MIToken::IntegerLiteral)) { in parseBBID()
689 assert(Token.is(MIToken::kw_call_frame_size)); in parseCallFrameSize()
701 assert(Token.is(MIToken::MachineBasicBlockLabel)); in parseBasicBlockDefinition()
705 auto Loc = Token.location(); in parseBasicBlockDefinition()
706 auto Name = Token.stringValue(); in parseBasicBlockDefinition()
721 switch (Token.kind()) { in parseBasicBlockDefinition()
817 while (Token.is(MIToken::Newline)) in parseBasicBlockDefinitions()
819 if (Token.isErrorOrEOF()) in parseBasicBlockDefinitions()
820 return Token.isError(); in parseBasicBlockDefinitions()
821 if (Token.isNot(MIToken::MachineBasicBlockLabel)) in parseBasicBlockDefinitions()
830 if ((Token.is(MIToken::MachineBasicBlockLabel) && IsAfterNewline) || in parseBasicBlockDefinitions()
831 Token.isErrorOrEOF()) in parseBasicBlockDefinitions()
833 else if (Token.is(MIToken::MachineBasicBlockLabel)) in parseBasicBlockDefinitions()
841 if (Token.is(MIToken::lbrace)) in parseBasicBlockDefinitions()
843 if (Token.is(MIToken::rbrace)) { in parseBasicBlockDefinitions()
851 if (!Token.isError() && BraceDepth) in parseBasicBlockDefinitions()
853 } while (!Token.isErrorOrEOF()); in parseBasicBlockDefinitions()
854 return Token.isError(); in parseBasicBlockDefinitions()
858 assert(Token.is(MIToken::kw_liveins)); in parseBasicBlockLiveins()
862 if (Token.isNewlineOrEOF()) // Allow an empty list of liveins. in parseBasicBlockLiveins()
865 if (Token.isNot(MIToken::NamedRegister)) in parseBasicBlockLiveins()
874 if (Token.isNot(MIToken::IntegerLiteral) && in parseBasicBlockLiveins()
875 Token.isNot(MIToken::HexLiteral)) in parseBasicBlockLiveins()
891 assert(Token.is(MIToken::kw_successors)); in parseBasicBlockSuccessors()
895 if (Token.isNewlineOrEOF()) // Allow an empty list of successors. in parseBasicBlockSuccessors()
898 if (Token.isNot(MIToken::MachineBasicBlock)) in parseBasicBlockSuccessors()
906 if (Token.isNot(MIToken::IntegerLiteral) && in parseBasicBlockSuccessors()
907 Token.isNot(MIToken::HexLiteral)) in parseBasicBlockSuccessors()
924 assert(Token.is(MIToken::MachineBasicBlockLabel)); in parseBasicBlock()
927 while (Token.isNot(MIToken::rparen) && !Token.isErrorOrEOF()) in parseBasicBlock()
944 if (Token.is(MIToken::kw_successors)) { in parseBasicBlock()
948 } else if (Token.is(MIToken::kw_liveins)) { in parseBasicBlock()
955 if (!Token.isNewlineOrEOF()) in parseBasicBlock()
963 while (!Token.is(MIToken::MachineBasicBlockLabel) && in parseBasicBlock()
964 !Token.is(MIToken::Eof)) { in parseBasicBlock()
983 if (Token.is(MIToken::lbrace)) { in parseBasicBlock()
990 if (!Token.is(MIToken::Newline)) in parseBasicBlock()
994 assert(Token.isNewlineOrEOF() && "MI is not fully parsed"); in parseBasicBlock()
1019 while (Token.is(MIToken::Newline)) in parseBasicBlocks()
1021 if (Token.isErrorOrEOF()) in parseBasicBlocks()
1022 return Token.isError(); in parseBasicBlocks()
1023 // The first parsing pass should have verified that this token is a MBB label in parseBasicBlocks()
1025 assert(Token.is(MIToken::MachineBasicBlockLabel)); in parseBasicBlocks()
1041 assert(Token.is(MIToken::MachineBasicBlockLabel) || Token.is(MIToken::Eof)); in parseBasicBlocks()
1042 } while (Token.isNot(MIToken::Eof)); in parseBasicBlocks()
1050 while (Token.isRegister() || Token.isRegisterFlag()) { in parse()
1051 auto Loc = Token.location(); in parse()
1056 ParsedMachineOperand(MO, Loc, Token.location(), TiedDefIdx)); in parse()
1057 if (Token.isNot(MIToken::comma)) in parse()
1065 if (Token.isError() || parseInstruction(OpCode, Flags)) in parse()
1069 while (!Token.isNewlineOrEOF() && Token.isNot(MIToken::kw_pre_instr_symbol) && in parse()
1070 Token.isNot(MIToken::kw_post_instr_symbol) && in parse()
1071 Token.isNot(MIToken::kw_heap_alloc_marker) && in parse()
1072 Token.isNot(MIToken::kw_pcsections) && in parse()
1073 Token.isNot(MIToken::kw_cfi_type) && in parse()
1074 Token.isNot(MIToken::kw_debug_location) && in parse()
1075 Token.isNot(MIToken::kw_debug_instr_number) && in parse()
1076 Token.isNot(MIToken::coloncolon) && Token.isNot(MIToken::lbrace)) { in parse()
1077 auto Loc = Token.location(); in parse()
1082 ParsedMachineOperand(MO, Loc, Token.location(), TiedDefIdx)); in parse()
1083 if (Token.isNewlineOrEOF() || Token.is(MIToken::coloncolon) || in parse()
1084 Token.is(MIToken::lbrace)) in parse()
1086 if (Token.isNot(MIToken::comma)) in parse()
1092 if (Token.is(MIToken::kw_pre_instr_symbol)) in parse()
1096 if (Token.is(MIToken::kw_post_instr_symbol)) in parse()
1100 if (Token.is(MIToken::kw_heap_alloc_marker)) in parse()
1104 if (Token.is(MIToken::kw_pcsections)) in parse()
1109 if (Token.is(MIToken::kw_cfi_type)) { in parse()
1111 if (Token.isNot(MIToken::IntegerLiteral)) in parse()
1118 if (Token.is(MIToken::comma)) in parse()
1123 if (Token.is(MIToken::kw_debug_instr_number)) { in parse()
1125 if (Token.isNot(MIToken::IntegerLiteral)) in parse()
1131 if (Token.is(MIToken::comma)) in parse()
1136 if (Token.is(MIToken::kw_debug_location)) { in parse()
1139 if (Token.is(MIToken::exclaim)) { in parse()
1142 } else if (Token.is(MIToken::md_dilocation)) { in parse()
1154 if (Token.is(MIToken::coloncolon)) { in parse()
1156 while (!Token.isNewlineOrEOF()) { in parse()
1161 if (Token.isNewlineOrEOF()) in parse()
1163 if (Token.isNot(MIToken::comma)) in parse()
1205 if (Token.isNot(MIToken::MachineBasicBlock)) in parseStandaloneMBB()
1210 if (Token.isNot(MIToken::Eof)) in parseStandaloneMBB()
1218 if (Token.isNot(MIToken::NamedRegister)) in parseStandaloneNamedRegister()
1223 if (Token.isNot(MIToken::Eof)) in parseStandaloneNamedRegister()
1230 if (Token.isNot(MIToken::VirtualRegister)) in parseStandaloneVirtualRegister()
1235 if (Token.isNot(MIToken::Eof)) in parseStandaloneVirtualRegister()
1242 if (Token.isNot(MIToken::NamedRegister) && in parseStandaloneRegister()
1243 Token.isNot(MIToken::VirtualRegister)) in parseStandaloneRegister()
1251 if (Token.isNot(MIToken::Eof)) in parseStandaloneRegister()
1258 if (Token.isNot(MIToken::StackObject)) in parseStandaloneStackObject()
1262 if (Token.isNot(MIToken::Eof)) in parseStandaloneStackObject()
1269 if (Token.is(MIToken::exclaim)) { in parseStandaloneMDNode()
1272 } else if (Token.is(MIToken::md_diexpr)) { in parseStandaloneMDNode()
1275 } else if (Token.is(MIToken::md_dilocation)) { in parseStandaloneMDNode()
1280 if (Token.isNot(MIToken::Eof)) in parseStandaloneMDNode()
1287 if (Token.isNot(MIToken::exclaim)) in parseMachineMetadata()
1291 if (Token.isNot(MIToken::IntegerLiteral) || Token.integerValue().isSigned()) in parseMachineMetadata()
1299 bool IsDistinct = Token.is(MIToken::kw_distinct); in parseMachineMetadata()
1302 if (Token.isNot(MIToken::exclaim)) in parseMachineMetadata()
1335 if (Token.isNot(MIToken::lbrace)) in parseMDNodeVector()
1339 if (Token.is(MIToken::rbrace)) { in parseMDNodeVector()
1351 if (Token.isNot(MIToken::comma)) in parseMDNodeVector()
1356 if (Token.isNot(MIToken::rbrace)) in parseMDNodeVector()
1366 if (Token.isNot(MIToken::exclaim)) in parseMetadata()
1370 if (Token.is(MIToken::StringConstant)) { in parseMetadata()
1378 if (Token.isNot(MIToken::IntegerLiteral) || Token.integerValue().isSigned()) in parseMetadata()
1381 SMLoc Loc = mapSMLoc(Token.location()); in parseMetadata()
1449 return error(Operands.empty() ? Token.location() : Operands.back().End, in verifyImplicitOperands()
1460 while (Token.is(MIToken::kw_frame_setup) || in parseInstruction()
1461 Token.is(MIToken::kw_frame_destroy) || in parseInstruction()
1462 Token.is(MIToken::kw_nnan) || in parseInstruction()
1463 Token.is(MIToken::kw_ninf) || in parseInstruction()
1464 Token.is(MIToken::kw_nsz) || in parseInstruction()
1465 Token.is(MIToken::kw_arcp) || in parseInstruction()
1466 Token.is(MIToken::kw_contract) || in parseInstruction()
1467 Token.is(MIToken::kw_afn) || in parseInstruction()
1468 Token.is(MIToken::kw_reassoc) || in parseInstruction()
1469 Token.is(MIToken::kw_nuw) || in parseInstruction()
1470 Token.is(MIToken::kw_nsw) || in parseInstruction()
1471 Token.is(MIToken::kw_exact) || in parseInstruction()
1472 Token.is(MIToken::kw_nofpexcept) || in parseInstruction()
1473 Token.is(MIToken::kw_noconvergent) || in parseInstruction()
1474 Token.is(MIToken::kw_unpredictable) || in parseInstruction()
1475 Token.is(MIToken::kw_nneg) || in parseInstruction()
1476 Token.is(MIToken::kw_disjoint)) { in parseInstruction()
1479 if (Token.is(MIToken::kw_frame_setup)) in parseInstruction()
1481 if (Token.is(MIToken::kw_frame_destroy)) in parseInstruction()
1483 if (Token.is(MIToken::kw_nnan)) in parseInstruction()
1485 if (Token.is(MIToken::kw_ninf)) in parseInstruction()
1487 if (Token.is(MIToken::kw_nsz)) in parseInstruction()
1489 if (Token.is(MIToken::kw_arcp)) in parseInstruction()
1491 if (Token.is(MIToken::kw_contract)) in parseInstruction()
1493 if (Token.is(MIToken::kw_afn)) in parseInstruction()
1495 if (Token.is(MIToken::kw_reassoc)) in parseInstruction()
1497 if (Token.is(MIToken::kw_nuw)) in parseInstruction()
1499 if (Token.is(MIToken::kw_nsw)) in parseInstruction()
1501 if (Token.is(MIToken::kw_exact)) in parseInstruction()
1503 if (Token.is(MIToken::kw_nofpexcept)) in parseInstruction()
1505 if (Token.is(MIToken::kw_unpredictable)) in parseInstruction()
1507 if (Token.is(MIToken::kw_noconvergent)) in parseInstruction()
1509 if (Token.is(MIToken::kw_nneg)) in parseInstruction()
1511 if (Token.is(MIToken::kw_disjoint)) in parseInstruction()
1516 if (Token.isNot(MIToken::Identifier)) in parseInstruction()
1518 StringRef InstrName = Token.stringValue(); in parseInstruction()
1526 assert(Token.is(MIToken::NamedRegister) && "Needs NamedRegister token"); in parseNamedRegister()
1527 StringRef Name = Token.stringValue(); in parseNamedRegister()
1534 assert(Token.is(MIToken::NamedVirtualRegister) && "Expected NamedVReg token"); in parseNamedVirtualRegister()
1535 StringRef Name = Token.stringValue(); in parseNamedVirtualRegister()
1543 if (Token.is(MIToken::NamedVirtualRegister)) in parseVirtualRegister()
1545 assert(Token.is(MIToken::VirtualRegister) && "Needs VirtualRegister token"); in parseVirtualRegister()
1554 switch (Token.kind()) { in parseRegister()
1568 llvm_unreachable("The current token should be a register"); in parseRegister()
1573 if (Token.isNot(MIToken::Identifier) && Token.isNot(MIToken::underscore)) in parseRegisterClassOrBank()
1575 StringRef::iterator Loc = Token.location(); in parseRegisterClassOrBank()
1576 StringRef Name = Token.stringValue(); in parseRegisterClassOrBank()
1632 switch (Token.kind()) { in parseRegisterFlag()
1664 llvm_unreachable("The current token should be a register flag"); in parseRegisterFlag()
1669 return error("duplicate '" + Token.stringValue() + "' register flag"); in parseRegisterFlag()
1675 assert(Token.is(MIToken::dot)); in parseSubRegisterIndex()
1677 if (Token.isNot(MIToken::Identifier)) in parseSubRegisterIndex()
1679 auto Name = Token.stringValue(); in parseSubRegisterIndex()
1690 if (Token.isNot(MIToken::IntegerLiteral)) in parseRegisterTiedDefIndex()
1741 while (Token.isRegisterFlag()) { in parseRegisterOperand()
1745 if (!Token.isRegister()) in parseRegisterOperand()
1753 if (Token.is(MIToken::dot)) { in parseRegisterOperand()
1759 if (Token.is(MIToken::colon)) { in parseRegisterOperand()
1775 if (parseLowLevelType(Token.location(), Ty)) in parseRegisterOperand()
1794 if (parseLowLevelType(Token.location(), Ty)) in parseRegisterOperand()
1832 assert(Token.is(MIToken::IntegerLiteral)); in parseImmediateOperand()
1833 const APSInt &Int = Token.integerValue(); in parseImmediateOperand()
1848 assert(Token.is(MIToken::dot)); in parseTargetImmMnemonic()
1849 auto Loc = Token.location(); // record start position in parseTargetImmMnemonic()
1854 if (Token.is(MIToken::IntegerLiteral)) { in parseTargetImmMnemonic()
1855 Len += Token.range().size(); in parseTargetImmMnemonic()
1860 if (Token.is(MIToken::comma)) in parseTargetImmMnemonic()
1863 assert(Token.is(MIToken::Identifier)); in parseTargetImmMnemonic()
1864 Src = StringRef(Loc, Len + Token.stringValue().size()); in parseTargetImmMnemonic()
1873 if (!Token.is(MIToken::comma)) in parseTargetImmMnemonic()
1900 if (parseIRConstant(Loc, StringRef(Loc, Token.range().end() - Loc), C)) in parseIRConstant()
1920 if (Token.range().front() == 's' || Token.range().front() == 'p') { in parseLowLevelType()
1921 StringRef SizeStr = Token.range().drop_front(); in parseLowLevelType()
1926 if (Token.range().front() == 's') { in parseLowLevelType()
1927 auto ScalarSize = APSInt(Token.range().drop_front()).getZExtValue(); in parseLowLevelType()
1933 Ty = LLT::token(); in parseLowLevelType()
1937 } else if (Token.range().front() == 'p') { in parseLowLevelType()
1939 uint64_t AS = APSInt(Token.range().drop_front()).getZExtValue(); in parseLowLevelType()
1949 if (Token.isNot(MIToken::less)) in parseLowLevelType()
1955 Token.is(MIToken::Identifier) && Token.stringValue() == "vscale"; in parseLowLevelType()
1958 if (Token.isNot(MIToken::Identifier) || Token.stringValue() != "x") in parseLowLevelType()
1970 if (Token.isNot(MIToken::IntegerLiteral)) in parseLowLevelType()
1972 uint64_t NumElements = Token.integerValue().getZExtValue(); in parseLowLevelType()
1978 if (Token.isNot(MIToken::Identifier) || Token.stringValue() != "x") in parseLowLevelType()
1982 if (Token.range().front() != 's' && Token.range().front() != 'p') in parseLowLevelType()
1985 StringRef SizeStr = Token.range().drop_front(); in parseLowLevelType()
1989 if (Token.range().front() == 's') { in parseLowLevelType()
1990 auto ScalarSize = APSInt(Token.range().drop_front()).getZExtValue(); in parseLowLevelType()
1994 } else if (Token.range().front() == 'p') { in parseLowLevelType()
1996 uint64_t AS = APSInt(Token.range().drop_front()).getZExtValue(); in parseLowLevelType()
2005 if (Token.isNot(MIToken::greater)) in parseLowLevelType()
2015 assert(Token.is(MIToken::Identifier)); in parseTypedImmediateOperand()
2016 StringRef TypeStr = Token.range(); in parseTypedImmediateOperand()
2021 StringRef SizeStr = Token.range().drop_front(); in parseTypedImmediateOperand()
2025 auto Loc = Token.location(); in parseTypedImmediateOperand()
2027 if (Token.isNot(MIToken::IntegerLiteral)) { in parseTypedImmediateOperand()
2028 if (Token.isNot(MIToken::Identifier) || in parseTypedImmediateOperand()
2029 !(Token.range() == "true" || Token.range() == "false")) in parseTypedImmediateOperand()
2040 auto Loc = Token.location(); in parseFPImmediateOperand()
2042 if (Token.isNot(MIToken::FloatingPointLiteral) && in parseFPImmediateOperand()
2043 Token.isNot(MIToken::HexLiteral)) in parseFPImmediateOperand()
2052 static bool getHexUint(const MIToken &Token, APInt &Result) { in getHexUint() argument
2053 assert(Token.is(MIToken::HexLiteral)); in getHexUint()
2054 StringRef S = Token.range(); in getHexUint()
2069 static bool getUnsigned(const MIToken &Token, unsigned &Result, in getUnsigned() argument
2071 if (Token.hasIntegerValue()) { in getUnsigned()
2073 uint64_t Val64 = Token.integerValue().getLimitedValue(Limit); in getUnsigned()
2075 return ErrCB(Token.location(), "expected 32-bit integer (too large)"); in getUnsigned()
2079 if (Token.is(MIToken::HexLiteral)) { in getUnsigned()
2081 if (getHexUint(Token, A)) in getUnsigned()
2084 return ErrCB(Token.location(), "expected 32-bit integer (too large)"); in getUnsigned()
2093 Token, Result, [this](StringRef::iterator Loc, const Twine &Msg) -> bool { in getUnsigned()
2099 assert(Token.is(MIToken::MachineBasicBlock) || in parseMBBReference()
2100 Token.is(MIToken::MachineBasicBlockLabel)); in parseMBBReference()
2111 if (!Token.stringValue().empty() && Token.stringValue() != MBB->getName()) in parseMBBReference()
2113 " isn't '" + Token.stringValue() + "'"); in parseMBBReference()
2127 assert(Token.is(MIToken::StackObject)); in parseStackFrameIndex()
2139 if (!Token.stringValue().empty() && Token.stringValue() != Name) in parseStackFrameIndex()
2141 "' isn't '" + Token.stringValue() + "'"); in parseStackFrameIndex()
2156 assert(Token.is(MIToken::FixedStackObject)); in parseFixedStackFrameIndex()
2177 static bool parseGlobalValue(const MIToken &Token, in parseGlobalValue() argument
2180 switch (Token.kind()) { in parseGlobalValue()
2183 GV = M->getNamedValue(Token.stringValue()); in parseGlobalValue()
2185 return ErrCB(Token.location(), Twine("use of undefined global value '") + in parseGlobalValue()
2186 Token.range() + "'"); in parseGlobalValue()
2191 if (getUnsigned(Token, GVIdx, ErrCB)) in parseGlobalValue()
2195 return ErrCB(Token.location(), Twine("use of undefined global value '@") + in parseGlobalValue()
2200 llvm_unreachable("The current token should be a global value"); in parseGlobalValue()
2207 Token, PFS, GV, in parseGlobalValue()
2225 assert(Token.is(MIToken::ConstantPoolItem)); in parseConstantPoolIndexOperand()
2240 assert(Token.is(MIToken::JumpTableIndex)); in parseJumpTableIndexOperand()
2253 assert(Token.is(MIToken::ExternalSymbol)); in parseExternalSymbolOperand()
2254 const char *Symbol = MF.createExternalSymbolName(Token.stringValue()); in parseExternalSymbolOperand()
2263 assert(Token.is(MIToken::MCSymbol)); in parseMCSymbolOperand()
2264 MCSymbol *Symbol = getOrCreateMCSymbol(Token.stringValue()); in parseMCSymbolOperand()
2273 assert(Token.is(MIToken::SubRegisterIndex)); in parseSubRegisterIndexOperand()
2274 StringRef Name = Token.stringValue(); in parseSubRegisterIndexOperand()
2275 unsigned SubRegIndex = PFS.Target.getSubRegIndex(Token.stringValue()); in parseSubRegisterIndexOperand()
2284 assert(Token.is(MIToken::exclaim)); in parseMDNode()
2286 auto Loc = Token.location(); in parseMDNode()
2288 if (Token.isNot(MIToken::IntegerLiteral) || Token.integerValue().isSigned()) in parseMDNode()
2317 assert(Token.is(MIToken::md_dilocation)); in parseDILocation()
2330 if (Token.isNot(MIToken::rparen)) { in parseDILocation()
2332 if (Token.is(MIToken::Identifier)) { in parseDILocation()
2333 if (Token.stringValue() == "line") { in parseDILocation()
2337 if (Token.isNot(MIToken::IntegerLiteral) || in parseDILocation()
2338 Token.integerValue().isSigned()) in parseDILocation()
2340 Line = Token.integerValue().getZExtValue(); in parseDILocation()
2345 if (Token.stringValue() == "column") { in parseDILocation()
2349 if (Token.isNot(MIToken::IntegerLiteral) || in parseDILocation()
2350 Token.integerValue().isSigned()) in parseDILocation()
2352 Column = Token.integerValue().getZExtValue(); in parseDILocation()
2356 if (Token.stringValue() == "scope") { in parseDILocation()
2366 if (Token.stringValue() == "inlinedAt") { in parseDILocation()
2370 if (Token.is(MIToken::exclaim)) { in parseDILocation()
2373 } else if (Token.is(MIToken::md_dilocation)) { in parseDILocation()
2382 if (Token.stringValue() == "isImplicitCode") { in parseDILocation()
2386 if (!Token.is(MIToken::Identifier)) in parseDILocation()
2391 if (Token.stringValue() == "true") in parseDILocation()
2393 else if (Token.stringValue() == "false") in parseDILocation()
2402 Token.stringValue() + "'"); in parseDILocation()
2421 if (Token.is(MIToken::exclaim)) { in parseMetadataOperand()
2424 } else if (Token.is(MIToken::md_diexpr)) { in parseMetadataOperand()
2433 if (Token.isNot(MIToken::IntegerLiteral)) in parseCFIOffset()
2435 if (Token.integerValue().getSignificantBits() > 32) in parseCFIOffset()
2437 Offset = (int)Token.integerValue().getExtValue(); in parseCFIOffset()
2443 if (Token.isNot(MIToken::NamedRegister)) in parseCFIRegister()
2459 if (Token.isNot(MIToken::IntegerLiteral)) in parseCFIAddressSpace()
2461 if (Token.integerValue().isSigned()) in parseCFIAddressSpace()
2463 AddressSpace = Token.integerValue().getZExtValue(); in parseCFIAddressSpace()
2470 if (Token.isNot(MIToken::HexLiteral)) in parseCFIEscapeValues()
2484 auto Kind = Token.kind(); in parseCFIOperand()
2584 llvm_unreachable("The current token should be a cfi operand"); in parseCFIOperand()
2591 switch (Token.kind()) { in parseIRBlock()
2594 F.getValueSymbolTable()->lookup(Token.stringValue())); in parseIRBlock()
2596 return error(Twine("use of undefined IR block '") + Token.range() + "'"); in parseIRBlock()
2610 llvm_unreachable("The current token should be an IR block reference"); in parseIRBlock()
2616 assert(Token.is(MIToken::kw_blockaddress)); in parseBlockAddressOperand()
2620 if (Token.isNot(MIToken::GlobalValue) && in parseBlockAddressOperand()
2621 Token.isNot(MIToken::NamedGlobalValue)) in parseBlockAddressOperand()
2633 if (Token.isNot(MIToken::IRBlock) && Token.isNot(MIToken::NamedIRBlock)) in parseBlockAddressOperand()
2647 assert(Token.is(MIToken::kw_intrinsic)); in parseIntrinsicOperand()
2652 if (Token.isNot(MIToken::NamedGlobalValue)) in parseIntrinsicOperand()
2655 std::string Name = std::string(Token.stringValue()); in parseIntrinsicOperand()
2676 assert(Token.is(MIToken::kw_intpred) || Token.is(MIToken::kw_floatpred)); in parsePredicateOperand()
2677 bool IsFloat = Token.is(MIToken::kw_floatpred); in parsePredicateOperand()
2683 if (Token.isNot(MIToken::Identifier)) in parsePredicateOperand()
2688 Pred = StringSwitch<CmpInst::Predicate>(Token.stringValue()) in parsePredicateOperand()
2709 Pred = StringSwitch<CmpInst::Predicate>(Token.stringValue()) in parsePredicateOperand()
2734 assert(Token.is(MIToken::kw_shufflemask)); in parseShuffleMaskOperand()
2742 if (Token.is(MIToken::kw_undef)) { in parseShuffleMaskOperand()
2744 } else if (Token.is(MIToken::IntegerLiteral)) { in parseShuffleMaskOperand()
2745 const APSInt &Int = Token.integerValue(); in parseShuffleMaskOperand()
2762 assert(Token.is(MIToken::kw_dbg_instr_ref)); in parseDbgInstrRefOperand()
2768 if (Token.isNot(MIToken::IntegerLiteral) || Token.integerValue().isNegative()) in parseDbgInstrRefOperand()
2770 uint64_t InstrIdx = Token.integerValue().getZExtValue(); in parseDbgInstrRefOperand()
2778 if (Token.isNot(MIToken::IntegerLiteral) || Token.integerValue().isNegative()) in parseDbgInstrRefOperand()
2780 uint64_t OpIdx = Token.integerValue().getZExtValue(); in parseDbgInstrRefOperand()
2793 assert(Token.is(MIToken::kw_target_index)); in parseTargetIndexOperand()
2797 if (Token.isNot(MIToken::Identifier)) in parseTargetIndexOperand()
2800 if (PFS.Target.getTargetIndex(Token.stringValue(), Index)) in parseTargetIndexOperand()
2801 return error("use of undefined target index '" + Token.stringValue() + "'"); in parseTargetIndexOperand()
2812 assert(Token.stringValue() == "CustomRegMask" && "Expected a custom RegMask"); in parseCustomRegisterMaskOperand()
2819 if (Token.isNot(MIToken::rparen)) { in parseCustomRegisterMaskOperand()
2820 if (Token.isNot(MIToken::NamedRegister)) in parseCustomRegisterMaskOperand()
2839 assert(Token.is(MIToken::kw_liveout)); in parseLiveoutRegisterMaskOperand()
2845 if (Token.isNot(MIToken::NamedRegister)) in parseLiveoutRegisterMaskOperand()
2853 if (Token.isNot(MIToken::comma)) in parseLiveoutRegisterMaskOperand()
2866 switch (Token.kind()) { in parseMachineOperand()
2949 if (const auto *RegMask = PFS.Target.getRegMask(Token.stringValue())) { in parseMachineOperand()
2953 } else if (Token.stringValue() == "CustomRegMask") { in parseMachineOperand()
2976 if (Token.is(MIToken::kw_target_flags)) { in parseMachineOperandAndTargetFlags()
2981 if (Token.isNot(MIToken::Identifier)) in parseMachineOperandAndTargetFlags()
2983 if (PFS.Target.getDirectTargetFlag(Token.stringValue(), TF)) { in parseMachineOperandAndTargetFlags()
2984 if (PFS.Target.getBitmaskTargetFlag(Token.stringValue(), TF)) in parseMachineOperandAndTargetFlags()
2985 return error("use of undefined target flag '" + Token.stringValue() + in parseMachineOperandAndTargetFlags()
2989 while (Token.is(MIToken::comma)) { in parseMachineOperandAndTargetFlags()
2991 if (Token.isNot(MIToken::Identifier)) in parseMachineOperandAndTargetFlags()
2994 if (PFS.Target.getBitmaskTargetFlag(Token.stringValue(), BitFlag)) in parseMachineOperandAndTargetFlags()
2995 return error("use of undefined target flag '" + Token.stringValue() + in parseMachineOperandAndTargetFlags()
3004 auto Loc = Token.location(); in parseMachineOperandAndTargetFlags()
3016 if (Token.isNot(MIToken::plus) && Token.isNot(MIToken::minus)) in parseOffset()
3018 StringRef Sign = Token.range(); in parseOffset()
3019 bool IsNegative = Token.is(MIToken::minus); in parseOffset()
3021 if (Token.isNot(MIToken::IntegerLiteral)) in parseOffset()
3023 if (Token.integerValue().getSignificantBits() > 64) in parseOffset()
3025 Offset = Token.integerValue().getExtValue(); in parseOffset()
3033 assert(Token.is(MIToken::kw_ir_block_address_taken)); in parseIRBlockAddressTaken()
3035 if (Token.isNot(MIToken::IRBlock) && Token.isNot(MIToken::NamedIRBlock)) in parseIRBlockAddressTaken()
3046 assert(Token.is(MIToken::kw_align) || Token.is(MIToken::kw_basealign)); in parseAlignment()
3048 if (Token.isNot(MIToken::IntegerLiteral) || Token.integerValue().isSigned()) in parseAlignment()
3061 assert(Token.is(MIToken::kw_addrspace)); in parseAddrspace()
3063 if (Token.isNot(MIToken::IntegerLiteral) || Token.integerValue().isSigned()) in parseAddrspace()
3079 static bool parseIRValue(const MIToken &Token, PerFunctionMIParsingState &PFS, in parseIRValue() argument
3081 switch (Token.kind()) { in parseIRValue()
3083 V = PFS.MF.getFunction().getValueSymbolTable()->lookup(Token.stringValue()); in parseIRValue()
3088 if (getUnsigned(Token, SlotNumber, ErrCB)) in parseIRValue()
3096 if (parseGlobalValue(Token, PFS, GV, ErrCB)) in parseIRValue()
3103 if (parseIRConstant(Token.location(), Token.stringValue(), PFS, C, ErrCB)) in parseIRValue()
3112 llvm_unreachable("The current token should be an IR block reference"); in parseIRValue()
3115 return ErrCB(Token.location(), Twine("use of undefined IR value '") + Token.range() + "'"); in parseIRValue()
3121 Token, PFS, V, [this](StringRef::iterator Loc, const Twine &Msg) -> bool { in parseIRValue()
3127 if (Token.hasIntegerValue()) { in getUint64()
3128 if (Token.integerValue().getActiveBits() > 64) in getUint64()
3130 Result = Token.integerValue().getZExtValue(); in getUint64()
3133 if (Token.is(MIToken::HexLiteral)) { in getUint64()
3146 return ::getHexUint(Token, Result); in getHexUint()
3151 switch (Token.kind()) { in parseMemoryOperandFlag()
3166 if (PFS.Target.getMMOTargetFlag(Token.stringValue(), TF)) in parseMemoryOperandFlag()
3167 return error("use of undefined target MMO flag '" + Token.stringValue() + in parseMemoryOperandFlag()
3173 llvm_unreachable("The current token should be a memory operand flag"); in parseMemoryOperandFlag()
3178 return error("duplicate '" + Token.stringValue() + "' memory operand flag"); in parseMemoryOperandFlag()
3184 switch (Token.kind()) { in parseMemoryPseudoSourceValue()
3202 // The token was already consumed, so use return here instead of break. in parseMemoryPseudoSourceValue()
3210 // The token was already consumed, so use return here instead of break. in parseMemoryPseudoSourceValue()
3215 switch (Token.kind()) { in parseMemoryPseudoSourceValue()
3226 MF.createExternalSymbolName(Token.stringValue())); in parseMemoryPseudoSourceValue()
3238 Token.stringValue(), MF, PFS, PSV, in parseMemoryPseudoSourceValue()
3248 llvm_unreachable("The current token should be pseudo source value"); in parseMemoryPseudoSourceValue()
3255 if (Token.is(MIToken::kw_constant_pool) || Token.is(MIToken::kw_stack) || in parseMachinePointerInfo()
3256 Token.is(MIToken::kw_got) || Token.is(MIToken::kw_jump_table) || in parseMachinePointerInfo()
3257 Token.is(MIToken::FixedStackObject) || Token.is(MIToken::StackObject) || in parseMachinePointerInfo()
3258 Token.is(MIToken::kw_call_entry) || Token.is(MIToken::kw_custom)) { in parseMachinePointerInfo()
3268 if (Token.isNot(MIToken::NamedIRValue) && Token.isNot(MIToken::IRValue) && in parseMachinePointerInfo()
3269 Token.isNot(MIToken::GlobalValue) && in parseMachinePointerInfo()
3270 Token.isNot(MIToken::NamedGlobalValue) && in parseMachinePointerInfo()
3271 Token.isNot(MIToken::QuotedIRValue) && in parseMachinePointerInfo()
3272 Token.isNot(MIToken::kw_unknown_address)) in parseMachinePointerInfo()
3290 if (Token.is(MIToken::Identifier) && Token.stringValue() == "syncscope") { in parseOptionalScope()
3309 if (Token.isNot(MIToken::Identifier)) in parseOptionalAtomicOrdering()
3312 Order = StringSwitch<AtomicOrdering>(Token.stringValue()) in parseOptionalAtomicOrdering()
3333 while (Token.isMemoryOperandFlag()) { in parseMachineMemoryOperand()
3337 if (Token.isNot(MIToken::Identifier) || in parseMachineMemoryOperand()
3338 (Token.stringValue() != "load" && Token.stringValue() != "store")) in parseMachineMemoryOperand()
3340 if (Token.stringValue() == "load") in parseMachineMemoryOperand()
3347 if (Token.is(MIToken::Identifier) && Token.stringValue() == "store") { in parseMachineMemoryOperand()
3366 if (Token.isNot(MIToken::IntegerLiteral) && in parseMachineMemoryOperand()
3367 Token.isNot(MIToken::kw_unknown_size) && in parseMachineMemoryOperand()
3368 Token.isNot(MIToken::lparen)) in parseMachineMemoryOperand()
3373 if (Token.is(MIToken::IntegerLiteral)) { in parseMachineMemoryOperand()
3380 } else if (Token.is(MIToken::kw_unknown_size)) { in parseMachineMemoryOperand()
3386 if (parseLowLevelType(Token.location(), MemoryType)) in parseMachineMemoryOperand()
3395 if (Token.is(MIToken::Identifier)) { in parseMachineMemoryOperand()
3401 if (Token.stringValue() != Word) in parseMachineMemoryOperand()
3413 switch (Token.kind()) { in parseMachineMemoryOperand()
3472 assert((Token.is(MIToken::kw_pre_instr_symbol) || in parsePreOrPostInstrSymbol()
3473 Token.is(MIToken::kw_post_instr_symbol)) && in parsePreOrPostInstrSymbol()
3474 "Invalid token for a pre- post-instruction symbol!"); in parsePreOrPostInstrSymbol()
3476 if (Token.isNot(MIToken::MCSymbol)) in parsePreOrPostInstrSymbol()
3478 Symbol = getOrCreateMCSymbol(Token.stringValue()); in parsePreOrPostInstrSymbol()
3480 if (Token.isNewlineOrEOF() || Token.is(MIToken::coloncolon) || in parsePreOrPostInstrSymbol()
3481 Token.is(MIToken::lbrace)) in parsePreOrPostInstrSymbol()
3483 if (Token.isNot(MIToken::comma)) in parsePreOrPostInstrSymbol()
3490 assert(Token.is(MIToken::kw_heap_alloc_marker) && in parseHeapAllocMarker()
3491 "Invalid token for a heap alloc marker!"); in parseHeapAllocMarker()
3497 if (Token.isNewlineOrEOF() || Token.is(MIToken::coloncolon) || in parseHeapAllocMarker()
3498 Token.is(MIToken::lbrace)) in parseHeapAllocMarker()
3500 if (Token.isNot(MIToken::comma)) in parseHeapAllocMarker()
3507 assert(Token.is(MIToken::kw_pcsections) && in parsePCSections()
3508 "Invalid token for a PC sections!"); in parsePCSections()
3514 if (Token.isNewlineOrEOF() || Token.is(MIToken::coloncolon) || in parsePCSections()
3515 Token.is(MIToken::lbrace)) in parsePCSections()
3517 if (Token.isNot(MIToken::comma)) in parsePCSections()
3568 if (Token.isNot(MIToken::StringConstant)) in parseStringConstant()
3570 Result = std::string(Token.stringValue()); in parseStringConstant()
3629 MIToken Token; in parseIRValue() local
3630 Src = lexMIToken(Src, Token, [&](StringRef::iterator Loc, const Twine &Msg) { in parseIRValue()
3635 return ::parseIRValue(Token, PFS, V, ErrorCallback); in parseIRValue()