Home | History | Annotate | Download | only in AsmParser

Lines Matching refs:ID

553       return TokError("Metadata id is already used");
595 ValID ID;
596 if (ParseValID(ID)) return true;
597 if (ID.Kind != ValID::t_Constant)
599 Aliasee = ID.ConstantVal;
747 /// GetGlobalVal - Get a value with the specified name or ID, creating a
791 GlobalValue *LLParser::GetGlobalVal(unsigned ID, Type *Ty, LocTy Loc) {
798 GlobalValue *Val = ID < NumberedVals.size() ? NumberedVals[ID] : 0;
804 I = ForwardRefValIDs.find(ID);
812 Error(Loc, "'@" + Twine(ID) + "' defined with type '" +
825 ForwardRefValIDs[ID] = std::make_pair(FwdVal, Loc);
1032 bool LLParser::ParseOptionalCallingConv(CallingConv::ID &CC) {
1053 CC = static_cast<CallingConv::ID>(ArbitraryCC);
1086 ValID ID;
1087 if (ParseMetadataListValue(ID, PFS))
1089 assert(ID.Kind == ValID::t_MDNode);
1090 Inst->setMetadata(MDK, ID.MDNodeVal);
1696 /// GetVal - Get a value with the specified name or ID, creating a
1741 Value *LLParser::PerFunctionState::GetVal(unsigned ID, Type *Ty,
1744 Value *Val = ID < NumberedVals.size() ? NumberedVals[ID] : 0;
1750 I = ForwardRefValIDs.find(ID);
1759 P.Error(Loc, "'%" + Twine(ID) + "' is not a basic block");
1761 P.Error(Loc, "'%" + Twine(ID) + "' defined with type '" +
1778 ForwardRefValIDs[ID] = std::make_pair(FwdVal, Loc);
1787 // If this instruction has void type, it cannot have a name or ID specified.
1797 // If neither a name nor an ID was specified, just use the next ID.
1841 /// GetBB - Get a basic block with the specified name or ID, creating a
1849 BasicBlock *LLParser::PerFunctionState::GetBB(unsigned ID, LocTy Loc) {
1850 return cast_or_null<BasicBlock>(GetVal(ID,
1892 bool LLParser::ParseValID(ValID &ID, PerFunctionState *PFS) {
1893 ID.Loc = Lex.getLoc();
1897 ID.UIntVal = Lex.getUIntVal();
1898 ID.Kind = ValID::t_GlobalID;
1901 ID.StrVal = Lex.getStrVal();
1902 ID.Kind = ValID::t_GlobalName;
1905 ID.UIntVal = Lex.getUIntVal();
1906 ID.Kind = ValID::t_LocalID;
1909 ID.StrVal = Lex.getStrVal();
1910 ID.Kind = ValID::t_LocalName;
1913 return ParseMetadataValue(ID, PFS);
1915 ID.APSIntVal = Lex.getAPSIntVal();
1916 ID.Kind = ValID::t_APSInt;
1919 ID.APFloatVal = Lex.getAPFloatVal();
1920 ID.Kind = ValID::t_APFloat;
1923 ID.ConstantVal = ConstantInt::getTrue(Context);
1924 ID
1927 ID.ConstantVal = ConstantInt::getFalse(Context);
1928 ID.Kind = ValID::t_Constant;
1930 case lltok::kw_null: ID.Kind = ValID::t_Null; break;
1931 case lltok::kw_undef: ID.Kind = ValID::t_Undef; break;
1932 case lltok::kw_zeroinitializer: ID.Kind = ValID::t_Zero; break;
1942 ID.ConstantStructElts = new Constant*[Elts.size()];
1943 ID.UIntVal = Elts.size();
1944 memcpy(ID.ConstantStructElts, Elts.data(), Elts.size()*sizeof(Elts[0]));
1945 ID.Kind = ValID::t_ConstantStruct;
1963 ID.ConstantStructElts = new Constant*[Elts.size()];
1964 memcpy(ID.ConstantStructElts, Elts.data(), Elts.size()*sizeof(Elts[0]));
1965 ID.UIntVal = Elts.size();
1966 ID.Kind = ValID::t_PackedConstantStruct;
1971 return Error(ID.Loc, "constant vector must not be empty");
1985 ID.ConstantVal = ConstantVector::get(Elts);
1986 ID.Kind = ValID::t_Constant;
2001 ID.Kind = ValID::t_EmptyArray;
2019 ID.ConstantVal = ConstantArray::get(ATy, Elts);
2020 ID.Kind = ValID::t_Constant;
2025 ID.ConstantVal = ConstantArray::get(Context, Lex.getStrVal(), false);
2027 ID.Kind = ValID::t_Constant;
2036 ParseStringConstant(ID.StrVal) ||
2040 ID.StrVal2 = Lex.getStrVal();
2041 ID.UIntVal = unsigned(HasSideEffect) | (unsigned(AlignStack)<<1);
2042 ID.Kind = ValID::t_InlineAsm;
2070 ID.ConstantVal = FwdRef;
2071 ID.Kind = ValID::t_Constant;
2098 return Error(ID.Loc, "invalid cast opcode for cast from '" +
2101 ID.ConstantVal = ConstantExpr::getCast((Instruction::CastOps)Opc,
2103 ID.Kind = ValID::t_Constant;
2117 return Error(ID.Loc, "extractvalue operand must be aggregate type");
2119 return Error(ID.Loc, "invalid indices for extractvalue");
2120 ID.ConstantVal = ConstantExpr::getExtractValue(Val, Indices);
2121 ID.Kind = ValID::t_Constant;
2136 return Error(ID.Loc, "insertvalue operand must be aggregate type");
2138 return Error(ID.Loc, "invalid indices for insertvalue");
2139 ID.ConstantVal = ConstantExpr::getInsertValue(Val0, Val1, Indices);
2140 ID.Kind = ValID::t_Constant;
2157 return Error(ID.Loc, "compare operands must have the same type");
2163 return Error(ID.Loc, "fcmp requires floating point operands");
2164 ID.ConstantVal = ConstantExpr::getFCmp(Pred, Val0, Val1);
2169 return Error(ID.Loc, "icmp requires pointer or integer operands");
2170 ID.ConstantVal = ConstantExpr::getICmp(Pred, Val0, Val1);
2172 ID.Kind = ValID::t_Constant;
2220 return Error(ID.Loc, "operands of constexpr must have same type");
2240 return Error(ID.Loc, "constexpr requires integer operands");
2248 return Error(ID.Loc, "constexpr requires fp operands");
2257 ID.ConstantVal = C;
2258 ID.Kind = ValID::t_Constant;
2276 return Error(ID.Loc, "operands of constexpr must have same type");
2278 return Error(ID.Loc,
2280 ID.ConstantVal = ConstantExpr::get(Opc, Val0, Val1);
2281 ID.Kind = ValID::t_Constant;
2303 return Error(ID.Loc, "getelementptr requires pointer operand");
2307 return Error(ID.Loc, "invalid indices for getelementptr");
2308 ID.ConstantVal = ConstantExpr::getGetElementPtr(Elts[0], Indices,
2312 return Error(ID.Loc, "expected three operands to select");
2315 return Error(ID.Loc, Reason);
2316 ID.ConstantVal = ConstantExpr::getSelect(Elts[0], Elts[1], Elts[2]);
2319 return Error(ID.Loc, "expected three operands to shufflevector");
2321 return Error(ID.Loc, "invalid operands to shufflevector");
2322 ID.ConstantVal =
2326 return Error(ID.Loc, "expected two operands to extractelement");
2328 return Error(ID.Loc, "invalid extractelement operands");
2329 ID.ConstantVal = ConstantExpr::getExtractElement(Elts[0], Elts[1]);
2333 return Error(ID.Loc, "expected three operands to insertelement");
2335 return Error(ID.Loc, "invalid insertelement operands");
2336 ID.ConstantVal =
2340 ID.Kind = ValID::t_Constant;
2352 ValID ID;
2354 bool Parsed = ParseValID(ID) ||
2355 ConvertValIDToValue(Ty, ID, V, NULL);
2357 return Error(ID.Loc, "global values must be constants");
2390 bool LLParser::ParseMetadataListValue(ValID &ID, PerFunctionState *PFS) {
2399 ID.MDNodeVal = MDNode::get(Context, Elts);
2400 ID.Kind = ValID::t_MDNode;
2408 bool LLParser::ParseMetadataValue(ValID &ID, PerFunctionState *PFS) {
2415 return ParseMetadataListValue(ID, PFS);
2420 if (ParseMDNodeID(ID.MDNodeVal)) return true;
2421 ID.Kind = ValID::t_MDNode;
2427 if (ParseMDString(ID.MDStringVal)) return true;
2428 ID.Kind = ValID::t_MDString;
2437 bool LLParser::ConvertValIDToValue(Type *Ty, ValID &ID, Value *&V,
2440 return Error(ID.Loc, "functions are not values, refer to them as pointers");
2442 switch (ID.Kind) {
2445 if (!PFS) return Error(ID.Loc, "invalid use of function-local name");
2446 V = PFS->GetVal(ID.UIntVal, Ty, ID.Loc);
2449 if (!PFS) return Error(ID.Loc, "invalid use of function-local name");
2450 V = PFS->GetVal(ID.StrVal, Ty, ID.Loc);
2456 if (!FTy || !InlineAsm::Verify(FTy, ID.StrVal2))
2457 return Error(ID.Loc, "invalid type for inline asm constraint string");
2458 V = InlineAsm::get(FTy, ID.StrVal, ID.StrVal2, ID.UIntVal&1, ID.UIntVal>>1);
2463 return Error(ID.Loc, "metadata value must have metadata type");
2464 V = ID.MDNodeVal;
2468 return Error(ID.Loc, "metadata value must have metadata type");
2469 V = ID.MDStringVal;
2472 V = GetGlobalVal(ID.StrVal, Ty, ID.Loc);
2475 V = GetGlobalVal(ID.UIntVal, Ty, ID.Loc);
2479 return Error(ID.Loc, "integer constant must have integer type");
2480 ID.APSIntVal = ID.APSIntVal.extOrTrunc(Ty->getPrimitiveSizeInBits());
2481 V = ConstantInt::get(Context, ID.APSIntVal);
2485 !ConstantFP::isValueValidForType(Ty, ID.APFloatVal))
2486 return Error(ID.Loc, "floating point constant invalid for type");
2490 if (&ID.APFloatVal.getSemantics() == &APFloat::IEEEdouble &&
2493 ID.APFloatVal.convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven,
2496 V = ConstantFP::get(Context, ID.APFloatVal);
2499 return Error(ID.Loc, "floating point constant does not have type '" +
2505 return Error(ID.Loc, "null must be a pointer type");
2511 return Error(ID.Loc, "invalid type for undef constant");
2516 return Error(ID.Loc, "invalid empty array initializer");
2522 return Error(ID.Loc, "invalid type for null constant");
2526 if (ID.ConstantVal->getType() != Ty)
2527 return Error(ID.Loc, "constant expression type mismatch");
2529 V = ID.ConstantVal;
2534 if (ST->getNumElements() != ID.UIntVal)
2535 return Error(ID.Loc,
2537 if (ST->isPacked() != (ID.Kind == ValID::t_PackedConstantStruct))
2538 return Error(ID.Loc, "packed'ness of initializer and type don't match");
2541 for (unsigned i = 0, e = ID.UIntVal; i != e; ++i)
2542 if (ID.ConstantStructElts[i]->getType() != ST->getElementType(i))
2543 return Error(ID.Loc, "element " + Twine(i) +
2546 V = ConstantStruct::get(ST, makeArrayRef(ID.ConstantStructElts,
2547 ID.UIntVal));
2549 return Error(ID.Loc, "constant expression type mismatch");
2556 ValID ID;
2557 return ParseValID(ID, PFS) ||
2558 ConvertValIDToValue(Ty, ID, V, PFS);
2589 CallingConv::ID CC;
2828 if (ParseToken(lltok::equal, "expected '=' after instruction id"))
3173 CallingConv::ID CC;
3572 CallingConv::ID CC;