|
| 1 | +//===- AArch64.cpp --------------------------------------------------------===// |
| 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 | +#include "clang/CIR/Target/AArch64.h" |
| 10 | +#include "ABIInfoImpl.h" |
| 11 | +#include "LowerFunctionInfo.h" |
| 12 | +#include "LowerTypes.h" |
| 13 | +#include "TargetInfo.h" |
| 14 | +#include "TargetLoweringInfo.h" |
| 15 | +#include "clang/CIR/ABIArgInfo.h" |
| 16 | +#include "clang/CIR/Dialect/IR/CIRTypes.h" |
| 17 | +#include "clang/CIR/MissingFeatures.h" |
| 18 | +#include "llvm/Support/ErrorHandling.h" |
| 19 | + |
| 20 | +using AArch64ABIKind = ::cir::AArch64ABIKind; |
| 21 | +using ABIArgInfo = ::cir::ABIArgInfo; |
| 22 | +using MissingFeature = ::cir::MissingFeatures; |
| 23 | + |
| 24 | +namespace mlir { |
| 25 | +namespace cir { |
| 26 | + |
| 27 | +//===----------------------------------------------------------------------===// |
| 28 | +// AArch64 ABI Implementation |
| 29 | +//===----------------------------------------------------------------------===// |
| 30 | + |
| 31 | +namespace { |
| 32 | + |
| 33 | +class AArch64ABIInfo : public ABIInfo { |
| 34 | + AArch64ABIKind Kind; |
| 35 | + |
| 36 | +public: |
| 37 | + AArch64ABIInfo(LowerTypes &CGT, AArch64ABIKind Kind) |
| 38 | + : ABIInfo(CGT), Kind(Kind) {} |
| 39 | + |
| 40 | +private: |
| 41 | + AArch64ABIKind getABIKind() const { return Kind; } |
| 42 | + |
| 43 | + ABIArgInfo classifyReturnType(Type RetTy, bool IsVariadic) const; |
| 44 | + |
| 45 | + void computeInfo(LowerFunctionInfo &FI) const override { |
| 46 | + if (!::mlir::cir::classifyReturnType(getCXXABI(), FI, *this)) |
| 47 | + FI.getReturnInfo() = |
| 48 | + classifyReturnType(FI.getReturnType(), FI.isVariadic()); |
| 49 | + |
| 50 | + for (auto &_ : FI.arguments()) |
| 51 | + llvm_unreachable("NYI"); |
| 52 | + } |
| 53 | +}; |
| 54 | + |
| 55 | +class AArch64TargetLoweringInfo : public TargetLoweringInfo { |
| 56 | +public: |
| 57 | + AArch64TargetLoweringInfo(LowerTypes <, AArch64ABIKind Kind) |
| 58 | + : TargetLoweringInfo(std::make_unique<AArch64ABIInfo>(LT, Kind)) { |
| 59 | + assert(!MissingFeature::swift()); |
| 60 | + } |
| 61 | +}; |
| 62 | + |
| 63 | +} // namespace |
| 64 | + |
| 65 | +ABIArgInfo AArch64ABIInfo::classifyReturnType(Type RetTy, |
| 66 | + bool IsVariadic) const { |
| 67 | + if (RetTy.isa<VoidType>()) |
| 68 | + return ABIArgInfo::getIgnore(); |
| 69 | + |
| 70 | + llvm_unreachable("NYI"); |
| 71 | +} |
| 72 | + |
| 73 | +std::unique_ptr<TargetLoweringInfo> |
| 74 | +createAArch64TargetLoweringInfo(LowerModule &CGM, AArch64ABIKind Kind) { |
| 75 | + return std::make_unique<AArch64TargetLoweringInfo>(CGM.getTypes(), Kind); |
| 76 | +} |
| 77 | + |
| 78 | +} // namespace cir |
| 79 | +} // namespace mlir |
0 commit comments