clang 20.0.0git
SPIRV.h
Go to the documentation of this file.
1//===--- SPIRV.h - SPIR-V Tool Implementations ------------------*- 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_CLANG_LIB_DRIVER_TOOLCHAINS_SPIRV_H
10#define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_SPIRV_H
11
12#include "clang/Driver/Tool.h"
14
15namespace clang {
16namespace driver {
17namespace tools {
18namespace SPIRV {
19
21 const JobAction &JA, const InputInfo &Output,
22 const InputInfo &Input,
23 const llvm::opt::ArgStringList &Args);
24
25class LLVM_LIBRARY_VISIBILITY Translator : public Tool {
26public:
28 : Tool("SPIR-V::Translator", "llvm-spirv", TC) {}
29
30 bool hasIntegratedCPP() const override { return false; }
31 bool hasIntegratedAssembler() const override { return true; }
32
33 void ConstructJob(Compilation &C, const JobAction &JA,
34 const InputInfo &Output, const InputInfoList &Inputs,
35 const llvm::opt::ArgList &TCArgs,
36 const char *LinkingOutput) const override;
37};
38
39class LLVM_LIBRARY_VISIBILITY Linker final : public Tool {
40public:
41 Linker(const ToolChain &TC) : Tool("SPIRV::Linker", "spirv-link", TC) {}
42 bool hasIntegratedCPP() const override { return false; }
43 bool isLinkJob() const override { return true; }
44 void ConstructJob(Compilation &C, const JobAction &JA,
45 const InputInfo &Output, const InputInfoList &Inputs,
46 const llvm::opt::ArgList &TCArgs,
47 const char *LinkingOutput) const override;
48};
49
50} // namespace SPIRV
51} // namespace tools
52
53namespace toolchains {
54
55class LLVM_LIBRARY_VISIBILITY SPIRVToolChain final : public ToolChain {
56 mutable std::unique_ptr<Tool> Translator;
57
58public:
59 SPIRVToolChain(const Driver &D, const llvm::Triple &Triple,
60 const llvm::opt::ArgList &Args);
61
62 bool useIntegratedAs() const override { return true; }
63
64 bool IsIntegratedBackendDefault() const override { return false; }
65 bool IsNonIntegratedBackendSupported() const override { return true; }
66 bool IsMathErrnoDefault() const override { return false; }
67 bool isCrossCompiling() const override { return true; }
68 bool isPICDefault() const override { return false; }
69 bool isPIEDefault(const llvm::opt::ArgList &Args) const override {
70 return false;
71 }
72 bool isPICDefaultForced() const override { return false; }
73 bool SupportsProfiling() const override { return false; }
74 bool HasNativeLLVMSupport() const override;
75
76 clang::driver::Tool *SelectTool(const JobAction &JA) const override;
77
78protected:
79 clang::driver::Tool *getTool(Action::ActionClass AC) const override;
80 Tool *buildLinker() const override;
81
82private:
83 clang::driver::Tool *getTranslator() const;
84 bool NativeLLVMSupport;
85};
86
87} // namespace toolchains
88} // namespace driver
89} // namespace clang
90#endif
const Decl * D
Compilation - A set of tasks to perform for a single driver invocation.
Definition: Compilation.h:45
Driver - Encapsulate logic for constructing compilation processes from a set of gcc-driver-like comma...
Definition: Driver.h:77
InputInfo - Wrapper for information about an input source.
Definition: InputInfo.h:22
ToolChain - Access to tools for a single platform.
Definition: ToolChain.h:92
Tool - Information on a specific compilation tool.
Definition: Tool.h:32
bool isPICDefault() const override
Test whether this toolchain defaults to PIC.
Definition: SPIRV.h:68
bool IsNonIntegratedBackendSupported() const override
IsNonIntegratedBackendSupported - Does this tool chain support -fno-integrated-objemitter.
Definition: SPIRV.h:65
bool useIntegratedAs() const override
Check if the toolchain should use the integrated assembler.
Definition: SPIRV.h:62
bool isPICDefaultForced() const override
Tests whether this toolchain forces its default for PIC, PIE or non-PIC.
Definition: SPIRV.h:72
bool IsMathErrnoDefault() const override
IsMathErrnoDefault - Does this tool chain use -fmath-errno by default.
Definition: SPIRV.h:66
bool IsIntegratedBackendDefault() const override
IsIntegratedBackendDefault - Does this tool chain enable -fintegrated-objemitter by default.
Definition: SPIRV.h:64
bool isPIEDefault(const llvm::opt::ArgList &Args) const override
Test whether this toolchain defaults to PIE.
Definition: SPIRV.h:69
bool isCrossCompiling() const override
Returns true if the toolchain is targeting a non-native architecture.
Definition: SPIRV.h:67
bool SupportsProfiling() const override
SupportsProfiling - Does this tool chain support -pg.
Definition: SPIRV.h:73
bool isLinkJob() const override
Definition: SPIRV.h:43
Linker(const ToolChain &TC)
Definition: SPIRV.h:41
bool hasIntegratedCPP() const override
Definition: SPIRV.h:42
bool hasIntegratedAssembler() const override
Definition: SPIRV.h:31
bool hasIntegratedCPP() const override
Definition: SPIRV.h:30
Translator(const ToolChain &TC)
Definition: SPIRV.h:27
void constructTranslateCommand(Compilation &C, const Tool &T, const JobAction &JA, const InputInfo &Output, const InputInfo &Input, const llvm::opt::ArgStringList &Args)
Definition: SPIRV.cpp:21
The JSON file list parser is used to communicate input to InstallAPI.
const FunctionProtoType * T