-
Notifications
You must be signed in to change notification settings - Fork 21
32 bit shift instructions are using missing libgcc symbols #163
Comments
Nonmenclature note: LLVM has a concept of legal and illegal types. Legal types are those that are properly supported by the architecture (as in, can be held in a single register), whereas illegal types are those that can not (i.e. It's a little bit sad that AVR does not have variable bit-shifts (the only shift instructions operate one bit at a time, so you must use Due to this, we tell LLVM to handle bit shifts manually here. As we do not handle 32-bit shifts manually, LLVM uses the default legalisation action - "expand". This will either expand it into two 16-bit shifts, or a call to a runtime library function which will do the shifts itself. LLVM chooses to expand into two 16-bit shifts if The problem is that LLVM assumes that the largest legal ("properly supported") type, is the type of the largest register. This presents a problem - it is an 8-bit microcontroller, but it has three (which only one can really be used) 16-bit registers, so This is currently a big problem we are facing - LLVM assuming that the largest register type is legal, even though it is only legal for a few operations. The underlying problem is that we have no control over how LLVM interprets the "expand" legalization action. It makes decisions based on the largest legal type, which for AVR, should really not be legal. It would be possible to add custom handling code for We have an entire file (~1400 lines of code) of expansion code for "fake" instructions we define in this file. This works around the fact that LLVM determines |
damn this problem sucks |
Is there any hope for splitting up the concept of "pointer size" and "legal size"? |
I started a big refactor of There is some hope, some time just needs to be invested. |
It looks like |
Interestingly, the |
LSHR and SHL with i32 operands are producing calls to libgcc symbols which don't exist. LSHR produces a call to
__lshrsi3
and SHL produces a call to__ashlsi3
.The following programs demonstrate the problem.
LSHR:
SHL:
The text was updated successfully, but these errors were encountered: