[llvm] [Cygwin] Cygwin cmodel medium for 64 bit (PR #74931)
εΎζζ Xu Chiheng via llvm-commits
llvm-commits at lists.llvm.org
Sun Dec 31 14:08:50 PST 2023
https://github.com/xu-chiheng updated https://github.com/llvm/llvm-project/pull/74931
>From 3eedb06a123b1a686d560c79d6fc16ce570d0697 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
<chiheng.xu at gmail.com>
Date: Mon, 1 Jan 2024 06:08:13 +0800
Subject: [PATCH] 1
---
llvm/lib/Target/X86/X86TargetMachine.cpp | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/llvm/lib/Target/X86/X86TargetMachine.cpp b/llvm/lib/Target/X86/X86TargetMachine.cpp
index 5668b514d6dec0..4e157cf9d5bcd1 100644
--- a/llvm/lib/Target/X86/X86TargetMachine.cpp
+++ b/llvm/lib/Target/X86/X86TargetMachine.cpp
@@ -218,6 +218,22 @@ getEffectiveX86CodeModel(std::optional<CodeModel::Model> CM, bool JIT,
return CodeModel::Small;
}
+static CodeModel::Model
+getEffectiveX86CodeModel(const Triple &TT, std::optional<CodeModel::Model> CM,
+ bool JIT) {
+ bool Is64Bit = TT.getArch() == Triple::x86_64;
+ if (CM) {
+ if (*CM == CodeModel::Tiny)
+ report_fatal_error("Target does not support the tiny CodeModel", false);
+ return *CM;
+ }
+ if (JIT)
+ return Is64Bit ? CodeModel::Large : CodeModel::Small;
+ if (TT.isWindowsCygwinEnvironment())
+ return Is64Bit ? CodeModel::Medium : CodeModel::Small;
+ return CodeModel::Small;
+}
+
/// Create an X86 target.
///
X86TargetMachine::X86TargetMachine(const Target &T, const Triple &TT,
More information about the llvm-commits
mailing list