LLVM 24.0.0git
M68kRegisterInfo.h
Go to the documentation of this file.
1//===-- M68kRegisterInfo.h - M68k Register Information Impl -----*- 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/// \file
10/// This file contains the M68k implementation of the TargetRegisterInfo
11/// class.
12///
13//===----------------------------------------------------------------------===//
14
15#ifndef LLVM_LIB_TARGET_M68K_M68KREGISTERINFO_H
16#define LLVM_LIB_TARGET_M68K_M68KREGISTERINFO_H
17
18#include "M68k.h"
19
21
22#define GET_REGINFO_HEADER
23#include "M68kGenRegisterInfo.inc"
24
25namespace llvm {
26class M68kSubtarget;
27
29 virtual void anchor();
30
31 /// Physical register used as stack ptr.
32 unsigned StackPtr;
33
34 /// Physical register used as frame ptr.
35 unsigned FramePtr;
36
37 /// Physical register used as a base ptr in complex stack frames. I.e., when
38 /// we need a 3rd base, not just SP and FP, due to variable size stack
39 /// objects.
40 unsigned BasePtr;
41
42 /// Physical register used to store GOT address if needed.
43 unsigned GlobalBasePtr;
44
45protected:
47
48public:
50
51 const MCPhysReg *getCalleeSavedRegs(const MachineFunction *MF) const override;
52
54 CallingConv::ID) const override;
55
56 /// Returns a register class with registers that can be used in forming tail
57 /// calls.
59 getRegsForTailCall(const MachineFunction &MF) const;
60
61 /// Return a mega-register of the specified register Reg so its sub-register
62 /// of index SubIdx is Reg, its super(or mega) Reg. In other words it will
63 /// return a register that is not direct super register but still shares
64 /// physical register with Reg.
65 /// NOTE not sure about the term though.
66 unsigned getMatchingMegaReg(unsigned Reg,
67 const TargetRegisterClass *RC) const;
68
69 /// Returns the Register Class of a physical register of the given type,
70 /// picking the biggest register class of the right type that contains this
71 /// physreg.
72 const TargetRegisterClass *getMaximalPhysRegClass(unsigned reg, MVT VT) const;
73
74 /// Return index of a register within a register class, otherwise return -1
75 int getRegisterOrder(unsigned Reg, const TargetRegisterClass &TRC) const;
76
77 /// Return spill order index of a register, if there is none then trap
78 int getSpillRegisterOrder(unsigned Reg) const;
79
80 BitVector getReservedRegs(const MachineFunction &MF) const override;
81
82 bool requiresRegisterScavenging(const MachineFunction &MF) const override;
83
84 bool trackLivenessAfterRegAlloc(const MachineFunction &MF) const override;
85
86 /// FrameIndex represent objects inside a abstract stack. We must replace
87 /// FrameIndex with an stack/frame pointer direct reference.
89 unsigned FIOperandNum,
90 RegScavenger *RS = nullptr) const override;
91
92 bool hasBasePointer(const MachineFunction &MF) const;
93
94 /// True if the stack can be realigned for the target.
95 bool canRealignStack(const MachineFunction &MF) const override;
96
97 Register getFrameRegister(const MachineFunction &MF) const override;
98
100 getCrossCopyRegClass(const TargetRegisterClass *RC) const override {
101 if (RC == &M68k::CCRCRegClass)
102 return &M68k::DR16RegClass;
103 return RC;
104 }
105
106 unsigned getStackRegister() const { return StackPtr; }
107 unsigned getBaseRegister() const { return BasePtr; }
108 unsigned getGlobalBaseRegister() const { return GlobalBasePtr; }
109
110 const TargetRegisterClass *intRegClass(unsigned Size) const;
111};
112
113} // end namespace llvm
114
115#endif // LLVM_LIB_TARGET_M68K_M68KREGISTERINFO_H
This file contains the entry points for global functions defined in the M68k target library,...
Register Reg
uint64_t IntrinsicInst * II
unsigned getMatchingMegaReg(unsigned Reg, const TargetRegisterClass *RC) const
Return a mega-register of the specified register Reg so its sub-register of index SubIdx is Reg,...
const uint32_t * getCallPreservedMask(const MachineFunction &MF, CallingConv::ID) const override
const TargetRegisterClass * intRegClass(unsigned Size) const
Register getFrameRegister(const MachineFunction &MF) const override
unsigned getBaseRegister() const
M68kRegisterInfo(const M68kSubtarget &Subtarget)
const TargetRegisterClass * getCrossCopyRegClass(const TargetRegisterClass *RC) const override
bool trackLivenessAfterRegAlloc(const MachineFunction &MF) const override
int getSpillRegisterOrder(unsigned Reg) const
Return spill order index of a register, if there is none then trap.
bool requiresRegisterScavenging(const MachineFunction &MF) const override
const TargetRegisterClass * getRegsForTailCall(const MachineFunction &MF) const
Returns a register class with registers that can be used in forming tail calls.
unsigned getGlobalBaseRegister() const
const M68kSubtarget & Subtarget
const TargetRegisterClass * getMaximalPhysRegClass(unsigned reg, MVT VT) const
Returns the Register Class of a physical register of the given type, picking the biggest register cla...
int getRegisterOrder(unsigned Reg, const TargetRegisterClass &TRC) const
Return index of a register within a register class, otherwise return -1.
bool hasBasePointer(const MachineFunction &MF) const
bool eliminateFrameIndex(MachineBasicBlock::iterator II, int SPAdj, unsigned FIOperandNum, RegScavenger *RS=nullptr) const override
FrameIndex represent objects inside a abstract stack.
bool canRealignStack(const MachineFunction &MF) const override
True if the stack can be realigned for the target.
const MCPhysReg * getCalleeSavedRegs(const MachineFunction *MF) const override
unsigned getStackRegister() const
BitVector getReservedRegs(const MachineFunction &MF) const override
Machine Value Type.
MachineInstrBundleIterator< MachineInstr > iterator
Wrapper class representing virtual and physical registers.
Definition Register.h:20
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition CallingConv.h:24
This is an optimization pass for GlobalISel generic memory operations.
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
Definition MCRegister.h:21
MCRegisterClass TargetRegisterClass
Definition FastISel.h:58