Add lli support for running example test cases #327
No reviewers
Labels
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: M-Labs/nac3#327
Loading…
Reference in New Issue
No description provided.
Delete Branch "lli-support"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@ -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
Just add a
run_demo_lli.sh > run_lli.log
and keep this structure, which avoids invoking the interpreter multiple times and overwriting files.@ -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
I don't think you need to add IRRT here. The output of the compiler (nac3core) is already supposed to inline IRRT.
This is necessary, as the
nac3standalone
program will only generate LLVM bitcode for the module-under-compilation (rather than including the dependencies).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).
ef8985d7e9
to9e17fac1d0
v2: Merged
check_demo_lli
withcheck_demo
.9e17fac1d0
to1fa92bb037
v3: Merged IRRT bitcode into
main.bc
, clean up temporary files after execution.@ -15,3 +15,3 @@
fi
rm -f *.o
rm -f "*.o" demo
Why? The next commands will overwrite them.
I just found it to be intuitive that if you are removing the object files, then the output executable should also be removed.
@ -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.
"the input generated from the input" ?
@ -0,0 +18,4 @@
diff -Nau interpreted.log run_lli.log
echo "ok"
rm -f interpreted.log run.log run_lli.log
Just keep them, they can be used for debugging if the test failed.
If the test failed, the files won't be deleted anyways because the script will exit after running
diff
, so it doesn't matter.Wasn't it already there, you just changed its location within main.bc?
1fa92bb037
tocbdbe53db1
v4: Output IRRT into
irrt.bc
, fixrun_demo_lli
emitting LLVM IR instead of bitcode.