16#include "mlir/IR/BuiltinAttributes.h"
17#include "mlir/IR/PatternMatch.h"
22#include "llvm/Support/ErrorHandling.h"
23#include "llvm/Support/FileSystem.h"
29 case clang::TargetCXXABI::AppleARM64:
30 case clang::TargetCXXABI::Fuchsia:
31 case clang::TargetCXXABI::GenericAArch64:
32 case clang::TargetCXXABI::GenericARM:
33 case clang::TargetCXXABI::iOS:
34 case clang::TargetCXXABI::WatchOS:
35 case clang::TargetCXXABI::GenericMIPS:
36 case clang::TargetCXXABI::GenericItanium:
37 case clang::TargetCXXABI::WebAssembly:
38 case clang::TargetCXXABI::XL:
40 case clang::TargetCXXABI::Microsoft:
41 llvm_unreachable(
"Windows ABI NYI");
44 llvm_unreachable(
"invalid C++ ABI kind");
47static std::unique_ptr<TargetLoweringInfo>
50 return std::make_unique<TargetLoweringInfo>();
55 mlir::ModuleOp &module,
56 std::unique_ptr<clang::TargetInfo> target,
57 mlir::PatternRewriter &rewriter)
62 if (!targetLoweringInfo)
64 return *targetLoweringInfo;
68std::unique_ptr<LowerModule>
71 llvm::Triple triple(mlir::cast<mlir::StringAttr>(
72 module->getAttr(cir::CIRDialect::getTripleAttrName()))
75 targetOptions.
Triple = triple.str();
89 if (
auto optInfo = mlir::cast_if_present<cir::OptInfoAttr>(
90 module->getAttr(cir::CIRDialect::getOptInfoAttrName()))) {
91 codeGenOpts.OptimizationLevel = optInfo.getLevel();
92 codeGenOpts.OptimizeSize = optInfo.getSize();
95 return std::make_unique<LowerModule>(std::move(langOpts),
96 std::move(codeGenOpts), module,
97 std::move(targetInfo), rewriter);
Defines the clang::LangOptions interface.
Defines the clang::TargetOptions class.
clang::TargetCXXABI::Kind getCXXABIKind() const
LowerModule(clang::LangOptions langOpts, clang::CodeGenOptions codeGenOpts, mlir::ModuleOp &module, std::unique_ptr< clang::TargetInfo > target, mlir::PatternRewriter &rewriter)
const TargetLoweringInfo & getTargetLoweringInfo()
CodeGenOptions - Track various options which control how the code is optimized and passed to the back...
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Options for controlling the target.
std::string Triple
The name of the target triple to compile for.
Defines the clang::TargetInfo interface.
static std::unique_ptr< TargetLoweringInfo > createTargetLoweringInfo(LowerModule &lm)
std::unique_ptr< CIRCXXABI > createItaniumCXXABI(LowerModule &lm)
Creates an Itanium-family ABI.
std::unique_ptr< LowerModule > createLowerModule(mlir::ModuleOp module, mlir::PatternRewriter &rewriter)
static std::unique_ptr< CIRCXXABI > createCXXABI(LowerModule &lm)
std::unique_ptr< clang::TargetInfo > AllocateTarget(const llvm::Triple &Triple, const clang::TargetOptions &Opts)
static bool lowerModuleLangOpts()
static bool lowerModuleCodeGenOpts()
static bool targetLoweringInfo()