[LLVMdev] 16 bit integers

Chris Lattner sabre at nondot.org
Tue Mar 25 12:12:54 PDT 2008


On Tue, 25 Mar 2008, Sanjiv Gupta wrote:
> I was able to build and play with clang today.
> Clang also promotes integer arithmetic to 32-bit.

Right, C requires promotion to int.

> Any pointers on how to tweak it so that it generate i16 for "int" and also
> promote int operations to 16-bit operations only?

The way to fix this is to shrink int to 16 bits.  This can be done by 
changing TargetInfo.h (in the clang include/clang/Basic directory) to:

   unsigned getIntWidth() const { return 16; }
   unsigned getIntAlign() const { return 16; }

-Chris

>
> On 3/20/08, Chris Lattner <sabre at nondot.org> wrote:
>>
>> On Wed, 19 Mar 2008, Duncan Sands wrote:
>>>> How can I build the front-end to generate 16-bit integers?
>>>
>>> Please clarify your question.
>>> If you are asking how to build llvm-gcc for a 16 bit target,
>>> I think the answer is: (1) gcc itself doesn't support 16 bit
>>> targets; (2) llvm doesn't currently support any 16 bit targets
>>> (but could with a little work).  So you are out of luck unless
>>> you are willing to work on it.
>>
>> Note that if you only care about C/ObjC (not C++, fortran, ada, etc) that
>> clang may be a good option for you.
>>
>> -Chris
>>
>> --
>> http://nondot.org/sabre/
>> http://llvm.org/
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>
>

-Chris

-- 
http://nondot.org/sabre/
http://llvm.org/



More information about the llvm-dev mailing list