[cfe-dev] disabling loop idiom recognizer in clang

Andrew Fish afish at apple.com
Thu Apr 28 15:40:35 PDT 2011


On Apr 28, 2011, at 3:17 PM, Damjan Marion wrote:

> 
> On Apr 29, 2011, at 12:15 AM, Chris Lattner wrote:
> 
>> 
>> On Apr 28, 2011, at 3:09 PM, Damjan Marion wrote:
>> 
>>> 
>>> Hi,
>>> 
>>> is there a way to disable loop idiom recognizer in clang?
>>> 
>>> I have a problem with compiling early stage code for ARM architecture which should not be linked to external libraries but clang replaces loop with memset call in the code.

If it is just the loop you care about make the pointer volatile. 

>> 
>> Yep, build with -fno-builtin or -ffreestanding.
> 
> It doesn't work. According to gcc docs (which clang probably follows): 
> "GCC requires the freestanding environment provide memcpy, memmove, memset and memcmp."


It works great, you just need your own copies of the functions.  That is what we did for ARM EFI firmware, for gcc, clang, and RVCT.  https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/ArmPkg/Library/CompilerIntrinsicsLib/Arm/. Sorry no makefiles as they get auto-generated from ../ CompilerIntrinsicsLib.inf. No floating point, but no external libraries means well no external libraries! 

Thanks,

Andrew





More information about the cfe-dev mailing list