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-exception 6 // 7 //===----------------------------------------------------------------------===// 8 // 9 // 10 //===----------------------------------------------------------------------===// 11 12 #ifndef OMPTARGET_OFFLOAD_ENTRY_H 13 #define OMPTARGET_OFFLOAD_ENTRY_H 14 15 #include "Shared/APITypes.h" 16 17 #include "omptarget.h" 18 19 #include "llvm/ADT/StringRef.h" 20 21 class DeviceImageTy; 22 23 class OffloadEntryTy { 24 DeviceImageTy &DeviceImage; 25 llvm::offloading::EntryTy &OffloadEntry; 26 27 public: 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_H 48