2007-12-04 22:35:58 +00:00
|
|
|
//===- SPUInstrInfo.h - Cell SPU Instruction Information --------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// 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.
|
2007-12-04 22:35:58 +00:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
2007-12-05 01:40:25 +00:00
|
|
|
// This file contains the CellSPU implementation of the TargetInstrInfo class.
|
2007-12-04 22:35:58 +00: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 01:03:04 +00:00
|
|
|
class SPUInstrInfo : public TargetInstrInfoImpl {
|
2007-12-04 22:35:58 +00:00
|
|
|
SPUTargetMachine &TM;
|
|
|
|
const SPURegisterInfo RI;
|
|
|
|
public:
|
2008-03-25 22:06:05 +00:00
|
|
|
explicit SPUInstrInfo(SPUTargetMachine &tm);
|
2007-12-04 22:35:58 +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-02-10 18:45:23 +00:00
|
|
|
virtual const TargetRegisterInfo &getRegisterInfo() const { return RI; }
|
2007-12-04 22:35:58 +00:00
|
|
|
|
|
|
|
/// getPointerRegClass - Return the register class to use to hold pointers.
|
|
|
|
/// This is used for addressing modes.
|
|
|
|
virtual const TargetRegisterClass *getPointerRegClass() const;
|
|
|
|
|
|
|
|
// 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,
|
2008-01-30 02:55:46 +00:00
|
|
|
unsigned& sourceReg,
|
|
|
|
unsigned& destReg) const;
|
2007-12-04 22:35:58 +00:00
|
|
|
|
|
|
|
unsigned isLoadFromStackSlot(MachineInstr *MI, int &FrameIndex) const;
|
|
|
|
unsigned isStoreToStackSlot(MachineInstr *MI, int &FrameIndex) const;
|
2007-12-31 06:32:00 +00:00
|
|
|
|
|
|
|
virtual void copyRegToReg(MachineBasicBlock &MBB,
|
|
|
|
MachineBasicBlock::iterator MI,
|
|
|
|
unsigned DestReg, unsigned SrcReg,
|
|
|
|
const TargetRegisterClass *DestRC,
|
|
|
|
const TargetRegisterClass *SrcRC) const;
|
2008-01-01 21:11:32 +00: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,
|
|
|
|
const TargetRegisterClass *RC) const;
|
|
|
|
|
|
|
|
//! Store a register to an address, based on its register class
|
|
|
|
virtual void storeRegToAddr(MachineFunction &MF, unsigned SrcReg, bool isKill,
|
2008-01-30 02:55:46 +00:00
|
|
|
SmallVectorImpl<MachineOperand> &Addr,
|
|
|
|
const TargetRegisterClass *RC,
|
|
|
|
SmallVectorImpl<MachineInstr*> &NewMIs) const;
|
2008-01-01 21:11:32 +00: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,
|
|
|
|
const TargetRegisterClass *RC) const;
|
|
|
|
|
|
|
|
//! Loqad a register from an address, based on its register class
|
|
|
|
virtual void loadRegFromAddr(MachineFunction &MF, unsigned DestReg,
|
2008-01-30 02:55:46 +00:00
|
|
|
SmallVectorImpl<MachineOperand> &Addr,
|
|
|
|
const TargetRegisterClass *RC,
|
2008-01-07 01:35:02 +00:00
|
|
|
SmallVectorImpl<MachineInstr*> &NewMIs) const;
|
|
|
|
|
|
|
|
//! Fold spills into load/store instructions
|
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;
|
|
|
|
|
|
|
|
//! Fold any load/store to an operand
|
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;
|
|
|
|
}
|
2007-12-04 22:35:58 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|