xref: /llvm-project/offload/test/tools/offload-tblgen/entry_points.td (revision fd3907ccb583df99e9c19d2fe84e4e7c52d75de9)
1// RUN: %offload-tblgen -gen-entry-points -I %S/../../../liboffload/API %s | %fcheck-generic
2
3// Check entry point wrapper functions are generated correctly
4
5include "APIDefs.td"
6
7def : Function {
8    let name = "FunctionA";
9    let desc = "Function A description";
10    let details = [ "Function A detailed information" ];
11    let params = [
12        Param<"uint32_t", "ParamA", "Parameter A description">,
13        Param<"uint32_t*", "ParamB", "Parameter B description">,
14    ];
15    let returns = [
16        Return<"OL_ERRC_INVALID_VALUE", ["When a value is invalid"]>
17    ];
18}
19
20
21// The validation function should call the implementation function
22// CHECK: FunctionA_val
23// CHECK: return FunctionA_impl(ParamA, ParamB);
24
25// CHECK: ol_result_t{{.*}} FunctionA(
26
27// The entry point should print tracing output if enabled
28// CHECK: if (offloadConfig().TracingEnabled) {
29// CHECK-NEXT: "---> FunctionA";
30
31// CHECK: Result = FunctionA_val(ParamA, ParamB);
32
33// Tracing should construct a param struct for printing
34// CHECK: if (offloadConfig().TracingEnabled) {
35// CHECK: function_a_params_t Params = {&ParamA, &ParamB};
36
37// CHECK: return Result;
38