You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.
When I compile a program that includes a divide operation to bitcode (using patmos-clang -S) and then try to further compile it to assembly with patmos-llc, using the singlepath flag, it crashes.
Take this minimal code (we will refer to this as main.c):
We compile it to LLVM bitcode using the command patmos-clang -S main.c -O2 without issue.
We then try to compile it to assembly using the command patmos-llc main.s -mpatmos-singlepath=main -O2. This fails with the following error:
Note that we are using -O2, but all other optimization levels result in the same issue. The issue is only present with the divide operator, changing it to a multiply makes the code compile successfully.
Additionally, the issue is only present when first compiling to bitcode and then using patmos-llc on it. If we instead use the command patmos-clang main.c the code compiles successfully. So the issue is caused by patmos-llc having to read bitcode.
The text was updated successfully, but these errors were encountered:
Divide is different form mul, as there is no divide instruction available on Patmos and a library routine needs to be linked in. Maybe this is a linking issue?
I have investigated further, and divide only causes errors if its used in a function that is converted to singlepath. E.g. this code works fine with the command patmos-llc main.s -mpatmos-singlepath=init_func:
This is because singlepath cannot handle external functions like printf and, apparently, the divide function provided by llvm. I don't know if there are any plans to remedy this in the future, but I am not planning to solve this. I will try to see if a better error message can be thrown instead of the current one.
When I compile a program that includes a divide operation to bitcode (using
patmos-clang -S
) and then try to further compile it to assembly withpatmos-llc
, using the singlepath flag, it crashes.Take this minimal code (we will refer to this as
main.c
):We compile it to LLVM bitcode using the command
patmos-clang -S main.c -O2
without issue.We then try to compile it to assembly using the command
patmos-llc main.s -mpatmos-singlepath=main -O2
. This fails with the following error:Note that we are using
-O2
, but all other optimization levels result in the same issue. The issue is only present with the divide operator, changing it to a multiply makes the code compile successfully.Additionally, the issue is only present when first compiling to bitcode and then using
patmos-llc
on it. If we instead use the commandpatmos-clang main.c
the code compiles successfully. So the issue is caused bypatmos-llc
having to read bitcode.The text was updated successfully, but these errors were encountered: