MCPcopy Create free account
hub / github.com/beefytech/Beef / CreateAllocaInst

Method CreateAllocaInst

IDEHelper/Compiler/BfModule.cpp:2123–2145  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2121}
2122
2123BfIRValue 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
2147BfDeferredCallEntry* BfModule::AddStackAlloc(BfTypedValue val, BfIRValue arraySize, BfAstNode* refNode, BfScopeData* scopeData, bool condAlloca, bool mayEscape, BfIRBlock valBlock)
2148{

Callers

nothing calls this directly

Calls 11

GetFakeValMethod · 0.80
MapTypeInstMethod · 0.80
SetAllocaAlignmentMethod · 0.80
ClearDebugLocationMethod · 0.80
CreateLifetimeStartMethod · 0.80
PopulateTypeMethod · 0.45
GetInsertBlockMethod · 0.45
SetInsertPointMethod · 0.45
CreateAllocaMethod · 0.45
SetNameMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected