mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-09 13:01:38 -07:00
Merge pull request #3308 from laytan/llvm-18
Support LLVM 18 (non-windows targets for now)
This commit is contained in:
+7
-6
@@ -25,12 +25,14 @@ error() {
|
||||
|
||||
if [ -z "$LLVM_CONFIG" ]; then
|
||||
# darwin, linux, openbsd
|
||||
if [ -n "$(command -v llvm-config-17)" ]; then LLVM_CONFIG="llvm-config-17"
|
||||
if [ -n "$(command -v llvm-config-18)" ]; then LLVM_CONFIG="llvm-config-18"
|
||||
elif [ -n "$(command -v llvm-config-17)" ]; then LLVM_CONFIG="llvm-config-17"
|
||||
elif [ -n "$(command -v llvm-config-14)" ]; then LLVM_CONFIG="llvm-config-14"
|
||||
elif [ -n "$(command -v llvm-config-13)" ]; then LLVM_CONFIG="llvm-config-13"
|
||||
elif [ -n "$(command -v llvm-config-12)" ]; then LLVM_CONFIG="llvm-config-12"
|
||||
elif [ -n "$(command -v llvm-config-11)" ]; then LLVM_CONFIG="llvm-config-11"
|
||||
# freebsd
|
||||
elif [ -n "$(command -v llvm-config18)" ]; then LLVM_CONFIG="llvm-config18"
|
||||
elif [ -n "$(command -v llvm-config17)" ]; then LLVM_CONFIG="llvm-config17"
|
||||
elif [ -n "$(command -v llvm-config14)" ]; then LLVM_CONFIG="llvm-config14"
|
||||
elif [ -n "$(command -v llvm-config13)" ]; then LLVM_CONFIG="llvm-config13"
|
||||
@@ -50,16 +52,15 @@ LLVM_VERSION_MAJOR="$(echo $LLVM_VERSION | awk -F. '{print $1}')"
|
||||
LLVM_VERSION_MINOR="$(echo $LLVM_VERSION | awk -F. '{print $2}')"
|
||||
LLVM_VERSION_PATCH="$(echo $LLVM_VERSION | awk -F. '{print $3}')"
|
||||
|
||||
if [ $LLVM_VERSION_MAJOR -lt 11 ] ||
|
||||
([ $LLVM_VERSION_MAJOR -gt 14 ] && [ $LLVM_VERSION_MAJOR -lt 17 ]); then
|
||||
error "Invalid LLVM version $LLVM_VERSION: must be 11, 12, 13, 14 or 17"
|
||||
if [ $LLVM_VERSION_MAJOR -lt 11 ] || ([ $LLVM_VERSION_MAJOR -gt 14 ] && [ $LLVM_VERSION_MAJOR -lt 17 ]) || [ $LLVM_VERSION_MAJOR -gt 18 ]; then
|
||||
error "Invalid LLVM version $LLVM_VERSION: must be 11, 12, 13, 14, 17 or 18"
|
||||
fi
|
||||
|
||||
case "$OS_NAME" in
|
||||
Darwin)
|
||||
if [ "$OS_ARCH" = "arm64" ]; then
|
||||
if [ $LLVM_VERSION_MAJOR -lt 13 ] || [ $LLVM_VERSION_MAJOR -gt 17 ]; then
|
||||
error "Darwin Arm64 requires LLVM 13, 14 or 17"
|
||||
if [ $LLVM_VERSION_MAJOR -lt 13 ]; then
|
||||
error "Invalid LLVM version $LLVM_VERSION: Darwin Arm64 requires LLVM 13, 14, 17 or 18"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ the_basics :: proc() {
|
||||
// os.args holds the path to the current executable and any arguments passed to it.
|
||||
if len(os.args) == 1 {
|
||||
fmt.printf("Hellope from %v.\n", os.args[0])
|
||||
} else {
|
||||
} else if len(os.args) > 2 {
|
||||
fmt.printf("%v, %v! from %v.\n", os.args[1], os.args[2], os.args[0])
|
||||
}
|
||||
|
||||
|
||||
+24
-31
@@ -613,7 +613,6 @@ struct TargetMetrics {
|
||||
isize max_align;
|
||||
isize max_simd_align;
|
||||
String target_triplet;
|
||||
String target_data_layout;
|
||||
TargetABIKind abi;
|
||||
};
|
||||
|
||||
@@ -923,7 +922,18 @@ gb_internal isize MAX_ERROR_COLLECTOR_COUNT(void) {
|
||||
return build_context.max_error_count;
|
||||
}
|
||||
|
||||
#if defined(GB_SYSTEM_WINDOWS)
|
||||
#include <llvm-c/Config/llvm-config.h>
|
||||
#else
|
||||
#include <llvm/Config/llvm-config.h>
|
||||
#endif
|
||||
|
||||
// NOTE: AMD64 targets had their alignment on 128 bit ints bumped from 8 to 16 (undocumented of course).
|
||||
#if LLVM_VERSION_MAJOR >= 18
|
||||
#define AMD64_MAX_ALIGNMENT 16
|
||||
#else
|
||||
#define AMD64_MAX_ALIGNMENT 8
|
||||
#endif
|
||||
|
||||
gb_global TargetMetrics target_windows_i386 = {
|
||||
TargetOs_windows,
|
||||
@@ -934,9 +944,8 @@ gb_global TargetMetrics target_windows_i386 = {
|
||||
gb_global TargetMetrics target_windows_amd64 = {
|
||||
TargetOs_windows,
|
||||
TargetArch_amd64,
|
||||
8, 8, 8, 16,
|
||||
8, 8, AMD64_MAX_ALIGNMENT, 16,
|
||||
str_lit("x86_64-pc-windows-msvc"),
|
||||
str_lit("e-m:w-i64:64-f80:128-n8:16:32:64-S128"),
|
||||
};
|
||||
|
||||
gb_global TargetMetrics target_linux_i386 = {
|
||||
@@ -949,16 +958,14 @@ gb_global TargetMetrics target_linux_i386 = {
|
||||
gb_global TargetMetrics target_linux_amd64 = {
|
||||
TargetOs_linux,
|
||||
TargetArch_amd64,
|
||||
8, 8, 8, 16,
|
||||
8, 8, AMD64_MAX_ALIGNMENT, 16,
|
||||
str_lit("x86_64-pc-linux-gnu"),
|
||||
str_lit("e-m:w-i64:64-f80:128-n8:16:32:64-S128"),
|
||||
};
|
||||
gb_global TargetMetrics target_linux_arm64 = {
|
||||
TargetOs_linux,
|
||||
TargetArch_arm64,
|
||||
8, 8, 8, 16,
|
||||
8, 8, 16, 16,
|
||||
str_lit("aarch64-linux-elf"),
|
||||
str_lit("e-m:o-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"),
|
||||
};
|
||||
|
||||
gb_global TargetMetrics target_linux_arm32 = {
|
||||
@@ -966,15 +973,13 @@ gb_global TargetMetrics target_linux_arm32 = {
|
||||
TargetArch_arm32,
|
||||
4, 4, 4, 8,
|
||||
str_lit("arm-linux-gnu"),
|
||||
str_lit("e-m:o-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"),
|
||||
};
|
||||
|
||||
gb_global TargetMetrics target_darwin_amd64 = {
|
||||
TargetOs_darwin,
|
||||
TargetArch_amd64,
|
||||
8, 8, 8, 16,
|
||||
8, 8, AMD64_MAX_ALIGNMENT, 16,
|
||||
str_lit("x86_64-apple-macosx"), // NOTE: Changes during initialization based on build flags.
|
||||
str_lit("e-m:o-i64:64-f80:128-n8:16:32:64-S128"),
|
||||
};
|
||||
|
||||
gb_global TargetMetrics target_darwin_arm64 = {
|
||||
@@ -982,7 +987,6 @@ gb_global TargetMetrics target_darwin_arm64 = {
|
||||
TargetArch_arm64,
|
||||
8, 8, 16, 16,
|
||||
str_lit("arm64-apple-macosx"), // NOTE: Changes during initialization based on build flags.
|
||||
str_lit("e-m:o-i64:64-i128:128-n32:64-S128"),
|
||||
};
|
||||
|
||||
gb_global TargetMetrics target_freebsd_i386 = {
|
||||
@@ -995,9 +999,8 @@ gb_global TargetMetrics target_freebsd_i386 = {
|
||||
gb_global TargetMetrics target_freebsd_amd64 = {
|
||||
TargetOs_freebsd,
|
||||
TargetArch_amd64,
|
||||
8, 8, 8, 16,
|
||||
8, 8, AMD64_MAX_ALIGNMENT, 16,
|
||||
str_lit("x86_64-unknown-freebsd-elf"),
|
||||
str_lit("e-m:w-i64:64-f80:128-n8:16:32:64-S128"),
|
||||
};
|
||||
|
||||
gb_global TargetMetrics target_freebsd_arm64 = {
|
||||
@@ -1005,28 +1008,26 @@ gb_global TargetMetrics target_freebsd_arm64 = {
|
||||
TargetArch_arm64,
|
||||
8, 8, 16, 16,
|
||||
str_lit("aarch64-unknown-freebsd-elf"),
|
||||
str_lit("e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"),
|
||||
};
|
||||
|
||||
gb_global TargetMetrics target_openbsd_amd64 = {
|
||||
TargetOs_openbsd,
|
||||
TargetArch_amd64,
|
||||
8, 8, 8, 16,
|
||||
8, 8, AMD64_MAX_ALIGNMENT, 16,
|
||||
str_lit("x86_64-unknown-openbsd-elf"),
|
||||
str_lit("e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"),
|
||||
};
|
||||
|
||||
gb_global TargetMetrics target_haiku_amd64 = {
|
||||
TargetOs_haiku,
|
||||
TargetArch_amd64,
|
||||
8, 8, 8, 16,
|
||||
8, 8, AMD64_MAX_ALIGNMENT, 16,
|
||||
str_lit("x86_64-unknown-haiku"),
|
||||
};
|
||||
|
||||
gb_global TargetMetrics target_essence_amd64 = {
|
||||
TargetOs_essence,
|
||||
TargetArch_amd64,
|
||||
8, 8, 8, 16,
|
||||
8, 8, AMD64_MAX_ALIGNMENT, 16,
|
||||
str_lit("x86_64-pc-none-elf"),
|
||||
};
|
||||
|
||||
@@ -1036,7 +1037,6 @@ gb_global TargetMetrics target_freestanding_wasm32 = {
|
||||
TargetArch_wasm32,
|
||||
4, 4, 8, 16,
|
||||
str_lit("wasm32-freestanding-js"),
|
||||
str_lit("e-m:e-p:32:32-i64:64-n32:64-S128"),
|
||||
};
|
||||
|
||||
gb_global TargetMetrics target_js_wasm32 = {
|
||||
@@ -1044,7 +1044,6 @@ gb_global TargetMetrics target_js_wasm32 = {
|
||||
TargetArch_wasm32,
|
||||
4, 4, 8, 16,
|
||||
str_lit("wasm32-js-js"),
|
||||
str_lit("e-m:e-p:32:32-i64:64-n32:64-S128"),
|
||||
};
|
||||
|
||||
gb_global TargetMetrics target_wasi_wasm32 = {
|
||||
@@ -1052,7 +1051,6 @@ gb_global TargetMetrics target_wasi_wasm32 = {
|
||||
TargetArch_wasm32,
|
||||
4, 4, 8, 16,
|
||||
str_lit("wasm32-wasi-js"),
|
||||
str_lit("e-m:e-p:32:32-i64:64-n32:64-S128"),
|
||||
};
|
||||
|
||||
|
||||
@@ -1061,7 +1059,6 @@ gb_global TargetMetrics target_freestanding_wasm64p32 = {
|
||||
TargetArch_wasm64p32,
|
||||
4, 8, 8, 16,
|
||||
str_lit("wasm32-freestanding-js"),
|
||||
str_lit("e-m:e-p:32:32-i64:64-n32:64-S128"),
|
||||
};
|
||||
|
||||
gb_global TargetMetrics target_js_wasm64p32 = {
|
||||
@@ -1069,7 +1066,6 @@ gb_global TargetMetrics target_js_wasm64p32 = {
|
||||
TargetArch_wasm64p32,
|
||||
4, 8, 8, 16,
|
||||
str_lit("wasm32-js-js"),
|
||||
str_lit("e-m:e-p:32:32-i64:64-n32:64-S128"),
|
||||
};
|
||||
|
||||
gb_global TargetMetrics target_wasi_wasm64p32 = {
|
||||
@@ -1077,7 +1073,6 @@ gb_global TargetMetrics target_wasi_wasm64p32 = {
|
||||
TargetArch_wasm32,
|
||||
4, 8, 8, 16,
|
||||
str_lit("wasm32-wasi-js"),
|
||||
str_lit("e-m:e-p:32:32-i64:64-n32:64-S128"),
|
||||
};
|
||||
|
||||
|
||||
@@ -1085,27 +1080,24 @@ gb_global TargetMetrics target_wasi_wasm64p32 = {
|
||||
gb_global TargetMetrics target_freestanding_amd64_sysv = {
|
||||
TargetOs_freestanding,
|
||||
TargetArch_amd64,
|
||||
8, 8, 8, 16,
|
||||
8, 8, AMD64_MAX_ALIGNMENT, 16,
|
||||
str_lit("x86_64-pc-none-gnu"),
|
||||
str_lit("e-m:w-i64:64-f80:128-n8:16:32:64-S128"),
|
||||
TargetABI_SysV,
|
||||
};
|
||||
|
||||
gb_global TargetMetrics target_freestanding_amd64_win64 = {
|
||||
TargetOs_freestanding,
|
||||
TargetArch_amd64,
|
||||
8, 8, 8, 16,
|
||||
8, 8, AMD64_MAX_ALIGNMENT, 16,
|
||||
str_lit("x86_64-pc-none-msvc"),
|
||||
str_lit("e-m:w-i64:64-f80:128-n8:16:32:64-S128"),
|
||||
TargetABI_Win64,
|
||||
};
|
||||
|
||||
gb_global TargetMetrics target_freestanding_arm64 = {
|
||||
TargetOs_freestanding,
|
||||
TargetArch_arm64,
|
||||
8, 8, 8, 16,
|
||||
8, 8, 16, 16,
|
||||
str_lit("aarch64-none-elf"),
|
||||
str_lit("e-m:o-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"),
|
||||
};
|
||||
|
||||
struct NamedTargetMetrics {
|
||||
@@ -2027,7 +2019,8 @@ gb_internal void init_build_context(TargetMetrics *cross_target, Subtarget subta
|
||||
|
||||
bc->optimization_level = gb_clamp(bc->optimization_level, -1, 3);
|
||||
|
||||
if (bc->metrics.os != TargetOs_windows) {
|
||||
// TODO: Static map calls are bugged on `amd64sysv` abi.
|
||||
if (bc->metrics.os != TargetOs_windows && bc->metrics.arch == TargetArch_amd64) {
|
||||
// ENFORCE DYNAMIC MAP CALLS
|
||||
bc->dynamic_map_calls = true;
|
||||
}
|
||||
|
||||
@@ -121,12 +121,14 @@ gb_internal ExactValue exact_value_string(String string) {
|
||||
|
||||
gb_internal ExactValue exact_value_i64(i64 i) {
|
||||
ExactValue result = {ExactValue_Integer};
|
||||
result.value_integer = {0};
|
||||
big_int_from_i64(&result.value_integer, i);
|
||||
return result;
|
||||
}
|
||||
|
||||
gb_internal ExactValue exact_value_u64(u64 i) {
|
||||
ExactValue result = {ExactValue_Integer};
|
||||
result.value_integer = {0};
|
||||
big_int_from_u64(&result.value_integer, i);
|
||||
return result;
|
||||
}
|
||||
@@ -177,6 +179,7 @@ gb_internal ExactValue exact_value_typeid(Type *type) {
|
||||
|
||||
gb_internal ExactValue exact_value_integer_from_string(String const &string) {
|
||||
ExactValue result = {ExactValue_Integer};
|
||||
result.value_integer = {0};
|
||||
bool success;
|
||||
big_int_from_string(&result.value_integer, string, &success);
|
||||
if (!success) {
|
||||
@@ -585,6 +588,7 @@ gb_internal ExactValue exact_unary_operator_value(TokenKind op, ExactValue v, i3
|
||||
return v;
|
||||
case ExactValue_Integer: {
|
||||
ExactValue i = {ExactValue_Integer};
|
||||
i.value_integer = {0};
|
||||
big_int_neg(&i.value_integer, &v.value_integer);
|
||||
return i;
|
||||
}
|
||||
@@ -616,6 +620,7 @@ gb_internal ExactValue exact_unary_operator_value(TokenKind op, ExactValue v, i3
|
||||
case ExactValue_Integer: {
|
||||
GB_ASSERT(precision != 0);
|
||||
ExactValue i = {ExactValue_Integer};
|
||||
i.value_integer = {0};
|
||||
big_int_not(&i.value_integer, &v.value_integer, precision, !is_unsigned);
|
||||
return i;
|
||||
}
|
||||
|
||||
+403
-7
@@ -1508,6 +1508,7 @@ gb_internal WORKER_TASK_PROC(lb_llvm_module_pass_worker_proc) {
|
||||
case 1:
|
||||
// default<Os>
|
||||
// Passes removed: coro, openmp, sroa
|
||||
#if LLVM_VERSION_MAJOR == 17
|
||||
array_add(&passes, u8R"(
|
||||
annotation2metadata,
|
||||
forceattrs,
|
||||
@@ -1523,13 +1524,14 @@ globalopt,
|
||||
function<eager-inv>(
|
||||
mem2reg,
|
||||
instcombine<max-iterations=1000;no-use-loop-info>,
|
||||
simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>),
|
||||
require<globals-aa>,
|
||||
function(
|
||||
invalidate<aa>
|
||||
),
|
||||
require<profile-summary>,
|
||||
cgscc(
|
||||
simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>
|
||||
),
|
||||
require<globals-aa>,
|
||||
function(
|
||||
invalidate<aa>
|
||||
),
|
||||
require<profile-summary>,
|
||||
cgscc(
|
||||
devirt<4>(
|
||||
inline<only-mandatory>,
|
||||
inline,
|
||||
@@ -1630,10 +1632,142 @@ function(
|
||||
),
|
||||
verify
|
||||
)");
|
||||
#else
|
||||
array_add(&passes, u8R"(
|
||||
annotation2metadata,
|
||||
forceattrs,
|
||||
inferattrs,
|
||||
function<eager-inv>(
|
||||
lower-expect,
|
||||
simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;no-switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>,
|
||||
sroa<modify-cfg>,
|
||||
early-cse<>
|
||||
),
|
||||
ipsccp,
|
||||
called-value-propagation,
|
||||
globalopt,
|
||||
function<eager-inv>(
|
||||
mem2reg,
|
||||
instcombine<max-iterations=1;no-use-loop-info;no-verify-fixpoint>,
|
||||
simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>
|
||||
),
|
||||
always-inline,
|
||||
require<globals-aa>,
|
||||
function(
|
||||
invalidate<aa>
|
||||
),
|
||||
require<profile-summary>,
|
||||
cgscc(
|
||||
devirt<4>(
|
||||
inline,
|
||||
function-attrs<skip-non-recursive-function-attrs>,
|
||||
function<eager-inv;no-rerun>(
|
||||
sroa<modify-cfg>,
|
||||
early-cse<memssa>,
|
||||
speculative-execution<only-if-divergent-target>,
|
||||
jump-threading,
|
||||
correlated-propagation,
|
||||
simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>,
|
||||
instcombine<max-iterations=1;no-use-loop-info;no-verify-fixpoint>,
|
||||
aggressive-instcombine,
|
||||
tailcallelim,
|
||||
simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>,
|
||||
reassociate,
|
||||
constraint-elimination,
|
||||
loop-mssa(
|
||||
loop-instsimplify,
|
||||
loop-simplifycfg,
|
||||
licm<no-allowspeculation>,
|
||||
loop-rotate<header-duplication;no-prepare-for-lto>,
|
||||
licm<allowspeculation>,
|
||||
simple-loop-unswitch<no-nontrivial;trivial>
|
||||
),
|
||||
simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>,
|
||||
instcombine<max-iterations=1;no-use-loop-info;no-verify-fixpoint>,
|
||||
loop(
|
||||
loop-idiom,
|
||||
indvars,
|
||||
loop-deletion,
|
||||
loop-unroll-full
|
||||
),
|
||||
sroa<modify-cfg>,
|
||||
vector-combine,
|
||||
mldst-motion<no-split-footer-bb>,
|
||||
gvn<>,
|
||||
sccp,
|
||||
bdce,
|
||||
instcombine<max-iterations=1;no-use-loop-info;no-verify-fixpoint>,
|
||||
jump-threading,
|
||||
correlated-propagation,
|
||||
adce,
|
||||
memcpyopt,
|
||||
dse,
|
||||
move-auto-init,
|
||||
loop-mssa(
|
||||
licm<allowspeculation>
|
||||
),
|
||||
simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;hoist-common-insts;sink-common-insts;speculate-blocks;simplify-cond-branch>,
|
||||
instcombine<max-iterations=1;no-use-loop-info;no-verify-fixpoint>
|
||||
),
|
||||
function-attrs,
|
||||
function(
|
||||
require<should-not-run-function-passes>
|
||||
)
|
||||
)
|
||||
),
|
||||
deadargelim,
|
||||
globalopt,
|
||||
globaldce,
|
||||
elim-avail-extern,
|
||||
rpo-function-attrs,
|
||||
recompute-globalsaa,
|
||||
function<eager-inv>(
|
||||
float2int,
|
||||
lower-constant-intrinsics,
|
||||
loop(
|
||||
loop-rotate<header-duplication;no-prepare-for-lto>,
|
||||
loop-deletion
|
||||
),
|
||||
loop-distribute,
|
||||
inject-tli-mappings,
|
||||
loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>,
|
||||
infer-alignment,
|
||||
loop-load-elim,
|
||||
instcombine<max-iterations=1;no-use-loop-info;no-verify-fixpoint>,
|
||||
simplifycfg<bonus-inst-threshold=1;forward-switch-cond;switch-range-to-icmp;switch-to-lookup;no-keep-loops;hoist-common-insts;sink-common-insts;speculate-blocks;simplify-cond-branch>,
|
||||
slp-vectorizer,
|
||||
vector-combine,
|
||||
instcombine<max-iterations=1;no-use-loop-info;no-verify-fixpoint>,
|
||||
loop-unroll<O2>,
|
||||
transform-warning,
|
||||
sroa<preserve-cfg>,
|
||||
infer-alignment,
|
||||
instcombine<max-iterations=1;no-use-loop-info;no-verify-fixpoint>,
|
||||
loop-mssa(
|
||||
licm<allowspeculation>
|
||||
),
|
||||
alignment-from-assumptions,
|
||||
loop-sink,
|
||||
instsimplify,
|
||||
div-rem-pairs,
|
||||
tailcallelim,
|
||||
simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>
|
||||
),
|
||||
globaldce,
|
||||
constmerge,
|
||||
cg-profile,
|
||||
rel-lookup-table-converter,
|
||||
function(
|
||||
annotation-remarks
|
||||
),
|
||||
verify
|
||||
)");
|
||||
#endif
|
||||
break;
|
||||
// default<O2>
|
||||
// Passes removed: coro, openmp, sroa
|
||||
case 2:
|
||||
#if LLVM_VERSION_MAJOR == 17
|
||||
array_add(&passes, u8R"(
|
||||
annotation2metadata,
|
||||
forceattrs,
|
||||
@@ -1758,11 +1892,144 @@ function(
|
||||
),
|
||||
verify
|
||||
)");
|
||||
#else
|
||||
array_add(&passes, u8R"(
|
||||
annotation2metadata,
|
||||
forceattrs,
|
||||
inferattrs,
|
||||
function<eager-inv>(
|
||||
lower-expect,
|
||||
simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;no-switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>,
|
||||
sroa<modify-cfg>,
|
||||
early-cse<>
|
||||
),
|
||||
ipsccp,
|
||||
called-value-propagation,
|
||||
globalopt,
|
||||
function<eager-inv>(
|
||||
mem2reg,
|
||||
instcombine<max-iterations=1;no-use-loop-info;no-verify-fixpoint>,
|
||||
simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>
|
||||
),
|
||||
always-inline,
|
||||
require<globals-aa>,
|
||||
function(
|
||||
invalidate<aa>
|
||||
),
|
||||
require<profile-summary>,
|
||||
cgscc(
|
||||
devirt<4>(
|
||||
inline,
|
||||
function-attrs<skip-non-recursive-function-attrs>,
|
||||
function<eager-inv;no-rerun>(
|
||||
sroa<modify-cfg>,
|
||||
early-cse<memssa>,
|
||||
speculative-execution<only-if-divergent-target>,
|
||||
jump-threading,
|
||||
correlated-propagation,
|
||||
simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>,
|
||||
instcombine<max-iterations=1;no-use-loop-info;no-verify-fixpoint>,
|
||||
aggressive-instcombine,
|
||||
libcalls-shrinkwrap,
|
||||
tailcallelim,
|
||||
simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>,
|
||||
reassociate,
|
||||
constraint-elimination,
|
||||
loop-mssa(
|
||||
loop-instsimplify,
|
||||
loop-simplifycfg,
|
||||
licm<no-allowspeculation>,
|
||||
loop-rotate<header-duplication;no-prepare-for-lto>,
|
||||
licm<allowspeculation>,
|
||||
simple-loop-unswitch<no-nontrivial;trivial>
|
||||
),
|
||||
simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>,
|
||||
instcombine<max-iterations=1;no-use-loop-info;no-verify-fixpoint>,
|
||||
loop(
|
||||
loop-idiom,
|
||||
indvars,
|
||||
loop-deletion,
|
||||
loop-unroll-full
|
||||
),
|
||||
sroa<modify-cfg>,
|
||||
vector-combine,
|
||||
mldst-motion<no-split-footer-bb>,
|
||||
gvn<>,
|
||||
sccp,
|
||||
bdce,
|
||||
instcombine<max-iterations=1;no-use-loop-info;no-verify-fixpoint>,
|
||||
jump-threading,
|
||||
correlated-propagation,
|
||||
adce,
|
||||
memcpyopt,
|
||||
dse,
|
||||
move-auto-init,
|
||||
loop-mssa(
|
||||
licm<allowspeculation>
|
||||
),
|
||||
simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;hoist-common-insts;sink-common-insts;speculate-blocks;simplify-cond-branch>,
|
||||
instcombine<max-iterations=1;no-use-loop-info;no-verify-fixpoint>
|
||||
),
|
||||
function-attrs,
|
||||
function(
|
||||
require<should-not-run-function-passes>
|
||||
)
|
||||
)
|
||||
),
|
||||
deadargelim,
|
||||
globalopt,
|
||||
globaldce,
|
||||
elim-avail-extern,
|
||||
rpo-function-attrs,
|
||||
recompute-globalsaa,
|
||||
function<eager-inv>(
|
||||
float2int,
|
||||
lower-constant-intrinsics,
|
||||
loop(
|
||||
loop-rotate<header-duplication;no-prepare-for-lto>,
|
||||
loop-deletion
|
||||
),
|
||||
loop-distribute,
|
||||
inject-tli-mappings,
|
||||
loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>,
|
||||
infer-alignment,
|
||||
loop-load-elim,
|
||||
instcombine<max-iterations=1;no-use-loop-info;no-verify-fixpoint>,
|
||||
simplifycfg<bonus-inst-threshold=1;forward-switch-cond;switch-range-to-icmp;switch-to-lookup;no-keep-loops;hoist-common-insts;sink-common-insts;speculate-blocks;simplify-cond-branch>,
|
||||
slp-vectorizer,
|
||||
vector-combine,
|
||||
instcombine<max-iterations=1;no-use-loop-info;no-verify-fixpoint>,
|
||||
loop-unroll<O2>,
|
||||
transform-warning,
|
||||
sroa<modify-cfg>,
|
||||
infer-alignment,
|
||||
instcombine<max-iterations=1;no-use-loop-info;no-verify-fixpoint>,
|
||||
loop-mssa(
|
||||
licm<allowspeculation>
|
||||
),
|
||||
alignment-from-assumptions,
|
||||
loop-sink,
|
||||
instsimplify,
|
||||
div-rem-pairs,
|
||||
tailcallelim,
|
||||
simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>
|
||||
),
|
||||
globaldce,
|
||||
constmerge,
|
||||
cg-profile,
|
||||
rel-lookup-table-converter,
|
||||
function(
|
||||
annotation-remarks
|
||||
),
|
||||
verify
|
||||
)");
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 3:
|
||||
// default<O3>
|
||||
// Passes removed: coro, openmp, sroa
|
||||
#if LLVM_VERSION_MAJOR == 17
|
||||
array_add(&passes, u8R"(
|
||||
annotation2metadata,
|
||||
forceattrs,
|
||||
@@ -1890,6 +2157,135 @@ function(
|
||||
),
|
||||
verify
|
||||
)");
|
||||
#else
|
||||
array_add(&passes, u8R"(
|
||||
annotation2metadata,
|
||||
forceattrs,
|
||||
inferattrs,
|
||||
function<eager-inv>(
|
||||
lower-expect,
|
||||
simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;no-switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>,
|
||||
sroa<modify-cfg>,
|
||||
early-cse<>,
|
||||
callsite-splitting
|
||||
),
|
||||
ipsccp,
|
||||
called-value-propagation,
|
||||
globalopt,
|
||||
function<eager-inv>(
|
||||
mem2reg,
|
||||
instcombine<max-iterations=1;no-use-loop-info;no-verify-fixpoint>,
|
||||
simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>
|
||||
),
|
||||
always-inline,
|
||||
require<globals-aa>,
|
||||
function(invalidate<aa>),
|
||||
require<profile-summary>,
|
||||
cgscc(
|
||||
devirt<4>(
|
||||
inline,
|
||||
function-attrs<skip-non-recursive-function-attrs>,
|
||||
argpromotion,
|
||||
function<eager-inv;no-rerun>(
|
||||
sroa<modify-cfg>,
|
||||
early-cse<memssa>,
|
||||
speculative-execution<only-if-divergent-target>,
|
||||
jump-threading,
|
||||
correlated-propagation,
|
||||
simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>,
|
||||
instcombine<max-iterations=1;no-use-loop-info;no-verify-fixpoint>,
|
||||
aggressive-instcombine,
|
||||
libcalls-shrinkwrap,
|
||||
tailcallelim,
|
||||
simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>,
|
||||
reassociate,
|
||||
constraint-elimination,
|
||||
loop-mssa(
|
||||
loop-instsimplify,
|
||||
loop-simplifycfg,
|
||||
licm<no-allowspeculation>,
|
||||
loop-rotate<header-duplication;no-prepare-for-lto>,
|
||||
licm<allowspeculation>,
|
||||
simple-loop-unswitch<nontrivial;trivial>
|
||||
),
|
||||
simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>,
|
||||
instcombine<max-iterations=1;no-use-loop-info;no-verify-fixpoint>,
|
||||
loop(
|
||||
loop-idiom,
|
||||
indvars,
|
||||
loop-deletion,
|
||||
loop-unroll-full
|
||||
),
|
||||
sroa<modify-cfg>,
|
||||
vector-combine,
|
||||
mldst-motion<no-split-footer-bb>,
|
||||
gvn<>,
|
||||
sccp,
|
||||
bdce,
|
||||
instcombine<max-iterations=1;no-use-loop-info;no-verify-fixpoint>,
|
||||
jump-threading,
|
||||
correlated-propagation,
|
||||
adce,
|
||||
memcpyopt,
|
||||
dse,
|
||||
move-auto-init,
|
||||
loop-mssa(licm<allowspeculation>),
|
||||
simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;hoist-common-insts;sink-common-insts;speculate-blocks;simplify-cond-branch>,
|
||||
instcombine<max-iterations=1;no-use-loop-info;no-verify-fixpoint>
|
||||
),
|
||||
function-attrs,
|
||||
function(
|
||||
require<should-not-run-function-passes>
|
||||
)
|
||||
)
|
||||
),
|
||||
deadargelim,
|
||||
globalopt,
|
||||
globaldce,
|
||||
elim-avail-extern,
|
||||
rpo-function-attrs,
|
||||
recompute-globalsaa,
|
||||
function<eager-inv>(
|
||||
float2int,
|
||||
lower-constant-intrinsics,
|
||||
chr,
|
||||
loop(
|
||||
loop-rotate<header-duplication;no-prepare-for-lto>,
|
||||
loop-deletion
|
||||
),
|
||||
loop-distribute,
|
||||
inject-tli-mappings,
|
||||
loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>,
|
||||
infer-alignment,
|
||||
loop-load-elim,
|
||||
instcombine<max-iterations=1;no-use-loop-info;no-verify-fixpoint>,
|
||||
simplifycfg<bonus-inst-threshold=1;forward-switch-cond;switch-range-to-icmp;switch-to-lookup;no-keep-loops;hoist-common-insts;sink-common-insts;speculate-blocks;simplify-cond-branch>,
|
||||
slp-vectorizer,
|
||||
vector-combine,
|
||||
instcombine<max-iterations=1;no-use-loop-info;no-verify-fixpoint>,
|
||||
loop-unroll<O3>,
|
||||
transform-warning,
|
||||
sroa<preserve-cfg>,
|
||||
infer-alignment,
|
||||
instcombine<max-iterations=1;no-use-loop-info;no-verify-fixpoint>,
|
||||
loop-mssa(licm<allowspeculation>),
|
||||
alignment-from-assumptions,
|
||||
loop-sink,
|
||||
instsimplify,
|
||||
div-rem-pairs,
|
||||
tailcallelim,
|
||||
simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>
|
||||
),
|
||||
globaldce,
|
||||
constmerge,
|
||||
cg-profile,
|
||||
rel-lookup-table-converter,
|
||||
function(
|
||||
annotation-remarks
|
||||
),
|
||||
verify
|
||||
)");
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
#if defined(GB_SYSTEM_WINDOWS)
|
||||
#include "llvm-c/Core.h"
|
||||
#include "llvm-c/ExecutionEngine.h"
|
||||
#include "llvm-c/Target.h"
|
||||
#include "llvm-c/Analysis.h"
|
||||
#include "llvm-c/Object.h"
|
||||
#include "llvm-c/BitWriter.h"
|
||||
#include "llvm-c/DebugInfo.h"
|
||||
#include "llvm-c/Transforms/PassBuilder.h"
|
||||
#include <llvm-c/Config/llvm-config.h>
|
||||
#else
|
||||
#include <llvm/Config/llvm-config.h>
|
||||
#endif
|
||||
|
||||
#include <llvm-c/Core.h>
|
||||
#include <llvm-c/ExecutionEngine.h>
|
||||
#include <llvm-c/Target.h>
|
||||
@@ -26,7 +22,6 @@
|
||||
#include <llvm-c/Transforms/Utils.h>
|
||||
#include <llvm-c/Transforms/Vectorize.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if LLVM_VERSION_MAJOR < 11
|
||||
#error "LLVM Version 11 is the minimum required"
|
||||
|
||||
+2
-5
@@ -86,11 +86,8 @@ gb_global Timings global_timings = {0};
|
||||
|
||||
#if defined(GB_SYSTEM_OSX)
|
||||
#include <llvm/Config/llvm-config.h>
|
||||
#if LLVM_VERSION_MAJOR < 11
|
||||
#error LLVM Version 11+ is required => "brew install llvm@11"
|
||||
#endif
|
||||
#if (LLVM_VERSION_MAJOR > 14 && LLVM_VERSION_MAJOR < 17) || LLVM_VERSION_MAJOR > 17
|
||||
#error LLVM Version 11..=14 or =17 is required => "brew install llvm@14"
|
||||
#if LLVM_VERSION_MAJOR < 11 || (LLVM_VERSION_MAJOR > 14 && LLVM_VERSION_MAJOR < 17) || LLVM_VERSION_MAJOR > 18
|
||||
#error LLVM Version 11..=14 or =18 is required => "brew install llvm@14"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user