[llvm] [Cygwin] Cygwin cmodel medium for 64 bit (PR #74931)
εΎζζ Xu Chiheng via llvm-commits
llvm-commits at lists.llvm.org
Sun Dec 31 20:39:29 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/3] 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,
>From c28e053637579b4b7787e2c556535ae59ada6a61 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 11:25:53 +0800
Subject: [PATCH 2/3] 1
---
llvm/lib/Target/X86/X86TargetMachine.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/lib/Target/X86/X86TargetMachine.cpp b/llvm/lib/Target/X86/X86TargetMachine.cpp
index 4e157cf9d5bcd1..b5b3b6fe85d544 100644
--- a/llvm/lib/Target/X86/X86TargetMachine.cpp
+++ b/llvm/lib/Target/X86/X86TargetMachine.cpp
@@ -245,7 +245,7 @@ X86TargetMachine::X86TargetMachine(const Target &T, const Triple &TT,
: LLVMTargetMachine(
T, computeDataLayout(TT), TT, CPU, FS, Options,
getEffectiveRelocModel(TT, JIT, RM),
- getEffectiveX86CodeModel(CM, JIT, TT.getArch() == Triple::x86_64),
+ getEffectiveX86CodeModel(TT, CM, JIT),
OL),
TLOF(createTLOF(getTargetTriple())), IsJIT(JIT) {
// On PS4/PS5, the "return address" of a 'noreturn' call must still be within
>From 2aa69048607b7a3c0b8350ac44ca037171189d50 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 12:38:48 +0800
Subject: [PATCH 3/3] 1
---
llvm/lib/Target/X86/X86TargetMachine.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/llvm/lib/Target/X86/X86TargetMachine.cpp b/llvm/lib/Target/X86/X86TargetMachine.cpp
index b5b3b6fe85d544..69117a1b89ee0b 100644
--- a/llvm/lib/Target/X86/X86TargetMachine.cpp
+++ b/llvm/lib/Target/X86/X86TargetMachine.cpp
@@ -229,8 +229,8 @@ getEffectiveX86CodeModel(const Triple &TT, std::optional<CodeModel::Model> CM,
}
if (JIT)
return Is64Bit ? CodeModel::Large : CodeModel::Small;
- if (TT.isWindowsCygwinEnvironment())
- return Is64Bit ? CodeModel::Medium : CodeModel::Small;
+// if (TT.isWindowsCygwinEnvironment())
+// return Is64Bit ? CodeModel::Medium : CodeModel::Small;
return CodeModel::Small;
}
More information about the llvm-commits
mailing list