16#include "mlir/IR/BuiltinAttributes.h"
17#include "mlir/IR/PatternMatch.h"
22#include "llvm/Support/ErrorHandling.h"
28 case clang::TargetCXXABI::AppleARM64:
29 case clang::TargetCXXABI::Fuchsia:
30 case clang::TargetCXXABI::GenericAArch64:
31 case clang::TargetCXXABI::GenericARM:
32 case clang::TargetCXXABI::iOS:
33 case clang::TargetCXXABI::WatchOS:
34 case clang::TargetCXXABI::GenericMIPS:
35 case clang::TargetCXXABI::GenericItanium:
36 case clang::TargetCXXABI::WebAssembly:
37 case clang::TargetCXXABI::XL:
39 case clang::TargetCXXABI::Microsoft:
40 llvm_unreachable(
"Windows ABI NYI");
43 llvm_unreachable(
"invalid C++ ABI kind");
48 mlir::ModuleOp &module,
49 std::unique_ptr<clang::TargetInfo> target,
50 mlir::PatternRewriter &rewriter)
55std::unique_ptr<LowerModule>
58 llvm::Triple triple(mlir::cast<mlir::StringAttr>(
59 module->getAttr(cir::CIRDialect::getTripleAttrName()))
62 targetOptions.
Triple = triple.str();
76 if (
auto optInfo = mlir::cast_if_present<cir::OptInfoAttr>(
77 module->getAttr(cir::CIRDialect::getOptInfoAttrName()))) {
78 codeGenOpts.OptimizationLevel = optInfo.getLevel();
79 codeGenOpts.OptimizeSize = optInfo.getSize();
82 return std::make_unique<LowerModule>(std::move(langOpts),
83 std::move(codeGenOpts), module,
84 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)
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.
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()