blob: e5e91481419a8adbd1b35e2c05d7987cdba4a136 [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
Andrew Trick2da8bc82010-12-24 05:03:26 +000035 ScheduleHazardRecognizer *
36 CreateTargetHazardRecognizer(const TargetMachine *TM,
37 const ScheduleDAG *DAG) const;
38
Dan Gohmancbad42c2008-11-18 19:49:32 +000039 unsigned isLoadFromStackSlot(const MachineInstr *MI,
40 int &FrameIndex) const;
41 unsigned isStoreToStackSlot(const MachineInstr *MI,
42 int &FrameIndex) const;
Scott Michel52d00012009-01-03 00:27:53 +000043
Jakob Stoklund Olesen377b7b72010-07-11 07:31:03 +000044 virtual void copyPhysReg(MachineBasicBlock &MBB,
45 MachineBasicBlock::iterator I, DebugLoc DL,
46 unsigned DestReg, unsigned SrcReg,
47 bool KillSrc) const;
Scott Michel52d00012009-01-03 00:27:53 +000048
Owen Andersonf6372aa2008-01-01 21:11:32 +000049 //! Store a register to a stack slot, based on its register class.
50 virtual void storeRegToStackSlot(MachineBasicBlock &MBB,
51 MachineBasicBlock::iterator MBBI,
52 unsigned SrcReg, bool isKill, int FrameIndex,
Evan Cheng746ad692010-05-06 19:06:44 +000053 const TargetRegisterClass *RC,
54 const TargetRegisterInfo *TRI) const;
Owen Andersonf6372aa2008-01-01 21:11:32 +000055
Owen Andersonf6372aa2008-01-01 21:11:32 +000056 //! Load a register from a stack slot, based on its register class.
57 virtual void loadRegFromStackSlot(MachineBasicBlock &MBB,
58 MachineBasicBlock::iterator MBBI,
59 unsigned DestReg, int FrameIndex,
Evan Cheng746ad692010-05-06 19:06:44 +000060 const TargetRegisterClass *RC,
61 const TargetRegisterInfo *TRI) const;
Owen Andersonf6372aa2008-01-01 21:11:32 +000062
Scott Michel52d00012009-01-03 00:27:53 +000063 //! Reverses a branch's condition, returning false on success.
64 virtual
65 bool ReverseBranchCondition(SmallVectorImpl<MachineOperand> &Cond) const;
Scott Michelaedc6372008-12-10 00:15:19 +000066
67 virtual bool AnalyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,
Scott Michel19c10e62009-01-26 03:37:41 +000068 MachineBasicBlock *&FBB,
Evan Chengdc54d312009-02-09 07:14:22 +000069 SmallVectorImpl<MachineOperand> &Cond,
70 bool AllowModify) const;
Scott Michel52d00012009-01-03 00:27:53 +000071
Scott Michelaedc6372008-12-10 00:15:19 +000072 virtual unsigned RemoveBranch(MachineBasicBlock &MBB) const;
Scott Michel52d00012009-01-03 00:27:53 +000073
Scott Michelaedc6372008-12-10 00:15:19 +000074 virtual unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
Stuart Hastings3bf91252010-06-17 22:43:56 +000075 MachineBasicBlock *FBB,
76 const SmallVectorImpl<MachineOperand> &Cond,
77 DebugLoc DL) const;
Scott Michelaedc6372008-12-10 00:15:19 +000078 };
Scott Michel66377522007-12-04 22:35:58 +000079}
80
81#endif