1 | //==- SPIRVOpenMP.cpp - SPIR-V OpenMP 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 | #include "SPIRVOpenMP.h" |
9 | #include "clang/Driver/CommonArgs.h" |
10 | |
11 | using namespace clang::driver; |
12 | using namespace clang::driver::toolchains; |
13 | using namespace clang::driver::tools; |
14 | using namespace llvm::opt; |
15 | |
16 | namespace clang::driver::toolchains { |
17 | SPIRVOpenMPToolChain::SPIRVOpenMPToolChain(const Driver &D, |
18 | const llvm::Triple &Triple, |
19 | const ToolChain &HostToolchain, |
20 | const ArgList &Args) |
21 | : SPIRVToolChain(D, Triple, Args), HostTC(HostToolchain) {} |
22 | |
23 | void SPIRVOpenMPToolChain::addClangTargetOptions( |
24 | const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args, |
25 | Action::OffloadKind DeviceOffloadingKind) const { |
26 | |
27 | if (DeviceOffloadingKind != Action::OFK_OpenMP) |
28 | return; |
29 | |
30 | if (!DriverArgs.hasFlag(Pos: options::OPT_offloadlib, Neg: options::OPT_no_offloadlib, |
31 | Default: true)) |
32 | return; |
33 | addOpenMPDeviceRTL(D: getDriver(), DriverArgs, CC1Args, BitcodeSuffix: "" , Triple: getTriple(), HostTC); |
34 | } |
35 | } // namespace clang::driver::toolchains |
36 | |