1 //===-- OffloadEntry.h - Representation of offload entries ------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
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"
23 class OffloadEntryTy
{
24 DeviceImageTy
&DeviceImage
;
25 __tgt_offload_entry
&OffloadEntry
;
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