xref: /freebsd/contrib/llvm-project/clang/lib/Driver/ToolChains/AIX.h (revision 0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583)
1480093f4SDimitry Andric //===--- AIX.h - AIX ToolChain Implementations ------------------*- C++ -*-===//
2480093f4SDimitry Andric //
3480093f4SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4480093f4SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
5480093f4SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6480093f4SDimitry Andric //
7480093f4SDimitry Andric //===----------------------------------------------------------------------===//
8480093f4SDimitry Andric 
9480093f4SDimitry Andric #ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_AIX_H
10480093f4SDimitry Andric #define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_AIX_H
11480093f4SDimitry Andric 
12480093f4SDimitry Andric #include "clang/Driver/Tool.h"
13480093f4SDimitry Andric #include "clang/Driver/ToolChain.h"
14480093f4SDimitry Andric 
15480093f4SDimitry Andric namespace clang {
16480093f4SDimitry Andric namespace driver {
17480093f4SDimitry Andric namespace tools {
18480093f4SDimitry Andric 
195f757f3fSDimitry Andric /// Directly call system default assembler and linker.
20480093f4SDimitry Andric namespace aix {
21480093f4SDimitry Andric 
225f757f3fSDimitry Andric class LLVM_LIBRARY_VISIBILITY Assembler final : public Tool {
23480093f4SDimitry Andric public:
Assembler(const ToolChain & TC)24480093f4SDimitry Andric   Assembler(const ToolChain &TC) : Tool("aix::Assembler", "assembler", TC) {}
25480093f4SDimitry Andric 
hasIntegratedCPP()26480093f4SDimitry Andric   bool hasIntegratedCPP() const override { return false; }
27480093f4SDimitry Andric 
28480093f4SDimitry Andric   void ConstructJob(Compilation &C, const JobAction &JA,
29480093f4SDimitry Andric                     const InputInfo &Output, const InputInfoList &Inputs,
30480093f4SDimitry Andric                     const llvm::opt::ArgList &TCArgs,
31480093f4SDimitry Andric                     const char *LinkingOutput) const override;
32480093f4SDimitry Andric };
33480093f4SDimitry Andric 
345f757f3fSDimitry Andric class LLVM_LIBRARY_VISIBILITY Linker final : public Tool {
35480093f4SDimitry Andric public:
Linker(const ToolChain & TC)36480093f4SDimitry Andric   Linker(const ToolChain &TC) : Tool("aix::Linker", "linker", TC) {}
37480093f4SDimitry Andric 
hasIntegratedCPP()38480093f4SDimitry Andric   bool hasIntegratedCPP() const override { return false; }
isLinkJob()39480093f4SDimitry Andric   bool isLinkJob() const override { return true; }
40480093f4SDimitry Andric 
41480093f4SDimitry Andric   void ConstructJob(Compilation &C, const JobAction &JA,
42480093f4SDimitry Andric                     const InputInfo &Output, const InputInfoList &Inputs,
43480093f4SDimitry Andric                     const llvm::opt::ArgList &TCArgs,
44480093f4SDimitry Andric                     const char *LinkingOutput) const override;
45480093f4SDimitry Andric };
46480093f4SDimitry Andric 
47480093f4SDimitry Andric } // end namespace aix
48480093f4SDimitry Andric 
49480093f4SDimitry Andric } // end namespace tools
50480093f4SDimitry Andric } // end namespace driver
51480093f4SDimitry Andric } // end namespace clang
52480093f4SDimitry Andric 
53480093f4SDimitry Andric namespace clang {
54480093f4SDimitry Andric namespace driver {
55480093f4SDimitry Andric namespace toolchains {
56480093f4SDimitry Andric 
57480093f4SDimitry Andric class LLVM_LIBRARY_VISIBILITY AIX : public ToolChain {
58480093f4SDimitry Andric public:
59480093f4SDimitry Andric   AIX(const Driver &D, const llvm::Triple &Triple,
60480093f4SDimitry Andric       const llvm::opt::ArgList &Args);
61480093f4SDimitry Andric 
parseInlineAsmUsingAsmParser()62fe6060f1SDimitry Andric   bool parseInlineAsmUsingAsmParser() const override {
63fe6060f1SDimitry Andric     return ParseInlineAsmUsingAsmParser;
64fe6060f1SDimitry Andric   }
isPICDefault()65480093f4SDimitry Andric   bool isPICDefault() const override { return true; }
isPIEDefault(const llvm::opt::ArgList & Args)66349cc55cSDimitry Andric   bool isPIEDefault(const llvm::opt::ArgList &Args) const override {
67349cc55cSDimitry Andric     return false;
68349cc55cSDimitry Andric   }
isPICDefaultForced()69480093f4SDimitry Andric   bool isPICDefaultForced() const override { return true; }
HasNativeLLVMSupport()70bdd1243dSDimitry Andric   bool HasNativeLLVMSupport() const override { return true; }
71480093f4SDimitry Andric 
725ffd83dbSDimitry Andric   void
735ffd83dbSDimitry Andric   AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
745ffd83dbSDimitry Andric                             llvm::opt::ArgStringList &CC1Args) const override;
755ffd83dbSDimitry Andric 
76349cc55cSDimitry Andric   void AddClangCXXStdlibIncludeArgs(
77349cc55cSDimitry Andric       const llvm::opt::ArgList &DriverArgs,
78349cc55cSDimitry Andric       llvm::opt::ArgStringList &CC1Args) const override;
79349cc55cSDimitry Andric 
80e8d8bef9SDimitry Andric   void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
81e8d8bef9SDimitry Andric                            llvm::opt::ArgStringList &CmdArgs) const override;
82e8d8bef9SDimitry Andric 
8306c3fb27SDimitry Andric   void addClangTargetOptions(
8406c3fb27SDimitry Andric       const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CC1Args,
8506c3fb27SDimitry Andric       Action::OffloadKind DeviceOffloadingKind) const override;
8606c3fb27SDimitry Andric 
87bdd1243dSDimitry Andric   void addProfileRTLibs(const llvm::opt::ArgList &Args,
88bdd1243dSDimitry Andric                         llvm::opt::ArgStringList &CmdArgs) const override;
89bdd1243dSDimitry Andric 
90e8d8bef9SDimitry Andric   CXXStdlibType GetDefaultCXXStdlibType() const override;
91e8d8bef9SDimitry Andric 
92e8d8bef9SDimitry Andric   RuntimeLibType GetDefaultRuntimeLibType() const override;
93e8d8bef9SDimitry Andric 
94fe6060f1SDimitry Andric   // Set default DWARF version to 3 for now as latest AIX OS supports version 3.
GetDefaultDwarfVersion()95fe6060f1SDimitry Andric   unsigned GetDefaultDwarfVersion() const override { return 3; }
96fe6060f1SDimitry Andric 
getDefaultDebuggerTuning()97fe6060f1SDimitry Andric   llvm::DebuggerKind getDefaultDebuggerTuning() const override {
98fe6060f1SDimitry Andric     return llvm::DebuggerKind::DBX;
99fe6060f1SDimitry Andric   }
100fe6060f1SDimitry Andric 
101480093f4SDimitry Andric protected:
102480093f4SDimitry Andric   Tool *buildAssembler() const override;
103480093f4SDimitry Andric   Tool *buildLinker() const override;
1045ffd83dbSDimitry Andric 
1055ffd83dbSDimitry Andric private:
1065ffd83dbSDimitry Andric   llvm::StringRef GetHeaderSysroot(const llvm::opt::ArgList &DriverArgs) const;
107fe6060f1SDimitry Andric   bool ParseInlineAsmUsingAsmParser;
108*0fca6ea1SDimitry Andric   void AddOpenMPIncludeArgs(const llvm::opt::ArgList &DriverArgs,
109*0fca6ea1SDimitry Andric                             llvm::opt::ArgStringList &CC1Args) const;
110480093f4SDimitry Andric };
111480093f4SDimitry Andric 
112480093f4SDimitry Andric } // end namespace toolchains
113480093f4SDimitry Andric } // end namespace driver
114480093f4SDimitry Andric } // end namespace clang
115480093f4SDimitry Andric 
116480093f4SDimitry Andric #endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_AIX_H
117