Path: blob/main/contrib/llvm-project/llvm/lib/Target/M68k/M68kRegisterInfo.h
96353 views
//===-- M68kRegisterInfo.h - M68k Register Information Impl -----*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7///8/// \file9/// This file contains the M68k implementation of the TargetRegisterInfo10/// class.11///12//===----------------------------------------------------------------------===//1314#ifndef LLVM_LIB_TARGET_M68K_M68KREGISTERINFO_H15#define LLVM_LIB_TARGET_M68K_M68KREGISTERINFO_H1617#include "M68k.h"1819#include "llvm/CodeGen/TargetRegisterInfo.h"2021#define GET_REGINFO_HEADER22#include "M68kGenRegisterInfo.inc"2324namespace llvm {25class M68kSubtarget;26class TargetInstrInfo;27class Type;2829class M68kRegisterInfo : public M68kGenRegisterInfo {30virtual void anchor();3132/// Physical register used as stack ptr.33unsigned StackPtr;3435/// Physical register used as frame ptr.36unsigned FramePtr;3738/// Physical register used as a base ptr in complex stack frames. I.e., when39/// we need a 3rd base, not just SP and FP, due to variable size stack40/// objects.41unsigned BasePtr;4243/// Physical register used to store GOT address if needed.44unsigned GlobalBasePtr;4546protected:47const M68kSubtarget &Subtarget;4849public:50M68kRegisterInfo(const M68kSubtarget &Subtarget);5152const MCPhysReg *getCalleeSavedRegs(const MachineFunction *MF) const override;5354const uint32_t *getCallPreservedMask(const MachineFunction &MF,55CallingConv::ID) const override;5657/// Returns a register class with registers that can be used in forming tail58/// calls.59const TargetRegisterClass *60getRegsForTailCall(const MachineFunction &MF) const;6162/// Return a mega-register of the specified register Reg so its sub-register63/// of index SubIdx is Reg, its super(or mega) Reg. In other words it will64/// return a register that is not direct super register but still shares65/// physical register with Reg.66/// NOTE not sure about the term though.67unsigned getMatchingMegaReg(unsigned Reg,68const TargetRegisterClass *RC) const;6970/// Returns the Register Class of a physical register of the given type,71/// picking the biggest register class of the right type that contains this72/// physreg.73const TargetRegisterClass *getMaximalPhysRegClass(unsigned reg, MVT VT) const;7475/// Return index of a register within a register class, otherwise return -176int getRegisterOrder(unsigned Reg, const TargetRegisterClass &TRC) const;7778/// Return spill order index of a register, if there is none then trap79int getSpillRegisterOrder(unsigned Reg) const;8081BitVector getReservedRegs(const MachineFunction &MF) const override;8283bool requiresRegisterScavenging(const MachineFunction &MF) const override;8485bool trackLivenessAfterRegAlloc(const MachineFunction &MF) const override;8687/// FrameIndex represent objects inside a abstract stack. We must replace88/// FrameIndex with an stack/frame pointer direct reference.89bool eliminateFrameIndex(MachineBasicBlock::iterator II, int SPAdj,90unsigned FIOperandNum,91RegScavenger *RS = nullptr) const override;9293bool hasBasePointer(const MachineFunction &MF) const;9495/// True if the stack can be realigned for the target.96bool canRealignStack(const MachineFunction &MF) const override;9798Register getFrameRegister(const MachineFunction &MF) const override;99100const TargetRegisterClass *101getCrossCopyRegClass(const TargetRegisterClass *RC) const override {102if (RC == &M68k::CCRCRegClass)103return &M68k::DR32RegClass;104return RC;105}106107unsigned getStackRegister() const { return StackPtr; }108unsigned getBaseRegister() const { return BasePtr; }109unsigned getGlobalBaseRegister() const { return GlobalBasePtr; }110111const TargetRegisterClass *intRegClass(unsigned Size) const;112};113114} // end namespace llvm115116#endif // LLVM_LIB_TARGET_M68K_M68KREGISTERINFO_H117118119