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

Method Build

IDEHelper/Compiler/CeMachine.cpp:2077–3620  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2075}
2076
2077void CeBuilder::Build()
2078{
2079 SetAndRestoreValue<CeDbgState*> prevDbgState;
2080 if (mCeMachine->mDebugger != NULL)
2081 prevDbgState.Init(mCeMachine->mDebugger->mCurDbgState, NULL);
2082
2083 auto irCodeGen = mCeMachine->mCeModule->mBfIRBuilder->mBeIRCodeGen;
2084 auto irBuilder = mCeMachine->mCeModule->mBfIRBuilder;
2085 auto beModule = irCodeGen->mBeModule;
2086
2087 mCeFunction->mFailed = true;
2088
2089 auto methodInstance = mCeFunction->mMethodInstance;
2090
2091 if (methodInstance != NULL)
2092 {
2093 BfMethodInstance dupMethodInstance;
2094 dupMethodInstance.CopyFrom(methodInstance);
2095 auto methodDef = methodInstance->mMethodDef;
2096
2097 bool isGenericVariation = (methodInstance->mIsUnspecializedVariation) || (methodInstance->GetOwner()->IsUnspecializedTypeVariation());
2098 int dependentGenericStartIdx = 0;
2099 if ((((methodInstance->mMethodInfoEx != NULL) && ((int)methodInstance->mMethodInfoEx->mMethodGenericArguments.size() > dependentGenericStartIdx)) ||
2100 ((methodInstance->GetOwner()->IsGenericTypeInstance()) && (!isGenericVariation) && (!methodInstance->mMethodDef->mIsLocalMethod) && (!methodInstance->mIsUnspecialized))))
2101 {
2102 auto unspecializedMethodInstance = mCeMachine->mCeModule->GetUnspecializedMethodInstance(methodInstance, !methodInstance->mMethodDef->mIsLocalMethod);
2103 if (!unspecializedMethodInstance->mHasBeenProcessed)
2104 {
2105 BfMethodInstance dupUnspecMethodInstance;
2106 dupUnspecMethodInstance.CopyFrom(unspecializedMethodInstance);
2107 ProcessMethod(unspecializedMethodInstance, &dupUnspecMethodInstance, false);
2108 if (dupUnspecMethodInstance.mMethodInfoEx != NULL)
2109 dupMethodInstance.GetMethodInfoEx()->mGenericTypeBindings = dupUnspecMethodInstance.mMethodInfoEx->mGenericTypeBindings;
2110 }
2111 }
2112
2113 // Clear this so we can properly get QueueStaticField calls
2114 mCeMachine->mCeModule->mStaticFieldRefs.Clear();
2115
2116 int startFunctionCount = (int)beModule->mFunctions.size();
2117 ProcessMethod(methodInstance, &dupMethodInstance, true);
2118 if (mCeFunction->mInitializeState == CeFunction::InitializeState_Initialized)
2119 return;
2120
2121 if (!dupMethodInstance.mIRFunction)
2122 {
2123 mCeFunction->mFailed = true;
2124 return;
2125 }
2126 mBeFunction = (BeFunction*)irCodeGen->TryGetBeValue(dupMethodInstance.mIRFunction.mId);
2127 if (mBeFunction == NULL)
2128 {
2129 mCeFunction->mFailed = true;
2130 return;
2131 }
2132
2133 mIntPtrType = irCodeGen->mBeContext->GetPrimitiveType((mPtrSize == 4) ? BeTypeCode_Int32 : BeTypeCode_Int64);
2134

Callers 1

PrepareFunctionMethod · 0.80

Calls 15

FailFunction · 0.85
GetMethodInfoExMethod · 0.80
TryGetBeValueMethod · 0.80
MapFunctionIdMethod · 0.80
GetDbgFileMethod · 0.80
AppendMethod · 0.80
GetFuncTypeMethod · 0.80
TryGetValueMethod · 0.80
CheckFunctionKindMethod · 0.80
GetBeContextMethod · 0.80
GetVoidPtrTypeMethod · 0.80

Tested by

no test coverage detected