17fa27ce4SDimitry Andric //=- RISCVMachineFunctionInfo.cpp - RISC-V machine function info --*- C++ -*-=//
2145449b1SDimitry Andric //
3145449b1SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4145449b1SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
5145449b1SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6145449b1SDimitry Andric //
7145449b1SDimitry Andric //===----------------------------------------------------------------------===//
8145449b1SDimitry Andric //
9145449b1SDimitry Andric // This file declares RISCV-specific per-machine-function information.
10145449b1SDimitry Andric //
11145449b1SDimitry Andric //===----------------------------------------------------------------------===//
12145449b1SDimitry Andric
13145449b1SDimitry Andric #include "RISCVMachineFunctionInfo.h"
14145449b1SDimitry Andric
15145449b1SDimitry Andric using namespace llvm;
16145449b1SDimitry Andric
RISCVMachineFunctionInfo(const llvm::RISCVMachineFunctionInfo & MFI)17145449b1SDimitry Andric yaml::RISCVMachineFunctionInfo::RISCVMachineFunctionInfo(
18145449b1SDimitry Andric const llvm::RISCVMachineFunctionInfo &MFI)
19145449b1SDimitry Andric : VarArgsFrameIndex(MFI.getVarArgsFrameIndex()),
20145449b1SDimitry Andric VarArgsSaveSize(MFI.getVarArgsSaveSize()) {}
21145449b1SDimitry Andric
clone(BumpPtrAllocator & Allocator,MachineFunction & DestMF,const DenseMap<MachineBasicBlock *,MachineBasicBlock * > & Src2DstMBB) const22145449b1SDimitry Andric MachineFunctionInfo *RISCVMachineFunctionInfo::clone(
23145449b1SDimitry Andric BumpPtrAllocator &Allocator, MachineFunction &DestMF,
24145449b1SDimitry Andric const DenseMap<MachineBasicBlock *, MachineBasicBlock *> &Src2DstMBB)
25145449b1SDimitry Andric const {
26145449b1SDimitry Andric return DestMF.cloneInfo<RISCVMachineFunctionInfo>(*this);
27145449b1SDimitry Andric }
28145449b1SDimitry Andric
mappingImpl(yaml::IO & YamlIO)29145449b1SDimitry Andric void yaml::RISCVMachineFunctionInfo::mappingImpl(yaml::IO &YamlIO) {
30145449b1SDimitry Andric MappingTraits<RISCVMachineFunctionInfo>::mapping(YamlIO, *this);
31145449b1SDimitry Andric }
32145449b1SDimitry Andric
initializeBaseYamlFields(const yaml::RISCVMachineFunctionInfo & YamlMFI)33145449b1SDimitry Andric void RISCVMachineFunctionInfo::initializeBaseYamlFields(
34145449b1SDimitry Andric const yaml::RISCVMachineFunctionInfo &YamlMFI) {
35145449b1SDimitry Andric VarArgsFrameIndex = YamlMFI.VarArgsFrameIndex;
36145449b1SDimitry Andric VarArgsSaveSize = YamlMFI.VarArgsSaveSize;
37145449b1SDimitry Andric }
38e3b55780SDimitry Andric
addSExt32Register(Register Reg)39e3b55780SDimitry Andric void RISCVMachineFunctionInfo::addSExt32Register(Register Reg) {
40e3b55780SDimitry Andric SExt32Registers.push_back(Reg);
41e3b55780SDimitry Andric }
42e3b55780SDimitry Andric
isSExt32Register(Register Reg) const43e3b55780SDimitry Andric bool RISCVMachineFunctionInfo::isSExt32Register(Register Reg) const {
44e3b55780SDimitry Andric return is_contained(SExt32Registers, Reg);
45e3b55780SDimitry Andric }
46