[X86][MC,LLD][NFC] Rename R_X86_64_REX2_GOTPCRELX (#116737)
[llvm-project.git] / offload / include / rtl.h
blob5e198bdad43642f4b925b07587820d04882d2ee4
1 //===------------ rtl.h - Target independent OpenMP target RTL ------------===//
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-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
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"
20 #include <cstdint>
21 #include <map>
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
47 struct TableMap {
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.
50 TableMap() = default;
51 TableMap(TranslationTable *Table, uint32_t Index)
52 : Table(Table), Index(Index) {}
54 typedef std::map<void *, TableMap> HostPtrToTableMapTy;
56 #endif