clang 24.0.0git
AArch64.cpp
Go to the documentation of this file.
1//===---- AArch64.cpp - AArch64-specific CIR CodeGen ----------------------===//
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//
9// This provides AArch64-specific CIR CodeGen logic.
10//
11//===----------------------------------------------------------------------===//
12
13#include "ABIInfo.h"
14#include "CIRGenFunction.h"
15#include "CIRGenModule.h"
16#include "TargetInfo.h"
17#include "clang/AST/Decl.h"
20
21using namespace clang;
22using namespace clang::CIRGen;
23
24namespace {
25
26class AArch64ABIInfo : public ABIInfo {
27public:
28 AArch64ABIInfo(CIRGenTypes &cgt) : ABIInfo(cgt) {}
29};
30
31class AArch64TargetCIRGenInfo : public TargetCIRGenInfo {
32public:
33 AArch64TargetCIRGenInfo(CIRGenTypes &cgt)
34 : TargetCIRGenInfo(std::make_unique<AArch64ABIInfo>(cgt)) {}
35
36 void setTargetAttributes(const Decl *d, mlir::Operation *gv,
37 CIRGenModule &cgm) const override {
38 auto fn = mlir::dyn_cast<cir::FuncOp>(gv);
39 if (!fn)
40 return;
43 }
44
45 bool isScalarizableAsmOperand(CIRGenFunction &cgf,
46 mlir::Type ty) const override {
47 if (cgf.getTarget().hasFeature("ls64")) {
48 cgf.cgm.errorNYI("AArch64 LS64 scalarizable asm operand");
49 return true;
50 }
52 }
53
54 bool wouldInliningViolateFunctionCallABI(
55 const FunctionDecl *caller, const FunctionDecl *callee) const override;
56};
57
58} // namespace
59
60bool AArch64TargetCIRGenInfo::wouldInliningViolateFunctionCallABI(
61 const FunctionDecl *caller, const FunctionDecl *callee) const {
62 return caller && callee &&
64 CodeGenUtils::ArmSMEInlinability::Ok;
65}
66
67std::unique_ptr<TargetCIRGenInfo>
69 return std::make_unique<AArch64TargetCIRGenInfo>(cgt);
70}
const TargetInfo & getTarget() const
DiagnosticBuilder errorNYI(SourceLocation, llvm::StringRef)
Helpers to emit "not yet implemented" error diagnostics.
This class organizes the cross-module state that is used while lowering AST types to CIR types.
Definition CIRGenTypes.h:51
virtual bool isScalarizableAsmOperand(CIRGenFunction &cgf, mlir::Type ty) const
Definition TargetInfo.h:164
Represents a function declaration or definition.
Definition Decl.h:2059
virtual bool hasFeature(StringRef Feature) const
Determine whether the given target has the given feature.
@ Decl
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
std::unique_ptr< TargetCIRGenInfo > createAArch64TargetCIRGenInfo(CIRGenTypes &cgt)
Definition AArch64.cpp:68
ArmSMEInlinability getArmSMEInlinability(const FunctionDecl *Caller, const FunctionDecl *Callee)
Determines if there are any Arm SME ABI issues with inlining Callee into Caller.
Top level wrappers for InstallAPI frontend operations.
static bool branchProtection()
static bool pointerAuthentication()