2006-02-05 13:50:24 +08:00
|
|
|
//===- SparcInstrInfo.h - Sparc Instruction Information ---------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-30 04:36:04 +08:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2006-02-05 13:50:24 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file contains the Sparc implementation of the TargetInstrInfo class.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef SPARCINSTRUCTIONINFO_H
|
|
|
|
#define SPARCINSTRUCTIONINFO_H
|
|
|
|
|
|
|
|
#include "llvm/Target/TargetInstrInfo.h"
|
|
|
|
#include "SparcRegisterInfo.h"
|
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
|
|
|
|
/// SPII - This namespace holds all of the target specific flags that
|
|
|
|
/// instruction info tracks.
|
|
|
|
///
|
|
|
|
namespace SPII {
|
|
|
|
enum {
|
|
|
|
Pseudo = (1<<0),
|
|
|
|
Load = (1<<1),
|
|
|
|
Store = (1<<2),
|
|
|
|
DelaySlot = (1<<3)
|
|
|
|
};
|
2006-05-25 01:04:05 +08:00
|
|
|
}
|
2006-02-05 13:50:24 +08:00
|
|
|
|
2008-01-01 09:03:04 +08:00
|
|
|
class SparcInstrInfo : public TargetInstrInfoImpl {
|
2006-02-05 13:50:24 +08:00
|
|
|
const SparcRegisterInfo RI;
|
2007-12-31 14:32:00 +08:00
|
|
|
const SparcSubtarget& Subtarget;
|
2006-02-05 13:50:24 +08:00
|
|
|
public:
|
2008-03-26 06:06:05 +08:00
|
|
|
explicit SparcInstrInfo(SparcSubtarget &ST);
|
2006-02-05 13:50:24 +08: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 09:58:56 +08:00
|
|
|
virtual const SparcRegisterInfo &getRegisterInfo() const { return RI; }
|
2006-02-05 13:50:24 +08: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.
|
2008-11-19 03:49:32 +08:00
|
|
|
virtual unsigned isLoadFromStackSlot(const MachineInstr *MI,
|
|
|
|
int &FrameIndex) const;
|
2006-02-05 13:50:24 +08:00
|
|
|
|
|
|
|
/// 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.
|
2008-11-19 03:49:32 +08:00
|
|
|
virtual unsigned isStoreToStackSlot(const MachineInstr *MI,
|
|
|
|
int &FrameIndex) const;
|
2011-01-16 11:15:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
virtual bool AnalyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,
|
|
|
|
MachineBasicBlock *&FBB,
|
|
|
|
SmallVectorImpl<MachineOperand> &Cond,
|
|
|
|
bool AllowModify = false) const ;
|
|
|
|
|
|
|
|
virtual unsigned RemoveBranch(MachineBasicBlock &MBB) const;
|
|
|
|
|
2007-05-18 08:18:17 +08:00
|
|
|
virtual unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
|
|
|
|
MachineBasicBlock *FBB,
|
2010-06-18 06:43:56 +08:00
|
|
|
const SmallVectorImpl<MachineOperand> &Cond,
|
|
|
|
DebugLoc DL) const;
|
2007-12-31 14:32:00 +08:00
|
|
|
|
2010-07-11 15:56:09 +08:00
|
|
|
virtual void copyPhysReg(MachineBasicBlock &MBB,
|
|
|
|
MachineBasicBlock::iterator I, DebugLoc DL,
|
|
|
|
unsigned DestReg, unsigned SrcReg,
|
|
|
|
bool KillSrc) const;
|
2008-01-02 05:11:32 +08:00
|
|
|
|
|
|
|
virtual void storeRegToStackSlot(MachineBasicBlock &MBB,
|
|
|
|
MachineBasicBlock::iterator MBBI,
|
|
|
|
unsigned SrcReg, bool isKill, int FrameIndex,
|
2010-05-07 03:06:44 +08:00
|
|
|
const TargetRegisterClass *RC,
|
|
|
|
const TargetRegisterInfo *TRI) const;
|
2008-01-02 05:11:32 +08:00
|
|
|
|
|
|
|
virtual void loadRegFromStackSlot(MachineBasicBlock &MBB,
|
|
|
|
MachineBasicBlock::iterator MBBI,
|
|
|
|
unsigned DestReg, int FrameIndex,
|
2010-05-07 03:06:44 +08:00
|
|
|
const TargetRegisterClass *RC,
|
|
|
|
const TargetRegisterInfo *TRI) const;
|
2008-01-07 09:35:02 +08:00
|
|
|
|
2009-09-16 01:46:24 +08:00
|
|
|
unsigned getGlobalBaseReg(MachineFunction *MF) const;
|
2006-02-05 13:50:24 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|