[LLVMdev] Generating target dependent function calls

Peter Collingbourne peter at pcc.me.uk
Wed Dec 22 12:12:12 PST 2010


On Wed, Dec 22, 2010 at 01:38:06PM -0500, Tobias Grosser wrote:
> Hi,
> 
> raghesh and I are working in Polly on automatically generating OpenMP 
> calls. This works nicely on a 64bit architecture,
> however the functions we need to generate are slightly different on 
> different platforms.
> 
> The reason for the difference is that e.g "long" in
> 
>  > bool GOMP_loop_runtime_next(long, long)
> 
> has a different size on different architectures.
> 
> Currently we generate the prototypes and functions ourselves:
>  > declare i8 @GOMP_loop_runtime_next(i64*, i64*) nounwind
> 
> To support a 32bit architecture we would need to generate:
>  > declare i8 @GOMP_loop_runtime_next(i32*, i32*) nounwind
> 
> Has anybody an idea what's a conceptually clean way to generate OpenMP 
> function calls for different architectures and best even for different 
> OpenMP implementations (e.g. mpc.sf.net)
> 
> Would overloaded intrinsics be a possible approach? How could we 
> model/derive the right signature for our target architecture. TargetData 
> does not seem to be enough for this. Is there a better approach than 
> passing this information using a command line switch?
> 
> Cheers and thanks for your help

Hi Tobias,

I'm facing a similar problem generating CUDA runtime code for
different architectures.  One solution I'm currently considering
is to use the TargetInfo class from Clang's Basic library which can
be used to obtain target specific parameters (such as sizeof(long))
given a target triple.

Thanks,
-- 
Peter



More information about the llvm-dev mailing list