[cfe-dev] disabling loop idiom recognizer in clang
Damjan Marion
damjan.marion at gmail.com
Thu Apr 28 15:38:07 PDT 2011
On Apr 29, 2011, at 12:24 AM, Chris Lattner 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.
>>>
>>> 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."
>
> Did you try it? I'm aware of the requirements for a freestanding implementation.
Yes, I tried both. Here is output:
# bin/clang -mcpu=arm926ej-s -Wa,-mcpu=arm926ej-s -ccc-host-triple arm-unknown-freebsd -mfloat-abi=soft -O2 -DKZIP -I. -I/Volumes/data/src/freebsd/sys -ffreestanding -fno-builtin -c /Volumes/data/src/freebsd/sys/kern/inflate.c -o inflate-tramp.o -g
# arm-none-eabi-objdump -S inflate-tramp.o | grep -B 5 -A 2 memset
b58: 85900400 ldrhi r0, [r0, #1024] ; 0x400
b5c: e58d104c str r1, [sp, #76] ; 0x4c
b60: e3a01000 mov r1, #0
b64: 858d0030 strhi r0, [sp, #48] ; 0x30
b68: e24b0064 sub r0, fp, #100 ; 0x64
b6c: ebfffffe bl 0 <memset>
for (i = 0; i < BMAX+1; i++) c [i] = 0;
More information about the cfe-dev
mailing list