| 1 | //= HexagonMachineFunctionInfo.cpp - Hexagon machine function info *- C++ -*-=// |
|---|---|
| 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 "HexagonMachineFunctionInfo.h" |
| 10 | #include "llvm/CodeGen/MachineRegisterInfo.h" |
| 11 | #include "llvm/CodeGen/TargetRegisterInfo.h" |
| 12 | #include "llvm/Support/raw_ostream.h" |
| 13 | |
| 14 | using namespace llvm; |
| 15 | |
| 16 | // pin vtable to this file |
| 17 | void HexagonMachineFunctionInfo::anchor() {} |
| 18 | |
| 19 | MachineFunctionInfo *HexagonMachineFunctionInfo::clone( |
| 20 | BumpPtrAllocator &Allocator, MachineFunction &DestMF, |
| 21 | const DenseMap<MachineBasicBlock *, MachineBasicBlock *> &Src2DstMBB) |
| 22 | const { |
| 23 | return DestMF.cloneInfo<HexagonMachineFunctionInfo>(Old: *this); |
| 24 | } |
| 25 | |
| 26 | static yaml::StringValue regToString(Register Reg, |
| 27 | const TargetRegisterInfo &TRI) { |
| 28 | yaml::StringValue Dest; |
| 29 | if (Reg.isValid()) { |
| 30 | raw_string_ostream OS(Dest.Value); |
| 31 | OS << printReg(Reg, TRI: &TRI); |
| 32 | } |
| 33 | return Dest; |
| 34 | } |
| 35 | |
| 36 | yaml::HexagonFunctionInfo::HexagonFunctionInfo( |
| 37 | const llvm::HexagonMachineFunctionInfo &MFI, const TargetRegisterInfo &TRI) |
| 38 | : StackAlignBaseReg(regToString(Reg: MFI.getStackAlignBaseReg(), TRI)) {} |
| 39 | |
| 40 | void yaml::HexagonFunctionInfo::mappingImpl(yaml::IO &YamlIO) { |
| 41 | MappingTraits<HexagonFunctionInfo>::mapping(YamlIO, MFI&: *this); |
| 42 | } |
| 43 | |
| 44 | void HexagonMachineFunctionInfo::initializeBaseYamlFields( |
| 45 | const yaml::HexagonFunctionInfo &YamlMFI) {} |
| 46 |