2002-12-28 21:32:54 +01:00
|
|
|
//===- X86RegisterInfo.h - X86 Register Information Impl --------*- C++ -*-===//
|
2005-04-22 01:38:14 +02:00
|
|
|
//
|
2003-10-21 17:17:13 +02:00
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-29 21:36:04 +01:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2005-04-22 01:38:14 +02:00
|
|
|
//
|
2003-10-21 17:17:13 +02:00
|
|
|
//===----------------------------------------------------------------------===//
|
2002-10-26 00:55:53 +02:00
|
|
|
//
|
2008-02-10 19:45:23 +01:00
|
|
|
// This file contains the X86 implementation of the TargetRegisterInfo class.
|
2002-10-26 00:55:53 +02:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef X86REGISTERINFO_H
|
|
|
|
#define X86REGISTERINFO_H
|
|
|
|
|
2008-02-10 19:45:23 +01:00
|
|
|
#include "llvm/Target/TargetRegisterInfo.h"
|
2003-08-03 17:48:14 +02:00
|
|
|
#include "X86GenRegisterInfo.h.inc"
|
2002-12-25 06:06:43 +01:00
|
|
|
|
2003-11-11 23:41:34 +01:00
|
|
|
namespace llvm {
|
2006-09-05 04:12:02 +02:00
|
|
|
class Type;
|
|
|
|
class TargetInstrInfo;
|
2006-09-08 08:48:29 +02:00
|
|
|
class X86TargetMachine;
|
2003-11-11 23:41:34 +01:00
|
|
|
|
2007-08-29 21:01:20 +02:00
|
|
|
/// N86 namespace - Native X86 register numbers
|
|
|
|
///
|
|
|
|
namespace N86 {
|
|
|
|
enum {
|
|
|
|
EAX = 0, ECX = 1, EDX = 2, EBX = 3, ESP = 4, EBP = 5, ESI = 6, EDI = 7
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2007-11-11 20:50:10 +01:00
|
|
|
/// DWARFFlavour - Flavour of dwarf regnumbers
|
|
|
|
///
|
|
|
|
namespace DWARFFlavour {
|
|
|
|
enum {
|
2008-01-25 01:34:13 +01:00
|
|
|
X86_64 = 0, X86_32_DarwinEH = 1, X86_32_Generic = 2
|
2007-11-11 20:50:10 +01:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2006-11-05 20:31:28 +01:00
|
|
|
class X86RegisterInfo : public X86GenRegisterInfo {
|
|
|
|
public:
|
2006-09-08 08:48:29 +02:00
|
|
|
X86TargetMachine &TM;
|
2006-09-05 04:12:02 +02:00
|
|
|
const TargetInstrInfo &TII;
|
2006-11-05 20:31:28 +01:00
|
|
|
|
2006-09-08 08:48:29 +02:00
|
|
|
private:
|
|
|
|
/// Is64Bit - Is the target 64-bits.
|
2007-10-02 01:44:33 +02:00
|
|
|
///
|
2006-09-08 08:48:29 +02:00
|
|
|
bool Is64Bit;
|
|
|
|
|
2008-03-22 22:04:01 +01:00
|
|
|
/// IsWin64 - Is the target on of win64 flavours
|
|
|
|
///
|
|
|
|
bool IsWin64;
|
|
|
|
|
2006-09-08 08:48:29 +02:00
|
|
|
/// SlotSize - Stack slot size in bytes.
|
2007-10-02 01:44:33 +02:00
|
|
|
///
|
2006-09-08 08:48:29 +02:00
|
|
|
unsigned SlotSize;
|
|
|
|
|
2007-11-05 08:30:01 +01:00
|
|
|
/// StackAlign - Default stack alignment.
|
|
|
|
///
|
|
|
|
unsigned StackAlign;
|
|
|
|
|
2006-09-08 08:48:29 +02:00
|
|
|
/// StackPtr - X86 physical register used as stack ptr.
|
2007-10-02 01:44:33 +02:00
|
|
|
///
|
2006-09-08 08:48:29 +02:00
|
|
|
unsigned StackPtr;
|
|
|
|
|
|
|
|
/// FramePtr - X86 physical register used as frame ptr.
|
2007-10-02 01:44:33 +02:00
|
|
|
///
|
2006-09-08 08:48:29 +02:00
|
|
|
unsigned FramePtr;
|
|
|
|
|
|
|
|
public:
|
|
|
|
X86RegisterInfo(X86TargetMachine &tm, const TargetInstrInfo &tii);
|
2002-12-25 06:06:43 +01:00
|
|
|
|
2007-08-29 21:01:20 +02:00
|
|
|
/// getX86RegNum - Returns the native X86 register number for the given LLVM
|
|
|
|
/// register identifier.
|
2008-04-16 22:10:13 +02:00
|
|
|
static unsigned getX86RegNum(unsigned RegNo);
|
2007-08-29 21:01:20 +02:00
|
|
|
|
2008-01-01 22:11:32 +01:00
|
|
|
unsigned getStackAlignment() const { return StackAlign; }
|
|
|
|
|
2007-11-07 01:25:05 +01:00
|
|
|
/// getDwarfRegNum - allows modification of X86GenRegisterInfo::getDwarfRegNum
|
|
|
|
/// (created by TableGen) for target dependencies.
|
2007-11-13 20:13:01 +01:00
|
|
|
int getDwarfRegNum(unsigned RegNum, bool isEH) const;
|
2007-11-07 01:25:05 +01:00
|
|
|
|
2002-12-28 21:32:54 +01:00
|
|
|
/// Code Generation virtual methods...
|
2008-01-05 00:57:37 +01:00
|
|
|
///
|
2008-10-27 08:14:50 +01:00
|
|
|
|
2009-07-18 04:10:10 +02:00
|
|
|
/// getMatchingSuperRegClass - Return a subclass of the specified register
|
|
|
|
/// class A so that each register in it has a sub-register of the
|
|
|
|
/// specified sub-register index which is in the specified register class B.
|
|
|
|
virtual const TargetRegisterClass *
|
|
|
|
getMatchingSuperRegClass(const TargetRegisterClass *A,
|
|
|
|
const TargetRegisterClass *B, unsigned Idx) const;
|
|
|
|
|
2009-02-06 18:43:24 +01:00
|
|
|
/// getPointerRegClass - Returns a TargetRegisterClass used for pointer
|
|
|
|
/// values.
|
2009-07-29 22:31:52 +02:00
|
|
|
const TargetRegisterClass *getPointerRegClass(unsigned Kind = 0) const;
|
2009-02-06 18:43:24 +01:00
|
|
|
|
2008-10-27 08:14:50 +01:00
|
|
|
/// getCrossCopyRegClass - Returns a legal register class to copy a register
|
|
|
|
/// in the specified class to or from. Returns NULL if it is possible to copy
|
|
|
|
/// between a two registers of the specified class.
|
2007-09-26 23:31:07 +02:00
|
|
|
const TargetRegisterClass *
|
|
|
|
getCrossCopyRegClass(const TargetRegisterClass *RC) const;
|
|
|
|
|
2007-01-02 22:33:40 +01:00
|
|
|
/// getCalleeSavedRegs - Return a null-terminated list of all of the
|
2006-05-18 02:12:58 +02:00
|
|
|
/// callee-save registers on this target.
|
2007-07-14 16:06:15 +02:00
|
|
|
const unsigned *getCalleeSavedRegs(const MachineFunction* MF = 0) const;
|
2006-05-18 02:12:58 +02:00
|
|
|
|
2007-02-19 22:49:54 +01:00
|
|
|
/// getReservedRegs - Returns a bitset indexed by physical register number
|
|
|
|
/// indicating if a register is a special register that has particular uses and
|
|
|
|
/// should be considered unavailable at all times, e.g. SP, RA. This is used by
|
|
|
|
/// register scavenger to determine what registers are free.
|
|
|
|
BitVector getReservedRegs(const MachineFunction &MF) const;
|
|
|
|
|
2010-01-19 19:31:11 +01:00
|
|
|
bool canRealignStack(const MachineFunction &MF) const;
|
|
|
|
|
2008-04-23 20:15:48 +02:00
|
|
|
bool needsStackRealignment(const MachineFunction &MF) const;
|
|
|
|
|
2010-07-20 08:52:21 +02:00
|
|
|
bool hasReservedSpillSlot(const MachineFunction &MF, unsigned Reg,
|
2009-07-09 08:53:48 +02:00
|
|
|
int &FrameIdx) const;
|
|
|
|
|
2004-02-14 20:49:54 +01:00
|
|
|
void eliminateCallFramePseudoInstr(MachineFunction &MF,
|
|
|
|
MachineBasicBlock &MBB,
|
|
|
|
MachineBasicBlock::iterator MI) const;
|
2002-12-13 10:54:12 +01:00
|
|
|
|
2010-08-27 01:32:16 +02:00
|
|
|
void eliminateFrameIndex(MachineBasicBlock::iterator MI,
|
|
|
|
int SPAdj, RegScavenger *RS = NULL) const;
|
2002-11-20 19:59:43 +01:00
|
|
|
|
2006-03-28 15:48:33 +02:00
|
|
|
// Debug information queries.
|
2006-04-07 18:34:46 +02:00
|
|
|
unsigned getRARegister() const;
|
2009-11-12 22:00:03 +01:00
|
|
|
unsigned getFrameRegister(const MachineFunction &MF) const;
|
2010-11-15 01:06:54 +01:00
|
|
|
unsigned getStackRegister() const { return StackPtr; }
|
|
|
|
// FIXME: Move to FrameInfok
|
|
|
|
unsigned getSlotSize() const { return SlotSize; }
|
|
|
|
|
2007-02-21 23:54:50 +01:00
|
|
|
// Exception handling queries.
|
|
|
|
unsigned getEHExceptionRegister() const;
|
|
|
|
unsigned getEHHandlerRegister() const;
|
2002-10-26 00:55:53 +02:00
|
|
|
};
|
|
|
|
|
2006-05-05 07:40:20 +02:00
|
|
|
// getX86SubSuperRegister - X86 utility function. It returns the sub or super
|
|
|
|
// register of a specific X86 register.
|
2009-08-11 00:56:29 +02:00
|
|
|
// e.g. getX86SubSuperRegister(X86::EAX, EVT::i16) return X86:AX
|
|
|
|
unsigned getX86SubSuperRegister(unsigned, EVT, bool High=false);
|
2006-05-05 07:40:20 +02:00
|
|
|
|
2003-11-11 23:41:34 +01:00
|
|
|
} // End llvm namespace
|
|
|
|
|
2002-10-26 00:55:53 +02:00
|
|
|
#endif
|