[flang-commits] [clang] [flang] [flang] Implement -mcmodel flag (PR #95411)
Tom Eccles via flang-commits
flang-commits at lists.llvm.org
Fri Jun 14 02:40:31 PDT 2024
================
@@ -39,6 +39,7 @@ ENUM_CODEGENOPT(RelocationModel, llvm::Reloc::Model, 3, llvm::Reloc::PIC_) ///<
ENUM_CODEGENOPT(DebugInfo, llvm::codegenoptions::DebugInfoKind, 4, llvm::codegenoptions::NoDebugInfo) ///< Level of debug info to generate
ENUM_CODEGENOPT(VecLib, llvm::driver::VectorLibrary, 3, llvm::driver::VectorLibrary::NoLibrary) ///< Vector functions library to use
ENUM_CODEGENOPT(FramePointer, llvm::FramePointerKind, 2, llvm::FramePointerKind::None) ///< Enable the usage of frame pointers
+ENUM_CODEGENOPT(CodeModel, llvm::CodeModel::Model, 5, llvm::CodeModel::Model::Small)
----------------
tblah wrote:
What was your reasoning for defaulting to `llvm::CodeModel::Model::Small` here? So far as I can tell, clang avoids setting it when the option is not specified explicitly: https://github.com/llvm/llvm-project/blob/44df1167f88cabbb4cfde816f279337379ea30b3/clang/lib/CodeGen/CodeGenModule.cpp#L1304
In LLVM, the code model logic seems to get overridden in each implementation of LLVMTargetMachine. The first one I looked at does default to llvm::CodeModel::Model::Small, but I don't know whether that will always be true for every target.
I think it would be safer to store this as a std::optional instead of a bitfield.
https://github.com/llvm/llvm-project/pull/95411
More information about the flang-commits
mailing list