Add gfx950 mfma instructions to ROCDL dialect (#123361)
[llvm-project.git] / llvm / lib / Target / ARM / ARMMachineFunctionInfo.cpp
blob3ec40b11ac87097992e84c9afa7c46b2510177ba
1 //===-- ARMMachineFunctionInfo.cpp - ARM machine function info ------------===//
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 //===----------------------------------------------------------------------===//
9 #include "ARMMachineFunctionInfo.h"
10 #include "ARMSubtarget.h"
12 using namespace llvm;
14 void ARMFunctionInfo::anchor() {}
16 yaml::ARMFunctionInfo::ARMFunctionInfo(const llvm::ARMFunctionInfo &MFI)
17 : LRSpilled(MFI.isLRSpilled()) {}
19 void yaml::ARMFunctionInfo::mappingImpl(yaml::IO &YamlIO) {
20 MappingTraits<ARMFunctionInfo>::mapping(YamlIO, *this);
23 void ARMFunctionInfo::initializeBaseYamlFields(
24 const yaml::ARMFunctionInfo &YamlMFI) {
25 LRSpilled = YamlMFI.LRSpilled;
28 static bool GetBranchTargetEnforcement(const Function &F,
29 const ARMSubtarget *Subtarget) {
30 if (!Subtarget->isMClass() || !Subtarget->hasV7Ops())
31 return false;
33 return F.hasFnAttribute("branch-target-enforcement");
36 // The pair returns values for the ARMFunctionInfo members
37 // SignReturnAddress and SignReturnAddressAll respectively.
38 static std::pair<bool, bool> GetSignReturnAddress(const Function &F) {
39 if (!F.hasFnAttribute("sign-return-address")) {
40 return {false, false};
43 StringRef Scope = F.getFnAttribute("sign-return-address").getValueAsString();
44 if (Scope == "none")
45 return {false, false};
47 if (Scope == "all")
48 return {true, true};
50 assert(Scope == "non-leaf");
51 return {true, false};
54 ARMFunctionInfo::ARMFunctionInfo(const Function &F,
55 const ARMSubtarget *Subtarget)
56 : isThumb(Subtarget->isThumb()), hasThumb2(Subtarget->hasThumb2()),
57 IsCmseNSEntry(F.hasFnAttribute("cmse_nonsecure_entry")),
58 IsCmseNSCall(F.hasFnAttribute("cmse_nonsecure_call")),
59 BranchTargetEnforcement(GetBranchTargetEnforcement(F, Subtarget)) {
60 if (Subtarget->isMClass() && Subtarget->hasV7Ops())
61 std::tie(SignReturnAddress, SignReturnAddressAll) = GetSignReturnAddress(F);
64 MachineFunctionInfo *
65 ARMFunctionInfo::clone(BumpPtrAllocator &Allocator, MachineFunction &DestMF,
66 const DenseMap<MachineBasicBlock *, MachineBasicBlock *>
67 &Src2DstMBB) const {
68 return DestMF.cloneInfo<ARMFunctionInfo>(*this);