brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · 551ee69 Raw
48 lines · c
1//===-- OffloadEntry.h - Representation of offload entries ------*- C++ -*-===//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//10//===----------------------------------------------------------------------===//11 12#ifndef OMPTARGET_OFFLOAD_ENTRY_H13#define OMPTARGET_OFFLOAD_ENTRY_H14 15#include "Shared/APITypes.h"16 17#include "omptarget.h"18 19#include "llvm/ADT/StringRef.h"20 21class DeviceImageTy;22 23class OffloadEntryTy {24  DeviceImageTy &DeviceImage;25  llvm::offloading::EntryTy &OffloadEntry;26 27public:28  OffloadEntryTy(DeviceImageTy &DeviceImage,29                 llvm::offloading::EntryTy &OffloadEntry)30      : DeviceImage(DeviceImage), OffloadEntry(OffloadEntry) {}31 32  bool isGlobal() const { return getSize() != 0; }33  size_t getSize() const { return OffloadEntry.Size; }34 35  void *getnAddress() const { return OffloadEntry.Address; }36  llvm::StringRef getName() const { return OffloadEntry.SymbolName; }37  const char *getNameAsCStr() const { return OffloadEntry.SymbolName; }38  __tgt_bin_desc *getBinaryDescription() const;39 40  bool isLink() const { return hasFlags(OMP_DECLARE_TARGET_LINK); }41 42  bool hasFlags(OpenMPOffloadingDeclareTargetFlags Flags) const {43    return Flags & OffloadEntry.Flags;44  }45};46 47#endif // OMPTARGET_OFFLOAD_ENTRY_H48