Commit graph

62 commits

Author SHA1 Message Date
Luke Boswell
915097d792
Merge remote-tracking branch 'remote/main' into upgrade-llvm-zig 2024-10-08 18:21:24 +11:00
Brendan Hansknecht
4e3ec97d7a
generate array of alignment type to enforce tag data alignment 2024-09-16 17:10:49 -07:00
Brendan Hansknecht
a7eae239f0
Avoid explicit tag padding
Explicit padding changes the c-abi when passed to/returned from functions.
This is leading to incorrect loading of types like `Task U64 {}`.
2024-09-16 16:47:20 -07:00
Luke Boswell
99e2bc2038
Merge remote-tracking branch 'remote/main' into upgrade-llvm-zig 2024-09-05 12:11:51 +10:00
Brendan Hansknecht
7997cf95e7
ensure alignment is never 0. Must be at least 1. 2024-08-25 11:48:46 -07:00
Brendan Hansknecht
cf5cd84d60
fix alignment of 16 bytes 2024-08-21 09:04:07 -07:00
Luke Boswell
1519e5f833
fix warnings from deprecated llvm ptr type 2024-08-04 12:52:44 +10:00
Brendan Hansknecht
6dc5bfb1b7
Use roc_target over target_lexicon
Tailors a target class for our needs.
Replaces tons of uses across the entire compiler.
This is a base for later adding new targets like thumb.
2024-03-31 10:50:26 -07:00
Brendan Hansknecht
398bf2f96c
update rust code to llvm-16 and fix build
also update:
 - llvm frame address
 - erased function type
 - dec passing to zig
 - gen dev storage size
2023-10-23 13:50:31 -07:00
Ayaz Hafiz
74d0f8d2e5
llvm types for erasure, function pointer 2023-07-12 14:43:40 -05:00
Ayaz Hafiz
7ea85e44d2
Add Layout::Erased 2023-07-12 14:43:24 -05:00
Ayaz Hafiz
6312d75ee0
Add FunctionPointer layout 2023-07-12 13:59:50 -05:00
Folkert
2d616d1fe9
manual clippy fixes 2023-07-10 18:27:10 +02:00
Folkert
6d2d65bb1e
remove Boxed layout 2023-07-09 15:47:28 +02:00
Folkert
9c85fb90d3
fix bugs 2023-06-24 14:49:47 +02:00
Folkert
17512873e8
add LayoutRepr::Ptr 2023-06-24 14:49:45 +02:00
Ayaz Hafiz
7ab044d79f
argument_type_from_layout takes layoutrepr 2023-06-17 18:13:02 -05:00
Ayaz Hafiz
bc41db2a34
Get rid of passing target_info a bunch 2023-06-17 18:13:00 -05:00
Ayaz Hafiz
8495f3b085
Have basic_type_from_layout take LayoutRepr 2023-06-17 18:12:17 -05:00
Ayaz Hafiz
6c4f76c5c9
Pass tag target ptr rather than alloca 2023-06-16 21:06:49 -05:00
Ayaz Hafiz
465cee053e
Have RocUnion::as_struct_value return an alloca instead
Saves a useless store/load.
2023-06-16 17:54:17 -05:00
Ayaz Hafiz
f95cef8086
Add llvm_alignment_bytes and memcpy function 2023-06-16 10:30:44 -05:00
Ayaz Hafiz
2294f6994f
TERRIBLE HACK to support x86 compilation 2023-06-16 10:30:44 -05:00
Ayaz Hafiz
ea6330b48b
Make sure to memcpy with correct size and alignments 2023-06-16 10:30:43 -05:00
Folkert
9b0cc2a5fd
make tag union opaque space use more optimal instructions 2023-06-16 10:30:43 -05:00
Ayaz Hafiz
5ce4435911
Debug assert struct layout 2023-06-16 10:30:43 -05:00
Ayaz Hafiz
879a97ee4c
Fix compare for big structs 2023-06-16 10:30:41 -05:00
Ayaz Hafiz
130501eb6a
layout_interner does not need to be mutable 2023-06-16 10:30:41 -05:00
Ayaz Hafiz
65ca836ecb
layout_interner does not need to be mutable 2023-06-16 10:30:41 -05:00
Ayaz Hafiz
510b920701
argument_type_from_struct_layout 2023-06-16 10:30:41 -05:00
Ayaz Hafiz
c09a33f9f4
Inline RocStructType back in 2023-06-16 10:30:41 -05:00
Ayaz Hafiz
47fb9fe6f2
Implement struct-by-reference for structs over 4 machine words 2023-06-16 10:30:40 -05:00
Ayaz Hafiz
470ed119c2
Move roc struct operations to a new "struct" module 2023-06-16 10:30:38 -05:00
Ayaz Hafiz
457cdabc5c
Make repr private and accessible only via the interner 2023-06-06 16:01:27 -05:00
Ayaz Hafiz
a67c148be7
Convert LayoutRepr::Struct into a tuple variant 2023-05-16 11:58:16 -05:00
Ayaz Hafiz
c3eeb5e2cc
Wrap layouts in a LayoutRepr constructor
Part 1 of support semantic layout representations.
2023-05-10 13:22:10 -05:00
Anton-4
9748e4a4dc
many clippy fixes 2023-04-24 16:21:46 +02:00
Folkert
c0f49ce62c
correctly add padding between data and tag id 2023-03-28 19:46:26 +02:00
Ayaz Hafiz
3a960e7809
Properly recast nested recursion pointers to their expanded layouts as needed
When we load a structure with a nested recursive pointer, the pointer
may be loaded opaquely. We need to refine it to the concrete type wanted
by the layout.

This conversion can be removed after we upgrade to LLVM 15.

Closes #5162
2023-03-22 08:21:08 -05:00
Folkert
178e80fa9a
fix for when C has to return an empty tag union 2023-02-15 15:30:26 +01:00
Folkert
0072192897
prepare for llvm 15 2023-01-28 14:51:47 +01:00
Ayaz Hafiz
8750127111
Begin support for looping-back recursive pointers to their source layouts 2023-01-23 14:37:48 -06:00
Ayaz Hafiz
03ece6e274
Update llvm backend 2023-01-11 14:39:10 -06:00
Ayaz Hafiz
ce717dca8b
Do not require allocating Layouts in arena before interning
This should reduce memory spend, the interner has its own effective
arena anyway
2023-01-10 09:47:13 -06:00
Ayaz Hafiz
50826d1a83
Inline interners into the layout interner module
I realized that we'll need to make the layout interner more complicated
to support things like recursive pointers pointing to their parents and
to support lambda set layout caching. Since the layout interner is the
only user of intern crate right now anyway, just inline the whole thing.
2023-01-03 14:19:39 -06:00
Ayaz Hafiz
512a1721ae
Push mutable layout interner through llvm backend 2022-12-29 10:04:43 -06:00
Ayaz Hafiz
7ab7fdfa7b
Push interned layouts as mut throughout the backend, and intern box layouts 2022-12-28 18:51:26 -06:00
Folkert
bb4ff34aaa
be more precise with zig return types 2022-12-20 15:43:11 +01:00
Folkert
9bf8d65170
upgrade most build_load usages 2022-12-20 00:11:45 +01:00
Folkert
bc9c813fec
already do some of the llvm struct_gep conversion work 2022-12-19 19:57:31 +01:00