mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 07:08:48 +00:00
Merge remote-tracking branch 'offical/master'
This commit is contained in:
@@ -169,15 +169,18 @@ type_has_nil :: proc($T: typeid) -> bool ---
|
|||||||
|
|
||||||
type_is_specialization_of :: proc($T, $S: typeid) -> bool ---
|
type_is_specialization_of :: proc($T, $S: typeid) -> bool ---
|
||||||
|
|
||||||
type_is_variant_of :: proc($U, $V: typeid) -> bool where type_is_union(U) ---
|
type_is_variant_of :: proc($U, $V: typeid) -> bool where type_is_union(U) ---
|
||||||
type_union_tag_type :: proc($T: typeid) -> typeid where type_is_union(T) ---
|
type_union_tag_type :: proc($T: typeid) -> typeid where type_is_union(T) ---
|
||||||
type_union_tag_offset :: proc($T: typeid) -> uintptr where type_is_union(T) ---
|
type_union_tag_offset :: proc($T: typeid) -> uintptr where type_is_union(T) ---
|
||||||
type_union_base_tag_value :: proc($T: typeid) -> int where type_is_union(U) ---
|
type_union_base_tag_value :: proc($T: typeid) -> int where type_is_union(U) ---
|
||||||
type_union_variant_count :: proc($T: typeid) -> int where type_is_union(T) ---
|
type_union_variant_count :: proc($T: typeid) -> int where type_is_union(T) ---
|
||||||
type_variant_type_of :: proc($T: typeid, $index: int) -> typeid where type_is_union(T) ---
|
type_variant_type_of :: proc($T: typeid, $index: int) -> typeid where type_is_union(T) ---
|
||||||
type_variant_index_of :: proc($U, $V: typeid) -> int where type_is_union(U) ---
|
type_variant_index_of :: proc($U, $V: typeid) -> int where type_is_union(U) ---
|
||||||
|
|
||||||
type_has_field :: proc($T: typeid, $name: string) -> bool ---
|
type_bit_set_elem_type :: proc($T: typeid) -> typeid where type_is_bit_set(T) ---
|
||||||
|
type_bit_set_underlying_type :: proc($T: typeid) -> typeid where type_is_bit_set(T) ---
|
||||||
|
|
||||||
|
type_has_field :: proc($T: typeid, $name: string) -> bool ---
|
||||||
type_field_type :: proc($T: typeid, $name: string) -> typeid ---
|
type_field_type :: proc($T: typeid, $name: string) -> typeid ---
|
||||||
|
|
||||||
type_proc_parameter_count :: proc($T: typeid) -> int where type_is_proc(T) ---
|
type_proc_parameter_count :: proc($T: typeid) -> int where type_is_proc(T) ---
|
||||||
|
|||||||
+7
-6
@@ -25,12 +25,14 @@ error() {
|
|||||||
|
|
||||||
if [ -z "$LLVM_CONFIG" ]; then
|
if [ -z "$LLVM_CONFIG" ]; then
|
||||||
# darwin, linux, openbsd
|
# 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-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-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-12)" ]; then LLVM_CONFIG="llvm-config-12"
|
||||||
elif [ -n "$(command -v llvm-config-11)" ]; then LLVM_CONFIG="llvm-config-11"
|
elif [ -n "$(command -v llvm-config-11)" ]; then LLVM_CONFIG="llvm-config-11"
|
||||||
# freebsd
|
# 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-config17)" ]; then LLVM_CONFIG="llvm-config17"
|
||||||
elif [ -n "$(command -v llvm-config14)" ]; then LLVM_CONFIG="llvm-config14"
|
elif [ -n "$(command -v llvm-config14)" ]; then LLVM_CONFIG="llvm-config14"
|
||||||
elif [ -n "$(command -v llvm-config13)" ]; then LLVM_CONFIG="llvm-config13"
|
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_MINOR="$(echo $LLVM_VERSION | awk -F. '{print $2}')"
|
||||||
LLVM_VERSION_PATCH="$(echo $LLVM_VERSION | awk -F. '{print $3}')"
|
LLVM_VERSION_PATCH="$(echo $LLVM_VERSION | awk -F. '{print $3}')"
|
||||||
|
|
||||||
if [ $LLVM_VERSION_MAJOR -lt 11 ] ||
|
if [ $LLVM_VERSION_MAJOR -lt 11 ] || ([ $LLVM_VERSION_MAJOR -gt 14 ] && [ $LLVM_VERSION_MAJOR -lt 17 ]) || [ $LLVM_VERSION_MAJOR -gt 18 ]; then
|
||||||
([ $LLVM_VERSION_MAJOR -gt 14 ] && [ $LLVM_VERSION_MAJOR -lt 17 ]); then
|
error "Invalid LLVM version $LLVM_VERSION: must be 11, 12, 13, 14, 17 or 18"
|
||||||
error "Invalid LLVM version $LLVM_VERSION: must be 11, 12, 13, 14 or 17"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case "$OS_NAME" in
|
case "$OS_NAME" in
|
||||||
Darwin)
|
Darwin)
|
||||||
if [ "$OS_ARCH" = "arm64" ]; then
|
if [ "$OS_ARCH" = "arm64" ]; then
|
||||||
if [ $LLVM_VERSION_MAJOR -lt 13 ] || [ $LLVM_VERSION_MAJOR -gt 17 ]; then
|
if [ $LLVM_VERSION_MAJOR -lt 13 ]; then
|
||||||
error "Darwin Arm64 requires LLVM 13, 14 or 17"
|
error "Invalid LLVM version $LLVM_VERSION: Darwin Arm64 requires LLVM 13, 14, 17 or 18"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -356,7 +356,7 @@ int_count_lsb :: proc(a: ^Int, allocator := context.allocator) -> (count: int, e
|
|||||||
}
|
}
|
||||||
|
|
||||||
platform_count_lsb :: #force_inline proc(a: $T) -> (count: int)
|
platform_count_lsb :: #force_inline proc(a: $T) -> (count: int)
|
||||||
where intrinsics.type_is_integer(T) && intrinsics.type_is_unsigned(T) {
|
where intrinsics.type_is_integer(T), intrinsics.type_is_unsigned(T) {
|
||||||
return int(intrinsics.count_trailing_zeros(a)) if a > 0 else 0
|
return int(intrinsics.count_trailing_zeros(a)) if a > 0 else 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -546,7 +546,7 @@ internal_int_shl1 :: proc(dest, src: ^Int, allocator := context.allocator) -> (e
|
|||||||
Like `internal_int_mul_digit` but with an integer as the small input.
|
Like `internal_int_mul_digit` but with an integer as the small input.
|
||||||
*/
|
*/
|
||||||
internal_int_mul_integer :: proc(dest, a: ^Int, b: $T, allocator := context.allocator) -> (err: Error)
|
internal_int_mul_integer :: proc(dest, a: ^Int, b: $T, allocator := context.allocator) -> (err: Error)
|
||||||
where intrinsics.type_is_integer(T) && T != DIGIT {
|
where intrinsics.type_is_integer(T), T != DIGIT {
|
||||||
context.allocator = allocator
|
context.allocator = allocator
|
||||||
|
|
||||||
t := &Int{}
|
t := &Int{}
|
||||||
@@ -2806,7 +2806,7 @@ internal_int_count_lsb :: proc(a: ^Int) -> (count: int, err: Error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal_platform_count_lsb :: #force_inline proc(a: $T) -> (count: int)
|
internal_platform_count_lsb :: #force_inline proc(a: $T) -> (count: int)
|
||||||
where intrinsics.type_is_integer(T) && intrinsics.type_is_unsigned(T) {
|
where intrinsics.type_is_integer(T), intrinsics.type_is_unsigned(T) {
|
||||||
return int(intrinsics.count_trailing_zeros(a)) if a > 0 else 0
|
return int(intrinsics.count_trailing_zeros(a)) if a > 0 else 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -469,7 +469,7 @@ internal_int_pack_count :: proc(a: ^Int, $T: typeid, nails := 0) -> (size_needed
|
|||||||
Assumes `a` not to be `nil` and to have been initialized.
|
Assumes `a` not to be `nil` and to have been initialized.
|
||||||
*/
|
*/
|
||||||
internal_int_pack :: proc(a: ^Int, buf: []$T, nails := 0, order := Order.LSB_First) -> (written: int, err: Error)
|
internal_int_pack :: proc(a: ^Int, buf: []$T, nails := 0, order := Order.LSB_First) -> (written: int, err: Error)
|
||||||
where intrinsics.type_is_integer(T) && intrinsics.type_is_unsigned(T) && size_of(T) <= 16 {
|
where intrinsics.type_is_integer(T), intrinsics.type_is_unsigned(T), size_of(T) <= 16 {
|
||||||
|
|
||||||
assert(nails >= 0 && nails < (size_of(T) * 8))
|
assert(nails >= 0 && nails < (size_of(T) * 8))
|
||||||
|
|
||||||
@@ -505,7 +505,7 @@ internal_int_pack :: proc(a: ^Int, buf: []$T, nails := 0, order := Order.LSB_Fir
|
|||||||
|
|
||||||
|
|
||||||
internal_int_unpack :: proc(a: ^Int, buf: []$T, nails := 0, order := Order.LSB_First, allocator := context.allocator) -> (err: Error)
|
internal_int_unpack :: proc(a: ^Int, buf: []$T, nails := 0, order := Order.LSB_First, allocator := context.allocator) -> (err: Error)
|
||||||
where intrinsics.type_is_integer(T) && intrinsics.type_is_unsigned(T) && size_of(T) <= 16 {
|
where intrinsics.type_is_integer(T), intrinsics.type_is_unsigned(T), size_of(T) <= 16 {
|
||||||
assert(nails >= 0 && nails < (size_of(T) * 8))
|
assert(nails >= 0 && nails < (size_of(T) * 8))
|
||||||
context.allocator = allocator
|
context.allocator = allocator
|
||||||
|
|
||||||
|
|||||||
@@ -701,3 +701,39 @@ enumerated_array :: proc(ptr: ^$T) -> []intrinsics.type_elem_type(T)
|
|||||||
where intrinsics.type_is_enumerated_array(T) {
|
where intrinsics.type_is_enumerated_array(T) {
|
||||||
return ([^]intrinsics.type_elem_type(T))(ptr)[:len(T)]
|
return ([^]intrinsics.type_elem_type(T))(ptr)[:len(T)]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Turn a `[]E` into `bit_set[E]`
|
||||||
|
// e.g.:
|
||||||
|
// bs := slice.enum_slice_to_bitset(my_flag_slice, rl.ConfigFlags)
|
||||||
|
@(require_results)
|
||||||
|
enum_slice_to_bitset :: proc(enums: []$E, $T: typeid/bit_set[E]) -> (bits: T) where intrinsics.type_is_enum(E), intrinsics.type_bit_set_elem_type(T) == E {
|
||||||
|
for v in enums {
|
||||||
|
bits |= {v}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Turn a `bit_set[E]` into a `[]E`
|
||||||
|
// e.g.:
|
||||||
|
// sl := slice.bitset_to_enum_slice(flag_buf[:], bs)
|
||||||
|
@(require_results)
|
||||||
|
bitset_to_enum_slice_with_buffer :: proc(buf: []$E, bs: $T) -> (slice: []E) where intrinsics.type_is_enum(E), intrinsics.type_bit_set_elem_type(T) == E {
|
||||||
|
count := 0
|
||||||
|
for v in bs {
|
||||||
|
buf[count] = v
|
||||||
|
count += 1
|
||||||
|
}
|
||||||
|
return buf[:count]
|
||||||
|
}
|
||||||
|
|
||||||
|
// Turn a `bit_set[E]` into a `[]E`, allocates
|
||||||
|
// e.g.:
|
||||||
|
// sl := slice.bitset_to_enum_slice(bs)
|
||||||
|
@(require_results)
|
||||||
|
bitset_to_enum_slice_with_make :: proc(bs: $T, $E: typeid, allocator := context.allocator) -> (slice: []E) where intrinsics.type_is_enum(E), intrinsics.type_bit_set_elem_type(T) == E {
|
||||||
|
ones := intrinsics.count_ones(transmute(E)bs)
|
||||||
|
buf := make([]E, int(ones), allocator)
|
||||||
|
return bitset_to_enum_slice(buf, bs)
|
||||||
|
}
|
||||||
|
|
||||||
|
bitset_to_enum_slice :: proc{bitset_to_enum_slice_with_make, bitset_to_enum_slice_with_buffer}
|
||||||
+15
-15
@@ -26,7 +26,7 @@ where
|
|||||||
@(private)
|
@(private)
|
||||||
syscall2 :: #force_inline proc "contextless" (nr: uintptr,p1: $T1, p2: $T2) -> int
|
syscall2 :: #force_inline proc "contextless" (nr: uintptr,p1: $T1, p2: $T2) -> int
|
||||||
where
|
where
|
||||||
size_of(p1) <= size_of(uintptr) &&
|
size_of(p1) <= size_of(uintptr),
|
||||||
size_of(p2) <= size_of(uintptr)
|
size_of(p2) <= size_of(uintptr)
|
||||||
{
|
{
|
||||||
return cast(int) intrinsics.syscall(nr,
|
return cast(int) intrinsics.syscall(nr,
|
||||||
@@ -36,8 +36,8 @@ where
|
|||||||
@(private)
|
@(private)
|
||||||
syscall3 :: #force_inline proc "contextless" (nr: uintptr, p1: $T1, p2: $T2, p3: $T3) -> int
|
syscall3 :: #force_inline proc "contextless" (nr: uintptr, p1: $T1, p2: $T2, p3: $T3) -> int
|
||||||
where
|
where
|
||||||
size_of(p1) <= size_of(uintptr) &&
|
size_of(p1) <= size_of(uintptr),
|
||||||
size_of(p2) <= size_of(uintptr) &&
|
size_of(p2) <= size_of(uintptr),
|
||||||
size_of(p3) <= size_of(uintptr)
|
size_of(p3) <= size_of(uintptr)
|
||||||
{
|
{
|
||||||
return cast(int) intrinsics.syscall(nr,
|
return cast(int) intrinsics.syscall(nr,
|
||||||
@@ -49,9 +49,9 @@ where
|
|||||||
@(private)
|
@(private)
|
||||||
syscall4 :: #force_inline proc "contextless" (nr: uintptr, p1: $T1, p2: $T2, p3: $T3, p4: $T4) -> int
|
syscall4 :: #force_inline proc "contextless" (nr: uintptr, p1: $T1, p2: $T2, p3: $T3, p4: $T4) -> int
|
||||||
where
|
where
|
||||||
size_of(p1) <= size_of(uintptr) &&
|
size_of(p1) <= size_of(uintptr),
|
||||||
size_of(p2) <= size_of(uintptr) &&
|
size_of(p2) <= size_of(uintptr),
|
||||||
size_of(p3) <= size_of(uintptr) &&
|
size_of(p3) <= size_of(uintptr),
|
||||||
size_of(p4) <= size_of(uintptr)
|
size_of(p4) <= size_of(uintptr)
|
||||||
{
|
{
|
||||||
return cast(int) intrinsics.syscall(nr,
|
return cast(int) intrinsics.syscall(nr,
|
||||||
@@ -64,10 +64,10 @@ where
|
|||||||
@(private)
|
@(private)
|
||||||
syscall5 :: #force_inline proc "contextless" (nr: uintptr, p1: $T1, p2: $T2, p3: $T3, p4: $T4, p5: $T5) -> int
|
syscall5 :: #force_inline proc "contextless" (nr: uintptr, p1: $T1, p2: $T2, p3: $T3, p4: $T4, p5: $T5) -> int
|
||||||
where
|
where
|
||||||
size_of(p1) <= size_of(uintptr) &&
|
size_of(p1) <= size_of(uintptr),
|
||||||
size_of(p2) <= size_of(uintptr) &&
|
size_of(p2) <= size_of(uintptr),
|
||||||
size_of(p3) <= size_of(uintptr) &&
|
size_of(p3) <= size_of(uintptr),
|
||||||
size_of(p4) <= size_of(uintptr) &&
|
size_of(p4) <= size_of(uintptr),
|
||||||
size_of(p5) <= size_of(uintptr)
|
size_of(p5) <= size_of(uintptr)
|
||||||
{
|
{
|
||||||
return cast(int) intrinsics.syscall(nr,
|
return cast(int) intrinsics.syscall(nr,
|
||||||
@@ -81,11 +81,11 @@ where
|
|||||||
@(private)
|
@(private)
|
||||||
syscall6 :: #force_inline proc "contextless" (nr: uintptr, p1: $T1, p2: $T2, p3: $T3, p4: $T4, p5: $T5, p6: $T6) -> int
|
syscall6 :: #force_inline proc "contextless" (nr: uintptr, p1: $T1, p2: $T2, p3: $T3, p4: $T4, p5: $T5, p6: $T6) -> int
|
||||||
where
|
where
|
||||||
size_of(p1) <= size_of(uintptr) &&
|
size_of(p1) <= size_of(uintptr),
|
||||||
size_of(p2) <= size_of(uintptr) &&
|
size_of(p2) <= size_of(uintptr),
|
||||||
size_of(p3) <= size_of(uintptr) &&
|
size_of(p3) <= size_of(uintptr),
|
||||||
size_of(p4) <= size_of(uintptr) &&
|
size_of(p4) <= size_of(uintptr),
|
||||||
size_of(p5) <= size_of(uintptr) &&
|
size_of(p5) <= size_of(uintptr),
|
||||||
size_of(p6) <= size_of(uintptr)
|
size_of(p6) <= size_of(uintptr)
|
||||||
{
|
{
|
||||||
return cast(int) intrinsics.syscall(nr,
|
return cast(int) intrinsics.syscall(nr,
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ the_basics :: proc() {
|
|||||||
// os.args holds the path to the current executable and any arguments passed to it.
|
// os.args holds the path to the current executable and any arguments passed to it.
|
||||||
if len(os.args) == 1 {
|
if len(os.args) == 1 {
|
||||||
fmt.printf("Hellope from %v.\n", os.args[0])
|
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])
|
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_align;
|
||||||
isize max_simd_align;
|
isize max_simd_align;
|
||||||
String target_triplet;
|
String target_triplet;
|
||||||
String target_data_layout;
|
|
||||||
TargetABIKind abi;
|
TargetABIKind abi;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -923,7 +922,18 @@ gb_internal isize MAX_ERROR_COLLECTOR_COUNT(void) {
|
|||||||
return build_context.max_error_count;
|
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 = {
|
gb_global TargetMetrics target_windows_i386 = {
|
||||||
TargetOs_windows,
|
TargetOs_windows,
|
||||||
@@ -934,9 +944,8 @@ gb_global TargetMetrics target_windows_i386 = {
|
|||||||
gb_global TargetMetrics target_windows_amd64 = {
|
gb_global TargetMetrics target_windows_amd64 = {
|
||||||
TargetOs_windows,
|
TargetOs_windows,
|
||||||
TargetArch_amd64,
|
TargetArch_amd64,
|
||||||
8, 8, 8, 16,
|
8, 8, AMD64_MAX_ALIGNMENT, 16,
|
||||||
str_lit("x86_64-pc-windows-msvc"),
|
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 = {
|
gb_global TargetMetrics target_linux_i386 = {
|
||||||
@@ -949,16 +958,14 @@ gb_global TargetMetrics target_linux_i386 = {
|
|||||||
gb_global TargetMetrics target_linux_amd64 = {
|
gb_global TargetMetrics target_linux_amd64 = {
|
||||||
TargetOs_linux,
|
TargetOs_linux,
|
||||||
TargetArch_amd64,
|
TargetArch_amd64,
|
||||||
8, 8, 8, 16,
|
8, 8, AMD64_MAX_ALIGNMENT, 16,
|
||||||
str_lit("x86_64-pc-linux-gnu"),
|
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 = {
|
gb_global TargetMetrics target_linux_arm64 = {
|
||||||
TargetOs_linux,
|
TargetOs_linux,
|
||||||
TargetArch_arm64,
|
TargetArch_arm64,
|
||||||
8, 8, 8, 16,
|
8, 8, 16, 16,
|
||||||
str_lit("aarch64-linux-elf"),
|
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 = {
|
gb_global TargetMetrics target_linux_arm32 = {
|
||||||
@@ -966,15 +973,13 @@ gb_global TargetMetrics target_linux_arm32 = {
|
|||||||
TargetArch_arm32,
|
TargetArch_arm32,
|
||||||
4, 4, 4, 8,
|
4, 4, 4, 8,
|
||||||
str_lit("arm-linux-gnu"),
|
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 = {
|
gb_global TargetMetrics target_darwin_amd64 = {
|
||||||
TargetOs_darwin,
|
TargetOs_darwin,
|
||||||
TargetArch_amd64,
|
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("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 = {
|
gb_global TargetMetrics target_darwin_arm64 = {
|
||||||
@@ -982,7 +987,6 @@ gb_global TargetMetrics target_darwin_arm64 = {
|
|||||||
TargetArch_arm64,
|
TargetArch_arm64,
|
||||||
8, 8, 16, 16,
|
8, 8, 16, 16,
|
||||||
str_lit("arm64-apple-macosx"), // NOTE: Changes during initialization based on build flags.
|
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 = {
|
gb_global TargetMetrics target_freebsd_i386 = {
|
||||||
@@ -995,9 +999,8 @@ gb_global TargetMetrics target_freebsd_i386 = {
|
|||||||
gb_global TargetMetrics target_freebsd_amd64 = {
|
gb_global TargetMetrics target_freebsd_amd64 = {
|
||||||
TargetOs_freebsd,
|
TargetOs_freebsd,
|
||||||
TargetArch_amd64,
|
TargetArch_amd64,
|
||||||
8, 8, 8, 16,
|
8, 8, AMD64_MAX_ALIGNMENT, 16,
|
||||||
str_lit("x86_64-unknown-freebsd-elf"),
|
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 = {
|
gb_global TargetMetrics target_freebsd_arm64 = {
|
||||||
@@ -1005,28 +1008,26 @@ gb_global TargetMetrics target_freebsd_arm64 = {
|
|||||||
TargetArch_arm64,
|
TargetArch_arm64,
|
||||||
8, 8, 16, 16,
|
8, 8, 16, 16,
|
||||||
str_lit("aarch64-unknown-freebsd-elf"),
|
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 = {
|
gb_global TargetMetrics target_openbsd_amd64 = {
|
||||||
TargetOs_openbsd,
|
TargetOs_openbsd,
|
||||||
TargetArch_amd64,
|
TargetArch_amd64,
|
||||||
8, 8, 8, 16,
|
8, 8, AMD64_MAX_ALIGNMENT, 16,
|
||||||
str_lit("x86_64-unknown-openbsd-elf"),
|
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 = {
|
gb_global TargetMetrics target_haiku_amd64 = {
|
||||||
TargetOs_haiku,
|
TargetOs_haiku,
|
||||||
TargetArch_amd64,
|
TargetArch_amd64,
|
||||||
8, 8, 8, 16,
|
8, 8, AMD64_MAX_ALIGNMENT, 16,
|
||||||
str_lit("x86_64-unknown-haiku"),
|
str_lit("x86_64-unknown-haiku"),
|
||||||
};
|
};
|
||||||
|
|
||||||
gb_global TargetMetrics target_essence_amd64 = {
|
gb_global TargetMetrics target_essence_amd64 = {
|
||||||
TargetOs_essence,
|
TargetOs_essence,
|
||||||
TargetArch_amd64,
|
TargetArch_amd64,
|
||||||
8, 8, 8, 16,
|
8, 8, AMD64_MAX_ALIGNMENT, 16,
|
||||||
str_lit("x86_64-pc-none-elf"),
|
str_lit("x86_64-pc-none-elf"),
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1036,7 +1037,6 @@ gb_global TargetMetrics target_freestanding_wasm32 = {
|
|||||||
TargetArch_wasm32,
|
TargetArch_wasm32,
|
||||||
4, 4, 8, 16,
|
4, 4, 8, 16,
|
||||||
str_lit("wasm32-freestanding-js"),
|
str_lit("wasm32-freestanding-js"),
|
||||||
str_lit("e-m:e-p:32:32-i64:64-n32:64-S128"),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
gb_global TargetMetrics target_js_wasm32 = {
|
gb_global TargetMetrics target_js_wasm32 = {
|
||||||
@@ -1044,7 +1044,6 @@ gb_global TargetMetrics target_js_wasm32 = {
|
|||||||
TargetArch_wasm32,
|
TargetArch_wasm32,
|
||||||
4, 4, 8, 16,
|
4, 4, 8, 16,
|
||||||
str_lit("wasm32-js-js"),
|
str_lit("wasm32-js-js"),
|
||||||
str_lit("e-m:e-p:32:32-i64:64-n32:64-S128"),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
gb_global TargetMetrics target_wasi_wasm32 = {
|
gb_global TargetMetrics target_wasi_wasm32 = {
|
||||||
@@ -1052,7 +1051,6 @@ gb_global TargetMetrics target_wasi_wasm32 = {
|
|||||||
TargetArch_wasm32,
|
TargetArch_wasm32,
|
||||||
4, 4, 8, 16,
|
4, 4, 8, 16,
|
||||||
str_lit("wasm32-wasi-js"),
|
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,
|
TargetArch_wasm64p32,
|
||||||
4, 8, 8, 16,
|
4, 8, 8, 16,
|
||||||
str_lit("wasm32-freestanding-js"),
|
str_lit("wasm32-freestanding-js"),
|
||||||
str_lit("e-m:e-p:32:32-i64:64-n32:64-S128"),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
gb_global TargetMetrics target_js_wasm64p32 = {
|
gb_global TargetMetrics target_js_wasm64p32 = {
|
||||||
@@ -1069,7 +1066,6 @@ gb_global TargetMetrics target_js_wasm64p32 = {
|
|||||||
TargetArch_wasm64p32,
|
TargetArch_wasm64p32,
|
||||||
4, 8, 8, 16,
|
4, 8, 8, 16,
|
||||||
str_lit("wasm32-js-js"),
|
str_lit("wasm32-js-js"),
|
||||||
str_lit("e-m:e-p:32:32-i64:64-n32:64-S128"),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
gb_global TargetMetrics target_wasi_wasm64p32 = {
|
gb_global TargetMetrics target_wasi_wasm64p32 = {
|
||||||
@@ -1077,7 +1073,6 @@ gb_global TargetMetrics target_wasi_wasm64p32 = {
|
|||||||
TargetArch_wasm32,
|
TargetArch_wasm32,
|
||||||
4, 8, 8, 16,
|
4, 8, 8, 16,
|
||||||
str_lit("wasm32-wasi-js"),
|
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 = {
|
gb_global TargetMetrics target_freestanding_amd64_sysv = {
|
||||||
TargetOs_freestanding,
|
TargetOs_freestanding,
|
||||||
TargetArch_amd64,
|
TargetArch_amd64,
|
||||||
8, 8, 8, 16,
|
8, 8, AMD64_MAX_ALIGNMENT, 16,
|
||||||
str_lit("x86_64-pc-none-gnu"),
|
str_lit("x86_64-pc-none-gnu"),
|
||||||
str_lit("e-m:w-i64:64-f80:128-n8:16:32:64-S128"),
|
|
||||||
TargetABI_SysV,
|
TargetABI_SysV,
|
||||||
};
|
};
|
||||||
|
|
||||||
gb_global TargetMetrics target_freestanding_amd64_win64 = {
|
gb_global TargetMetrics target_freestanding_amd64_win64 = {
|
||||||
TargetOs_freestanding,
|
TargetOs_freestanding,
|
||||||
TargetArch_amd64,
|
TargetArch_amd64,
|
||||||
8, 8, 8, 16,
|
8, 8, AMD64_MAX_ALIGNMENT, 16,
|
||||||
str_lit("x86_64-pc-none-msvc"),
|
str_lit("x86_64-pc-none-msvc"),
|
||||||
str_lit("e-m:w-i64:64-f80:128-n8:16:32:64-S128"),
|
|
||||||
TargetABI_Win64,
|
TargetABI_Win64,
|
||||||
};
|
};
|
||||||
|
|
||||||
gb_global TargetMetrics target_freestanding_arm64 = {
|
gb_global TargetMetrics target_freestanding_arm64 = {
|
||||||
TargetOs_freestanding,
|
TargetOs_freestanding,
|
||||||
TargetArch_arm64,
|
TargetArch_arm64,
|
||||||
8, 8, 8, 16,
|
8, 8, 16, 16,
|
||||||
str_lit("aarch64-none-elf"),
|
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 {
|
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);
|
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
|
// ENFORCE DYNAMIC MAP CALLS
|
||||||
bc->dynamic_map_calls = true;
|
bc->dynamic_map_calls = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5433,6 +5433,58 @@ gb_internal bool check_builtin_procedure(CheckerContext *c, Operand *operand, As
|
|||||||
operand->value = exact_value_i64(u->Union.kind == UnionType_no_nil ? 0 : 1);
|
operand->value = exact_value_i64(u->Union.kind == UnionType_no_nil ? 0 : 1);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
|
case BuiltinProc_type_bit_set_elem_type:
|
||||||
|
{
|
||||||
|
|
||||||
|
if (operand->mode != Addressing_Type) {
|
||||||
|
error(operand->expr, "Expected a type for '%.*s'", LIT(builtin_name));
|
||||||
|
operand->mode = Addressing_Invalid;
|
||||||
|
operand->type = t_invalid;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Type *bs = operand->type;
|
||||||
|
|
||||||
|
if (!is_type_bit_set(bs)) {
|
||||||
|
error(operand->expr, "Expected a bit_set type for '%.*s'", LIT(builtin_name));
|
||||||
|
operand->mode = Addressing_Invalid;
|
||||||
|
operand->type = t_invalid;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bs = base_type(bs);
|
||||||
|
GB_ASSERT(bs->kind == Type_BitSet);
|
||||||
|
|
||||||
|
operand->mode = Addressing_Type;
|
||||||
|
operand->type = bs->BitSet.elem;
|
||||||
|
} break;
|
||||||
|
|
||||||
|
case BuiltinProc_type_bit_set_underlying_type:
|
||||||
|
{
|
||||||
|
|
||||||
|
if (operand->mode != Addressing_Type) {
|
||||||
|
error(operand->expr, "Expected a type for '%.*s'", LIT(builtin_name));
|
||||||
|
operand->mode = Addressing_Invalid;
|
||||||
|
operand->type = t_invalid;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Type *bs = operand->type;
|
||||||
|
|
||||||
|
if (!is_type_bit_set(bs)) {
|
||||||
|
error(operand->expr, "Expected a bit_set type for '%.*s'", LIT(builtin_name));
|
||||||
|
operand->mode = Addressing_Invalid;
|
||||||
|
operand->type = t_invalid;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bs = base_type(bs);
|
||||||
|
GB_ASSERT(bs->kind == Type_BitSet);
|
||||||
|
|
||||||
|
operand->mode = Addressing_Type;
|
||||||
|
operand->type = bit_set_to_int(bs);
|
||||||
|
} break;
|
||||||
|
|
||||||
case BuiltinProc_type_union_variant_count:
|
case BuiltinProc_type_union_variant_count:
|
||||||
{
|
{
|
||||||
if (operand->mode != Addressing_Type) {
|
if (operand->mode != Addressing_Type) {
|
||||||
|
|||||||
@@ -1619,6 +1619,17 @@ gb_internal bool check_proc_body(CheckerContext *ctx_, Token token, DeclInfo *de
|
|||||||
if (e->kind != Entity_Variable) {
|
if (e->kind != Entity_Variable) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (is_type_polymorphic(e->type)) {
|
||||||
|
gbString s = type_to_string(e->type);
|
||||||
|
char const *msg = "Unspecialized polymorphic types are not allowed in procedure parameters, got %s";
|
||||||
|
if (e->Variable.type_expr) {
|
||||||
|
error(e->Variable.type_expr, msg, s);
|
||||||
|
} else {
|
||||||
|
error(e->token, msg, s);
|
||||||
|
}
|
||||||
|
gb_string_free(s);
|
||||||
|
}
|
||||||
|
|
||||||
if (!(e->flags & EntityFlag_Using)) {
|
if (!(e->flags & EntityFlag_Using)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6193,6 +6193,20 @@ gb_internal bool evaluate_where_clauses(CheckerContext *ctx, Ast *call_expr, Sco
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ast_file_vet_style(ctx->file)) {
|
||||||
|
Ast *c = unparen_expr(clause);
|
||||||
|
if (c->kind == Ast_BinaryExpr && c->BinaryExpr.op.kind == Token_CmpAnd) {
|
||||||
|
ERROR_BLOCK();
|
||||||
|
error(c, "Prefer to separate 'where' clauses with a comma rather than '&&'");
|
||||||
|
gbString x = expr_to_string(c->BinaryExpr.left);
|
||||||
|
gbString y = expr_to_string(c->BinaryExpr.right);
|
||||||
|
error_line("\tSuggestion: '%s, %s'\n", x, y);
|
||||||
|
gb_string_free(y);
|
||||||
|
gb_string_free(x);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -1166,7 +1166,7 @@ gb_internal void check_bit_field_type(CheckerContext *ctx, Type *bit_field_type,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (all_ones && all_booleans) {
|
if (all_ones && all_booleans) {
|
||||||
if (build_context.vet_flags & VetFlag_Style) {
|
if (ast_file_vet_style(ctx->file)) {
|
||||||
char const *msg = "This 'bit_field' is better expressed as a 'bit_set' since all of the fields are booleans, of 1-bit in size, and the backing type is an integer (-vet-style)";
|
char const *msg = "This 'bit_field' is better expressed as a 'bit_set' since all of the fields are booleans, of 1-bit in size, and the backing type is an integer (-vet-style)";
|
||||||
error(node, msg);
|
error(node, msg);
|
||||||
} else {
|
} else {
|
||||||
@@ -2076,6 +2076,7 @@ gb_internal Type *check_get_params(CheckerContext *ctx, Scope *scope, Ast *_para
|
|||||||
param = alloc_entity_param(scope, name->Ident.token, type, is_using, true);
|
param = alloc_entity_param(scope, name->Ident.token, type, is_using, true);
|
||||||
param->Variable.param_value = param_value;
|
param->Variable.param_value = param_value;
|
||||||
param->Variable.field_group_index = field_group_index;
|
param->Variable.field_group_index = field_group_index;
|
||||||
|
param->Variable.type_expr = type_expr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (p->flags&FieldFlag_no_alias) {
|
if (p->flags&FieldFlag_no_alias) {
|
||||||
|
|||||||
@@ -269,6 +269,9 @@ BuiltinProc__type_simple_boolean_end,
|
|||||||
BuiltinProc_type_variant_type_of,
|
BuiltinProc_type_variant_type_of,
|
||||||
BuiltinProc_type_variant_index_of,
|
BuiltinProc_type_variant_index_of,
|
||||||
|
|
||||||
|
BuiltinProc_type_bit_set_elem_type,
|
||||||
|
BuiltinProc_type_bit_set_underlying_type,
|
||||||
|
|
||||||
BuiltinProc_type_struct_field_count,
|
BuiltinProc_type_struct_field_count,
|
||||||
|
|
||||||
BuiltinProc_type_proc_parameter_count,
|
BuiltinProc_type_proc_parameter_count,
|
||||||
@@ -577,6 +580,9 @@ gb_global BuiltinProc builtin_procs[BuiltinProc_COUNT] = {
|
|||||||
{STR_LIT("type_variant_type_of"), 2, false, Expr_Expr, BuiltinProcPkg_intrinsics},
|
{STR_LIT("type_variant_type_of"), 2, false, Expr_Expr, BuiltinProcPkg_intrinsics},
|
||||||
{STR_LIT("type_variant_index_of"), 2, false, Expr_Expr, BuiltinProcPkg_intrinsics},
|
{STR_LIT("type_variant_index_of"), 2, false, Expr_Expr, BuiltinProcPkg_intrinsics},
|
||||||
|
|
||||||
|
{STR_LIT("type_bit_set_elem_type"), 1, false, Expr_Expr, BuiltinProcPkg_intrinsics},
|
||||||
|
{STR_LIT("type_bit_set_underlying_type"), 1, false, Expr_Expr, BuiltinProcPkg_intrinsics},
|
||||||
|
|
||||||
{STR_LIT("type_struct_field_count"), 1, false, Expr_Expr, BuiltinProcPkg_intrinsics},
|
{STR_LIT("type_struct_field_count"), 1, false, Expr_Expr, BuiltinProcPkg_intrinsics},
|
||||||
|
|
||||||
{STR_LIT("type_proc_parameter_count"), 1, false, Expr_Expr, BuiltinProcPkg_intrinsics},
|
{STR_LIT("type_proc_parameter_count"), 1, false, Expr_Expr, BuiltinProcPkg_intrinsics},
|
||||||
|
|||||||
@@ -210,6 +210,7 @@ struct Entity {
|
|||||||
CommentGroup *comment;
|
CommentGroup *comment;
|
||||||
} Constant;
|
} Constant;
|
||||||
struct {
|
struct {
|
||||||
|
Ast *type_expr; // only used for some variables within procedure bodies
|
||||||
Ast *init_expr; // only used for some variables within procedure bodies
|
Ast *init_expr; // only used for some variables within procedure bodies
|
||||||
i32 field_index;
|
i32 field_index;
|
||||||
i32 field_group_index;
|
i32 field_group_index;
|
||||||
|
|||||||
+6
-2
@@ -719,9 +719,13 @@ gb_internal void print_all_errors(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (it.str.len-it.pos > 0) {
|
// Merge additional text (suggestions for example) into the previous error.
|
||||||
array_add_elems(&prev_ev->msg, it.str.text+it.pos, it.str.len-it.pos);
|
String current = {prev_ev->msg.data, prev_ev->msg.count};
|
||||||
|
String addition = {it.str.text+it.pos, it.str.len-it.pos};
|
||||||
|
if (addition.len > 0 && !string_contains_string(current, addition)) {
|
||||||
|
array_add_elems(&prev_ev->msg, addition.text, addition.len);
|
||||||
}
|
}
|
||||||
|
|
||||||
array_free(&ev.msg);
|
array_free(&ev.msg);
|
||||||
array_ordered_remove(&global_error_collector.error_values, i);
|
array_ordered_remove(&global_error_collector.error_values, i);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -121,12 +121,14 @@ gb_internal ExactValue exact_value_string(String string) {
|
|||||||
|
|
||||||
gb_internal ExactValue exact_value_i64(i64 i) {
|
gb_internal ExactValue exact_value_i64(i64 i) {
|
||||||
ExactValue result = {ExactValue_Integer};
|
ExactValue result = {ExactValue_Integer};
|
||||||
|
result.value_integer = {0};
|
||||||
big_int_from_i64(&result.value_integer, i);
|
big_int_from_i64(&result.value_integer, i);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
gb_internal ExactValue exact_value_u64(u64 i) {
|
gb_internal ExactValue exact_value_u64(u64 i) {
|
||||||
ExactValue result = {ExactValue_Integer};
|
ExactValue result = {ExactValue_Integer};
|
||||||
|
result.value_integer = {0};
|
||||||
big_int_from_u64(&result.value_integer, i);
|
big_int_from_u64(&result.value_integer, i);
|
||||||
return result;
|
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) {
|
gb_internal ExactValue exact_value_integer_from_string(String const &string) {
|
||||||
ExactValue result = {ExactValue_Integer};
|
ExactValue result = {ExactValue_Integer};
|
||||||
|
result.value_integer = {0};
|
||||||
bool success;
|
bool success;
|
||||||
big_int_from_string(&result.value_integer, string, &success);
|
big_int_from_string(&result.value_integer, string, &success);
|
||||||
if (!success) {
|
if (!success) {
|
||||||
@@ -585,6 +588,7 @@ gb_internal ExactValue exact_unary_operator_value(TokenKind op, ExactValue v, i3
|
|||||||
return v;
|
return v;
|
||||||
case ExactValue_Integer: {
|
case ExactValue_Integer: {
|
||||||
ExactValue i = {ExactValue_Integer};
|
ExactValue i = {ExactValue_Integer};
|
||||||
|
i.value_integer = {0};
|
||||||
big_int_neg(&i.value_integer, &v.value_integer);
|
big_int_neg(&i.value_integer, &v.value_integer);
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
@@ -616,6 +620,7 @@ gb_internal ExactValue exact_unary_operator_value(TokenKind op, ExactValue v, i3
|
|||||||
case ExactValue_Integer: {
|
case ExactValue_Integer: {
|
||||||
GB_ASSERT(precision != 0);
|
GB_ASSERT(precision != 0);
|
||||||
ExactValue i = {ExactValue_Integer};
|
ExactValue i = {ExactValue_Integer};
|
||||||
|
i.value_integer = {0};
|
||||||
big_int_not(&i.value_integer, &v.value_integer, precision, !is_unsigned);
|
big_int_not(&i.value_integer, &v.value_integer, precision, !is_unsigned);
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|||||||
+403
-7
@@ -1508,6 +1508,7 @@ gb_internal WORKER_TASK_PROC(lb_llvm_module_pass_worker_proc) {
|
|||||||
case 1:
|
case 1:
|
||||||
// default<Os>
|
// default<Os>
|
||||||
// Passes removed: coro, openmp, sroa
|
// Passes removed: coro, openmp, sroa
|
||||||
|
#if LLVM_VERSION_MAJOR == 17
|
||||||
array_add(&passes, u8R"(
|
array_add(&passes, u8R"(
|
||||||
annotation2metadata,
|
annotation2metadata,
|
||||||
forceattrs,
|
forceattrs,
|
||||||
@@ -1523,13 +1524,14 @@ globalopt,
|
|||||||
function<eager-inv>(
|
function<eager-inv>(
|
||||||
mem2reg,
|
mem2reg,
|
||||||
instcombine<max-iterations=1000;no-use-loop-info>,
|
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>),
|
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(
|
require<globals-aa>,
|
||||||
invalidate<aa>
|
function(
|
||||||
),
|
invalidate<aa>
|
||||||
require<profile-summary>,
|
),
|
||||||
cgscc(
|
require<profile-summary>,
|
||||||
|
cgscc(
|
||||||
devirt<4>(
|
devirt<4>(
|
||||||
inline<only-mandatory>,
|
inline<only-mandatory>,
|
||||||
inline,
|
inline,
|
||||||
@@ -1630,10 +1632,142 @@ function(
|
|||||||
),
|
),
|
||||||
verify
|
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;
|
break;
|
||||||
// default<O2>
|
// default<O2>
|
||||||
// Passes removed: coro, openmp, sroa
|
// Passes removed: coro, openmp, sroa
|
||||||
case 2:
|
case 2:
|
||||||
|
#if LLVM_VERSION_MAJOR == 17
|
||||||
array_add(&passes, u8R"(
|
array_add(&passes, u8R"(
|
||||||
annotation2metadata,
|
annotation2metadata,
|
||||||
forceattrs,
|
forceattrs,
|
||||||
@@ -1758,11 +1892,144 @@ function(
|
|||||||
),
|
),
|
||||||
verify
|
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;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
// default<O3>
|
// default<O3>
|
||||||
// Passes removed: coro, openmp, sroa
|
// Passes removed: coro, openmp, sroa
|
||||||
|
#if LLVM_VERSION_MAJOR == 17
|
||||||
array_add(&passes, u8R"(
|
array_add(&passes, u8R"(
|
||||||
annotation2metadata,
|
annotation2metadata,
|
||||||
forceattrs,
|
forceattrs,
|
||||||
@@ -1890,6 +2157,135 @@ function(
|
|||||||
),
|
),
|
||||||
verify
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,9 @@
|
|||||||
#if defined(GB_SYSTEM_WINDOWS)
|
#if defined(GB_SYSTEM_WINDOWS)
|
||||||
#include "llvm-c/Core.h"
|
#include <llvm-c/Config/llvm-config.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"
|
|
||||||
#else
|
#else
|
||||||
|
#include <llvm/Config/llvm-config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <llvm-c/Core.h>
|
#include <llvm-c/Core.h>
|
||||||
#include <llvm-c/ExecutionEngine.h>
|
#include <llvm-c/ExecutionEngine.h>
|
||||||
#include <llvm-c/Target.h>
|
#include <llvm-c/Target.h>
|
||||||
@@ -26,7 +22,6 @@
|
|||||||
#include <llvm-c/Transforms/Utils.h>
|
#include <llvm-c/Transforms/Utils.h>
|
||||||
#include <llvm-c/Transforms/Vectorize.h>
|
#include <llvm-c/Transforms/Vectorize.h>
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
#if LLVM_VERSION_MAJOR < 11
|
#if LLVM_VERSION_MAJOR < 11
|
||||||
#error "LLVM Version 11 is the minimum required"
|
#error "LLVM Version 11 is the minimum required"
|
||||||
|
|||||||
@@ -4383,7 +4383,11 @@ gb_internal lbAddr lb_build_addr_compound_lit(lbProcedure *p, Ast *expr) {
|
|||||||
mask = LLVMConstSub(mask, LLVMConstInt(lit, 1, false));
|
mask = LLVMConstSub(mask, LLVMConstInt(lit, 1, false));
|
||||||
|
|
||||||
LLVMValueRef elem = values[i].value;
|
LLVMValueRef elem = values[i].value;
|
||||||
elem = LLVMBuildZExt(p->builder, elem, lit, "");
|
if (lb_sizeof(lit) < lb_sizeof(LLVMTypeOf(elem))) {
|
||||||
|
elem = LLVMBuildTrunc(p->builder, elem, lit, "");
|
||||||
|
} else {
|
||||||
|
elem = LLVMBuildZExt(p->builder, elem, lit, "");
|
||||||
|
}
|
||||||
elem = LLVMBuildAnd(p->builder, elem, mask, "");
|
elem = LLVMBuildAnd(p->builder, elem, mask, "");
|
||||||
|
|
||||||
elem = LLVMBuildShl(p->builder, elem, LLVMConstInt(lit, f.bit_offset, false), "");
|
elem = LLVMBuildShl(p->builder, elem, LLVMConstInt(lit, f.bit_offset, false), "");
|
||||||
|
|||||||
+2
-5
@@ -86,11 +86,8 @@ gb_global Timings global_timings = {0};
|
|||||||
|
|
||||||
#if defined(GB_SYSTEM_OSX)
|
#if defined(GB_SYSTEM_OSX)
|
||||||
#include <llvm/Config/llvm-config.h>
|
#include <llvm/Config/llvm-config.h>
|
||||||
#if LLVM_VERSION_MAJOR < 11
|
#if LLVM_VERSION_MAJOR < 11 || (LLVM_VERSION_MAJOR > 14 && LLVM_VERSION_MAJOR < 17) || LLVM_VERSION_MAJOR > 18
|
||||||
#error LLVM Version 11+ is required => "brew install llvm@11"
|
#error LLVM Version 11..=14 or =18 is required => "brew install llvm@14"
|
||||||
#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"
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
#include "parser_pos.cpp"
|
#include "parser_pos.cpp"
|
||||||
|
|
||||||
gb_internal u64 ast_file_vet_flags(AstFile *f) {
|
gb_internal u64 ast_file_vet_flags(AstFile *f) {
|
||||||
if (f->vet_flags_set) {
|
if (f != nullptr && f->vet_flags_set) {
|
||||||
return f->vet_flags;
|
return f->vet_flags;
|
||||||
}
|
}
|
||||||
return build_context.vet_flags;
|
return build_context.vet_flags;
|
||||||
|
|||||||
@@ -3267,6 +3267,10 @@ gb_internal Selection lookup_field_with_selection(Type *type_, String field_name
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (is_type_polymorphic(type)) {
|
||||||
|
// NOTE(bill): A polymorphic struct has no fields, this only hits in the case of an error
|
||||||
|
return sel;
|
||||||
|
}
|
||||||
wait_signal_until_available(&type->Struct.fields_wait_signal);
|
wait_signal_until_available(&type->Struct.fields_wait_signal);
|
||||||
isize field_count = type->Struct.fields.count;
|
isize field_count = type->Struct.fields.count;
|
||||||
if (field_count != 0) for_array(i, type->Struct.fields) {
|
if (field_count != 0) for_array(i, type->Struct.fields) {
|
||||||
|
|||||||
Reference in New Issue
Block a user