Files
Alex Duran 525b9ff127 [Offload][Omp][Acc][NFC] Restructure offload directory (#242220)
Create a src and include directory for libomptarget and libompaccsupport
following the same structure as liboffload.

Move headers from the base include directory to the directories that use
them.

Just a few utility headers remain in the share base include/Shared
directory. Of those, Environment.h and RPCOpcodes.h seem questionable
but seem in used in both the plugins and libomptarget (which seems to
point to further refactoring needed).

Changes in source files are basically due to directory changes, leftover
headers, and in a few cases, changing headers that were only used
transitively for their own dependence.

Headers in libompaccsupport seem like they could be further refined as
they contain both shared and things only neeeded by libomptarget, but
that's a larger refactoring to be done later.

Mechanical work done by Claude.
2026-11-17 10:29:55 +01:00

57 lines
1.9 KiB
C++

//===------------ rtl.h - Target independent OpenMP target RTL ------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// Declarations for handling RTL plugins.
//
//===----------------------------------------------------------------------===//
#ifndef _OMPTARGET_RTL_H
#define _OMPTARGET_RTL_H
#include "llvm/ADT/SmallVector.h"
#include "omptarget.h"
#include <cstdint>
#include <map>
/// Map between the host entry begin and the translation table. Each
/// registered library gets one TranslationTable. Use the map from
/// llvm::offloading::EntryTy so that we may quickly determine whether we
/// are trying to (re)register an existing lib or really have a new one.
struct TranslationTable {
__tgt_target_table HostTable;
llvm::SmallVector<__tgt_target_table> DeviceTables;
// Image assigned to a given device.
llvm::SmallVector<__tgt_device_image *>
TargetsImages; // One image per device ID.
// Arrays of entries active on the device.
llvm::SmallVector<llvm::SmallVector<llvm::offloading::EntryTy>>
TargetsEntries; // One table per device ID.
// Table of entry points or NULL if it was not already computed.
llvm::SmallVector<__tgt_target_table *>
TargetsTable; // One table per device ID.
};
typedef std::map<llvm::offloading::EntryTy *, TranslationTable>
HostEntriesBeginToTransTableTy;
/// Map between the host ptr and a table index
struct TableMap {
TranslationTable *Table = nullptr; // table associated with the host ptr.
uint32_t Index = 0; // index in which the host ptr translated entry is found.
TableMap() = default;
TableMap(TranslationTable *Table, uint32_t Index)
: Table(Table), Index(Index) {}
};
typedef std::map<void *, TableMap> HostPtrToTableMapTy;
#endif