[llvm] [Cygwin] Cygwin cmodel medium for 64 bit (PR #74931)

via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 9 04:46:32 PST 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-x86

Author: εΎζŒζ’ Xu Chiheng (xu-chiheng)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/74931.diff


1 Files Affected:

- (modified) llvm/lib/Target/X86/X86TargetMachine.cpp (+5-3) 


``````````diff
diff --git a/llvm/lib/Target/X86/X86TargetMachine.cpp b/llvm/lib/Target/X86/X86TargetMachine.cpp
index 5668b514d6dec0..544b88228d5614 100644
--- a/llvm/lib/Target/X86/X86TargetMachine.cpp
+++ b/llvm/lib/Target/X86/X86TargetMachine.cpp
@@ -206,8 +206,8 @@ static Reloc::Model getEffectiveRelocModel(const Triple &TT, bool JIT,
 }
 
 static CodeModel::Model
-getEffectiveX86CodeModel(std::optional<CodeModel::Model> CM, bool JIT,
-                         bool Is64Bit) {
+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);
@@ -215,6 +215,8 @@ getEffectiveX86CodeModel(std::optional<CodeModel::Model> CM, bool JIT,
   }
   if (JIT)
     return Is64Bit ? CodeModel::Large : CodeModel::Small;
+  if (TT.isWindowsCygwinEnvironment())
+    return Is64Bit ? CodeModel::Medium : CodeModel::Small;
   return CodeModel::Small;
 }
 
@@ -229,7 +231,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

``````````

</details>


https://github.com/llvm/llvm-project/pull/74931


More information about the llvm-commits mailing list