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

Function BfProject_SetOptions

IDEHelper/Compiler/BfSystem.cpp:4706–4759  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4704}
4705
4706BF_EXPORT void BF_CALLTYPE BfProject_SetOptions(BfProject* bfProject, int targetType, const char* startupObject, const char* preprocessorMacros,
4707 int optLevel, int ltoType, int relocType, int picLevel, BfProjectFlags flags)
4708{
4709 bfProject->mTargetType = (BfTargetType)targetType;
4710 bfProject->mStartupObject = startupObject;
4711
4712 BfCodeGenOptions codeGenOptions;
4713 codeGenOptions.mOptLevel = (BfOptLevel)optLevel;
4714 codeGenOptions.mLTOType = (BfLTOType)ltoType;
4715 codeGenOptions.mRelocType = (BfRelocType)relocType;
4716 codeGenOptions.mPICLevel = (BfPICLevel)picLevel;
4717 codeGenOptions.mMergeFunctions = (flags & BfProjectFlags_MergeFunctions) != 0;
4718 codeGenOptions.mLoadCombine = (flags & BfProjectFlags_CombineLoads) != 0;
4719 codeGenOptions.mLoopVectorize = (flags & BfProjectFlags_VectorizeLoops) != 0;
4720 codeGenOptions.mSLPVectorize = (flags & BfProjectFlags_VectorizeSLP) != 0;
4721 if ((flags & BfProjectFlags_AsmOutput) != 0)
4722 {
4723 static bool setLLVMAsmKind = false;
4724 if ((flags & BfProjectFlags_AsmOutput_ATT) != 0)
4725 codeGenOptions.mAsmKind = BfAsmKind_ATT;
4726 else
4727 codeGenOptions.mAsmKind = BfAsmKind_Intel;
4728
4729 if (!setLLVMAsmKind)
4730 {
4731 setLLVMAsmKind = true;
4732 BfIRCodeGen::SetAsmKind(codeGenOptions.mAsmKind);
4733 }
4734 }
4735 bfProject->mCodeGenOptions = codeGenOptions;
4736 bfProject->mSingleModule = (flags & BfProjectFlags_SingleModule) != 0;
4737 bfProject->mAlwaysIncludeAll = (flags & BfProjectFlags_AlwaysIncludeAll) != 0;
4738
4739 bfProject->mPreprocessorMacros.Clear();
4740
4741 int startIdx = 0;
4742 int idx = 0;
4743 while (true)
4744 {
4745 char c = preprocessorMacros[idx];
4746 if ((c == '\n') || (c == 0))
4747 {
4748 String macroStr = String(preprocessorMacros + startIdx, preprocessorMacros + idx);
4749 if (macroStr.length() > 0)
4750 bfProject->mPreprocessorMacros.Add(macroStr);
4751 startIdx = idx + 1;
4752 }
4753
4754 if (c == 0)
4755 break;
4756
4757 idx++;
4758 }
4759}
4760
4761//////////////////////////////////////////////////////////////////////////
4762

Callers 2

PrepareCompilerMethod · 0.85
CompileMethod · 0.85

Calls 4

StringClass · 0.85
ClearMethod · 0.45
lengthMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected