Skip to content

Commit

Permalink
Attempted fixed datalayouts for llvm trunk (#7898)
Browse files Browse the repository at this point in the history
* Attempted fixed datalayouts for llvm trunk

* Missed a few i128:128s
  • Loading branch information
abadams authored Oct 13, 2023
1 parent a3911bb commit 51ad730
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/LLVM_Runtime_Linker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,37 @@ DECLARE_NO_INITMOD(riscv_cpu_features)

llvm::DataLayout get_data_layout_for_target(Target target) {
if (target.arch == Target::X86) {
#if LLVM_VERSION >= 180
if (target.bits == 32) {
if (target.os == Target::OSX) {
return llvm::DataLayout("e-m:o-p:32:32-p270:32:32-p271:32:32-p272:64:64-i128:128-f64:32:64-f80:128-n8:16:32-S128");
} else if (target.os == Target::IOS) {
return llvm::DataLayout("e-m:o-p:32:32-p270:32:32-p271:32:32-p272:64:64-i128:128-f64:32:64-f80:128-n8:16:32-S128");
} else if (target.os == Target::Windows) {
// For 32-bit MSVC targets, alignment of f80 values is 16 bytes (see https://reviews.llvm.org/D115942)
if (!target.has_feature(Target::JIT)) {
return llvm::DataLayout("e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32-a:0:32-S32");
} else {
return llvm::DataLayout("e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32-a:0:32-S32");
}
} else {
// Linux/Android
return llvm::DataLayout("e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-i128:128-f64:32:64-f80:32-n8:16:32-S128");
}
} else { // 64-bit
if (target.os == Target::OSX) {
return llvm::DataLayout("e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128");
} else if (target.os == Target::IOS) {
return llvm::DataLayout("e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128");
} else if (target.os == Target::Windows && !target.has_feature(Target::JIT)) {
return llvm::DataLayout("e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128");
} else if (target.os == Target::Windows) {
return llvm::DataLayout("e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128");
} else {
return llvm::DataLayout("e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128");
}
}
#else
if (target.bits == 32) {
if (target.os == Target::OSX) {
return llvm::DataLayout("e-m:o-p:32:32-p270:32:32-p271:32:32-p272:64:64-f64:32:64-f80:128-n8:16:32-S128");
Expand Down Expand Up @@ -324,6 +355,7 @@ llvm::DataLayout get_data_layout_for_target(Target target) {
return llvm::DataLayout("e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128");
}
}
#endif
} else if (target.arch == Target::ARM) {
if (target.bits == 32) {
if (target.os == Target::IOS) {
Expand Down

0 comments on commit 51ad730

Please sign in to comment.