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
a18d095245
nac3core: codegen fix call parameter type error
2022-07-04 14:39:33 +08:00
c4ab2855e5
nac3core: pretty print codegen panic error
2022-05-30 04:09:21 +08:00
325ba0a408
nac3core: add debug info
2022-05-11 03:53:53 +08:00
7443c5ea0f
nac3core: add location information to codegen context
2022-04-05 18:21:46 +08:00
bf067e2481
nac3artiq: implement attribute writeback
...
We will only writeback attributes that are supported by the current RPC
implementation: primitives, tuple and lists of lists... of primitives.
2022-03-26 20:13:58 +08:00
80631fc92b
Option type support ( #224 )
...
Co-authored-by: ychenfo <yc@m-labs.hk>
Co-committed-by: ychenfo <yc@m-labs.hk>
2022-03-26 15:09:15 +08:00
41d62f7325
nac3core/toplevel: fixed typevar substitution bug
2022-03-23 00:25:10 +08:00
2f85bb3837
nac3core: impl call attributes
...
sret for returning large structs, and byval for struct args in extern
function calls.
2022-03-09 22:09:36 +08:00
79c469301a
basic unsigned integer support
2022-03-08 13:34:02 +08:00
323d77a455
nac3artiq: improve error message for out of range error
2022-02-28 23:09:14 +08:00
e710b6c320
nac3core: fix exception final branch handling
...
According to https://github.com/m-labs/artiq/pull/1855
Passed the test cases from 1855.
Fixes #196 .
2022-02-25 17:42:47 +08:00
3ad25c8f07
nac3core: sort error messages for determinism
2022-02-22 14:33:43 +08:00
f97f93d92c
applied rustfmt and clippy auto fix
2022-02-21 18:27:46 +08:00
d9cb506f6a
nac3core: refactored for better error messages
2022-02-21 18:24:19 +08:00