brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.4 KiB · c57a2e1 Raw
87 lines · plain
1//===-- Symbol.td - Symbol definitions for Offload ---------*- tablegen -*-===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8//9// This file contains Offload API definitions related to the symbol handle.10//11//===----------------------------------------------------------------------===//12 13def ol_symbol_kind_t : Enum {14  let desc = "The kind of a symbol";15  let etors =[16    Etor<"KERNEL", "a kernel object">,17    Etor<"GLOBAL_VARIABLE", "a global variable">,18  ];19}20 21def olGetSymbol : Function {22    let desc = "Get a symbol (kernel or global variable) identified by `Name` in the given program.";23    let details = [24        "Symbol handles are owned by the program and do not need to be manually destroyed."25    ];26    let params = [27        Param<"ol_program_handle_t", "Program", "handle of the program", PARAM_IN>,28        Param<"const char*", "Name", "name of the symbol to look up", PARAM_IN>,29        Param<"ol_symbol_kind_t", "Kind", "symbol kind to look up", PARAM_IN>,30        Param<"ol_symbol_handle_t*", "Symbol", "output pointer for the symbol", PARAM_OUT>,31    ];32    let returns = [];33}34 35def ol_symbol_info_t : Enum {36  let desc = "Supported symbol info.";37  let is_typed = 1;38  let etors = [39    TaggedEtor<"KIND", "ol_symbol_kind_t", "The kind of this symbol.">,40    TaggedEtor<"GLOBAL_VARIABLE_ADDRESS", "void *", "The address in memory for this global variable.">,41    TaggedEtor<"GLOBAL_VARIABLE_SIZE", "size_t", "The size in bytes for this global variable.">,42  ];43}44 45def olGetSymbolInfo : Function {46  let desc = "Queries the given property of the symbol.";47  let details = [48    "`olGetSymbolInfoSize` can be used to query the storage size "49    "required for the given query."50  ];51  let params = [52    Param<"ol_symbol_handle_t", "Symbol", "handle of the symbol", PARAM_IN>,53    Param<"ol_symbol_info_t", "PropName", "type of the info to retrieve", PARAM_IN>,54    Param<"size_t", "PropSize", "the number of bytes pointed to by PropValue.", PARAM_IN>,55    TypeTaggedParam<"void*", "PropValue", "array of bytes holding the info. "56      "If PropSize is not equal to or greater to the real number of bytes needed to return the info "57      "then the OL_ERRC_INVALID_SIZE error is returned and PropValue is not used.", PARAM_OUT,58      TypeInfo<"PropName" , "PropSize">>59  ];60  let returns = [61    Return<"OL_ERRC_INVALID_SIZE", [62      "`PropSize == 0`",63      "If `PropSize` is less than the real number of bytes needed to return the info."64    ]>,65    Return<"OL_ERRC_SYMBOL_KIND", [66      "If the requested info isn't applicable to the type of symbol."67    ]>,68    Return<"OL_ERRC_INVALID_SYMBOL">69  ];70}71 72def olGetSymbolInfoSize : Function {73  let desc = "Returns the storage size of the given symbol query.";74  let details = [];75  let params = [76    Param<"ol_symbol_handle_t", "Symbol", "handle of the symbol", PARAM_IN>,77    Param<"ol_symbol_info_t", "PropName", "type of the info to query", PARAM_IN>,78    Param<"size_t*", "PropSizeRet", "pointer to the number of bytes required to store the query", PARAM_OUT>79  ];80  let returns = [81    Return<"OL_ERRC_INVALID_SYMBOL">,82    Return<"OL_ERRC_SYMBOL_KIND", [83      "If the requested info isn't applicable to the type of symbol."84    ]>,85  ];86}87