LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
X86RegisterInfo.h
Go to the documentation of this file.
1 //===-- X86RegisterInfo.h - X86 Register Information Impl -------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file contains the X86 implementation of the TargetRegisterInfo class.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef X86REGISTERINFO_H
15 #define X86REGISTERINFO_H
16 
18 
19 #define GET_REGINFO_HEADER
20 #include "X86GenRegisterInfo.inc"
21 
22 namespace llvm {
23  class Type;
24  class TargetInstrInfo;
25  class X86TargetMachine;
26 
28 public:
30 
31 private:
32  /// Is64Bit - Is the target 64-bits.
33  ///
34  bool Is64Bit;
35 
36  /// IsWin64 - Is the target on of win64 flavours
37  ///
38  bool IsWin64;
39 
40  /// SlotSize - Stack slot size in bytes.
41  ///
42  unsigned SlotSize;
43 
44  /// StackPtr - X86 physical register used as stack ptr.
45  ///
46  unsigned StackPtr;
47 
48  /// FramePtr - X86 physical register used as frame ptr.
49  ///
50  unsigned FramePtr;
51 
52  /// BasePtr - X86 physical register used as a base ptr in complex stack
53  /// frames. I.e., when we need a 3rd base, not just SP and FP, due to
54  /// variable size stack objects.
55  unsigned BasePtr;
56 
57 public:
59 
60  // FIXME: This should be tablegen'd like getDwarfRegNum is
61  int getSEHRegNum(unsigned i) const;
62 
63  /// getCompactUnwindRegNum - This function maps the register to the number for
64  /// compact unwind encoding. Return -1 if the register isn't valid.
65  int getCompactUnwindRegNum(unsigned RegNum, bool isEH) const;
66 
67  /// Code Generation virtual methods...
68  ///
69  virtual bool trackLivenessAfterRegAlloc(const MachineFunction &MF) const;
70 
71  /// getMatchingSuperRegClass - Return a subclass of the specified register
72  /// class A so that each register in it has a sub-register of the
73  /// specified sub-register index which is in the specified register class B.
74  virtual const TargetRegisterClass *
76  const TargetRegisterClass *B, unsigned Idx) const;
77 
78  virtual const TargetRegisterClass *
79  getSubClassWithSubReg(const TargetRegisterClass *RC, unsigned Idx) const;
80 
81  const TargetRegisterClass*
83 
84  /// getPointerRegClass - Returns a TargetRegisterClass used for pointer
85  /// values.
86  const TargetRegisterClass *
87  getPointerRegClass(const MachineFunction &MF, unsigned Kind = 0) const;
88 
89  /// getCrossCopyRegClass - Returns a legal register class to copy a register
90  /// in the specified class to or from. Returns NULL if it is possible to copy
91  /// between a two registers of the specified class.
92  const TargetRegisterClass *
94 
95  unsigned getRegPressureLimit(const TargetRegisterClass *RC,
96  MachineFunction &MF) const;
97 
98  /// getCalleeSavedRegs - Return a null-terminated list of all of the
99  /// callee-save registers on this target.
100  const uint16_t *getCalleeSavedRegs(const MachineFunction* MF = 0) const;
101  const uint32_t *getCallPreservedMask(CallingConv::ID) const;
102  const uint32_t *getNoPreservedMask() const;
103 
104  /// getReservedRegs - Returns a bitset indexed by physical register number
105  /// indicating if a register is a special register that has particular uses and
106  /// should be considered unavailable at all times, e.g. SP, RA. This is used by
107  /// register scavenger to determine what registers are free.
108  BitVector getReservedRegs(const MachineFunction &MF) const;
109 
110  bool hasBasePointer(const MachineFunction &MF) const;
111 
112  bool canRealignStack(const MachineFunction &MF) const;
113 
114  bool needsStackRealignment(const MachineFunction &MF) const;
115 
116  bool hasReservedSpillSlot(const MachineFunction &MF, unsigned Reg,
117  int &FrameIdx) const;
118 
120  int SPAdj, unsigned FIOperandNum,
121  RegScavenger *RS = NULL) const;
122 
123  // Debug information queries.
124  unsigned getFrameRegister(const MachineFunction &MF) const;
125  unsigned getStackRegister() const { return StackPtr; }
126  unsigned getBaseRegister() const { return BasePtr; }
127  // FIXME: Move to FrameInfok
128  unsigned getSlotSize() const { return SlotSize; }
129 };
130 
131 // getX86SubSuperRegister - X86 utility function. It returns the sub or super
132 // register of a specific X86 register.
133 // e.g. getX86SubSuperRegister(X86::EAX, MVT::i16) return X86:AX
134 unsigned getX86SubSuperRegister(unsigned, MVT::SimpleValueType, bool High=false);
135 
136 //get512BitRegister - X86 utility - returns 512-bit super register
137 unsigned get512BitSuperRegister(unsigned Reg);
138 
139 } // End llvm namespace
140 
141 #endif
X86RegisterInfo(X86TargetMachine &tm)
COFF::RelocationTypeX86 Type
Definition: COFFYAML.cpp:227
const TargetRegisterClass * getLargestLegalSuperClass(const TargetRegisterClass *RC) const
bool hasBasePointer(const MachineFunction &MF) const
unsigned getFrameRegister(const MachineFunction &MF) const
const uint32_t * getCallPreservedMask(CallingConv::ID) const
const TargetRegisterClass * getCrossCopyRegClass(const TargetRegisterClass *RC) const
bool needsStackRealignment(const MachineFunction &MF) const
ID
LLVM Calling Convention Representation.
Definition: CallingConv.h:26
bool canRealignStack(const MachineFunction &MF) const
unsigned getX86SubSuperRegister(unsigned Reg, MVT::SimpleValueType VT, bool High)
bundle_iterator< MachineInstr, instr_iterator > iterator
unsigned get512BitSuperRegister(unsigned Reg)
BitVector getReservedRegs(const MachineFunction &MF) const
bool hasReservedSpillSlot(const MachineFunction &MF, unsigned Reg, int &FrameIdx) const
virtual const TargetRegisterClass * getSubClassWithSubReg(const TargetRegisterClass *RC, unsigned Idx) const
unsigned getBaseRegister() const
unsigned getStackRegister() const
int getSEHRegNum(unsigned i) const
int getCompactUnwindRegNum(unsigned RegNum, bool isEH) const
virtual bool trackLivenessAfterRegAlloc(const MachineFunction &MF) const
const uint32_t * getNoPreservedMask() const
const TargetRegisterClass * getPointerRegClass(const MachineFunction &MF, unsigned Kind=0) const
unsigned getSlotSize() const
const uint16_t * getCalleeSavedRegs(const MachineFunction *MF=0) const
virtual const TargetRegisterClass * getMatchingSuperRegClass(const TargetRegisterClass *A, const TargetRegisterClass *B, unsigned Idx) const
void eliminateFrameIndex(MachineBasicBlock::iterator MI, int SPAdj, unsigned FIOperandNum, RegScavenger *RS=NULL) const
unsigned getRegPressureLimit(const TargetRegisterClass *RC, MachineFunction &MF) const
X86TargetMachine & TM