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

Method RestoreScopeState

IDEHelper/Compiler/BfModule.cpp:2043–2081  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2041}
2042
2043void BfModule::RestoreScopeState()
2044{
2045 BfScopeData* prevScopeData = mCurMethodState->mCurScope->mPrevScope;
2046 mCurMethodState->mBlockNestLevel--;
2047
2048 if (!mCurMethodState->mCurScope->mAtEndBlocks.empty())
2049 {
2050 BfIRBlock afterEndBlock;
2051 if (!mCurMethodState->mLeftBlockUncond)
2052 {
2053 afterEndBlock = mBfIRBuilder->CreateBlock("scopeAfterEnd");
2054 mBfIRBuilder->CreateBr(afterEndBlock);
2055 mBfIRBuilder->ClearDebugLocation_Last();
2056 }
2057
2058 for (auto preExitBlock : mCurMethodState->mCurScope->mAtEndBlocks)
2059 mBfIRBuilder->MoveBlockToEnd(preExitBlock);
2060
2061 if (afterEndBlock)
2062 {
2063 mBfIRBuilder->AddBlock(afterEndBlock);
2064 mBfIRBuilder->SetInsertPoint(afterEndBlock);
2065 }
2066 }
2067
2068 mCurMethodState->mCurScope->mDone = true;
2069 if (!mCurMethodState->mLeftBlockUncond)
2070 EmitDeferredScopeCalls(true, mCurMethodState->mCurScope);
2071
2072 EmitDeferredCallProcessorInstances(mCurMethodState->mCurScope);
2073
2074 RestoreScoreState_LocalVariables(mCurMethodState->mCurScope->mLocalVarStart);
2075
2076 if (mCurMethodState->mCurScope->mValueScopeStart)
2077 mBfIRBuilder->CreateValueScopeHardEnd(mCurMethodState->mCurScope->mValueScopeStart);
2078
2079 mCurMethodState->mCurScope = prevScopeData;
2080 mCurMethodState->mTailScope = mCurMethodState->mCurScope;
2081}
2082
2083BfIRValue BfModule::CreateAlloca(BfIRType irType, int align, bool addLifetime, const char* name, BfIRValue arraySize)
2084{

Callers 2

VisitMethod · 0.80
InjectMixinMethod · 0.80

Calls 8

MoveBlockToEndMethod · 0.80
emptyMethod · 0.45
CreateBlockMethod · 0.45
CreateBrMethod · 0.45
AddBlockMethod · 0.45
SetInsertPointMethod · 0.45

Tested by

no test coverage detected