[cfe-dev] Strange character around function declared with "asm"

Lorenzo De Carli lorenzo at cs.wisc.edu
Fri Dec 3 07:40:27 PST 2010


Thanks everyone. I guess the question then becomes how can I instruct
CLANG to emit calls to user-defined intrinsics when it generates LLVM
bytecode.

Does anyone have a suggestion? Or if someone can point me to the code
that generates the asm code, I can do some dirty hack (without
submitting it!) to manage the situation where the symbol start with
"llvm.". As it was said, it is probably not a good idea in general,
but it would be good enough for my purpose :-)

Thanks,
Lorenzo


On Fri, Dec 3, 2010 at 1:11 AM, Eric Christopher <echristo at apple.com> wrote:
>
> On Dec 2, 2010, at 11:10 PM, Chris Lattner wrote:
>
>>
>> On Dec 2, 2010, at 11:07 PM, Eric Christopher wrote:
>>
>>>
>>> On Dec 2, 2010, at 11:06 PM, Chris Lattner wrote:
>>>
>>>>>>>>> Apparently clang is mangling it this way on purpose as far as I can
>>>>>>>>> tell... I'm not really sure why though.
>>>>>>>>
>>>>>>>> The gnu "asm renaming" extension says that USER_LABEL_PREFIX is not prefixed onto the symbol name.  The \1 prefix on the LLVM name tells the backend (through the 'Mangler' class) not to add it.
>>>>>>>
>>>>>>> Interesting. llvm-gcc bug then?
>>>>>>
>>>>>> What's the bug?
>>>>>
>>>>> There's no \01 prefix in the llvm-gcc version of the module.
>>>>
>>>> On linux or darwin?  IIRC, on linux there is no USER_LABEL_PREFIX so it doesn't matter if there is a \1 or not.
>>>
>>> darwin.
>>>
>>> Just checked out of curiosity :)
>>
>> Ah, I didn't notice that the name was "llvm.foo".  It is entirely possible that llvm-gcc has a special hack for symbols that start with "llvm.", but I don't see it with a quick look.  This is dangerous though, because the intrinsics change over time, and not getting the right argument types would cause the middle-end to blow up.
>
> OK. If you file it I'll fix it :)
>
> -eric




More information about the cfe-dev mailing list