blob: 191e55d0ca612fd367543d6e0190cf3664a01b7a [file] [log] [blame]
Scott Michel66377522007-12-04 22:35:58 +00001//===- SPUInstrInfo.h - Cell SPU Instruction Information --------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
Chris Lattner4ee451d2007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Scott Michel66377522007-12-04 22:35:58 +00007//
8//===----------------------------------------------------------------------===//
9//
Scott Michel2466c372007-12-05 01:40:25 +000010// This file contains the CellSPU implementation of the TargetInstrInfo class.
Scott Michel66377522007-12-04 22:35:58 +000011//
12//===----------------------------------------------------------------------===//
13
14#ifndef SPU_INSTRUCTIONINFO_H
15#define SPU_INSTRUCTIONINFO_H
16
17#include "SPU.h"
18#include "llvm/Target/TargetInstrInfo.h"
19#include "SPURegisterInfo.h"
20
21namespace llvm {
22 //! Cell SPU instruction information class
Chris Lattner64105522008-01-01 01:03:04 +000023 class SPUInstrInfo : public TargetInstrInfoImpl {
Scott Michel66377522007-12-04 22:35:58 +000024 SPUTargetMachine &TM;
25 const SPURegisterInfo RI;
26 public:
Dan Gohman950a4c42008-03-25 22:06:05 +000027 explicit SPUInstrInfo(SPUTargetMachine &tm);
Scott Michel66377522007-12-04 22:35:58 +000028
29 /// getRegisterInfo - TargetInstrInfo is a superset of MRegister info. As
30 /// such, whenever a client has an instance of instruction info, it should
31 /// always be able to get register info as well (through this method).
32 ///
Dan Gohmanc9f5f3f2008-05-14 01:58:56 +000033 virtual const SPURegisterInfo &getRegisterInfo() const { return RI; }
Scott Michel66377522007-12-04 22:35:58 +000034
Dan Gohmancbad42c2008-11-18 19:49:32 +000035 unsigned isLoadFromStackSlot(const MachineInstr *MI,
36 int &FrameIndex) const;
37 unsigned isStoreToStackSlot(const MachineInstr *MI,
38 int &FrameIndex) const;
Scott Michel52d00012009-01-03 00:27:53 +000039
Jakob Stoklund Olesen377b7b72010-07-11 07:31:03 +000040 virtual void copyPhysReg(MachineBasicBlock &MBB,
41 MachineBasicBlock::iterator I, DebugLoc DL,
42 unsigned DestReg, unsigned SrcReg,
43 bool KillSrc) const;
Scott Michel52d00012009-01-03 00:27:53 +000044
Owen Andersonf6372aa2008-01-01 21:11:32 +000045 //! Store a register to a stack slot, based on its register class.
46 virtual void storeRegToStackSlot(MachineBasicBlock &MBB,
47 MachineBasicBlock::iterator MBBI,
48 unsigned SrcReg, bool isKill, int FrameIndex,
Evan Cheng746ad692010-05-06 19:06:44 +000049 const TargetRegisterClass *RC,
50 const TargetRegisterInfo *TRI) const;
Owen Andersonf6372aa2008-01-01 21:11:32 +000051
Owen Andersonf6372aa2008-01-01 21:11:32 +000052 //! Load a register from a stack slot, based on its register class.
53 virtual void loadRegFromStackSlot(MachineBasicBlock &MBB,
54 MachineBasicBlock::iterator MBBI,
55 unsigned DestReg, int FrameIndex,
Evan Cheng746ad692010-05-06 19:06:44 +000056 const TargetRegisterClass *RC,
57 const TargetRegisterInfo *TRI) const;
Owen Andersonf6372aa2008-01-01 21:11:32 +000058
Scott Michel52d00012009-01-03 00:27:53 +000059 //! Reverses a branch's condition, returning false on success.
60 virtual
61 bool ReverseBranchCondition(SmallVectorImpl<MachineOperand> &Cond) const;
Scott Michelaedc6372008-12-10 00:15:19 +000062
63 virtual bool AnalyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,
Scott Michel19c10e62009-01-26 03:37:41 +000064 MachineBasicBlock *&FBB,
Evan Chengdc54d312009-02-09 07:14:22 +000065 SmallVectorImpl<MachineOperand> &Cond,
66 bool AllowModify) const;
Scott Michel52d00012009-01-03 00:27:53 +000067
Scott Michelaedc6372008-12-10 00:15:19 +000068 virtual unsigned RemoveBranch(MachineBasicBlock &MBB) const;
Scott Michel52d00012009-01-03 00:27:53 +000069
Scott Michelaedc6372008-12-10 00:15:19 +000070 virtual unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
Stuart Hastings3bf91252010-06-17 22:43:56 +000071 MachineBasicBlock *FBB,
72 const SmallVectorImpl<MachineOperand> &Cond,
73 DebugLoc DL) const;
Scott Michelaedc6372008-12-10 00:15:19 +000074 };
Scott Michel66377522007-12-04 22:35:58 +000075}
76
77#endif