Lines Matching refs:VD
30 DeclScope(ByteCodeExprGen<Emitter> *Ctx, const ValueDecl *VD) in DeclScope() argument
31 : VariableScope<Emitter>(Ctx), Scope(Ctx->P, VD), in DeclScope()
33 Ctx->GlobalDecl = Context::shouldBeGloballyIndexed(VD); in DeclScope()
2052 if (const auto *VD = dyn_cast<VarDecl>(DE->getDecl())) in dereference() local
2053 return dereferenceVar(LV, *T, VD, AK, Direct, Indirect); in dereference()
2113 const Expr *LV, PrimType T, const VarDecl *VD, DerefKind AK, in dereferenceVar() argument
2116 auto It = Locals.find(VD); in dereferenceVar()
2141 } else if (auto Idx = P.getGlobal(VD)) { in dereferenceVar()
2170 if (VD->hasLocalStorage() && VD->hasInit() && !VD->isConstexpr()) { in dereferenceVar()
2171 QualType VT = VD->getType(); in dereferenceVar()
2173 return this->visit(VD->getInit()); in dereferenceVar()
2241 if (const auto *VD = in allocateLocalPrimitive() local
2243 assert(!P.getGlobal(VD)); in allocateLocalPrimitive()
2244 assert(!Locals.contains(VD)); in allocateLocalPrimitive()
2253 if (auto *VD = dyn_cast_if_present<ValueDecl>(Src.dyn_cast<const Decl *>())) in allocateLocalPrimitive() local
2254 Locals.insert({VD, Local}); in allocateLocalPrimitive()
2263 if ([[maybe_unused]] const auto *VD = in allocateLocal() local
2265 assert(!P.getGlobal(VD)); in allocateLocal()
2266 assert(!Locals.contains(VD)); in allocateLocal()
2273 if (auto *VD = dyn_cast_if_present<ValueDecl>(Src.dyn_cast<const Decl *>())) { in allocateLocal() local
2274 Key = VD; in allocateLocal()
2275 Ty = VD->getType(); in allocateLocal()
2277 if (const auto *VarD = dyn_cast<VarDecl>(VD)) in allocateLocal()
2358 bool ByteCodeExprGen<Emitter>::visitDecl(const VarDecl *VD) { in visitDecl() argument
2359 assert(!VD->isInvalidDecl() && "Trying to constant evaluate an invalid decl"); in visitDecl()
2362 if (!this->visitVarDecl(VD)) in visitDecl()
2365 std::optional<PrimType> VarT = classify(VD->getType()); in visitDecl()
2367 if (Context::shouldBeGloballyIndexed(VD)) { in visitDecl()
2368 auto GlobalIndex = P.getGlobal(VD); in visitDecl()
2371 if (!this->emitGetGlobalUnchecked(*VarT, *GlobalIndex, VD)) in visitDecl()
2374 if (!this->emitGetPtrGlobal(*GlobalIndex, VD)) in visitDecl()
2378 auto Local = Locals.find(VD); in visitDecl()
2381 if (!this->emitGetLocal(*VarT, Local->second.Offset, VD)) in visitDecl()
2384 if (!this->emitGetPtrLocal(Local->second.Offset, VD)) in visitDecl()
2391 return this->emitRet(*VarT, VD); in visitDecl()
2394 return this->emitRet(PT_Ptr, VD); in visitDecl()
2398 bool ByteCodeExprGen<Emitter>::visitVarDecl(const VarDecl *VD) { in visitVarDecl() argument
2400 if (VD->getType().isNull()) in visitVarDecl()
2403 const Expr *Init = VD->getInit(); in visitVarDecl()
2404 std::optional<PrimType> VarT = classify(VD->getType()); in visitVarDecl()
2406 if (Context::shouldBeGloballyIndexed(VD)) { in visitVarDecl()
2408 if (P.getGlobal(VD)) in visitVarDecl()
2411 std::optional<unsigned> GlobalIndex = P.createGlobal(VD, Init); in visitVarDecl()
2418 DeclScope<Emitter> LocalScope(this, VD); in visitVarDecl()
2423 return this->emitInitGlobal(*VarT, *GlobalIndex, VD); in visitVarDecl()
2431 VD, *VarT, VD->getType().isConstQualified()); in visitVarDecl()
2438 return this->emitSetLocal(*VarT, Offset, VD); in visitVarDecl()
2441 if (std::optional<unsigned> Offset = this->allocateLocal(VD)) { in visitVarDecl()
2891 if (const auto *VD = dyn_cast<VarDecl>(D); in VisitDeclRefExpr() local
2892 VD && VD->hasGlobalStorage() && VD->getAnyInitializer() && in VisitDeclRefExpr()
2893 VD->getType().isConstQualified()) { in VisitDeclRefExpr()
2894 if (!this->visitVarDecl(VD)) in VisitDeclRefExpr()