| 2121 | } |
| 2122 | |
| 2123 | BfIRValue BfModule::CreateAllocaInst(BfTypeInstance* typeInst, bool addLifetime, const char* name) |
| 2124 | { |
| 2125 | if (mBfIRBuilder->mIgnoreWrites) |
| 2126 | return mBfIRBuilder->GetFakeVal(); |
| 2127 | |
| 2128 | BF_ASSERT((*(int8*)&addLifetime == 1) || (*(int8*)&addLifetime == 0)); |
| 2129 | mBfIRBuilder->PopulateType(typeInst); |
| 2130 | auto prevInsertBlock = mBfIRBuilder->GetInsertBlock(); |
| 2131 | mBfIRBuilder->SetInsertPoint(mCurMethodState->mIRHeadBlock); |
| 2132 | auto allocaInst = mBfIRBuilder->CreateAlloca(mBfIRBuilder->MapTypeInst(typeInst)); |
| 2133 | mBfIRBuilder->SetAllocaAlignment(allocaInst, typeInst->mInstAlign); |
| 2134 | mBfIRBuilder->ClearDebugLocation(allocaInst); |
| 2135 | if (name != NULL) |
| 2136 | mBfIRBuilder->SetName(allocaInst, name); |
| 2137 | mBfIRBuilder->SetInsertPoint(prevInsertBlock); |
| 2138 | if ((addLifetime) && (WantsLifetimes())) |
| 2139 | { |
| 2140 | auto lifetimeStart = mBfIRBuilder->CreateLifetimeStart(allocaInst); |
| 2141 | mBfIRBuilder->ClearDebugLocation(lifetimeStart); |
| 2142 | mCurMethodState->mCurScope->mDeferredLifetimeEnds.push_back(allocaInst); |
| 2143 | } |
| 2144 | return allocaInst; |
| 2145 | } |
| 2146 | |
| 2147 | BfDeferredCallEntry* BfModule::AddStackAlloc(BfTypedValue val, BfIRValue arraySize, BfAstNode* refNode, BfScopeData* scopeData, bool condAlloca, bool mayEscape, BfIRBlock valBlock) |
| 2148 | { |
nothing calls this directly
no test coverage detected