[memprof] Use a new constructor of IndexedAllocationInfo (NFC) (#116920)
[llvm-project.git] / offload / include / OffloadEntry.h
blobda1de8123be9791e4f8e10e28c786dd115c563cf
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 //===----------------------------------------------------------------------===//
12 #ifndef OMPTARGET_OFFLOAD_ENTRY_H
13 #define OMPTARGET_OFFLOAD_ENTRY_H
15 #include "Shared/APITypes.h"
17 #include "omptarget.h"
19 #include "llvm/ADT/StringRef.h"
21 class DeviceImageTy;
23 class OffloadEntryTy {
24 DeviceImageTy &DeviceImage;
25 __tgt_offload_entry &OffloadEntry;
27 public:
28 OffloadEntryTy(DeviceImageTy &DeviceImage, __tgt_offload_entry &OffloadEntry)
29 : DeviceImage(DeviceImage), OffloadEntry(OffloadEntry) {}
31 bool isGlobal() const { return getSize() != 0; }
32 size_t getSize() const { return OffloadEntry.size; }
34 void *getAddress() const { return OffloadEntry.addr; }
35 llvm::StringRef getName() const { return OffloadEntry.name; }
36 const char *getNameAsCStr() const { return OffloadEntry.name; }
37 __tgt_bin_desc *getBinaryDescription() const;
39 bool isLink() const { return hasFlags(OMP_DECLARE_TARGET_LINK); }
41 bool hasFlags(OpenMPOffloadingDeclareTargetFlags Flags) const {
42 return Flags & OffloadEntry.flags;
46 #endif // OMPTARGET_OFFLOAD_ENTRY_H