Adding register and instruction information
The target description captures most information about registers and instructions. To access that information, we must implement the M88kRegisterInfo
and M88kInstrInfo
classes. These classes also contain hooks that we can override to accomplish tasks that are too complex to express in the target description. Let’s begin with the M88kRegisterInfo
class, which is declared in the M88kRegisterInfo.h
file:
- The header file begins by including the code generated from the target description:
#define GET_REGINFO_HEADER #include "M88kGenRegisterInfo.inc"
- After that, we must declare the
M88kRegisterInfo
class in thellvm
namespace. We only override a couple of methods:namespace llvm { struct M88kRegisterInfo : public M88kGenRegisterInfo { M88kRegisterInfo(); const MCPhysReg *getCalleeSavedRegs( const MachineFunction *MF) const override; BitVector getReservedRegs...