[llvm-dev] Help with bitcast instruction

Alberto Barbaro via llvm-dev llvm-dev at lists.llvm.org
Sun Mar 10 00:56:15 PST 2019


Thanks I missed that

Alberto

On Sun, Mar 10, 2019, 08:36 Craig Topper <craig.topper at gmail.com> wrote:

> bitcast is an LLVM IR instruction. You can find its description here
> https://llvm.org/docs/LangRef.html#bitcast-to-instruction
>
> ~Craig
>
>
> On Sun, Mar 10, 2019 at 12:18 AM Alberto Barbaro via llvm-dev <
> llvm-dev at lists.llvm.org> wrote:
>
>> Hi,
>> I'm playing with the IR of pngpixel and I encountered this instruction:
>>
>> call void bitcast (void (%struct.png_struct_def.68*, i8*, i8*
>> (%struct.png_struct_def.68*, i64)*, void (%struct.png_struct_def.68*,
>> i8*)*)* @png_set_mem_fn to void (%struct.png_struct_def*, i8*, i8*
>> (%struct.png_struct_def*, i64)*, void (%struct.png_struct_def*,
>> i8*)*)*)(%struct.png_struct_def* %create_struct, i8* %mem_ptr, i8*
>> (%struct.png_struct_def*, i64)* %malloc_fn, void (%struct.png_struct_def*,
>> i8*)* %free_fn) #15
>>
>> I would like to understand where bitcast is defined because it is not
>> defined within libpng. I also noticed that the @ is not present, what does
>> the missing @ mean? I guess it must be an LLVM function.
>>
>> The bitcast operation seems to represent the following C code:
>>
>> if (png_ptr != NULL)
>>    {
>>       png_ptr->mem_ptr = mem_ptr;
>>       png_ptr->malloc_fn = malloc_fn;
>>       png_ptr->free_fn = free_fn;
>>    }
>>
>>
>> _______________________________________________
>> LLVM Developers mailing list
>> llvm-dev at lists.llvm.org
>> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190310/932e08ff/attachment.html>


More information about the llvm-dev mailing list