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

Method ProcessMethod

IDEHelper/Compiler/CeMachine.cpp:2036–2075  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2034}
2035
2036void CeBuilder::ProcessMethod(BfMethodInstance* methodInstance, BfMethodInstance* dupMethodInstance, bool forceIRWrites)
2037{
2038 SetAndRestoreValue<BfMethodState*> prevMethodStateInConstEval(mCeMachine->mCeModule->mCurMethodState, NULL);
2039 BfAutoComplete* prevAutoComplete = NULL;
2040 if (mCeMachine->mCeModule->mCompiler->mResolvePassData != NULL)
2041 {
2042 prevAutoComplete = mCeMachine->mCeModule->mCompiler->mResolvePassData->mAutoComplete;
2043 mCeMachine->mCeModule->mCompiler->mResolvePassData->mAutoComplete = NULL;
2044 }
2045
2046 auto irCodeGen = mCeMachine->mCeModule->mBfIRBuilder->mBeIRCodeGen;
2047 auto irBuilder = mCeMachine->mCeModule->mBfIRBuilder;
2048 auto beModule = irCodeGen->mBeModule;
2049 beModule->mCeMachine = mCeMachine;
2050
2051 dupMethodInstance->mIsReified = true;
2052 dupMethodInstance->mInCEMachine = false; // Only have the original one
2053
2054 // We can't use methodInstance->mMethodInstanceGroup because we may add foreign method instances which
2055 // would reallocate the methodInstanceGroup
2056 BfMethodInstanceGroup methodInstanceGroup;
2057 methodInstanceGroup.mOwner = methodInstance->mMethodInstanceGroup->mOwner;
2058 methodInstanceGroup.mDefault = methodInstance->mMethodInstanceGroup->mDefault;
2059 methodInstanceGroup.mMethodIdx = methodInstance->mMethodInstanceGroup->mMethodIdx;
2060 methodInstanceGroup.mOnDemandKind = BfMethodOnDemandKind_AlwaysInclude;
2061 dupMethodInstance->mMethodInstanceGroup = &methodInstanceGroup;
2062
2063 mCeMachine->mCeModule->mHadBuildError = false;
2064 auto irState = irBuilder->GetState();
2065 auto beState = irCodeGen->GetState();
2066 mCeMachine->mCeModule->ProcessMethod(dupMethodInstance, true, forceIRWrites);
2067 irCodeGen->SetState(beState);
2068 irBuilder->SetState(irState);
2069
2070 if (mCeMachine->mCeModule->mCompiler->mResolvePassData != NULL)
2071 mCeMachine->mCeModule->mCompiler->mResolvePassData->mAutoComplete = prevAutoComplete;
2072
2073 methodInstanceGroup.mDefault = NULL;
2074 dupMethodInstance->mMethodInstanceGroup = methodInstance->mMethodInstanceGroup;
2075}
2076
2077void CeBuilder::Build()
2078{

Callers

nothing calls this directly

Calls 2

GetStateMethod · 0.45
SetStateMethod · 0.45

Tested by

no test coverage detected