2002-12-28 20:32:54 +00:00
|
|
|
//===- X86RegisterInfo.h - X86 Register Information Impl --------*- C++ -*-===//
|
2005-04-21 23:38:14 +00:00
|
|
|
//
|
2003-10-21 15:17:13 +00:00
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file was developed by the LLVM research group and is distributed under
|
|
|
|
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
2005-04-21 23:38:14 +00:00
|
|
|
//
|
2003-10-21 15:17:13 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
2002-10-25 22:55:53 +00:00
|
|
|
//
|
|
|
|
// This file contains the X86 implementation of the MRegisterInfo class.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef X86REGISTERINFO_H
|
|
|
|
#define X86REGISTERINFO_H
|
|
|
|
|
|
|
|
#include "llvm/Target/MRegisterInfo.h"
|
2003-08-03 15:48:14 +00:00
|
|
|
#include "X86GenRegisterInfo.h.inc"
|
2002-12-25 05:06:43 +00:00
|
|
|
|
2003-11-11 22:41:34 +00:00
|
|
|
namespace llvm {
|
2006-09-05 02:12:02 +00:00
|
|
|
class Type;
|
|
|
|
class TargetInstrInfo;
|
2006-09-08 06:48:29 +00:00
|
|
|
class X86TargetMachine;
|
2003-11-11 22:41:34 +00:00
|
|
|
|
2006-11-05 19:31:28 +00:00
|
|
|
class X86RegisterInfo : public X86GenRegisterInfo {
|
|
|
|
public:
|
2006-09-08 06:48:29 +00:00
|
|
|
X86TargetMachine &TM;
|
2006-09-05 02:12:02 +00:00
|
|
|
const TargetInstrInfo &TII;
|
2006-11-05 19:31:28 +00:00
|
|
|
|
2006-09-08 06:48:29 +00:00
|
|
|
private:
|
|
|
|
/// Is64Bit - Is the target 64-bits.
|
|
|
|
bool Is64Bit;
|
|
|
|
|
|
|
|
/// SlotSize - Stack slot size in bytes.
|
|
|
|
unsigned SlotSize;
|
|
|
|
|
|
|
|
/// StackPtr - X86 physical register used as stack ptr.
|
|
|
|
unsigned StackPtr;
|
|
|
|
|
|
|
|
/// FramePtr - X86 physical register used as frame ptr.
|
|
|
|
unsigned FramePtr;
|
|
|
|
|
|
|
|
public:
|
|
|
|
X86RegisterInfo(X86TargetMachine &tm, const TargetInstrInfo &tii);
|
2002-12-25 05:06:43 +00:00
|
|
|
|
2002-12-28 20:32:54 +00:00
|
|
|
/// Code Generation virtual methods...
|
2004-08-15 22:15:11 +00:00
|
|
|
void storeRegToStackSlot(MachineBasicBlock &MBB,
|
2004-02-12 08:11:04 +00:00
|
|
|
MachineBasicBlock::iterator MI,
|
2005-09-30 01:29:42 +00:00
|
|
|
unsigned SrcReg, int FrameIndex,
|
|
|
|
const TargetRegisterClass *RC) const;
|
2004-08-15 22:15:11 +00:00
|
|
|
|
|
|
|
void loadRegFromStackSlot(MachineBasicBlock &MBB,
|
|
|
|
MachineBasicBlock::iterator MI,
|
2005-09-30 01:29:42 +00:00
|
|
|
unsigned DestReg, int FrameIndex,
|
|
|
|
const TargetRegisterClass *RC) const;
|
2005-04-21 23:38:14 +00:00
|
|
|
|
2004-08-15 22:15:11 +00:00
|
|
|
void copyRegToReg(MachineBasicBlock &MBB,
|
|
|
|
MachineBasicBlock::iterator MI,
|
|
|
|
unsigned DestReg, unsigned SrcReg,
|
|
|
|
const TargetRegisterClass *RC) const;
|
2007-03-20 08:09:38 +00:00
|
|
|
|
|
|
|
void reMaterialize(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI,
|
|
|
|
unsigned DestReg, const MachineInstr *Orig) const;
|
2002-12-25 05:06:43 +00:00
|
|
|
|
2004-02-17 05:54:57 +00:00
|
|
|
/// foldMemoryOperand - If this target supports it, fold a load or store of
|
|
|
|
/// the specified stack slot into the specified machine instruction for the
|
|
|
|
/// specified operand. If this is possible, the target should perform the
|
|
|
|
/// folding and return true, otherwise it should return false. If it folds
|
|
|
|
/// the instruction, it is likely that the MachineInstruction the iterator
|
|
|
|
/// references has been changed.
|
2006-05-18 00:12:58 +00:00
|
|
|
MachineInstr* foldMemoryOperand(MachineInstr* MI,
|
|
|
|
unsigned OpNum,
|
|
|
|
int FrameIndex) const;
|
|
|
|
|
2007-01-02 21:33:40 +00:00
|
|
|
/// getCalleeSavedRegs - Return a null-terminated list of all of the
|
2006-05-18 00:12:58 +00:00
|
|
|
/// callee-save registers on this target.
|
2007-01-02 21:33:40 +00:00
|
|
|
const unsigned *getCalleeSavedRegs() const;
|
2006-05-18 00:12:58 +00:00
|
|
|
|
2007-01-02 21:33:40 +00:00
|
|
|
/// getCalleeSavedRegClasses - Return a null-terminated list of the preferred
|
2006-05-18 00:12:58 +00:00
|
|
|
/// register classes to spill each callee-saved register with. The order and
|
2007-01-02 21:33:40 +00:00
|
|
|
/// length of this list match the getCalleeSavedRegs() list.
|
|
|
|
const TargetRegisterClass* const* getCalleeSavedRegClasses() const;
|
2004-02-17 04:33:18 +00:00
|
|
|
|
2007-02-19 21:49:54 +00: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;
|
|
|
|
|
2007-01-23 00:57:47 +00:00
|
|
|
bool hasFP(const MachineFunction &MF) const;
|
|
|
|
|
2004-02-14 19:49:54 +00:00
|
|
|
void eliminateCallFramePseudoInstr(MachineFunction &MF,
|
|
|
|
MachineBasicBlock &MBB,
|
|
|
|
MachineBasicBlock::iterator MI) const;
|
2002-12-13 09:54:12 +00:00
|
|
|
|
2007-02-28 00:21:17 +00:00
|
|
|
void eliminateFrameIndex(MachineBasicBlock::iterator MI,
|
|
|
|
RegScavenger *RS = NULL) const;
|
2002-11-20 18:59:43 +00:00
|
|
|
|
2004-02-14 19:49:54 +00:00
|
|
|
void processFunctionBeforeFrameFinalized(MachineFunction &MF) const;
|
2002-12-03 23:11:21 +00:00
|
|
|
|
2004-02-14 19:49:54 +00:00
|
|
|
void emitPrologue(MachineFunction &MF) const;
|
|
|
|
void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const;
|
2006-03-23 18:12:57 +00:00
|
|
|
|
2006-03-28 13:48:33 +00:00
|
|
|
// Debug information queries.
|
2006-04-07 16:34:46 +00:00
|
|
|
unsigned getRARegister() const;
|
2006-03-28 13:48:33 +00:00
|
|
|
unsigned getFrameRegister(MachineFunction &MF) const;
|
2007-01-24 19:15:24 +00:00
|
|
|
void getInitialFrameState(std::vector<MachineMove> &Moves) const;
|
2007-02-21 22:54:50 +00:00
|
|
|
|
|
|
|
// Exception handling queries.
|
|
|
|
unsigned getEHExceptionRegister() const;
|
|
|
|
unsigned getEHHandlerRegister() const;
|
2002-10-25 22:55:53 +00:00
|
|
|
};
|
|
|
|
|
2006-05-05 05:40:20 +00:00
|
|
|
// getX86SubSuperRegister - X86 utility function. It returns the sub or super
|
|
|
|
// register of a specific X86 register.
|
|
|
|
// e.g. getX86SubSuperRegister(X86::EAX, MVT::i16) return X86:AX
|
|
|
|
unsigned getX86SubSuperRegister(unsigned, MVT::ValueType, bool High=false);
|
|
|
|
|
2003-11-11 22:41:34 +00:00
|
|
|
} // End llvm namespace
|
|
|
|
|
2002-10-25 22:55:53 +00:00
|
|
|
#endif
|