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

Method FinishInit

IDEHelper/Compiler/BfModule.cpp:1111–1161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1109}
1110
1111void BfModule::FinishInit()
1112{
1113 BfLogSysM("FinishInit %@ %s\n", this, mModuleName.c_str());
1114
1115 BF_ASSERT(mAwaitingInitFinish);
1116
1117 auto moduleOptions = GetModuleOptions();
1118
1119 mBfIRBuilder->Start(mModuleName, mCompiler->mSystem->mPtrSize, IsOptimized());
1120
1121 mBfIRBuilder->Module_SetTargetTriple(mCompiler->mOptions.mTargetTriple, mCompiler->mOptions.mTargetCPU);
1122
1123 mBfIRBuilder->SetBackend(IsTargetingBeefBackend());
1124
1125 if (moduleOptions.mOptLevel == BfOptLevel_OgPlus)
1126 {
1127 // Og+ requires debug info
1128 moduleOptions.mEmitDebugInfo = 1;
1129 }
1130
1131 mHasFullDebugInfo = moduleOptions.mEmitDebugInfo == 1;
1132
1133 if (mIsComptimeModule)
1134 mHasFullDebugInfo = true;
1135
1136 if (((!mCompiler->mIsResolveOnly) && (!mIsScratchModule) && (moduleOptions.mEmitDebugInfo != 0) && (mIsReified)) ||
1137 (mIsComptimeModule))
1138 {
1139 mBfIRBuilder->DbgInit();
1140 }
1141 else
1142 mHasFullDebugInfo = false;
1143
1144 if ((mBfIRBuilder->DbgHasInfo()) && (mModuleName != "") &&
1145 ((moduleOptions.mEmitDebugInfo != 0)))
1146 {
1147 if (mCompiler->mOptions.IsCodeView())
1148 {
1149 mBfIRBuilder->Module_AddModuleFlag("CodeView", 1);
1150 }
1151 else
1152 {
1153 mBfIRBuilder->Module_AddModuleFlag("Dwarf Version", 4);
1154 }
1155 mBfIRBuilder->Module_AddModuleFlag("Debug Info Version", 3);
1156
1157 mDICompileUnit = mBfIRBuilder->DbgCreateCompileUnit(llvm::dwarf::DW_LANG_C_plus_plus, mModuleName, ".", "Beef Compiler 0.42.3", /*moduleOptions.mOptLevel > 0*/false, "", 0, !mHasFullDebugInfo);
1158 }
1159
1160 mAwaitingInitFinish = false;
1161}
1162
1163void BfModule::CalcGeneratesCode()
1164{

Callers 3

CreateVDataMethod · 0.80
DoCompileMethod · 0.80
InitMethod · 0.80

Calls 9

SetBackendMethod · 0.80
DbgInitMethod · 0.80
DbgHasInfoMethod · 0.80
IsCodeViewMethod · 0.80
Module_AddModuleFlagMethod · 0.80
DbgCreateCompileUnitMethod · 0.80
c_strMethod · 0.45
StartMethod · 0.45

Tested by

no test coverage detected