summaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorArthur Eubanks <aeubanks@google.com>2023-09-26 09:44:31 -0700
committerGitHub <noreply@github.com>2023-09-26 09:44:31 -0700
commita42787d10854fe2fdaca019634aed03adebcb864 (patch)
treed13a35ce8f30b474139ca22ce3477caea7f14103 /clang/lib/CodeGen/CodeGenModule.cpp
parentc1afed9f48c2d4ebb21ac1672948e82d23c69174 (diff)
[clang] Add -mlarge-data-threshold for x86_64 medium code model (#66839)
Error if not used with x86_64. Warn if not used with the medium code model (can update if other code models end up using this). Set TargetMachine option and add module flag.
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 130cedcd4f2b..25945759e23f 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -1146,6 +1146,12 @@ void CodeGenModule::Release() {
if (CM != ~0u) {
llvm::CodeModel::Model codeModel = static_cast<llvm::CodeModel::Model>(CM);
getModule().setCodeModel(codeModel);
+
+ if (CM == llvm::CodeModel::Medium &&
+ Context.getTargetInfo().getTriple().getArch() ==
+ llvm::Triple::x86_64) {
+ getModule().setLargeDataThreshold(getCodeGenOpts().LargeDataThreshold);
+ }
}
}