Path: blob/main/contrib/llvm-project/clang/lib/Driver/ToolChains/Flang.h
35269 views
//===--- Flang.h - Flang Tool and ToolChain Implementations ====-*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_FLANG_H9#define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_FLANG_H1011#include "clang/Driver/Tool.h"12#include "clang/Driver/Action.h"13#include "clang/Driver/Compilation.h"14#include "clang/Driver/ToolChain.h"15#include "llvm/Option/ArgList.h"16#include "llvm/Support/Compiler.h"1718namespace clang {19namespace driver {2021namespace tools {2223/// Flang compiler tool.24class LLVM_LIBRARY_VISIBILITY Flang : public Tool {25private:26/// Extract fortran dialect options from the driver arguments and add them to27/// the list of arguments for the generated command/job.28///29/// \param [in] Args The list of input driver arguments30/// \param [out] CmdArgs The list of output command arguments31void addFortranDialectOptions(const llvm::opt::ArgList &Args,32llvm::opt::ArgStringList &CmdArgs) const;3334/// Extract preprocessing options from the driver arguments and add them to35/// the preprocessor command arguments.36///37/// \param [in] Args The list of input driver arguments38/// \param [out] CmdArgs The list of output command arguments39void addPreprocessingOptions(const llvm::opt::ArgList &Args,40llvm::opt::ArgStringList &CmdArgs) const;4142/// Extract PIC options from the driver arguments and add them to43/// the command arguments.44///45/// \param [in] Args The list of input driver arguments46/// \param [out] CmdArgs The list of output command arguments47void addPicOptions(const llvm::opt::ArgList &Args,48llvm::opt::ArgStringList &CmdArgs) const;4950/// Extract target options from the driver arguments and add them to51/// the command arguments.52///53/// \param [in] Args The list of input driver arguments54/// \param [out] CmdArgs The list of output command arguments55void addTargetOptions(const llvm::opt::ArgList &Args,56llvm::opt::ArgStringList &CmdArgs) const;5758/// Add specific options for AArch64 target.59///60/// \param [in] Args The list of input driver arguments61/// \param [out] CmdArgs The list of output command arguments62void AddAArch64TargetArgs(const llvm::opt::ArgList &Args,63llvm::opt::ArgStringList &CmdArgs) const;6465/// Add specific options for AMDGPU target.66///67/// \param [in] Args The list of input driver arguments68/// \param [out] CmdArgs The list of output command arguments69void AddAMDGPUTargetArgs(const llvm::opt::ArgList &Args,70llvm::opt::ArgStringList &CmdArgs) const;7172/// Add specific options for RISC-V target.73///74/// \param [in] Args The list of input driver arguments75/// \param [out] CmdArgs The list of output command arguments76void AddRISCVTargetArgs(const llvm::opt::ArgList &Args,77llvm::opt::ArgStringList &CmdArgs) const;7879/// Add specific options for X86_64 target.80///81/// \param [in] Args The list of input driver arguments82/// \param [out] CmdArgs The list of output command arguments83void AddX86_64TargetArgs(const llvm::opt::ArgList &Args,84llvm::opt::ArgStringList &CmdArgs) const;8586/// Extract offload options from the driver arguments and add them to87/// the command arguments.88/// \param [in] C The current compilation for the driver invocation89/// \param [in] Inputs The input infomration on the current file inputs90/// \param [in] JA The job action91/// \param [in] Args The list of input driver arguments92/// \param [out] CmdArgs The list of output command arguments93void addOffloadOptions(Compilation &C, const InputInfoList &Inputs,94const JobAction &JA, const llvm::opt::ArgList &Args,95llvm::opt::ArgStringList &CmdArgs) const;9697/// Extract options for code generation from the driver arguments and add them98/// to the command arguments.99///100/// \param [in] Args The list of input driver arguments101/// \param [out] CmdArgs The list of output command arguments102void addCodegenOptions(const llvm::opt::ArgList &Args,103llvm::opt::ArgStringList &CmdArgs) const;104105/// Extract other compilation options from the driver arguments and add them106/// to the command arguments.107///108/// \param [in] Args The list of input driver arguments109/// \param [out] CmdArgs The list of output command arguments110void addOtherOptions(const llvm::opt::ArgList &Args,111llvm::opt::ArgStringList &CmdArgs) const;112113public:114Flang(const ToolChain &TC);115~Flang() override;116117bool hasGoodDiagnostics() const override { return true; }118bool hasIntegratedAssembler() const override { return true; }119bool hasIntegratedCPP() const override { return true; }120bool canEmitIR() const override { return true; }121122void ConstructJob(Compilation &C, const JobAction &JA,123const InputInfo &Output, const InputInfoList &Inputs,124const llvm::opt::ArgList &TCArgs,125const char *LinkingOutput) const override;126};127128} // end namespace tools129130} // end namespace driver131} // end namespace clang132133#endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_FLANG_H134135136