[llvm] [Offload] Introduce offload-tblgen and initial new API implementation (PR #108413)

Callum Fare via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 13 08:28:18 PDT 2024


================
@@ -0,0 +1,75 @@
+def : Macro {
+  let name = "OFFLOAD_APICALL";
+  let desc = "Calling convention for all API functions";
+  let condition = "defined(_WIN32)";
+  let value = "__cdecl";
+  let alt_value = "";
+}
+
+def : Macro {
+  let name = "OFFLOAD_APIEXPORT";
+  let desc = "Microsoft-specific dllexport storage-class attribute";
+  let condition = "defined(_WIN32)";
+  let value = "__declspec(dllexport)";
+  let alt_value = "";
+}
+
+def : Macro {
+  let name = "OFFLOAD_DLLEXPORT";
+  let desc = "Microsoft-specific dllexport storage-class attribute";
+  let condition = "defined(_WIN32)";
+  let value = "__declspec(dllexport)";
+}
+
+def : Macro {
+  let name = "OFFLOAD_DLLEXPORT";
+  let desc = "GCC-specific dllexport storage-class attribute";
+  let condition = "__GNUC__ >= 4";
+  let value = "__attribute__ ((visibility (\"default\")))";
+  let alt_value = "";
+}
+
+def : Typedef {
+  let name = "offload_bool_t";
+  let value = "uint8_t";
+  let desc = "compiler-independent type";
+}
+
+def : Handle {
+  let name = "offload_platform_handle_t";
+  let desc = "Handle of a platform instance";
+}
+
+def : Handle {
+  let name = "offload_device_handle_t";
+  let desc = "Handle of platform's device object";
+}
+
+def : Handle {
+  let name = "offload_context_handle_t";
----------------
callumfare wrote:

Agreed, by the time I was done it was feeling a little unwieldy but I didn't want to rewrite everything without agreement - it would be good to make a decision as a group on this. `ol_` or `offl_` might be better choices

https://github.com/llvm/llvm-project/pull/108413


More information about the llvm-commits mailing list