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

Method CreateAlloca

IDEHelper/Compiler/BfModule.cpp:2083–2111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2081}
2082
2083BfIRValue BfModule::CreateAlloca(BfIRType irType, int align, bool addLifetime, const char* name, BfIRValue arraySize)
2084{
2085 if (mBfIRBuilder->mIgnoreWrites)
2086 return mBfIRBuilder->GetFakeVal();
2087
2088 BF_ASSERT((*(int8*)&addLifetime == 1) || (*(int8*)&addLifetime == 0));
2089 auto prevInsertBlock = mBfIRBuilder->GetInsertBlock();
2090 if (!mBfIRBuilder->mIgnoreWrites)
2091 BF_ASSERT(!prevInsertBlock.IsFake());
2092 mBfIRBuilder->SetInsertPoint(mCurMethodState->mIRHeadBlock);
2093 BfIRValue allocaInst;
2094 if (arraySize)
2095 allocaInst = mBfIRBuilder->CreateAlloca(irType, arraySize);
2096 else
2097 allocaInst = mBfIRBuilder->CreateAlloca(irType);
2098 if (align > 0)
2099 mBfIRBuilder->SetAllocaAlignment(allocaInst, align);
2100 mBfIRBuilder->ClearDebugLocation(allocaInst);
2101 if (name != NULL)
2102 mBfIRBuilder->SetName(allocaInst, name);
2103 mBfIRBuilder->SetInsertPoint(prevInsertBlock);
2104 if ((addLifetime) && (WantsLifetimes()))
2105 {
2106 auto lifetimeStart = mBfIRBuilder->CreateLifetimeStart(allocaInst);
2107 mBfIRBuilder->ClearDebugLocation(lifetimeStart);
2108 mCurMethodState->mCurScope->mDeferredLifetimeEnds.push_back(allocaInst);
2109 }
2110 return allocaInst;
2111}
2112
2113BfIRValue BfModule::CreateAlloca(BfType* type, bool addLifetime, const char* name, BfIRValue arraySize)
2114{

Callers 15

AddDeferredCallEntryMethod · 0.45
TryInitVarMethod · 0.45
VisitMethod · 0.45
CreateAllocaInstMethod · 0.45
AllocFromTypeMethod · 0.45
EmitDtorBodyMethod · 0.45
ProcessMethodMethod · 0.45
DbgFinishMethod · 0.45
EmitTestMethodMethod · 0.45
HandleNextCmdMethod · 0.45
LoadLocalMethod · 0.45
LoadFieldMethod · 0.45

Calls 11

GetFakeValMethod · 0.80
SetAllocaAlignmentMethod · 0.80
ClearDebugLocationMethod · 0.80
CreateLifetimeStartMethod · 0.80
MapTypeMethod · 0.80
GetInsertBlockMethod · 0.45
IsFakeMethod · 0.45
SetInsertPointMethod · 0.45
SetNameMethod · 0.45
push_backMethod · 0.45
PopulateTypeMethod · 0.45

Tested by

no test coverage detected