Lines Matching defs:ID

697     ValID ID;
698 if (ParseValID(ID))
700 if (ID.Kind != ValID::t_Constant)
702 Aliasee = ID.ConstantVal;
1078 /// GetGlobalVal - Get a value with the specified name or ID, creating a
1115 GlobalValue *LLParser::GetGlobalVal(unsigned ID, Type *Ty, LocTy Loc) {
1122 GlobalValue *Val = ID < NumberedVals.size() ? NumberedVals[ID] : nullptr;
1127 auto I = ForwardRefValIDs.find(ID);
1135 Error(Loc, "'@" + Twine(ID) + "' defined with type '" +
1142 ForwardRefValIDs[ID] = std::make_pair(FwdVal, Loc);
2320 /// GetVal - Get a value with the specified name or ID, creating a
2365 Value *LLParser::PerFunctionState::GetVal(unsigned ID, Type *Ty, LocTy Loc) {
2367 Value *Val = ID < NumberedVals.size() ? NumberedVals[ID] : nullptr;
2372 auto I = ForwardRefValIDs.find(ID);
2381 P.Error(Loc, "'%" + Twine(ID) + "' is not a basic block");
2383 P.Error(Loc, "'%" + Twine(ID) + "' defined with type '" +
2401 ForwardRefValIDs[ID] = std::make_pair(FwdVal, Loc);
2410 // If this instruction has void type, it cannot have a name or ID specified.
2420 // If neither a name nor an ID was specified, just use the next ID.
2466 /// GetBB - Get a basic block with the specified name or ID, creating a
2474 BasicBlock *LLParser::PerFunctionState::GetBB(unsigned ID, LocTy Loc) {
2475 return dyn_cast_or_null<BasicBlock>(GetVal(ID,
2517 bool LLParser::ParseValID(ValID &ID, PerFunctionState *PFS) {
2518 ID.Loc = Lex.getLoc();
2522 ID.UIntVal = Lex.getUIntVal();
2523 ID.Kind = ValID::t_GlobalID;
2526 ID.StrVal = Lex.getStrVal();
2527 ID.Kind = ValID::t_GlobalName;
2530 ID.UIntVal = Lex.getUIntVal();
2531 ID.Kind = ValID::t_LocalID;
2534 ID.StrVal = Lex.getStrVal();
2535 ID.Kind = ValID::t_LocalName;
2538 ID.APSIntVal = Lex.getAPSIntVal();
2539 ID.Kind = ValID::t_APSInt;
2542 ID.APFloatVal = Lex.getAPFloatVal();
2543 ID.Kind = ValID::t_APFloat;
2546 ID.ConstantVal = ConstantInt::getTrue(Context);
2547 ID.Kind = ValID::t_Constant;
2550 ID.ConstantVal = ConstantInt::getFalse(Context);
2551 ID.Kind = ValID::t_Constant;
2553 case lltok::kw_null: ID.Kind = ValID::t_Null; break;
2554 case lltok::kw_undef: ID.Kind = ValID::t_Undef; break;
2555 case lltok::kw_zeroinitializer: ID.Kind = ValID::t_Zero; break;
2556 case lltok::kw_none: ID.Kind = ValID::t_None; break;
2566 ID.ConstantStructElts = make_unique<Constant *[]>(Elts.size());
2567 ID.UIntVal = Elts.size();
2568 memcpy(ID.ConstantStructElts.get(), Elts.data(),
2570 ID.Kind = ValID::t_ConstantStruct;
2588 ID.ConstantStructElts = make_unique<Constant *[]>(Elts.size());
2589 memcpy(ID.ConstantStructElts.get(), Elts.data(),
2591 ID.UIntVal = Elts.size();
2592 ID.Kind = ValID::t_PackedConstantStruct;
2597 return Error(ID.Loc, "constant vector must not be empty");
2612 ID.ConstantVal = ConstantVector::get(Elts);
2613 ID.Kind = ValID::t_Constant;
2628 ID.Kind = ValID::t_EmptyArray;
2646 ID.ConstantVal = ConstantArray::get(ATy, Elts);
2647 ID.Kind = ValID::t_Constant;
2652 ID.ConstantVal = ConstantDataArray::getString(Context, Lex.getStrVal(),
2655 ID.Kind = ValID::t_Constant;
2666 ParseStringConstant(ID.StrVal) ||
2670 ID.StrVal2 = Lex.getStrVal();
2671 ID.UIntVal = unsigned(HasSideEffect) | (unsigned(AlignStack)<<1) |
2673 ID.Kind = ValID::t_InlineAsm;
2724 ID.ConstantVal = FwdRef;
2725 ID.Kind = ValID::t_Constant;
2749 ID.ConstantVal = BlockAddress::get(F, BB);
2750 ID.Kind = ValID::t_Constant;
2778 return Error(ID.Loc, "invalid cast opcode for cast from '" +
2781 ID.ConstantVal = ConstantExpr::getCast((Instruction::CastOps)Opc,
2783 ID.Kind = ValID::t_Constant;
2797 return Error(ID.Loc, "extractvalue operand must be aggregate type");
2799 return Error(ID.Loc, "invalid indices for extractvalue");
2800 ID.ConstantVal = ConstantExpr::getExtractValue(Val, Indices);
2801 ID.Kind = ValID::t_Constant;
2816 return Error(ID.Loc, "insertvalue operand must be aggregate type");
2820 return Error(ID.Loc, "invalid indices for insertvalue");
2822 return Error(ID.Loc, "insertvalue operand and field disagree in type: '" +
2826 ID.ConstantVal = ConstantExpr::getInsertValue(Val0, Val1, Indices);
2827 ID.Kind = ValID::t_Constant;
2844 return Error(ID.Loc, "compare operands must have the same type");
2850 return Error(ID.Loc, "fcmp requires floating point operands");
2851 ID.ConstantVal = ConstantExpr::getFCmp(Pred, Val0, Val1);
2856 return Error(ID.Loc, "icmp requires pointer or integer operands");
2857 ID.ConstantVal = ConstantExpr::getICmp(Pred, Val0, Val1);
2859 ID.Kind = ValID::t_Constant;
2907 return Error(ID.Loc, "operands of constexpr must have same type");
2927 return Error(ID.Loc, "constexpr requires integer operands");
2935 return Error(ID.Loc, "constexpr requires fp operands");
2944 ID.ConstantVal = C;
2945 ID.Kind = ValID::t_Constant;
2963 return Error(ID.Loc, "operands of constexpr must have same type");
2965 return Error(ID.Loc,
2967 ID.ConstantVal = ConstantExpr::get(Opc, Val0, Val1);
2968 ID.Kind = ValID::t_Constant;
3003 return Error(ID.Loc, "base of getelementptr must be a pointer");
3016 return Error(ID.Loc, "getelementptr index must be an integer");
3018 return Error(ID.Loc, "getelementptr index type missmatch");
3024 ID.Loc,
3031 return Error(ID.Loc, "base element of getelementptr must be sized");
3034 return Error(ID.Loc, "invalid getelementptr indices");
3035 ID.ConstantVal =
3039 return Error(ID.Loc, "expected three operands to select");
3042 return Error(ID.Loc, Reason);
3043 ID.ConstantVal = ConstantExpr::getSelect(Elts[0], Elts[1], Elts[2]);
3046 return Error(ID.Loc, "expected three operands to shufflevector");
3048 return Error(ID.Loc, "invalid operands to shufflevector");
3049 ID.ConstantVal =
3053 return Error(ID.Loc, "expected two operands to extractelement");
3055 return Error(ID.Loc, "invalid extractelement operands");
3056 ID.ConstantVal = ConstantExpr::getExtractElement(Elts[0], Elts[1]);
3060 return Error(ID.Loc, "expected three operands to insertelement");
3062 return Error(ID.Loc, "invalid insertelement operands");
3063 ID.ConstantVal =
3067 ID.Kind = ValID::t_Constant;
3079 ValID ID;
3081 bool Parsed = ParseValID(ID) ||
3082 ConvertValIDToValue(Ty, ID, V, nullptr);
3084 return Error(ID.Loc, "global values must be constants");
4159 bool LLParser::ConvertValIDToValue(Type *Ty, ValID &ID, Value *&V,
4162 return Error(ID.Loc, "functions are not values, refer to them as pointers");
4164 switch (ID.Kind) {
4166 if (!PFS) return Error(ID.Loc, "invalid use of function-local name");
4167 V = PFS->GetVal(ID.UIntVal, Ty, ID.Loc);
4170 if (!PFS) return Error(ID.Loc, "invalid use of function-local name");
4171 V = PFS->GetVal(ID.StrVal, Ty, ID.Loc);
4174 if (!ID.FTy || !InlineAsm::Verify(ID.FTy, ID.StrVal2))
4175 return Error(ID.Loc, "invalid type for inline asm constraint string");
4176 V = InlineAsm::get(ID.FTy, ID.StrVal, ID.StrVal2, ID.UIntVal & 1,
4177 (ID.UIntVal >> 1) & 1,
4178 (InlineAsm::AsmDialect(ID.UIntVal >> 2)));
4182 V = GetGlobalVal(ID.StrVal, Ty, ID.Loc);
4185 V = GetGlobalVal(ID.UIntVal, Ty, ID.Loc);
4189 return Error(ID.Loc, "integer constant must have integer type");
4190 ID.APSIntVal = ID.APSIntVal.extOrTrunc(Ty->getPrimitiveSizeInBits());
4191 V = ConstantInt::get(Context, ID.APSIntVal);
4195 !ConstantFP::isValueValidForType(Ty, ID.APFloatVal))
4196 return Error(ID.Loc, "floating point constant invalid for type");
4200 if (&ID.APFloatVal.getSemantics() == &APFloat::IEEEdouble) {
4203 ID.APFloatVal.convert(APFloat::IEEEhalf, APFloat::rmNearestTiesToEven,
4206 ID.APFloatVal.convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven,
4209 V = ConstantFP::get(Context, ID.APFloatVal);
4212 return Error(ID.Loc, "floating point constant does not have type '" +
4218 return Error(ID.Loc, "null must be a pointer type");
4224 return Error(ID.Loc, "invalid type for undef constant");
4229 return Error(ID.Loc, "invalid empty array initializer");
4235 return Error(ID.Loc, "invalid type for null constant");
4240 return Error(ID.Loc, "invalid type for none constant");
4244 if (ID.ConstantVal->getType() != Ty)
4245 return Error(ID.Loc, "constant expression type mismatch");
4247 V = ID.ConstantVal;
4252 if (ST->getNumElements() != ID.UIntVal)
4253 return Error(ID.Loc,
4255 if (ST->isPacked() != (ID.Kind == ValID::t_PackedConstantStruct))
4256 return Error(ID.Loc, "packed'ness of initializer and type don't match");
4259 for (unsigned i = 0, e = ID.UIntVal; i != e; ++i)
4260 if (ID.ConstantStructElts[i]->getType() != ST->getElementType(i))
4261 return Error(ID.Loc, "element " + Twine(i) +
4265 ST, makeArrayRef(ID.ConstantStructElts.get(), ID.UIntVal));
4267 return Error(ID.Loc, "constant expression type mismatch");
4275 ValID ID;
4277 if (ParseValID(ID, /*PFS=*/nullptr))
4279 switch (ID.Kind) {
4287 if (ConvertValIDToValue(Ty, ID, V, /*PFS=*/nullptr))
4300 ValID ID;
4301 return ParseValID(ID, PFS) || ConvertValIDToValue(Ty, ID, V, PFS);
4547 ValID ID;
4549 ID.Kind = ValID::t_GlobalID;
4550 ID.UIntVal = NumberedVals.size() - 1;
4552 ID.Kind = ValID::t_GlobalName;
4553 ID.StrVal = FunctionName;
4555 auto Blocks = ForwardRefBlockAddresses.find(ID);
4563 ValID ID;
4565 ID.Kind = ValID::t_GlobalName;
4566 ID.StrVal = F.getName();
4568 ID.Kind = ValID::t_GlobalID;
4569 ID.UIntVal = FunctionNumber;
4572 auto Blocks = P.ForwardRefBlockAddresses.find(ID);