2012-02-18 20:03:15 +08:00
|
|
|
//===-- SparcInstrInfo.h - Sparc Instruction Information --------*- C++ -*-===//
|
2006-02-05 13:50:24 +08:00
|
|
|
//
|
|
|
|
// 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.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2014-08-14 00:26:38 +08:00
|
|
|
#ifndef LLVM_LIB_TARGET_SPARC_SPARCINSTRINFO_H
|
|
|
|
#define LLVM_LIB_TARGET_SPARC_SPARCINSTRINFO_H
|
2006-02-05 13:50:24 +08:00
|
|
|
|
|
|
|
#include "SparcRegisterInfo.h"
|
2012-03-18 02:46:09 +08:00
|
|
|
#include "llvm/Target/TargetInstrInfo.h"
|
2006-02-05 13:50:24 +08:00
|
|
|
|
2011-07-02 01:57:27 +08:00
|
|
|
#define GET_INSTRINFO_HEADER
|
|
|
|
#include "SparcGenInstrInfo.inc"
|
|
|
|
|
2006-02-05 13:50:24 +08:00
|
|
|
namespace llvm {
|
|
|
|
|
2015-03-12 13:55:26 +08:00
|
|
|
class SparcSubtarget;
|
|
|
|
|
2006-02-05 13:50:24 +08:00
|
|
|
/// 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
|
|
|
|
2011-07-02 01:57:27 +08:00
|
|
|
class SparcInstrInfo : public SparcGenInstrInfo {
|
2006-02-05 13:50:24 +08:00
|
|
|
const SparcRegisterInfo RI;
|
2007-12-31 14:32:00 +08:00
|
|
|
const SparcSubtarget& Subtarget;
|
2013-11-19 08:57:56 +08:00
|
|
|
virtual void anchor();
|
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).
|
|
|
|
///
|
2014-04-29 15:57:13 +08:00
|
|
|
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.
|
2014-04-29 15:57:13 +08:00
|
|
|
unsigned isLoadFromStackSlot(const MachineInstr *MI,
|
|
|
|
int &FrameIndex) const override;
|
2013-06-05 02:33:25 +08:00
|
|
|
|
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.
|
2014-04-29 15:57:13 +08:00
|
|
|
unsigned isStoreToStackSlot(const MachineInstr *MI,
|
|
|
|
int &FrameIndex) const override;
|
|
|
|
|
|
|
|
bool AnalyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,
|
|
|
|
MachineBasicBlock *&FBB,
|
|
|
|
SmallVectorImpl<MachineOperand> &Cond,
|
|
|
|
bool AllowModify = false) const override ;
|
|
|
|
|
|
|
|
unsigned RemoveBranch(MachineBasicBlock &MBB) const override;
|
|
|
|
|
|
|
|
unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
|
2015-06-12 03:30:37 +08:00
|
|
|
MachineBasicBlock *FBB, ArrayRef<MachineOperand> Cond,
|
2014-04-29 15:57:13 +08:00
|
|
|
DebugLoc DL) const override;
|
|
|
|
|
|
|
|
void copyPhysReg(MachineBasicBlock &MBB,
|
|
|
|
MachineBasicBlock::iterator I, DebugLoc DL,
|
|
|
|
unsigned DestReg, unsigned SrcReg,
|
|
|
|
bool KillSrc) const override;
|
|
|
|
|
|
|
|
void storeRegToStackSlot(MachineBasicBlock &MBB,
|
|
|
|
MachineBasicBlock::iterator MBBI,
|
|
|
|
unsigned SrcReg, bool isKill, int FrameIndex,
|
|
|
|
const TargetRegisterClass *RC,
|
|
|
|
const TargetRegisterInfo *TRI) const override;
|
|
|
|
|
|
|
|
void loadRegFromStackSlot(MachineBasicBlock &MBB,
|
|
|
|
MachineBasicBlock::iterator MBBI,
|
|
|
|
unsigned DestReg, int FrameIndex,
|
|
|
|
const TargetRegisterClass *RC,
|
|
|
|
const TargetRegisterInfo *TRI) const override;
|
2013-06-05 02:33:25 +08:00
|
|
|
|
2009-09-16 01:46:24 +08:00
|
|
|
unsigned getGlobalBaseReg(MachineFunction *MF) const;
|
2006-02-05 13:50:24 +08:00
|
|
|
};
|
|
|
|
|
2015-06-23 17:49:53 +08:00
|
|
|
}
|
2006-02-05 13:50:24 +08:00
|
|
|
|
|
|
|
#endif
|