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/
Yes, I am working on an 8-bit target and I am only interested in C. We have made some progress in adapting llvm to lower and generate the target instructions from the current llvm-gcc output, however, we would like to have 16-bit int type for this target, and currently, llvm-gcc assumes 32-bit int, and of course, 32-bit integer promotions. I know some other ports of gcc have 16-bit int type, so I am looking for a way to configure (or if needed to modify) the front-end to generate 16-bit int type and only promote the integer calculation to 16-bit. Ideally I would like to disable the integer promotions in the front-end (going out of the standard for performance purposes) and take care of them in my backend as needed. Thanks, A. -----Original Message----- From: Chris Lattner [mailto:sabre at nondot.org] Sent: Wednesday, March 19, 2008 2:15 PM To: LLVM Developers Mailing List Cc: Alireza Moshtaghi - C13012 Subject: Re: [LLVMdev] 16 bit integers 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/
I was able to build and play with clang today. Clang also promotes integer arithmetic to 32-bit. Any pointers on how to tweak it so that it generate i16 for "int" and also promote int operations to 16-bit operations only? Thanks, Sanjiv 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 >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20080325/3c2646a5/attachment.html>
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/