How to always enforce name mangling?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to always enforce name mangling?

Robinson, Paul via cfe-dev

Hi all,

I wanted to ask, if someone knows a possibility to always enforce name mangling,
no matter what source language (but instead depending on other compiler flags).

I am currently developing a SPIR-V target for OpenMP using OpenCL as runtime.
Thus, I have C/C++ input files, but emit SPIR-V.
The SPIR-V specification states: "By convention, for debugging purposes, modules with OpSource Source Language of OpenCL use the Itanium name-mangling standard."
The problem arises, when I try to make use of built-in functions, which are expected to be mangled
for the LLVM->SPIR-V transformation (with many of them being overloaded).

Is there any global option which can be set on invocation or do I have to apply changes all over the place where the actual mangling happens? Then, it might be enough to change function names and calls. Is the name mangling done in the parsing/sema stage or in codegen?

Kind regards,
Daniel


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: How to always enforce name mangling?

Robinson, Paul via cfe-dev

Of course, thanks for the interest.

The goal of this work is to enable OpenMP 4.x accelerator offloading for OpenCL 2.1 devices.
By specifying "-fopenmp -fopenmp-targets=spir(64)-unknown-unknown", the compiler should produce a fat binary consisting of host code and SPIR-V target code. Using the LLVM fork from Nicholas Wilson ( http://lists.llvm.org/pipermail/llvm-dev/2017-May/112538.html ), I created a toolchain to emit SPIR-V kernels and extended codegen to generate appropriate code for this target. I also wrote an OpenCL 2.1 plugin for the OpenMP runtime subproject. Although the device runtime routines are still missing, I already got some nice results.

Now, my problem is that some benchmarks use math lib functions (in target regions). In principal, these functions are available on OpenCL devices. However, the compiler doesn't mangle the function calls, which makes the back-end not recognizing them as built-ins. Therefore, I would like to mangle the names when openmp and spir are specified, according to the spec.

Kind regards,
Daniel


On 11/28/2017 06:06 PM, Andreas Bergmeier wrote:
That sounds very interesting. Can you get a bit more into detail?

Cheers
Andreas

Daniel Schürmann via cfe-dev <[hidden email]> schrieb am Di., 28. Nov. 2017, 17:16:

Hi all,

I wanted to ask, if someone knows a possibility to always enforce name mangling,
no matter what source language (but instead depending on other compiler flags).

I am currently developing a SPIR-V target for OpenMP using OpenCL as runtime.
Thus, I have C/C++ input files, but emit SPIR-V.
The SPIR-V specification states: "By convention, for debugging purposes, modules with OpSource Source Language of OpenCL use the Itanium name-mangling standard."
The problem arises, when I try to make use of built-in functions, which are expected to be mangled
for the LLVM->SPIR-V transformation (with many of them being overloaded).

Is there any global option which can be set on invocation or do I have to apply changes all over the place where the actual mangling happens? Then, it might be enough to change function names and calls. Is the name mangling done in the parsing/sema stage or in codegen?

Kind regards,
Daniel

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev