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 struct X86RegisterInfo : public X86GenRegisterInfo {
27 const TargetInstrInfo &TII;
29 /// Is64Bit - Is the target 64-bits.
32 /// SlotSize - Stack slot size in bytes.
35 /// StackPtr - X86 physical register used as stack ptr.
38 /// FramePtr - X86 physical register used as frame ptr.
42 X86RegisterInfo(X86TargetMachine &tm, const TargetInstrInfo &tii);
44 /// Code Generation virtual methods...
45 void storeRegToStackSlot(MachineBasicBlock &MBB,
46 MachineBasicBlock::iterator MI,
47 unsigned SrcReg, int FrameIndex,
48 const TargetRegisterClass *RC) const;
50 void loadRegFromStackSlot(MachineBasicBlock &MBB,
51 MachineBasicBlock::iterator MI,
52 unsigned DestReg, int FrameIndex,
53 const TargetRegisterClass *RC) const;
55 void copyRegToReg(MachineBasicBlock &MBB,
56 MachineBasicBlock::iterator MI,
57 unsigned DestReg, unsigned SrcReg,
58 const TargetRegisterClass *RC) const;
60 /// foldMemoryOperand - If this target supports it, fold a load or store of
61 /// the specified stack slot into the specified machine instruction for the
62 /// specified operand. If this is possible, the target should perform the
63 /// folding and return true, otherwise it should return false. If it folds
64 /// the instruction, it is likely that the MachineInstruction the iterator
65 /// references has been changed.
66 MachineInstr* foldMemoryOperand(MachineInstr* MI,
68 int FrameIndex) const;
70 /// getCalleeSaveRegs - Return a null-terminated list of all of the
71 /// callee-save registers on this target.
72 const unsigned *getCalleeSaveRegs() const;
74 /// getCalleeSaveRegClasses - Return a null-terminated list of the preferred
75 /// register classes to spill each callee-saved register with. The order and
76 /// length of this list match the getCalleeSaveRegs() list.
77 const TargetRegisterClass* const* getCalleeSaveRegClasses() const;
79 void eliminateCallFramePseudoInstr(MachineFunction &MF,
80 MachineBasicBlock &MBB,
81 MachineBasicBlock::iterator MI) const;
83 void eliminateFrameIndex(MachineBasicBlock::iterator MI) const;
85 void processFunctionBeforeFrameFinalized(MachineFunction &MF) const;
87 void emitPrologue(MachineFunction &MF) const;
88 void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const;
90 // Debug information queries.
91 unsigned getRARegister() const;
92 unsigned getFrameRegister(MachineFunction &MF) const;
95 // getX86SubSuperRegister - X86 utility function. It returns the sub or super
96 // register of a specific X86 register.
97 // e.g. getX86SubSuperRegister(X86::EAX, MVT::i16) return X86:AX
98 unsigned getX86SubSuperRegister(unsigned, MVT::ValueType, bool High=false);
100 } // End llvm namespace