[LLVMdev] LLVM on small MCUs?

Alireza.Moshtaghi at microchip.com Alireza.Moshtaghi at microchip.com
Tue May 20 10:00:15 PDT 2008


>Wow, PIC looks like a brutal port.
It is brutal...

>sizeof(short)=2
>sizeof(int)=2
>sizeof(long)=4
>sizeof(long long)=8
>sizeof(int *)=2
>sizeof(enum)=2
>alignof(anything)=1

We have the same size and alignment exept for long long which is not
supported.

>For any architecture where sizeof(int) > sizeof(register) it is
desirable 
>avoid whenever possible being forced to perform int-sized computations,

>which tend to be extremely inefficient, by C's promote to integer 
>tendencies.  I think this is what is being discussed in "challenge #1"
in 
>the mail to llvm-commits above.  This optimization is crucial for MCU 
>compilers.

The problem of integer promotions manifest differently. "challenge #1"
refers to the problem and solution that we chose regarding legalizing
feature of LLVM where you can define for it the granularity of your
operations. For example in an 8-bit MCU, all arithmetic must be 8-bit.
So if you add two 32-bit values, you have add:i32 and the compiler must
lower them to four add:i8.

Cheers.
Ali

_______________________________________________
LLVM Developers mailing list
LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list