1 //===------------ rtl.h - Target independent OpenMP target RTL ------------===//
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-exception
7 //===----------------------------------------------------------------------===//
9 // Declarations for handling RTL plugins.
11 //===----------------------------------------------------------------------===//
13 #ifndef _OMPTARGET_RTL_H
14 #define _OMPTARGET_RTL_H
16 #include "llvm/ADT/SmallVector.h"
18 #include "omptarget.h"
23 /// Map between the host entry begin and the translation table. Each
24 /// registered library gets one TranslationTable. Use the map from
25 /// __tgt_offload_entry so that we may quickly determine whether we
26 /// are trying to (re)register an existing lib or really have a new one.
27 struct TranslationTable
{
28 __tgt_target_table HostTable
;
29 llvm::SmallVector
<__tgt_target_table
> DeviceTables
;
31 // Image assigned to a given device.
32 llvm::SmallVector
<__tgt_device_image
*>
33 TargetsImages
; // One image per device ID.
35 // Arrays of entries active on the device.
36 llvm::SmallVector
<llvm::SmallVector
<__tgt_offload_entry
>>
37 TargetsEntries
; // One table per device ID.
39 // Table of entry points or NULL if it was not already computed.
40 llvm::SmallVector
<__tgt_target_table
*>
41 TargetsTable
; // One table per device ID.
43 typedef std::map
<__tgt_offload_entry
*, TranslationTable
>
44 HostEntriesBeginToTransTableTy
;
46 /// Map between the host ptr and a table index
48 TranslationTable
*Table
= nullptr; // table associated with the host ptr.
49 uint32_t Index
= 0; // index in which the host ptr translated entry is found.
51 TableMap(TranslationTable
*Table
, uint32_t Index
)
52 : Table(Table
), Index(Index
) {}
54 typedef std::map
<void *, TableMap
> HostPtrToTableMapTy
;