adadf56e2b
nac3standalone: generate PIC
2023-12-04 19:09:50 +08:00
98199768e3
demo: fix 64-bit format strings
2023-12-04 18:51:06 +08:00
120f8da5c7
fix compilation warnings
2023-11-26 09:09:24 +08:00
5c5620692f
core: Add np_{round,floor,ceil}
...
These functions are NumPy variants of round/floor/ceil, which returns
floats instead of ints.
2023-11-23 13:45:07 +08:00
0af1e37e99
core: Prefix all NumPy/SciPy functions with np_/sp_spec
2023-11-23 13:35:23 +08:00
d322c91697
core: Change bitshift operators to accept int32/uint32 for RHS operand
2023-11-09 12:16:20 +08:00
fd787ca3f5
core: Remove trunc
...
The behavior of trunc is already implemented by casts and is therefore
redundant.
2023-11-04 13:35:53 +08:00
4dbe07a0c0
core: Revert breaking changes to round-family functions
...
These functions should return ints as the math.* functions do instead of
following the convention of numpy.* functions.
2023-11-04 13:35:53 +08:00
9d737743c1
standalone: Add regression test for numeric primitive operations
2023-11-03 16:24:26 +08:00
447eb9c387
standalone: Fix output format string for output_uint*
2023-11-03 16:24:26 +08:00
7e4dab15ae
standalone: Add math tests for non-number arguments
2023-11-01 18:03:29 +08:00
2b635a0b97
core: Implement numpy and scipy functions
2023-11-01 18:03:29 +08:00
60ad100fbb
core: Implement and expose {isinf,isnan}
2023-11-01 18:03:29 +08:00
630897b779
standalone: Do not output sign if float is NaN
...
Matches behavior in Python.
2023-11-01 18:03:29 +08:00
e95586f61e
core: Fix IR generation of for
loop containing break/continue
...
Fix cases where the body BB would have two terminators because of a
preceding continue/break statement already emitting a terminator.
2023-11-01 13:21:27 +08:00
bb27e3d400
standalone: Fix indentation of demo.c
2023-11-01 13:20:26 +08:00
bb5147521f
standalone: Fix indentation of test files
2023-11-01 13:20:26 +08:00
7fc2a30c14
Force single-threaded compilation if LLVM is not thread-safe
2023-10-16 15:55:10 +08:00
950f431483
standalone: Update help text for --emit-llvm
2023-10-16 15:52:51 +08:00
a50c690428
standalone: Fix run_demo script
...
- Link main and module*.bc together if using multiple threads
- Fix temporary files not being deleted
2023-10-16 15:52:48 +08:00
48eb64403f
standalone: Treat -T0 as using all available threads
2023-10-13 14:57:16 +08:00
2c44b58bb8
standalone: Require use of -T
for specifying thread count
2023-10-13 14:36:34 +08:00
c7de22287e
core: Fix restoration of stack address
...
All allocas for temporary objects are now placed in the beginning of the
function. Allocas for on-temporary objects are not modified because
these variables may appear in a loop and thus must be uniquely
represented.
2023-10-06 11:34:23 +08:00
c5629d4eb5
standalone: Remove redundant const in demo library
2023-10-06 10:32:58 +08:00
a79286113e
standalone: Add output_bool in demo library
2023-10-06 10:19:22 +08:00
f34c6053d6
standalone: Add flags to control demo output options
2023-10-04 18:11:44 +08:00
e8a5f0dfef
standalone: Fix parsing NAC3 args in check_demo.sh
2023-10-04 18:03:28 +08:00
7140901261
standalone: Fix missing libraries when linking
...
Fixes `undefined reference to 'pow'` for pow.py using -O0.
2023-10-04 18:03:28 +08:00
2a775d822e
core: Demote dead code into a stdout warning
2023-10-04 18:03:25 +08:00
1659c3e724
standalone: Remove temporary logfiles after execution
2023-09-30 09:31:18 +08:00
f53cb804ec
standalone: Add execution of test cases via lli
2023-09-30 09:31:18 +08:00
279376a373
standalone: Emit IRRT IR
2023-09-30 09:31:18 +08:00
b6afd1bfda
standalone: Split check_demos into check_demo
...
Allows individual tests to be executed.
2023-09-30 09:31:18 +08:00
be3e8f50a2
standalone: Refactor demo library to C
...
Needed for use by lli.
2023-09-30 09:31:18 +08:00
059d3da58b
standalone: Add float64 output tests
2023-09-30 09:31:18 +08:00
48c6498d1f
core: Fix restoration of loop target in try statement
...
old_loop_target is only assigned if ctx.loop_target is overwritten,
meaning that if ctx.loop_target is never overwritten, ctx.loop_target
will always be overwritten to None.
We fix this by only restoring from old_loop_target if we previously
assigned to old_loop_target.
2023-09-28 20:00:02 +08:00
2a38d5160e
meta: Respect opt flags when performing whole-module optimization
2023-09-28 19:58:54 +08:00
b39831b388
standalone: Update demos
...
- Add `output_str` for printing a string
- Add demo_test.py to test interop
2023-09-28 19:58:53 +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
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
769fd01df8
meta: Allow specifying compiler arguments for check_demos
2023-09-18 11:35:20 +08:00
f59d45805f
standalone: Add command line flags for target properties
...
For testing codegen for different platforms on the host system.
2023-09-18 11:35:20 +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
eb63f2ad48
meta: Update to Rust Edition 2021
2023-09-15 10:25:50 +08:00
008d50995c
meta: Update run_demo.sh
...
- Allow more than one argument to nac3standalone executable
2023-09-12 16:20:50 +08:00
474f9050ce
standalone: Expose flags in command-line
2023-09-12 16:20:49 +08:00
3993a5cf3f
core: Add LLVM options to WorkerRegistry
2023-09-12 10:57:05 +08:00
e4940247f3
standalone: Implement command-line parser using clap
...
In preparation for adding more command-line options.
2023-09-12 10:08:34 +08:00
4481d48709
core: Use C-style for loop logic for iterables
...
Index increment is now performed at the end of the loop body.
2023-09-06 20:09:38 +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
17b4686260
standalone: Adapt loop example to output loop variable
2023-09-06 18:56:45 +08:00
d37287a33d
Cargo: Update dependencies
2023-09-04 10:43:57 +08:00
aead36f0fd
update dependencies
2023-03-08 15:19:09 +08:00
f66ca02b2d
update Rust dependencies
2022-08-05 16:58:57 +08:00
ebd25af38b
nac3standalone: allow classes without explicit init ( #221 )
...
Reviewed-on: M-Labs/nac3#304
Co-authored-by: z78078 <cc@m-labs.hk>
Co-committed-by: z78078 <cc@m-labs.hk>
2022-07-07 10:36:25 +08:00
8addf2b55e
nac3standalone: add more tests
2022-06-01 17:58:16 +08:00
3f327113b2
update dependencies, use upstream inkwell
2022-04-27 15:41:46 +08:00
85f21060e4
update to LLVM 14
2022-04-18 18:47:20 +08:00
a308d24caa
nac3standalone: cleanup
2022-04-18 16:02:48 +08:00
1eac111d4c
cleanup
2022-04-18 15:55:37 +08:00
44199781dc
nac3standalone: add tests for operators
2022-04-18 15:31:56 +08:00
86ce513cb5
nac3standalone: fix broken test
...
previously this test unexpectedly passed because it is a slice assignment to extend the list, which is valid in CPython and hence in interpret_demo, and which also happened to give the same output in nac3 by memmove the elements in the list of bool
2022-04-05 18:21:46 +08:00
23b7f4ef18
nac3standalone: add tests for power
2022-04-04 22:10:56 +08:00
b8ef44d64e
nac3standalone: add test for default param
2022-03-30 04:05:47 +08:00
bed33a7421
nac3standalone: add tests for tuple
2022-03-27 10:31:20 +08:00
e4581a6d9b
nac3standalone/demo: fix return type in loop.py
2022-03-26 21:10:12 +08:00
1a82d296e7
nac3core/codegen: prevent users from modifying loop counter
...
Fixes #211
2022-03-26 20:58:37 +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
3f890f183c
nac3standalone/demo: handle imports consistently
2022-03-19 09:14:27 +08:00
234823c51a
nac3standalone: added typevar test
2022-03-18 16:52:52 +08:00
0ca2797428
fix compilation warning
2022-03-17 21:31:45 +08:00
60b3807ab3
nac3standalone: add test for abs function
2022-03-08 23:26:01 +08:00
1cc276cb43
nac3standalone: add test for max function
2022-03-08 22:23:13 +08:00
e9a17cf8f8
nac3standalone: add test for min function
2022-03-08 21:59:42 +08:00
63b0f29728
Fix broken tests
2022-03-05 00:27:51 +08:00
aa79c8d8b7
rename exception symbols in host code
2022-02-23 11:43:41 +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
352831b2ca
nac3core: removed legacy location definition
2022-02-13 22:39:24 +08:00
91f41052fe
test: remove outdated comment
2022-02-13 17:24:47 +08:00
14d25b3b9d
Fixed broken tests
2022-02-13 17:21:42 +08:00
4b8e70f746
nac3standalone: disable broken tests ( #188 )
2022-02-13 11:41:42 +08:00
31e76ca3b6
nac3standalone: add dummy support for artiq_personality
...
So existing tests can run again
2022-02-13 11:35:02 +08:00
b18626b149
Fix compilation and test failures
2022-02-12 22:50:32 +08:00
43048eb8d8
nac3standalone: add tests for list slice and len
2022-01-26 03:58:27 +08:00
ced7acd871
check_demos: improve output
2022-01-24 11:38:43 +08:00
f8e3f7a4ca
add some basic list tests
2022-01-23 14:28:08 +08:00
ba997ae094
flake: run nac3standalone demo checks
...
also keep auxiliary projects in separate Nix outputs
2022-01-23 11:32:34 +08:00
2a0caf931f
nac3standalone: work around bash mess with exit codes of substituted processes
...
https://unix.stackexchange.com/questions/376114/how-to-detect-an-error-using-process-substitution
2022-01-23 11:15:11 +08:00
64b94955fe
nac3standalone: reorganize demos, compare against cpython
2022-01-23 10:35:06 +08:00
4a1a4dc076
nac3core/artiq/standalone: symbol resolver return error msg for type error of host variables
2022-01-14 16:28:34 +08:00
096193f7ab
demo: rewrite in Rust
2022-01-09 10:51:10 +08:00
4760851638
nac3standalone: link modules and load irrt like in nac3artiq
2022-01-09 02:17:58 +08:00
b638d1b4b0
nac3standalone: set up LLVM inliner like in nac3artiq
2022-01-08 21:03:58 +08:00
9cc9a0284a
nac3standalone: style
2021-12-28 10:59:17 +08:00
88f0da7bdd
add file name to AST node location
2021-12-28 01:28:55 +08:00
fa04768a77
redo "nac3core: fix #84 "
...
This reverts commit 86005da8e1
.
2021-12-27 22:56:26 +08:00
86005da8e1
Revert "nac3core: fix #84 "
...
This reverts commit 0902d8adf4
.
2021-12-26 08:35:27 +08:00
d2a5cd6d57
update to LLVM 13
2021-12-25 22:49:47 +08:00
9e3f75255e
update inkwell. Closes #67
2021-12-25 22:17:06 +08:00
0902d8adf4
nac3core: fix #84
2021-12-23 15:26:48 +08:00
2008db8097
nac3standalone: remove unused import
2021-12-20 17:39:16 +08:00
91625dd327
update kernel-only attribute annotation
...
Reviewed-on: M-Labs/nac3#127
Co-authored-by: ychenfo <yc@m-labs.hk>
Co-committed-by: ychenfo <yc@m-labs.hk>
2021-12-19 11:04:53 +08:00
69b9ac5152
nac3standalone: consistent naming
2021-12-13 11:19:11 +08:00
ccfcba4066
nac3standalone: add output_long
2021-12-13 10:44:33 +08:00
3f73896477
remove a small amount of LLVM bloat
...
Also avoids libffi.dll dependency on Windows.
2021-12-08 17:41:34 +08:00
4526c28edb
Merge branch 'windows'
2021-12-02 22:26:55 +08:00
25fc9db66d
cargo: specify inkwell LLVM target explicitly
...
Windows LLVM linking otherwise breaks on the non-existing targets.
2021-12-02 22:24:33 +08:00
dfd3548ed2
TypeVar and virtual support in Symbol Resolver ( #99 )
...
Add `TypeVar` and `virtual` support for Symbol Resolver in nac3artiq and nac3standalone
Reviewed-on: M-Labs/nac3#99
Co-authored-by: ychenfo <yc@m-labs.hk>
Co-committed-by: ychenfo <yc@m-labs.hk>
2021-12-01 22:44:53 +08:00
4b17511b4a
Merge branch 'master' into KernelInvariant
2021-11-27 21:29:27 +08:00
4587088835
Constant Default Parameter Support ( #98 )
...
Add support for constant default parameter
Reviewed-on: M-Labs/nac3#98
Co-authored-by: ychenfo <yc@m-labs.hk>
Co-committed-by: ychenfo <yc@m-labs.hk>
2021-11-23 07:32:09 +08:00
c6f75c8bde
nac3standalone: fix error message when no entry point is found
2021-11-22 14:52:52 +08:00
aae9925014
nac3standalone: report when entry point run function cannot be found
2021-11-21 06:11:55 +08:00
ba08deada6
nac3core: refactor codegen
2021-11-20 19:50:25 +08:00
dba1a8b3d4
nac3standalone: link libm in demo runner
2021-11-11 19:44:18 +08:00
bf7e2c295a
integrate nac3parser
2021-11-03 17:11:00 +08:00
624dfe8cd1
upgrade to LLVM 12
2021-11-02 14:00:20 +08:00
279f47f633
nac3core/codegen: avoid sending unifiers
...
Previously, we have to copy types from one unification table to another,
and make the table sendable. This requires cloning (processing) the
whole table 3 times per function call which is not efficient and uses
more memory than required when the unification table is large.
We now use a concrete type table to only copy the type we need. This
reduces the overhead as we only need to process the unification table
for once (when we do the function codegen), and reduces memory usage by
a bit (but not noticeable when the unification table is small, i.e. the
types are simple).
2021-10-17 13:02:18 +08:00
1f5bea2448
nac3core/codegen: refactor according to #23
2021-10-16 22:17:36 +08:00
c4259d14d1
fixed some clippy warnings
2021-10-16 18:08:13 +08:00
11144301ca
nac3artiq: added simple host value support
2021-10-06 16:07:42 +08:00
0cbe4778d2
nac3standalone: demonstrate scalar conversion functions in mandelbrot
2021-10-02 19:21:59 +08:00
ba93931758
implement timeline functions for RISC-V (WIP)
2021-10-02 19:05:35 +08:00
f0fdfe42cb
nac3core: better impl of #24
2021-09-30 17:07:48 +08:00
d4ed76d76e
nac3core: implementing #24
2021-09-26 22:17:09 +08:00
c4fbfeaca9
nac3standalone: added thread number arg
2021-09-23 20:02:56 +08:00
105d605e6d
nac3core: fix clippy warnings
2021-09-22 18:04:06 +08:00
084efe92af
nac3core: use string interning
2021-09-22 18:04:06 +08:00
db14b4b635
demo: remove old obj files
2021-09-22 15:02:05 +08:00
8acb39f31f
fix parallel compilation
2021-09-22 15:00:32 +08:00
d561450bf5
demo: fix classes example
2021-09-22 14:57:24 +08:00
956cca6ac8
cleanup demos
2021-09-22 14:57:13 +08:00
4a5f2d495e
added time measurement to track performance
2021-09-22 14:45:56 +08:00
e66693282c
nac3core: change the place to unify constructor type for function body type check
...
add really basic field initialize check
2021-09-20 23:44:39 +08:00
4939ff4dbd
simple implementation of classes
2021-09-19 22:54:06 +08:00
bf1769cef6
nac3standalone: more tests
2021-09-19 17:50:01 +08:00
2b74895b71
nac3standalone, nac3core: can use top level composer to compile and run mandelbrot
2021-09-19 16:19:49 +08:00
2ac3f9a176
nac3core: separate top level compoer to a new file
2021-09-12 05:10:10 +08:00
03b5e51822
nac3standalone: cleanup
2021-09-10 21:27:08 +08:00
87f25e1c5d
nac3core: remove mutex on dyn symbol resolve
2021-09-08 19:27:32 +08:00
54b4572c5f
nac3core: allow interior mutability to dyn symbolresolver, add add_id_def to symbolresolver trait, remove primitive from top level def list
2021-09-06 19:23:04 +08:00
2223c86d9b
nac3standalone: compile multiple functions
2021-08-27 16:25:59 +08:00
d81249cabe
nac3standalone: enabled optimization and recorded time
2021-08-27 12:35:21 +08:00
52dd792b3e
nac3standalone: added return check
2021-08-27 11:39:36 +08:00
a24e204824
type_inferencer: check defined identifiers during inference
2021-08-27 11:13:43 +08:00
862d205f67
remove self kind and extra primitive info in the return of top level composer constructor, adding some helper function for type annotation
2021-08-25 17:47:26 +08:00
0608fd9659
fixed test and nac3standalone
2021-08-25 15:30:36 +08:00
93270d7227
use forked version of rustpython
...
to implement Clone for AST nodes
2021-08-25 15:28:32 +08:00