[cfe-dev] disabling loop idiom recognizer in clang
jahanian
fjahanian at apple.com
Thu Apr 28 15:59:47 PDT 2011
On Apr 28, 2011, at 3:49 PM, Damjan Marion wrote:
>
> On Apr 29, 2011, at 12:40 AM, Andrew Fish wrote:
>
>> 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!
>
> In my case writing my own functions is slightly overkill for just avoiding clang to convert "for (i = 0; i <17; i++) c [i] = 0;" to memset. Must be a way to tell him not to mess with my loop :)
Can you write it in a way that memset conversion logic does not recognize it; such as i =0; for (; i <17; i++) c [i] = 0;
- fariborz
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
More information about the cfe-dev
mailing list