| 1109 | } |
| 1110 | |
| 1111 | void 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 | |
| 1163 | void BfModule::CalcGeneratesCode() |
| 1164 | { |
no test coverage detected