blob: 85e5821aefa115c4015f0e0b11953e7d7154a53f [file] [log] [blame]
Jia Liu31d157a2012-02-18 12:03:15 +00001//===-- SPUInstrInfo.h - Cell SPU Instruction Information -------*- C++ -*-===//
Scott Michel66377522007-12-04 22:35:58 +00002//
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"
Scott Michel66377522007-12-04 22:35:58 +000018#include "SPURegisterInfo.h"
Craig Topper79aa3412012-03-17 18:46:09 +000019#include "llvm/Target/TargetInstrInfo.h"
Scott Michel66377522007-12-04 22:35:58 +000020
Evan Cheng4db3cff2011-07-01 17:57:27 +000021#define GET_INSTRINFO_HEADER
22#include "SPUGenInstrInfo.inc"
23
Scott Michel66377522007-12-04 22:35:58 +000024namespace llvm {
25 //! Cell SPU instruction information class
Evan Cheng4db3cff2011-07-01 17:57:27 +000026 class SPUInstrInfo : public SPUGenInstrInfo {
Scott Michel66377522007-12-04 22:35:58 +000027 SPUTargetMachine &TM;
28 const SPURegisterInfo RI;
29 public:
Dan Gohman950a4c42008-03-25 22:06:05 +000030 explicit SPUInstrInfo(SPUTargetMachine &tm);
Scott Michel66377522007-12-04 22:35:58 +000031
32 /// getRegisterInfo - TargetInstrInfo is a superset of MRegister info. As
33 /// such, whenever a client has an instance of instruction info, it should
34 /// always be able to get register info as well (through this method).
35 ///
Dan Gohmanc9f5f3f2008-05-14 01:58:56 +000036 virtual const SPURegisterInfo &getRegisterInfo() const { return RI; }
Scott Michel66377522007-12-04 22:35:58 +000037
Andrew Trick2da8bc82010-12-24 05:03:26 +000038 ScheduleHazardRecognizer *
39 CreateTargetHazardRecognizer(const TargetMachine *TM,
40 const ScheduleDAG *DAG) const;
41
Dan Gohmancbad42c2008-11-18 19:49:32 +000042 unsigned isLoadFromStackSlot(const MachineInstr *MI,
43 int &FrameIndex) const;
44 unsigned isStoreToStackSlot(const MachineInstr *MI,
45 int &FrameIndex) const;
Scott Michel52d00012009-01-03 00:27:53 +000046
Jakob Stoklund Olesen377b7b72010-07-11 07:31:03 +000047 virtual void copyPhysReg(MachineBasicBlock &MBB,
48 MachineBasicBlock::iterator I, DebugLoc DL,
49 unsigned DestReg, unsigned SrcReg,
50 bool KillSrc) const;
Scott Michel52d00012009-01-03 00:27:53 +000051
Owen Andersonf6372aa2008-01-01 21:11:32 +000052 //! Store a register to a stack slot, based on its register class.
53 virtual void storeRegToStackSlot(MachineBasicBlock &MBB,
54 MachineBasicBlock::iterator MBBI,
55 unsigned SrcReg, bool isKill, 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
Owen Andersonf6372aa2008-01-01 21:11:32 +000059 //! Load a register from a stack slot, based on its register class.
60 virtual void loadRegFromStackSlot(MachineBasicBlock &MBB,
61 MachineBasicBlock::iterator MBBI,
62 unsigned DestReg, int FrameIndex,
Evan Cheng746ad692010-05-06 19:06:44 +000063 const TargetRegisterClass *RC,
64 const TargetRegisterInfo *TRI) const;
Owen Andersonf6372aa2008-01-01 21:11:32 +000065
Scott Michel52d00012009-01-03 00:27:53 +000066 //! Reverses a branch's condition, returning false on success.
67 virtual
68 bool ReverseBranchCondition(SmallVectorImpl<MachineOperand> &Cond) const;
Scott Michelaedc6372008-12-10 00:15:19 +000069
70 virtual bool AnalyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,
Scott Michel19c10e62009-01-26 03:37:41 +000071 MachineBasicBlock *&FBB,
Evan Chengdc54d312009-02-09 07:14:22 +000072 SmallVectorImpl<MachineOperand> &Cond,
73 bool AllowModify) const;
Scott Michel52d00012009-01-03 00:27:53 +000074
Scott Michelaedc6372008-12-10 00:15:19 +000075 virtual unsigned RemoveBranch(MachineBasicBlock &MBB) const;
Scott Michel52d00012009-01-03 00:27:53 +000076
Scott Michelaedc6372008-12-10 00:15:19 +000077 virtual unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
Stuart Hastings3bf91252010-06-17 22:43:56 +000078 MachineBasicBlock *FBB,
79 const SmallVectorImpl<MachineOperand> &Cond,
80 DebugLoc DL) const;
Scott Michelaedc6372008-12-10 00:15:19 +000081 };
Scott Michel66377522007-12-04 22:35:58 +000082}
83
84#endif