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

Function BfCompiler_SetOptions

IDEHelper/Compiler/BfCompiler.cpp:11115–11238  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11113}
11114
11115BF_EXPORT void BF_CALLTYPE BfCompiler_SetOptions(BfCompiler* bfCompiler, BfProject* hotProject, int hotIdx,
11116 const char* targetTriple, const char* targetCPU, int toolsetType, int simdSetting, int allocStackCount, int maxWorkerThreads,
11117 BfCompilerOptionFlags optionFlags, char* mallocLinkName, char* freeLinkName)
11118{
11119 BfLogSys(bfCompiler->mSystem, "BfCompiler_SetOptions\n");
11120
11121 //printf("BfCompiler_SetOptions Threads:%d\n", maxWorkerThreads);
11122
11123 auto options = &bfCompiler->mOptions;
11124
11125 options->mErrorString.Clear();
11126 options->mHotProject = hotProject;
11127 options->mHotCompileIdx = hotIdx;
11128 options->mTargetTriple = targetTriple;
11129 options->mTargetCPU = targetCPU;
11130
11131 if (options->mTargetTriple.StartsWith("x86_64-"))
11132 options->mMachineType = BfMachineType_x64;
11133 else if (options->mTargetTriple.StartsWith("i686-"))
11134 options->mMachineType = BfMachineType_x86;
11135 else if ((options->mTargetTriple.StartsWith("arm64")) || (options->mTargetTriple.StartsWith("aarch64")))
11136 options->mMachineType = BfMachineType_AArch64;
11137 else if (options->mTargetTriple.StartsWith("armv"))
11138 options->mMachineType = BfMachineType_ARM;
11139 else if (options->mTargetTriple.StartsWith("wasm32"))
11140 options->mMachineType = BfMachineType_Wasm32;
11141 else if (options->mTargetTriple.StartsWith("wasm64"))
11142 options->mMachineType = BfMachineType_Wasm64;
11143 else
11144 options->mMachineType = BfMachineType_x64; // Default
11145
11146 options->mPlatformType = GetPlatform(options->mTargetTriple);
11147
11148 options->mCLongSize = 4;
11149 if ((options->mMachineType == BfMachineType_AArch64) || (options->mMachineType == BfMachineType_x64))
11150 {
11151 if (options->mPlatformType != BfPlatformType_Windows)
11152 options->mCLongSize = 8;
11153 }
11154
11155 bfCompiler->mCodeGen.SetMaxThreads(maxWorkerThreads);
11156
11157 if (!bfCompiler->mIsResolveOnly)
11158 {
11159 bool allowHotSwapping = (optionFlags & BfCompilerOptionFlag_EnableHotSwapping) != 0;
11160 bool emitDebugInfo = (optionFlags & BfCompilerOptionFlag_EmitDebugInfo) != 0;
11161
11162 // These settings only matter for code generation, they are not applicable for resolveOnly
11163 options->mCompileOnDemandKind = BfCompileOnDemandKind_ResolveUnused;
11164 //options->mCompileOnDemandKind = BfCompileOnDemandKind_AlwaysInclude;
11165 options->mToolsetType = (BfToolsetType)toolsetType;
11166 options->mSIMDSetting = (BfSIMDSetting)simdSetting;
11167 options->mIncrementalBuild = (optionFlags & BfCompilerOptionFlag_IncrementalBuild) != 0;
11168 options->mWriteIR = (optionFlags & BfCompilerOptionFlag_WriteIR) != 0;
11169 options->mGenerateObj = (optionFlags & BfCompilerOptionFlag_GenerateOBJ) != 0;
11170 options->mGenerateBitcode = (optionFlags & BfCompilerOptionFlag_GenerateBitcode) != 0;
11171 options->mNoFramePointerElim = (optionFlags & BfCompilerOptionFlag_NoFramePointerElim) != 0;
11172 options->mInitLocalVariables = (optionFlags & BfCompilerOptionFlag_ClearLocalVars) != 0;

Callers 2

PrepareCompilerMethod · 0.85
CompileMethod · 0.85

Calls 6

GetPlatformFunction · 0.85
SetMaxThreadsMethod · 0.80
ClearMethod · 0.45
StartsWithMethod · 0.45
IsEmptyMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected