LLVM 19.0.0git
OffloadWrapper.h
Go to the documentation of this file.
1//===- OffloadWrapper.h --r-------------------------------------*- 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#ifndef LLVM_FRONTEND_OFFLOADING_OFFLOADWRAPPER_H
10#define LLVM_FRONTEND_OFFLOADING_OFFLOADWRAPPER_H
11
12#include "llvm/ADT/ArrayRef.h"
13#include "llvm/IR/Module.h"
14
15namespace llvm {
16namespace offloading {
17using EntryArrayTy = std::pair<GlobalVariable *, GlobalVariable *>;
18/// Wraps the input device images into the module \p M as global symbols and
19/// registers the images with the OpenMP Offloading runtime libomptarget.
20/// \param EntryArray Optional pair pointing to the `__start` and `__stop`
21/// symbols holding the `__tgt_offload_entry` array.
22/// \param Suffix An optional suffix appended to the emitted symbols.
23/// \param Relocatable Indicate if we need to change the offloading section to
24/// create a relocatable object.
27 EntryArrayTy EntryArray,
28 llvm::StringRef Suffix = "",
29 bool Relocatable = false);
30
31/// Wraps the input fatbinary image into the module \p M as global symbols and
32/// registers the images with the CUDA runtime.
33/// \param EntryArray Optional pair pointing to the `__start` and `__stop`
34/// symbols holding the `__tgt_offload_entry` array.
35/// \param Suffix An optional suffix appended to the emitted symbols.
36/// \param EmitSurfacesAndTextures Whether to emit surface and textures
37/// registration code. It defaults to false.
39 EntryArrayTy EntryArray, llvm::StringRef Suffix = "",
40 bool EmitSurfacesAndTextures = true);
41
42/// Wraps the input bundled image into the module \p M as global symbols and
43/// registers the images with the HIP runtime.
44/// \param EntryArray Optional pair pointing to the `__start` and `__stop`
45/// symbols holding the `__tgt_offload_entry` array.
46/// \param Suffix An optional suffix appended to the emitted symbols.
47/// \param EmitSurfacesAndTextures Whether to emit surface and textures
48/// registration code. It defaults to false.
50 EntryArrayTy EntryArray, llvm::StringRef Suffix = "",
51 bool EmitSurfacesAndTextures = true);
52} // namespace offloading
53} // namespace llvm
54
55#endif // LLVM_FRONTEND_OFFLOADING_OFFLOADWRAPPER_H
Module.h This file contains the declarations for the Module class.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: ArrayRef.h:41
Lightweight error class with error context and mandatory checking.
Definition: Error.h:160
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:65
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
llvm::Error wrapOpenMPBinaries(llvm::Module &M, llvm::ArrayRef< llvm::ArrayRef< char > > Images, EntryArrayTy EntryArray, llvm::StringRef Suffix="", bool Relocatable=false)
Wraps the input device images into the module M as global symbols and registers the images with the O...
std::pair< GlobalVariable *, GlobalVariable * > EntryArrayTy
llvm::Error wrapHIPBinary(llvm::Module &M, llvm::ArrayRef< char > Images, EntryArrayTy EntryArray, llvm::StringRef Suffix="", bool EmitSurfacesAndTextures=true)
Wraps the input bundled image into the module M as global symbols and registers the images with the H...
llvm::Error wrapCudaBinary(llvm::Module &M, llvm::ArrayRef< char > Images, EntryArrayTy EntryArray, llvm::StringRef Suffix="", bool EmitSurfacesAndTextures=true)
Wraps the input fatbinary image into the module M as global symbols and registers the images with the...
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18