[LLVMdev] endian independence

Chris Lattner clattner at apple.com
Mon Oct 27 11:05:17 PDT 2008


On Oct 27, 2008, at 3:14 AM, Jay Foad wrote:

>>> I'm already working on this myself. Would you be interested in  
>>> having
>>> this work contributed back to LLVM?
>>
>> If this were to better support target independent languages, it would
>> be very useful.  If you're just trying to *reduce* the endianness
>> assumptions that leak through, I don't think it's a good approach.
>> There is just no way to solve this problem with C.
>
> Yes, I can see that the llvm part of this is more straightforward and
> less controversial than the llvm-gcc part. Maybe I should submit the
> llvm part (since it applies to all source languages) and keep the
> llvm-gcc part as a local hack.

Ok, if you want to address this in LLVM, the place to start is to make  
the optimizers completely targetdata-independent.  The best way to do  
this (IMO) is to change passes to use "getAnalysisToUpdate" instead of  
"getAnalysis/AddRequired" on TargetData.  Then, change opt to only add  
targetdata to the passmgr if a target data string exists in the module.

This would make the optimizers transparently take advantage of TD when  
available, but gracefully handle the cases when it isn't.

-Chris



More information about the llvm-dev mailing list