Add lli support for running example test cases #327

Merged
sb10q merged 7 commits from lli-support into master 2023-09-30 09:31:18 +08:00
Collaborator
No description provided.
derppening self-assigned this 2023-09-29 15:22:21 +08:00
derppening added 4 commits 2023-09-29 15:22:22 +08:00
derppening requested review from sb10q 2023-09-29 15:22:27 +08:00
sb10q reviewed 2023-09-29 15:28:05 +08:00
@ -7,4 +7,0 @@
echo -n "checking $demo... "
./interpret_demo.py $demo > interpreted.log
./run_demo.sh "$@" $demo > run.log
diff -Nau interpreted.log run.log
Owner

Just add a run_demo_lli.sh > run_lli.log and keep this structure, which avoids invoking the interpreter multiple times and overwriting files.

Just add a `run_demo_lli.sh > run_lli.log` and keep this structure, which avoids invoking the interpreter multiple times and overwriting files.
derppening marked this conversation as resolved
sb10q reviewed 2023-09-29 15:29:58 +08:00
@ -0,0 +18,4 @@
$nac3standalone --emit-llvm "$@"
clang -S -std=gnu11 -Wall -Wextra -O3 -emit-llvm -o demo.bc demo.c
clang -S -std=gnu11 -Wall -Wextra -O3 -emit-llvm -o irrt.bc ../../nac3core/src/codegen/irrt/irrt.c
Owner

I don't think you need to add IRRT here. The output of the compiler (nac3core) is already supposed to inline IRRT.

I don't think you need to add IRRT here. The output of the compiler (nac3core) is already supposed to inline IRRT.
Author
Collaborator

This is necessary, as the nac3standalone program will only generate LLVM bitcode for the module-under-compilation (rather than including the dependencies).

This is necessary, as the `nac3standalone` program will only generate LLVM bitcode for the module-under-compilation (rather than including the dependencies).
Owner

I would change it so it also emits the already compiled and integrated IRRT then, instead of compiling it redundantly (and with the wrong compiler).

I would change it so it also emits the already compiled and integrated IRRT then, instead of compiling it redundantly (and with the wrong compiler).
derppening force-pushed lli-support from ef8985d7e9 to 9e17fac1d0 2023-09-29 16:04:02 +08:00 Compare
Author
Collaborator

v2: Merged check_demo_lli with check_demo.

v2: Merged `check_demo_lli` with `check_demo`.
derppening force-pushed lli-support from 9e17fac1d0 to 1fa92bb037 2023-09-29 16:43:53 +08:00 Compare
Author
Collaborator

v3: Merged IRRT bitcode into main.bc, clean up temporary files after execution.

v3: Merged IRRT bitcode into `main.bc`, clean up temporary files after execution.
sb10q reviewed 2023-09-29 22:45:46 +08:00
@ -15,3 +15,3 @@
fi
rm -f *.o
rm -f "*.o" demo
Owner

Why? The next commands will overwrite them.

Why? The next commands will overwrite them.
Author
Collaborator

I just found it to be intuitive that if you are removing the object files, then the output executable should also be removed.

I just found it to be intuitive that if you are removing the object files, then the output executable should also be removed.
sb10q marked this conversation as resolved
sb10q reviewed 2023-09-29 22:47:05 +08:00
@ -341,1 +341,4 @@
.unwrap();
// Emit bitcode with main and IRRT dependencies first before linking in the other modules.
// This helps separate the input generated from the input and the IRRT utilities.
Owner

"the input generated from the input" ?

"the input generated from the input" ?
sb10q reviewed 2023-09-29 22:47:50 +08:00
@ -0,0 +18,4 @@
diff -Nau interpreted.log run_lli.log
echo "ok"
rm -f interpreted.log run.log run_lli.log
Owner

Just keep them, they can be used for debugging if the test failed.

Just keep them, they can be used for debugging if the test failed.
Author
Collaborator

If the test failed, the files won't be deleted anyways because the script will exit after running diff, so it doesn't matter.

If the test failed, the files won't be deleted anyways because the script will exit after running `diff`, so it doesn't matter.
sb10q marked this conversation as resolved
Owner

v3: Merged IRRT bitcode into main.bc,

Wasn't it already there, you just changed its location within main.bc?

> v3: Merged IRRT bitcode into main.bc, Wasn't it already there, you just changed its location within main.bc?
derppening force-pushed lli-support from 1fa92bb037 to cbdbe53db1 2023-09-30 08:45:01 +08:00 Compare
Author
Collaborator

v4: Output IRRT into irrt.bc, fix run_demo_lli emitting LLVM IR instead of bitcode.

v4: Output IRRT into `irrt.bc`, fix `run_demo_lli` emitting LLVM IR instead of bitcode.
sb10q merged commit 1659c3e724 into master 2023-09-30 09:31:18 +08:00
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: M-Labs/nac3#327
No description provided.