[llvm-dev] [LLVM][RFC] Representing the target device information in the LLVM IR

Friedman, Eli via llvm-dev llvm-dev at lists.llvm.org
Wed Apr 25 16:14:02 PDT 2018


On 4/25/2018 3:48 PM, Lin, Jin wrote:
>
> Given a global variable @gg, the compiler has to generate code on the 
> host to specify whether it is passed by value or passed by reference. 
> In the following example, if the compiler generates the code for 
> passing by value, the outlined function on the target 
> i386-pc-linux-gnucannot get the correct value since it assumes the 
> variable @gg is passed by reference.
>
> Here is the corresponding IR on the host side.
>
>   %0 = load double, double* @gg, align 8, !tbaa !3
>
>   %1 = bitcast double %0 to i64
>
>    …
>
>   %12 = getelementptr inbounds [4 x i8*], [4 x i8*]* 
> %.offload_baseptrs, i32 0, i32 2
>
>   %13 = bitcast i8** %12 to i64*
>
>   store i64 %1, i64* %13, align 8
>

Could you describe the overall process of calling an offloaded function 
in a bit more detail?  How do you describe the ABI of the called 
function to the OpenMP runtime?

I suspect you shouldn't be trying to store things which aren't pointers 
into offload_baseptrs.

-Eli

-- 
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180425/18567e1b/attachment.html>


More information about the llvm-dev mailing list