[Openmp-commits] [PATCH] D109277: [OpenMP][libomptarget] Change internal return status to enum type

Shilei Tian via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Sun Sep 5 22:23:14 PDT 2021

tianshilei1992 added a comment.

`__tgt_target` series is emitted by the compiler, and the return value is also checked. If the offloading fails, it calls a host version. Currently if offloading is mandatory, the program immediately `abort` in `libomptarget`. That being said, the return value of those interface functions are being used.

Changing the return value of internal functions to enum doesn’t hurt anything, but it is not beneficial as well because at the end of the day, it still has to return an integer of type `int`. Since the return value is communicated among multiple C interfaces, defining them as macro or enumeration or even global values doesn’t make too much difference.

If you want a cleaner way, I think we can define a set of return values for plug-in, another set of return values for those `libomptarget` interfaces, and a set of return values for internal functions. The first two sets have to be integer as they are for C functions. The last one can be anything you want, enum, enum class, or even a real class.

  rG LLVM Github Monorepo



More information about the Openmp-commits mailing list