1 //===- X86RegisterInfo.h - X86 Register Information Impl --------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file contains the X86 implementation of the MRegisterInfo class.
12 //===----------------------------------------------------------------------===//
14 #ifndef X86REGISTERINFO_H
15 #define X86REGISTERINFO_H
17 #include "llvm/Target/MRegisterInfo.h"
18 #include "X86GenRegisterInfo.h.inc"
22 class TargetInstrInfo;
23 class X86TargetMachine;
25 class X86RegisterInfo : public X86GenRegisterInfo {
28 const TargetInstrInfo &TII;
31 /// Is64Bit - Is the target 64-bits.
34 /// SlotSize - Stack slot size in bytes.
37 /// StackPtr - X86 physical register used as stack ptr.
40 /// FramePtr - X86 physical register used as frame ptr.
44 X86RegisterInfo(X86TargetMachine &tm, const TargetInstrInfo &tii);
46 /// Code Generation virtual methods...
47 void storeRegToStackSlot(MachineBasicBlock &MBB,
48 MachineBasicBlock::iterator MI,
49 unsigned SrcReg, int FrameIndex,
50 const TargetRegisterClass *RC) const;
52 void loadRegFromStackSlot(MachineBasicBlock &MBB,
53 MachineBasicBlock::iterator MI,
54 unsigned DestReg, int FrameIndex,
55 const TargetRegisterClass *RC) const;
57 void copyRegToReg(MachineBasicBlock &MBB,
58 MachineBasicBlock::iterator MI,
59 unsigned DestReg, unsigned SrcReg,
60 const TargetRegisterClass *RC) const;
62 /// foldMemoryOperand - If this target supports it, fold a load or store of
63 /// the specified stack slot into the specified machine instruction for the
64 /// specified operand. If this is possible, the target should perform the
65 /// folding and return true, otherwise it should return false. If it folds
66 /// the instruction, it is likely that the MachineInstruction the iterator
67 /// references has been changed.
68 MachineInstr* foldMemoryOperand(MachineInstr* MI,
70 int FrameIndex) const;
72 /// getCalleeSavedRegs - Return a null-terminated list of all of the
73 /// callee-save registers on this target.
74 const unsigned *getCalleeSavedRegs() const;
76 /// getCalleeSavedRegClasses - Return a null-terminated list of the preferred
77 /// register classes to spill each callee-saved register with. The order and
78 /// length of this list match the getCalleeSavedRegs() list.
79 const TargetRegisterClass* const* getCalleeSavedRegClasses() const;
81 bool hasFP(const MachineFunction &MF) const;
83 void eliminateCallFramePseudoInstr(MachineFunction &MF,
84 MachineBasicBlock &MBB,
85 MachineBasicBlock::iterator MI) const;
87 void eliminateFrameIndex(MachineBasicBlock::iterator MI) const;
89 void processFunctionBeforeFrameFinalized(MachineFunction &MF) const;
91 void emitPrologue(MachineFunction &MF) const;
92 void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const;
94 // Debug information queries.
95 unsigned getRARegister() const;
96 unsigned getFrameRegister(MachineFunction &MF) const;
99 // getX86SubSuperRegister - X86 utility function. It returns the sub or super
100 // register of a specific X86 register.
101 // e.g. getX86SubSuperRegister(X86::EAX, MVT::i16) return X86:AX
102 unsigned getX86SubSuperRegister(unsigned, MVT::ValueType, bool High=false);
104 } // End llvm namespace