2007-12-05 06:35:58 +08:00
|
|
|
//===- SPUInstrInfo.h - Cell SPU 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.
|
2007-12-05 06:35:58 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
2007-12-05 09:40:25 +08:00
|
|
|
// This file contains the CellSPU implementation of the TargetInstrInfo class.
|
2007-12-05 06:35:58 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef SPU_INSTRUCTIONINFO_H
|
|
|
|
#define SPU_INSTRUCTIONINFO_H
|
|
|
|
|
|
|
|
#include "SPU.h"
|
|
|
|
#include "llvm/Target/TargetInstrInfo.h"
|
|
|
|
#include "SPURegisterInfo.h"
|
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
//! Cell SPU instruction information class
|
2008-01-01 09:03:04 +08:00
|
|
|
class SPUInstrInfo : public TargetInstrInfoImpl {
|
2007-12-05 06:35:58 +08:00
|
|
|
SPUTargetMachine &TM;
|
|
|
|
const SPURegisterInfo RI;
|
2009-01-03 08:27:53 +08:00
|
|
|
protected:
|
|
|
|
virtual MachineInstr* foldMemoryOperandImpl(MachineFunction &MF,
|
|
|
|
MachineInstr* MI,
|
|
|
|
const SmallVectorImpl<unsigned> &Ops,
|
|
|
|
int FrameIndex) const;
|
|
|
|
|
|
|
|
virtual MachineInstr* foldMemoryOperandImpl(MachineFunction &MF,
|
|
|
|
MachineInstr* MI,
|
|
|
|
const SmallVectorImpl<unsigned> &Ops,
|
|
|
|
MachineInstr* LoadMI) const {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2007-12-05 06:35:58 +08:00
|
|
|
public:
|
2008-03-26 06:06:05 +08:00
|
|
|
explicit SPUInstrInfo(SPUTargetMachine &tm);
|
2007-12-05 06:35:58 +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 SPURegisterInfo &getRegisterInfo() const { return RI; }
|
2007-12-05 06:35:58 +08:00
|
|
|
|
2009-01-21 03:12:24 +08:00
|
|
|
/// Return true if the instruction is a register to register move and return
|
|
|
|
/// the source and dest operands and their sub-register indices by reference.
|
|
|
|
virtual bool isMoveInstr(const MachineInstr &MI,
|
|
|
|
unsigned &SrcReg, unsigned &DstReg,
|
|
|
|
unsigned &SrcSubIdx, unsigned &DstSubIdx) const;
|
2007-12-05 06:35:58 +08:00
|
|
|
|
2008-11-19 03:49:32 +08:00
|
|
|
unsigned isLoadFromStackSlot(const MachineInstr *MI,
|
|
|
|
int &FrameIndex) const;
|
|
|
|
unsigned isStoreToStackSlot(const MachineInstr *MI,
|
|
|
|
int &FrameIndex) const;
|
2009-01-03 08:27:53 +08:00
|
|
|
|
2008-08-27 02:03:31 +08:00
|
|
|
virtual bool copyRegToReg(MachineBasicBlock &MBB,
|
2007-12-31 14:32:00 +08:00
|
|
|
MachineBasicBlock::iterator MI,
|
|
|
|
unsigned DestReg, unsigned SrcReg,
|
|
|
|
const TargetRegisterClass *DestRC,
|
2010-05-07 04:33:48 +08:00
|
|
|
const TargetRegisterClass *SrcRC,
|
|
|
|
DebugLoc DL) const;
|
2009-01-03 08:27:53 +08:00
|
|
|
|
2008-01-02 05:11:32 +08:00
|
|
|
//! Store a register to a stack slot, based on its register class.
|
|
|
|
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
|
|
|
|
|
|
|
//! Load a register from a stack slot, based on its register class.
|
|
|
|
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-02 05:11:32 +08:00
|
|
|
|
2009-01-03 08:27:53 +08:00
|
|
|
//! Return true if the specified load or store can be folded
|
|
|
|
virtual
|
|
|
|
bool canFoldMemoryOperand(const MachineInstr *MI,
|
|
|
|
const SmallVectorImpl<unsigned> &Ops) const;
|
|
|
|
|
|
|
|
//! Reverses a branch's condition, returning false on success.
|
|
|
|
virtual
|
|
|
|
bool ReverseBranchCondition(SmallVectorImpl<MachineOperand> &Cond) const;
|
2008-12-10 08:15:19 +08:00
|
|
|
|
|
|
|
virtual bool AnalyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,
|
2009-01-26 11:37:41 +08:00
|
|
|
MachineBasicBlock *&FBB,
|
2009-02-09 15:14:22 +08:00
|
|
|
SmallVectorImpl<MachineOperand> &Cond,
|
|
|
|
bool AllowModify) const;
|
2009-01-03 08:27:53 +08:00
|
|
|
|
2008-12-10 08:15:19 +08:00
|
|
|
virtual unsigned RemoveBranch(MachineBasicBlock &MBB) const;
|
2009-01-03 08:27:53 +08:00
|
|
|
|
2008-12-10 08:15:19 +08:00
|
|
|
virtual unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
|
2010-06-18 06:43:56 +08:00
|
|
|
MachineBasicBlock *FBB,
|
|
|
|
const SmallVectorImpl<MachineOperand> &Cond,
|
|
|
|
DebugLoc DL) const;
|
2008-12-10 08:15:19 +08:00
|
|
|
};
|
2007-12-05 06:35:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|