2006-02-05 05:50:24 +00:00
|
|
|
//===- SparcInstrInfo.h - Sparc Instruction Information ---------*- C++ -*-===//
|
2005-04-21 23:30:14 +00:00
|
|
|
//
|
2004-02-25 19:28:19 +00:00
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-29 20:36:04 +00:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2005-04-21 23:30:14 +00:00
|
|
|
//
|
2004-02-25 19:28:19 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
2006-02-05 05:50:24 +00:00
|
|
|
// This file contains the Sparc implementation of the TargetInstrInfo class.
|
2004-02-25 19:28:19 +00:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2006-02-05 05:50:24 +00:00
|
|
|
#ifndef SPARCINSTRUCTIONINFO_H
|
|
|
|
#define SPARCINSTRUCTIONINFO_H
|
2004-02-25 19:28:19 +00:00
|
|
|
|
|
|
|
#include "llvm/Target/TargetInstrInfo.h"
|
2006-02-05 05:50:24 +00:00
|
|
|
#include "SparcRegisterInfo.h"
|
2004-02-25 19:28:19 +00:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
|
2006-02-05 05:50:24 +00:00
|
|
|
/// SPII - This namespace holds all of the target specific flags that
|
2004-07-16 10:31:59 +00:00
|
|
|
/// instruction info tracks.
|
|
|
|
///
|
2006-02-05 05:50:24 +00:00
|
|
|
namespace SPII {
|
2004-07-16 10:31:59 +00:00
|
|
|
enum {
|
|
|
|
Pseudo = (1<<0),
|
|
|
|
Load = (1<<1),
|
|
|
|
Store = (1<<2),
|
|
|
|
DelaySlot = (1<<3)
|
|
|
|
};
|
2006-05-24 17:04:05 +00:00
|
|
|
}
|
2004-07-16 10:31:59 +00:00
|
|
|
|
2008-01-01 01:03:04 +00:00
|
|
|
class SparcInstrInfo : public TargetInstrInfoImpl {
|
2006-02-05 05:50:24 +00:00
|
|
|
const SparcRegisterInfo RI;
|
2007-12-31 06:32:00 +00:00
|
|
|
const SparcSubtarget& Subtarget;
|
2004-02-25 19:28:19 +00:00
|
|
|
public:
|
2008-03-25 22:06:05 +00:00
|
|
|
explicit SparcInstrInfo(SparcSubtarget &ST);
|
2004-02-25 19:28:19 +00:00
|
|
|
|
|
|
|
/// getRegisterInfo - TargetInstrInfo is a superset of MRegister info. As
|
|
|
|
/// such, whenever a client has an instance of instruction info, it should
|
|
|
|
/// always be able to get register info as well (through this method).
|
|
|
|
///
|
2008-05-14 01:58:56 +00:00
|
|
|
virtual const SparcRegisterInfo &getRegisterInfo() const { return RI; }
|
2004-07-25 06:19:04 +00:00
|
|
|
|
|
|
|
/// Return true if the instruction is a register to register move and
|
|
|
|
/// leave the source and dest operands in the passed parameters.
|
|
|
|
///
|
|
|
|
virtual bool isMoveInstr(const MachineInstr &MI,
|
|
|
|
unsigned &SrcReg, unsigned &DstReg) const;
|
2006-02-03 06:44:54 +00:00
|
|
|
|
|
|
|
/// isLoadFromStackSlot - If the specified machine instruction is a direct
|
|
|
|
/// load from a stack slot, return the virtual or physical register number of
|
|
|
|
/// the destination along with the FrameIndex of the loaded stack slot. If
|
|
|
|
/// not, return 0. This predicate must return 0 if the instruction has
|
|
|
|
/// any side effects other than loading from the stack slot.
|
|
|
|
virtual unsigned isLoadFromStackSlot(MachineInstr *MI, int &FrameIndex) const;
|
|
|
|
|
|
|
|
/// isStoreToStackSlot - If the specified machine instruction is a direct
|
|
|
|
/// store to a stack slot, return the virtual or physical register number of
|
|
|
|
/// the source reg along with the FrameIndex of the loaded stack slot. If
|
|
|
|
/// not, return 0. This predicate must return 0 if the instruction has
|
|
|
|
/// any side effects other than storing to the stack slot.
|
|
|
|
virtual unsigned isStoreToStackSlot(MachineInstr *MI, int &FrameIndex) const;
|
2006-10-24 16:39:19 +00:00
|
|
|
|
|
|
|
|
2007-05-18 00:18:17 +00:00
|
|
|
virtual unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
|
|
|
|
MachineBasicBlock *FBB,
|
|
|
|
const std::vector<MachineOperand> &Cond) const;
|
2007-12-31 06:32:00 +00:00
|
|
|
|
|
|
|
virtual void copyRegToReg(MachineBasicBlock &MBB,
|
|
|
|
MachineBasicBlock::iterator I,
|
|
|
|
unsigned DestReg, unsigned SrcReg,
|
|
|
|
const TargetRegisterClass *DestRC,
|
|
|
|
const TargetRegisterClass *SrcRC) const;
|
2008-01-01 21:11:32 +00:00
|
|
|
|
|
|
|
virtual void storeRegToStackSlot(MachineBasicBlock &MBB,
|
|
|
|
MachineBasicBlock::iterator MBBI,
|
|
|
|
unsigned SrcReg, bool isKill, int FrameIndex,
|
|
|
|
const TargetRegisterClass *RC) const;
|
|
|
|
|
|
|
|
virtual void storeRegToAddr(MachineFunction &MF, unsigned SrcReg, bool isKill,
|
|
|
|
SmallVectorImpl<MachineOperand> &Addr,
|
|
|
|
const TargetRegisterClass *RC,
|
|
|
|
SmallVectorImpl<MachineInstr*> &NewMIs) const;
|
|
|
|
|
|
|
|
virtual void loadRegFromStackSlot(MachineBasicBlock &MBB,
|
|
|
|
MachineBasicBlock::iterator MBBI,
|
|
|
|
unsigned DestReg, int FrameIndex,
|
|
|
|
const TargetRegisterClass *RC) const;
|
|
|
|
|
|
|
|
virtual void loadRegFromAddr(MachineFunction &MF, unsigned DestReg,
|
|
|
|
SmallVectorImpl<MachineOperand> &Addr,
|
|
|
|
const TargetRegisterClass *RC,
|
|
|
|
SmallVectorImpl<MachineInstr*> &NewMIs) const;
|
2008-01-07 01:35:02 +00:00
|
|
|
|
2008-02-08 21:20:40 +00:00
|
|
|
virtual MachineInstr* foldMemoryOperand(MachineFunction &MF,
|
|
|
|
MachineInstr* MI,
|
2008-01-07 01:35:02 +00:00
|
|
|
SmallVectorImpl<unsigned> &Ops,
|
|
|
|
int FrameIndex) const;
|
|
|
|
|
2008-02-08 21:20:40 +00:00
|
|
|
virtual MachineInstr* foldMemoryOperand(MachineFunction &MF,
|
|
|
|
MachineInstr* MI,
|
2008-01-07 01:35:02 +00:00
|
|
|
SmallVectorImpl<unsigned> &Ops,
|
|
|
|
MachineInstr* LoadMI) const {
|
|
|
|
return 0;
|
|
|
|
}
|
2004-02-25 19:28:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|