fac60c3974
core/codegen: Handle vararg in function generation
2024-08-06 11:46:00 +08:00
f5fb504a15
core/codegen/expr: Implement vararg handling in gen_call
2024-08-06 11:46:00 +08:00
6a64c9d1de
core/typecheck/typedef: Add is_vararg_ctx to TTuple
2024-08-06 11:45:54 +08:00
cbf79c5e9c
core/typecheck/typedef: Add is_vararg to FuncArg, ConcreteFuncArg
2024-08-06 11:43:13 +08:00
f5b998cd9c
core/codegen: Remove unnecessary mut from get_llvm*_type
2024-08-06 10:52:24 +08:00
0ba68f6657
core: Set target triple and datalayout for each module
...
Fixes an issue with inconsistent pointer sizes causing crashes.
2024-07-26 13:35:40 +08:00
2194dbddd5
core/type_annotation: Refactor List type to TObj
...
In preparation for operators on lists.
2024-07-04 15:32:18 +08:00
74096eb9f6
core: name codegen worker threads
2024-06-25 12:36:37 +08:00
06e9d90d57
apply clippy changes
2024-06-21 14:14:01 +08:00
fd36f78005
core: refactor PrimitiveDefinitionId
into enum PrimDef
2024-06-12 15:01:01 +08:00
8168692cc3
apply cargo fmt
2024-06-12 14:45:03 +08:00
210d9e2334
core: Add more creator functions for ProxyType
2024-06-11 15:26:37 +08:00
51671800b6
core/builtins: Extract codegen portion into functions
...
We will need to reuse them when implementing elementwise function
application for ndarrays.
2024-05-06 13:21:54 +08:00
3a6c53d760
core/toplevel/numpy: Split ndarray type var utilities
2024-04-03 00:07:33 +08:00
2c4bf3ce59
core: Allow unsized CodeGenerator to be passed to some codegen functions
...
Enables codegen_callback to call these codegen functions as well.
2024-03-22 15:07:28 +08:00
1b77e62901
core: Split numpy into codegen and toplevel
2024-03-22 15:07:28 +08:00
234a6bde2a
core: Use TObj for NDArray
2024-03-01 15:41:55 +08:00
82fdb02d13
core: Extract LLVM intrinsic functions to their functions
2024-02-23 15:41:06 +08:00
49de81ef1e
core: Apply clippy suggestions
2024-02-23 15:41:06 +08:00
8492503af2
core: Update cargo dependencies
2024-02-23 15:41:04 +08:00
8470915809
core: Add NDArrayValue and helper functions
2024-01-25 15:51:39 +08:00
5ee08b585f
core: Add ListValue and helper functions
2024-01-25 15:51:39 +08:00
140f8f8a08
core: Implement most ndarray-creation functions
2023-12-22 16:29:55 +08:00
c395472094
core: Initial infrastructure for ndarray
2023-12-21 15:39:46 +08:00
bd792904f9
core: Add size_t to primitive store
...
Used for ndims in ndarray.
2023-12-21 15:20:31 +08:00
5f692debd8
core: Add PrimitiveStore into Unifier
...
This will be used during unification between a const generic variable
and a `Literal`.
2023-12-16 18:40:48 +08:00
a19f1065e3
meta: Refactor to use more let-else bindings
2023-12-12 16:31:14 +08:00
02933753ca
core: Apply clippy pedantic changes
2023-12-11 15:16:23 +08:00
a1f244834f
meta: Bringup some documentation
2023-12-11 15:16:23 +08:00
d304afd333
meta: Apply clippy suggested changes
2023-12-11 15:16:23 +08:00
5182453bd9
meta: Remove redundant path prefixes
2023-12-11 15:16:23 +08:00
0a84f7ac31
Add CodeGenerator::gen_block and refactor to use it
2023-11-04 13:42:44 +08:00
50230e61f3
core: Simplify loop condition check for list comprehension
2023-10-06 12:24:03 +08:00
a2fce49b26
core: Allocate exceptions at the beginning of function
...
Only one instance of exception is necessary, as exceptions will always
be initialized before being thrown.
2023-10-06 12:13:20 +08:00
1a54aaa1c0
core: Restore debug location when generating allocas
...
Debug location is lost when moving the builder cursor.
2023-10-06 11:11:50 +08:00
2a775d822e
core: Demote dead code into a stdout warning
2023-10-04 18:03:25 +08:00
2a38d5160e
meta: Respect opt flags when performing whole-module optimization
2023-09-28 19:58:54 +08:00
acdb1de6fe
meta: Improve documentation for various modified classes
2023-09-25 15:42:07 +08:00
31dcd2dde9
core: Use i8 for boolean variable allocation
...
In LLVM, i1 represents a 1-byte integer with a single valid bit; The
rest of the 7 upper bits are undefined. This causes problems when
using these variables in memory operations (e.g. memcpy/memmove as
needed by List slicing and assignment).
We fix this by treating all local boolean variables as i8 so that they
are well-defined for memory operations. Function ABIs will continue to
use i1, as memory operations cannot be directly performed on function
arguments or return types, instead they are always converted back into
local boolean variables (which are i8s anyways).
Fixes #315 .
2023-09-25 15:42:07 +08:00
fc93fc2f0e
core: Move bitcode verification error message into panic message
2023-09-22 17:16:29 +08:00
ab2360d7a0
core: Remove emit_llvm from CodeGenLLVMOptions
...
We instead output an LLVM bitcode file when the option is specified on
the command-line.
2023-09-22 17:16:29 +08:00
048fcb0a69
core: Switch to LLVM New Pass Manager
2023-09-18 11:35:15 +08:00
676d07657a
core: Add target field to CodeGenLLVMOptions
...
For specifying the target machine options when optimizing and linking.
This field is currently unused but will be required in a future
commit.
2023-09-18 09:46:24 +08:00
2482a1ef9b
core: Add CodeGenTargetMachineOptions
...
Needed in a future commit.
2023-09-18 09:41:49 +08:00
3993a5cf3f
core: Add LLVM options to WorkerRegistry
2023-09-12 10:57:05 +08:00
39724de598
core: Add CodeGenLLVMOptions
...
For specifying LLVM options during code generation.
2023-09-12 10:57:04 +08:00
e0de82993f
core: Preserve value of variable shadowed by for loop
...
Previously, the final value of the target expression would be one after
the last element of the loop, which does not match Python's behavior.
This commit fixes this problem while also preserving the last assigned
value of the loop beyond the loop, matching Python's behavior.
2023-09-06 20:09:36 +08:00
aead36f0fd
update dependencies
2023-03-08 15:19:09 +08:00
c1c45373a6
update dependencies
2023-01-12 19:31:03 +08:00
96b3a3bf5c
work around random segmentation fault ( #275 )
...
Reviewed-on: M-Labs/nac3#302
Co-authored-by: z78078 <cc@m-labs.hk>
Co-committed-by: z78078 <cc@m-labs.hk>
2022-07-04 18:06:36 +08:00