aboutsummaryrefslogtreecommitdiff
path: root/offload/test/tools/offload-tblgen/entry_points.td
blob: 94ea820d453ee449624404e8958f89a5f4774982 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// RUN: %offload-tblgen -gen-entry-points -I %S/../../../liboffload/API %s | %fcheck-generic

// Check entry point wrapper functions are generated correctly

include "APIDefs.td"

def FunctionA : Function {
    let desc = "Function A description";
    let details = [ "Function A detailed information" ];
    let params = [
        Param<"uint32_t", "ParamA", "Parameter A description">,
        Param<"uint32_t*", "ParamB", "Parameter B description">,
    ];
    let returns = [
        Return<"OL_ERRC_INVALID_VALUE", ["When a value is invalid"]>
    ];
}


// The validation function should call the implementation function
// CHECK: FunctionA_val
// CHECK: return llvm::offload::FunctionA_impl(ParamA, ParamB);

// CHECK: ol_result_t{{.*}} FunctionA(

// The entry point should print tracing output if enabled
// CHECK: if (llvm::offload::isTracingEnabled()) {
// CHECK-NEXT: "---> FunctionA";

// CHECK: Result = llvmErrorToOffloadError(FunctionA_val(ParamA, ParamB));

// Tracing should construct a param struct for printing
// CHECK: if (llvm::offload::isTracingEnabled()) {
// CHECK: function_a_params_t Params = {&ParamA, &ParamB};

// CHECK: return Result;