clang 20.0.0git
DeviceOffload.h
Go to the documentation of this file.
1//===----------- DeviceOffload.h - Device Offloading ------------*- 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// This file implements classes required for offloading to CUDA devices.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_CLANG_LIB_INTERPRETER_DEVICE_OFFLOAD_H
14#define LLVM_CLANG_LIB_INTERPRETER_DEVICE_OFFLOAD_H
15
16#include "IncrementalParser.h"
17#include "llvm/Support/FileSystem.h"
18#include "llvm/Support/VirtualFileSystem.h"
19
20namespace clang {
21struct PartialTranslationUnit;
22class CompilerInstance;
23class CodeGenOptions;
24class TargetOptions;
25
27 const std::list<PartialTranslationUnit> &PTUs;
28
29public:
31 std::unique_ptr<CompilerInstance> DeviceInstance,
32 CompilerInstance &HostInstance,
34 llvm::Error &Err, const std::list<PartialTranslationUnit> &PTUs);
35
36 llvm::Expected<TranslationUnitDecl *> Parse(llvm::StringRef Input) override;
37
38 // Generate PTX for the last PTU.
40
41 // Generate fatbinary contents in memory
42 llvm::Error GenerateFatbinary();
43
45
46protected:
47 std::unique_ptr<CompilerInstance> DeviceCI;
52 CodeGenOptions &CodeGenOpts; // Intentionally a reference.
54};
55
56} // namespace clang
57
58#endif // LLVM_CLANG_LIB_INTERPRETER_DEVICE_OFFLOAD_H
CodeGenOptions - Track various options which control how the code is optimized and passed to the back...
CompilerInstance - Helper class for managing a single instance of the Clang compiler.
llvm::SmallVector< char, 1024 > FatbinContent
Definition: DeviceOffload.h:50
llvm::SmallString< 1024 > PTXCode
Definition: DeviceOffload.h:49
std::unique_ptr< CompilerInstance > DeviceCI
Definition: DeviceOffload.h:47
llvm::Expected< TranslationUnitDecl * > Parse(llvm::StringRef Input) override
Parses incremental input by creating an in-memory file.
llvm::IntrusiveRefCntPtr< llvm::vfs::InMemoryFileSystem > VFS
Definition: DeviceOffload.h:51
llvm::Expected< llvm::StringRef > GeneratePTX()
const TargetOptions & TargetOpts
Definition: DeviceOffload.h:53
Provides support for incremental compilation.
Options for controlling the target.
Definition: TargetOptions.h:26
The JSON file list parser is used to communicate input to InstallAPI.