Lines Matching refs:Token

396   MIToken Token;  member in __anon0daf8f910111::MIParser
583 CurrentSource.slice(SkipChar, StringRef::npos), Token, in lex()
587 bool MIParser::error(const Twine &Msg) { return error(Token.location(), Msg); } in error()
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()
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()
1477 if (Token.is(MIToken::kw_frame_setup)) in parseInstruction()
1479 if (Token.is(MIToken::kw_frame_destroy)) in parseInstruction()
1481 if (Token.is(MIToken::kw_nnan)) in parseInstruction()
1483 if (Token.is(MIToken::kw_ninf)) in parseInstruction()
1485 if (Token.is(MIToken::kw_nsz)) in parseInstruction()
1487 if (Token.is(MIToken::kw_arcp)) in parseInstruction()
1489 if (Token.is(MIToken::kw_contract)) in parseInstruction()
1491 if (Token.is(MIToken::kw_afn)) in parseInstruction()
1493 if (Token.is(MIToken::kw_reassoc)) in parseInstruction()
1495 if (Token.is(MIToken::kw_nuw)) in parseInstruction()
1497 if (Token.is(MIToken::kw_nsw)) in parseInstruction()
1499 if (Token.is(MIToken::kw_exact)) in parseInstruction()
1501 if (Token.is(MIToken::kw_nofpexcept)) in parseInstruction()
1503 if (Token.is(MIToken::kw_unpredictable)) in parseInstruction()
1505 if (Token.is(MIToken::kw_noconvergent)) in parseInstruction()
1510 if (Token.isNot(MIToken::Identifier)) in parseInstruction()
1512 StringRef InstrName = Token.stringValue(); in parseInstruction()
1520 assert(Token.is(MIToken::NamedRegister) && "Needs NamedRegister token"); in parseNamedRegister()
1521 StringRef Name = Token.stringValue(); in parseNamedRegister()
1528 assert(Token.is(MIToken::NamedVirtualRegister) && "Expected NamedVReg token"); in parseNamedVirtualRegister()
1529 StringRef Name = Token.stringValue(); in parseNamedVirtualRegister()
1537 if (Token.is(MIToken::NamedVirtualRegister)) in parseVirtualRegister()
1539 assert(Token.is(MIToken::VirtualRegister) && "Needs VirtualRegister token"); in parseVirtualRegister()
1548 switch (Token.kind()) { in parseRegister()
1567 if (Token.isNot(MIToken::Identifier) && Token.isNot(MIToken::underscore)) in parseRegisterClassOrBank()
1569 StringRef::iterator Loc = Token.location(); in parseRegisterClassOrBank()
1570 StringRef Name = Token.stringValue(); in parseRegisterClassOrBank()
1626 switch (Token.kind()) { in parseRegisterFlag()
1663 return error("duplicate '" + Token.stringValue() + "' register flag"); in parseRegisterFlag()
1669 assert(Token.is(MIToken::dot)); in parseSubRegisterIndex()
1671 if (Token.isNot(MIToken::Identifier)) in parseSubRegisterIndex()
1673 auto Name = Token.stringValue(); in parseSubRegisterIndex()
1684 if (Token.isNot(MIToken::IntegerLiteral)) in parseRegisterTiedDefIndex()
1735 while (Token.isRegisterFlag()) { in parseRegisterOperand()
1739 if (!Token.isRegister()) in parseRegisterOperand()
1747 if (Token.is(MIToken::dot)) { in parseRegisterOperand()
1753 if (Token.is(MIToken::colon)) { in parseRegisterOperand()
1769 if (parseLowLevelType(Token.location(), Ty)) in parseRegisterOperand()
1788 if (parseLowLevelType(Token.location(), Ty)) in parseRegisterOperand()
1826 assert(Token.is(MIToken::IntegerLiteral)); in parseImmediateOperand()
1827 const APSInt &Int = Token.integerValue(); in parseImmediateOperand()
1842 assert(Token.is(MIToken::dot)); in parseTargetImmMnemonic()
1843 auto Loc = Token.location(); // record start position in parseTargetImmMnemonic()
1848 if (Token.is(MIToken::IntegerLiteral)) { in parseTargetImmMnemonic()
1849 Len += Token.range().size(); in parseTargetImmMnemonic()
1854 if (Token.is(MIToken::comma)) in parseTargetImmMnemonic()
1857 assert(Token.is(MIToken::Identifier)); in parseTargetImmMnemonic()
1858 Src = StringRef(Loc, Len + Token.stringValue().size()); in parseTargetImmMnemonic()
1867 if (!Token.is(MIToken::comma)) in parseTargetImmMnemonic()
1894 if (parseIRConstant(Loc, StringRef(Loc, Token.range().end() - Loc), C)) in parseIRConstant()
1914 if (Token.range().front() == 's' || Token.range().front() == 'p') { in parseLowLevelType()
1915 StringRef SizeStr = Token.range().drop_front(); in parseLowLevelType()
1920 if (Token.range().front() == 's') { in parseLowLevelType()
1921 auto ScalarSize = APSInt(Token.range().drop_front()).getZExtValue(); in parseLowLevelType()
1928 } else if (Token.range().front() == 'p') { in parseLowLevelType()
1930 uint64_t AS = APSInt(Token.range().drop_front()).getZExtValue(); in parseLowLevelType()
1940 if (Token.isNot(MIToken::less)) in parseLowLevelType()
1946 Token.is(MIToken::Identifier) && Token.stringValue() == "vscale"; in parseLowLevelType()
1949 if (Token.isNot(MIToken::Identifier) || Token.stringValue() != "x") in parseLowLevelType()
1961 if (Token.isNot(MIToken::IntegerLiteral)) in parseLowLevelType()
1963 uint64_t NumElements = Token.integerValue().getZExtValue(); in parseLowLevelType()
1969 if (Token.isNot(MIToken::Identifier) || Token.stringValue() != "x") in parseLowLevelType()
1973 if (Token.range().front() != 's' && Token.range().front() != 'p') in parseLowLevelType()
1976 StringRef SizeStr = Token.range().drop_front(); in parseLowLevelType()
1980 if (Token.range().front() == 's') { in parseLowLevelType()
1981 auto ScalarSize = APSInt(Token.range().drop_front()).getZExtValue(); in parseLowLevelType()
1985 } else if (Token.range().front() == 'p') { in parseLowLevelType()
1987 uint64_t AS = APSInt(Token.range().drop_front()).getZExtValue(); in parseLowLevelType()
1996 if (Token.isNot(MIToken::greater)) in parseLowLevelType()
2006 assert(Token.is(MIToken::Identifier)); in parseTypedImmediateOperand()
2007 StringRef TypeStr = Token.range(); in parseTypedImmediateOperand()
2012 StringRef SizeStr = Token.range().drop_front(); in parseTypedImmediateOperand()
2016 auto Loc = Token.location(); in parseTypedImmediateOperand()
2018 if (Token.isNot(MIToken::IntegerLiteral)) { in parseTypedImmediateOperand()
2019 if (Token.isNot(MIToken::Identifier) || in parseTypedImmediateOperand()
2020 !(Token.range() == "true" || Token.range() == "false")) in parseTypedImmediateOperand()
2031 auto Loc = Token.location(); in parseFPImmediateOperand()
2033 if (Token.isNot(MIToken::FloatingPointLiteral) && in parseFPImmediateOperand()
2034 Token.isNot(MIToken::HexLiteral)) in parseFPImmediateOperand()
2043 static bool getHexUint(const MIToken &Token, APInt &Result) { in getHexUint() argument
2044 assert(Token.is(MIToken::HexLiteral)); in getHexUint()
2045 StringRef S = Token.range(); in getHexUint()
2060 static bool getUnsigned(const MIToken &Token, unsigned &Result, in getUnsigned() argument
2062 if (Token.hasIntegerValue()) { in getUnsigned()
2064 uint64_t Val64 = Token.integerValue().getLimitedValue(Limit); in getUnsigned()
2066 return ErrCB(Token.location(), "expected 32-bit integer (too large)"); in getUnsigned()
2070 if (Token.is(MIToken::HexLiteral)) { in getUnsigned()
2072 if (getHexUint(Token, A)) in getUnsigned()
2075 return ErrCB(Token.location(), "expected 32-bit integer (too large)"); in getUnsigned()
2084 Token, Result, [this](StringRef::iterator Loc, const Twine &Msg) -> bool { in getUnsigned()
2090 assert(Token.is(MIToken::MachineBasicBlock) || in parseMBBReference()
2091 Token.is(MIToken::MachineBasicBlockLabel)); in parseMBBReference()
2102 if (!Token.stringValue().empty() && Token.stringValue() != MBB->getName()) in parseMBBReference()
2104 " isn't '" + Token.stringValue() + "'"); in parseMBBReference()
2118 assert(Token.is(MIToken::StackObject)); in parseStackFrameIndex()
2130 if (!Token.stringValue().empty() && Token.stringValue() != Name) in parseStackFrameIndex()
2132 "' isn't '" + Token.stringValue() + "'"); in parseStackFrameIndex()
2147 assert(Token.is(MIToken::FixedStackObject)); in parseFixedStackFrameIndex()
2168 static bool parseGlobalValue(const MIToken &Token, in parseGlobalValue() argument
2171 switch (Token.kind()) { in parseGlobalValue()
2174 GV = M->getNamedValue(Token.stringValue()); in parseGlobalValue()
2176 return ErrCB(Token.location(), Twine("use of undefined global value '") + in parseGlobalValue()
2177 Token.range() + "'"); in parseGlobalValue()
2182 if (getUnsigned(Token, GVIdx, ErrCB)) in parseGlobalValue()
2185 return ErrCB(Token.location(), Twine("use of undefined global value '@") + in parseGlobalValue()
2198 Token, PFS, GV, in parseGlobalValue()
2216 assert(Token.is(MIToken::ConstantPoolItem)); in parseConstantPoolIndexOperand()
2231 assert(Token.is(MIToken::JumpTableIndex)); in parseJumpTableIndexOperand()
2244 assert(Token.is(MIToken::ExternalSymbol)); in parseExternalSymbolOperand()
2245 const char *Symbol = MF.createExternalSymbolName(Token.stringValue()); in parseExternalSymbolOperand()
2254 assert(Token.is(MIToken::MCSymbol)); in parseMCSymbolOperand()
2255 MCSymbol *Symbol = getOrCreateMCSymbol(Token.stringValue()); in parseMCSymbolOperand()
2264 assert(Token.is(MIToken::SubRegisterIndex)); in parseSubRegisterIndexOperand()
2265 StringRef Name = Token.stringValue(); in parseSubRegisterIndexOperand()
2266 unsigned SubRegIndex = PFS.Target.getSubRegIndex(Token.stringValue()); in parseSubRegisterIndexOperand()
2275 assert(Token.is(MIToken::exclaim)); in parseMDNode()
2277 auto Loc = Token.location(); in parseMDNode()
2279 if (Token.isNot(MIToken::IntegerLiteral) || Token.integerValue().isSigned()) in parseMDNode()
2296 assert(Token.is(MIToken::md_diexpr)); in parseDIExpression()
2305 if (Token.isNot(MIToken::rparen)) { in parseDIExpression()
2307 if (Token.is(MIToken::Identifier)) { in parseDIExpression()
2308 if (unsigned Op = dwarf::getOperationEncoding(Token.stringValue())) { in parseDIExpression()
2313 if (unsigned Enc = dwarf::getAttributeEncoding(Token.stringValue())) { in parseDIExpression()
2318 return error(Twine("invalid DWARF op '") + Token.stringValue() + "'"); in parseDIExpression()
2321 if (Token.isNot(MIToken::IntegerLiteral) || in parseDIExpression()
2322 Token.integerValue().isSigned()) in parseDIExpression()
2325 auto &U = Token.integerValue(); in parseDIExpression()
2342 assert(Token.is(MIToken::md_dilocation)); in parseDILocation()
2355 if (Token.isNot(MIToken::rparen)) { in parseDILocation()
2357 if (Token.is(MIToken::Identifier)) { in parseDILocation()
2358 if (Token.stringValue() == "line") { in parseDILocation()
2362 if (Token.isNot(MIToken::IntegerLiteral) || in parseDILocation()
2363 Token.integerValue().isSigned()) in parseDILocation()
2365 Line = Token.integerValue().getZExtValue(); in parseDILocation()
2370 if (Token.stringValue() == "column") { in parseDILocation()
2374 if (Token.isNot(MIToken::IntegerLiteral) || in parseDILocation()
2375 Token.integerValue().isSigned()) in parseDILocation()
2377 Column = Token.integerValue().getZExtValue(); in parseDILocation()
2381 if (Token.stringValue() == "scope") { in parseDILocation()
2391 if (Token.stringValue() == "inlinedAt") { in parseDILocation()
2395 if (Token.is(MIToken::exclaim)) { in parseDILocation()
2398 } else if (Token.is(MIToken::md_dilocation)) { in parseDILocation()
2407 if (Token.stringValue() == "isImplicitCode") { in parseDILocation()
2411 if (!Token.is(MIToken::Identifier)) in parseDILocation()
2416 if (Token.stringValue() == "true") in parseDILocation()
2418 else if (Token.stringValue() == "false") in parseDILocation()
2427 Token.stringValue() + "'"); in parseDILocation()
2446 if (Token.is(MIToken::exclaim)) { in parseMetadataOperand()
2449 } else if (Token.is(MIToken::md_diexpr)) { in parseMetadataOperand()
2458 if (Token.isNot(MIToken::IntegerLiteral)) in parseCFIOffset()
2460 if (Token.integerValue().getSignificantBits() > 32) in parseCFIOffset()
2462 Offset = (int)Token.integerValue().getExtValue(); in parseCFIOffset()
2468 if (Token.isNot(MIToken::NamedRegister)) in parseCFIRegister()
2484 if (Token.isNot(MIToken::IntegerLiteral)) in parseCFIAddressSpace()
2486 if (Token.integerValue().isSigned()) in parseCFIAddressSpace()
2488 AddressSpace = Token.integerValue().getZExtValue(); in parseCFIAddressSpace()
2495 if (Token.isNot(MIToken::HexLiteral)) in parseCFIEscapeValues()
2509 auto Kind = Token.kind(); in parseCFIOperand()
2616 switch (Token.kind()) { in parseIRBlock()
2619 F.getValueSymbolTable()->lookup(Token.stringValue())); in parseIRBlock()
2621 return error(Twine("use of undefined IR block '") + Token.range() + "'"); in parseIRBlock()
2641 assert(Token.is(MIToken::kw_blockaddress)); in parseBlockAddressOperand()
2645 if (Token.isNot(MIToken::GlobalValue) && in parseBlockAddressOperand()
2646 Token.isNot(MIToken::NamedGlobalValue)) in parseBlockAddressOperand()
2658 if (Token.isNot(MIToken::IRBlock) && Token.isNot(MIToken::NamedIRBlock)) in parseBlockAddressOperand()
2672 assert(Token.is(MIToken::kw_intrinsic)); in parseIntrinsicOperand()
2677 if (Token.isNot(MIToken::NamedGlobalValue)) in parseIntrinsicOperand()
2680 std::string Name = std::string(Token.stringValue()); in parseIntrinsicOperand()
2701 assert(Token.is(MIToken::kw_intpred) || Token.is(MIToken::kw_floatpred)); in parsePredicateOperand()
2702 bool IsFloat = Token.is(MIToken::kw_floatpred); in parsePredicateOperand()
2708 if (Token.isNot(MIToken::Identifier)) in parsePredicateOperand()
2713 Pred = StringSwitch<CmpInst::Predicate>(Token.stringValue()) in parsePredicateOperand()
2734 Pred = StringSwitch<CmpInst::Predicate>(Token.stringValue()) in parsePredicateOperand()
2759 assert(Token.is(MIToken::kw_shufflemask)); in parseShuffleMaskOperand()
2767 if (Token.is(MIToken::kw_undef)) { in parseShuffleMaskOperand()
2769 } else if (Token.is(MIToken::IntegerLiteral)) { in parseShuffleMaskOperand()
2770 const APSInt &Int = Token.integerValue(); in parseShuffleMaskOperand()
2787 assert(Token.is(MIToken::kw_dbg_instr_ref)); in parseDbgInstrRefOperand()
2793 if (Token.isNot(MIToken::IntegerLiteral) || Token.integerValue().isNegative()) in parseDbgInstrRefOperand()
2795 uint64_t InstrIdx = Token.integerValue().getZExtValue(); in parseDbgInstrRefOperand()
2803 if (Token.isNot(MIToken::IntegerLiteral) || Token.integerValue().isNegative()) in parseDbgInstrRefOperand()
2805 uint64_t OpIdx = Token.integerValue().getZExtValue(); in parseDbgInstrRefOperand()
2818 assert(Token.is(MIToken::kw_target_index)); in parseTargetIndexOperand()
2822 if (Token.isNot(MIToken::Identifier)) in parseTargetIndexOperand()
2825 if (PFS.Target.getTargetIndex(Token.stringValue(), Index)) in parseTargetIndexOperand()
2826 return error("use of undefined target index '" + Token.stringValue() + "'"); in parseTargetIndexOperand()
2837 assert(Token.stringValue() == "CustomRegMask" && "Expected a custom RegMask"); in parseCustomRegisterMaskOperand()
2844 if (Token.isNot(MIToken::rparen)) { in parseCustomRegisterMaskOperand()
2845 if (Token.isNot(MIToken::NamedRegister)) in parseCustomRegisterMaskOperand()
2864 assert(Token.is(MIToken::kw_liveout)); in parseLiveoutRegisterMaskOperand()
2870 if (Token.isNot(MIToken::NamedRegister)) in parseLiveoutRegisterMaskOperand()
2878 if (Token.isNot(MIToken::comma)) in parseLiveoutRegisterMaskOperand()
2891 switch (Token.kind()) { in parseMachineOperand()
2973 if (const auto *RegMask = PFS.Target.getRegMask(Token.stringValue())) { in parseMachineOperand()
2977 } else if (Token.stringValue() == "CustomRegMask") { in parseMachineOperand()
3000 if (Token.is(MIToken::kw_target_flags)) { in parseMachineOperandAndTargetFlags()
3005 if (Token.isNot(MIToken::Identifier)) in parseMachineOperandAndTargetFlags()
3007 if (PFS.Target.getDirectTargetFlag(Token.stringValue(), TF)) { in parseMachineOperandAndTargetFlags()
3008 if (PFS.Target.getBitmaskTargetFlag(Token.stringValue(), TF)) in parseMachineOperandAndTargetFlags()
3009 return error("use of undefined target flag '" + Token.stringValue() + in parseMachineOperandAndTargetFlags()
3013 while (Token.is(MIToken::comma)) { in parseMachineOperandAndTargetFlags()
3015 if (Token.isNot(MIToken::Identifier)) in parseMachineOperandAndTargetFlags()
3018 if (PFS.Target.getBitmaskTargetFlag(Token.stringValue(), BitFlag)) in parseMachineOperandAndTargetFlags()
3019 return error("use of undefined target flag '" + Token.stringValue() + in parseMachineOperandAndTargetFlags()
3028 auto Loc = Token.location(); in parseMachineOperandAndTargetFlags()
3040 if (Token.isNot(MIToken::plus) && Token.isNot(MIToken::minus)) in parseOffset()
3042 StringRef Sign = Token.range(); in parseOffset()
3043 bool IsNegative = Token.is(MIToken::minus); in parseOffset()
3045 if (Token.isNot(MIToken::IntegerLiteral)) in parseOffset()
3047 if (Token.integerValue().getSignificantBits() > 64) in parseOffset()
3049 Offset = Token.integerValue().getExtValue(); in parseOffset()
3057 assert(Token.is(MIToken::kw_ir_block_address_taken)); in parseIRBlockAddressTaken()
3059 if (Token.isNot(MIToken::IRBlock) && Token.isNot(MIToken::NamedIRBlock)) in parseIRBlockAddressTaken()
3070 assert(Token.is(MIToken::kw_align) || Token.is(MIToken::kw_basealign)); in parseAlignment()
3072 if (Token.isNot(MIToken::IntegerLiteral) || Token.integerValue().isSigned()) in parseAlignment()
3085 assert(Token.is(MIToken::kw_addrspace)); in parseAddrspace()
3087 if (Token.isNot(MIToken::IntegerLiteral) || Token.integerValue().isSigned()) in parseAddrspace()
3103 static bool parseIRValue(const MIToken &Token, PerFunctionMIParsingState &PFS, in parseIRValue() argument
3105 switch (Token.kind()) { in parseIRValue()
3107 V = PFS.MF.getFunction().getValueSymbolTable()->lookup(Token.stringValue()); in parseIRValue()
3112 if (getUnsigned(Token, SlotNumber, ErrCB)) in parseIRValue()
3120 if (parseGlobalValue(Token, PFS, GV, ErrCB)) in parseIRValue()
3127 if (parseIRConstant(Token.location(), Token.stringValue(), PFS, C, ErrCB)) in parseIRValue()
3139 return ErrCB(Token.location(), Twine("use of undefined IR value '") + Token.range() + "'"); in parseIRValue()
3145 Token, PFS, V, [this](StringRef::iterator Loc, const Twine &Msg) -> bool { in parseIRValue()
3151 if (Token.hasIntegerValue()) { in getUint64()
3152 if (Token.integerValue().getActiveBits() > 64) in getUint64()
3154 Result = Token.integerValue().getZExtValue(); in getUint64()
3157 if (Token.is(MIToken::HexLiteral)) { in getUint64()
3170 return ::getHexUint(Token, Result); in getHexUint()
3175 switch (Token.kind()) { in parseMemoryOperandFlag()
3190 if (PFS.Target.getMMOTargetFlag(Token.stringValue(), TF)) in parseMemoryOperandFlag()
3191 return error("use of undefined target MMO flag '" + Token.stringValue() + in parseMemoryOperandFlag()
3202 return error("duplicate '" + Token.stringValue() + "' memory operand flag"); in parseMemoryOperandFlag()
3208 switch (Token.kind()) { in parseMemoryPseudoSourceValue()
3239 switch (Token.kind()) { in parseMemoryPseudoSourceValue()
3250 MF.createExternalSymbolName(Token.stringValue())); in parseMemoryPseudoSourceValue()
3262 Token.stringValue(), MF, PFS, PSV, in parseMemoryPseudoSourceValue()
3279 if (Token.is(MIToken::kw_constant_pool) || Token.is(MIToken::kw_stack) || in parseMachinePointerInfo()
3280 Token.is(MIToken::kw_got) || Token.is(MIToken::kw_jump_table) || in parseMachinePointerInfo()
3281 Token.is(MIToken::FixedStackObject) || Token.is(MIToken::StackObject) || in parseMachinePointerInfo()
3282 Token.is(MIToken::kw_call_entry) || Token.is(MIToken::kw_custom)) { in parseMachinePointerInfo()
3292 if (Token.isNot(MIToken::NamedIRValue) && Token.isNot(MIToken::IRValue) && in parseMachinePointerInfo()
3293 Token.isNot(MIToken::GlobalValue) && in parseMachinePointerInfo()
3294 Token.isNot(MIToken::NamedGlobalValue) && in parseMachinePointerInfo()
3295 Token.isNot(MIToken::QuotedIRValue) && in parseMachinePointerInfo()
3296 Token.isNot(MIToken::kw_unknown_address)) in parseMachinePointerInfo()
3314 if (Token.is(MIToken::Identifier) && Token.stringValue() == "syncscope") { in parseOptionalScope()
3333 if (Token.isNot(MIToken::Identifier)) in parseOptionalAtomicOrdering()
3336 Order = StringSwitch<AtomicOrdering>(Token.stringValue()) in parseOptionalAtomicOrdering()
3357 while (Token.isMemoryOperandFlag()) { in parseMachineMemoryOperand()
3361 if (Token.isNot(MIToken::Identifier) || in parseMachineMemoryOperand()
3362 (Token.stringValue() != "load" && Token.stringValue() != "store")) in parseMachineMemoryOperand()
3364 if (Token.stringValue() == "load") in parseMachineMemoryOperand()
3371 if (Token.is(MIToken::Identifier) && Token.stringValue() == "store") { in parseMachineMemoryOperand()
3390 if (Token.isNot(MIToken::IntegerLiteral) && in parseMachineMemoryOperand()
3391 Token.isNot(MIToken::kw_unknown_size) && in parseMachineMemoryOperand()
3392 Token.isNot(MIToken::lparen)) in parseMachineMemoryOperand()
3397 if (Token.is(MIToken::IntegerLiteral)) { in parseMachineMemoryOperand()
3404 } else if (Token.is(MIToken::kw_unknown_size)) { in parseMachineMemoryOperand()
3410 if (parseLowLevelType(Token.location(), MemoryType)) in parseMachineMemoryOperand()
3419 if (Token.is(MIToken::Identifier)) { in parseMachineMemoryOperand()
3425 if (Token.stringValue() != Word) in parseMachineMemoryOperand()
3437 switch (Token.kind()) { in parseMachineMemoryOperand()
3496 assert((Token.is(MIToken::kw_pre_instr_symbol) || in parsePreOrPostInstrSymbol()
3497 Token.is(MIToken::kw_post_instr_symbol)) && in parsePreOrPostInstrSymbol()
3500 if (Token.isNot(MIToken::MCSymbol)) in parsePreOrPostInstrSymbol()
3502 Symbol = getOrCreateMCSymbol(Token.stringValue()); in parsePreOrPostInstrSymbol()
3504 if (Token.isNewlineOrEOF() || Token.is(MIToken::coloncolon) || in parsePreOrPostInstrSymbol()
3505 Token.is(MIToken::lbrace)) in parsePreOrPostInstrSymbol()
3507 if (Token.isNot(MIToken::comma)) in parsePreOrPostInstrSymbol()
3514 assert(Token.is(MIToken::kw_heap_alloc_marker) && in parseHeapAllocMarker()
3521 if (Token.isNewlineOrEOF() || Token.is(MIToken::coloncolon) || in parseHeapAllocMarker()
3522 Token.is(MIToken::lbrace)) in parseHeapAllocMarker()
3524 if (Token.isNot(MIToken::comma)) in parseHeapAllocMarker()
3531 assert(Token.is(MIToken::kw_pcsections) && in parsePCSections()
3538 if (Token.isNewlineOrEOF() || Token.is(MIToken::coloncolon) || in parsePCSections()
3539 Token.is(MIToken::lbrace)) in parsePCSections()
3541 if (Token.isNot(MIToken::comma)) in parsePCSections()
3592 if (Token.isNot(MIToken::StringConstant)) in parseStringConstant()
3594 Result = std::string(Token.stringValue()); in parseStringConstant()
3653 MIToken Token; in parseIRValue() local
3654 Src = lexMIToken(Src, Token, [&](StringRef::iterator Loc, const Twine &Msg) { in parseIRValue()
3659 return ::parseIRValue(Token, PFS, V, ErrorCallback); in parseIRValue()