blob: eda64efb7a03d97b4e1049445cd3c0e8f3fe7b7f [file] [log] [blame]
Chris Lattner7c90f732006-02-05 05:50:24 +00001//===- SparcInstrInfo.h - Sparc Instruction Information ---------*- C++ -*-===//
Misha Brukmanb5f662f2005-04-21 23:30:14 +00002//
Brian Gaekee785e532004-02-25 19:28:19 +00003// 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.
Misha Brukmanb5f662f2005-04-21 23:30:14 +00007//
Brian Gaekee785e532004-02-25 19:28:19 +00008//===----------------------------------------------------------------------===//
9//
Chris Lattner7c90f732006-02-05 05:50:24 +000010// This file contains the Sparc implementation of the TargetInstrInfo class.
Brian Gaekee785e532004-02-25 19:28:19 +000011//
12//===----------------------------------------------------------------------===//
13
Chris Lattner7c90f732006-02-05 05:50:24 +000014#ifndef SPARCINSTRUCTIONINFO_H
15#define SPARCINSTRUCTIONINFO_H
Brian Gaekee785e532004-02-25 19:28:19 +000016
17#include "llvm/Target/TargetInstrInfo.h"
Chris Lattner7c90f732006-02-05 05:50:24 +000018#include "SparcRegisterInfo.h"
Brian Gaekee785e532004-02-25 19:28:19 +000019
Evan Cheng4db3cff2011-07-01 17:57:27 +000020#define GET_INSTRINFO_HEADER
21#include "SparcGenInstrInfo.inc"
22
Brian Gaekee785e532004-02-25 19:28:19 +000023namespace llvm {
24
Chris Lattner7c90f732006-02-05 05:50:24 +000025/// SPII - This namespace holds all of the target specific flags that
Brian Gaeke7d7ac632004-07-16 10:31:59 +000026/// instruction info tracks.
27///
Chris Lattner7c90f732006-02-05 05:50:24 +000028namespace SPII {
Brian Gaeke7d7ac632004-07-16 10:31:59 +000029 enum {
30 Pseudo = (1<<0),
31 Load = (1<<1),
32 Store = (1<<2),
33 DelaySlot = (1<<3)
34 };
Chris Lattnerd74ea2b2006-05-24 17:04:05 +000035}
Brian Gaeke7d7ac632004-07-16 10:31:59 +000036
Evan Cheng4db3cff2011-07-01 17:57:27 +000037class SparcInstrInfo : public SparcGenInstrInfo {
Chris Lattner7c90f732006-02-05 05:50:24 +000038 const SparcRegisterInfo RI;
Owen Andersond10fd972007-12-31 06:32:00 +000039 const SparcSubtarget& Subtarget;
Brian Gaekee785e532004-02-25 19:28:19 +000040public:
Dan Gohman950a4c42008-03-25 22:06:05 +000041 explicit SparcInstrInfo(SparcSubtarget &ST);
Brian Gaekee785e532004-02-25 19:28:19 +000042
43 /// getRegisterInfo - TargetInstrInfo is a superset of MRegister info. As
44 /// such, whenever a client has an instance of instruction info, it should
45 /// always be able to get register info as well (through this method).
46 ///
Dan Gohmanc9f5f3f2008-05-14 01:58:56 +000047 virtual const SparcRegisterInfo &getRegisterInfo() const { return RI; }
Chris Lattner1d6dc972004-07-25 06:19:04 +000048
Chris Lattner5ccc7222006-02-03 06:44:54 +000049 /// isLoadFromStackSlot - If the specified machine instruction is a direct
50 /// load from a stack slot, return the virtual or physical register number of
51 /// the destination along with the FrameIndex of the loaded stack slot. If
52 /// not, return 0. This predicate must return 0 if the instruction has
53 /// any side effects other than loading from the stack slot.
Dan Gohmancbad42c2008-11-18 19:49:32 +000054 virtual unsigned isLoadFromStackSlot(const MachineInstr *MI,
55 int &FrameIndex) const;
Chris Lattner5ccc7222006-02-03 06:44:54 +000056
57 /// isStoreToStackSlot - If the specified machine instruction is a direct
58 /// store to a stack slot, return the virtual or physical register number of
59 /// the source reg along with the FrameIndex of the loaded stack slot. If
60 /// not, return 0. This predicate must return 0 if the instruction has
61 /// any side effects other than storing to the stack slot.
Dan Gohmancbad42c2008-11-18 19:49:32 +000062 virtual unsigned isStoreToStackSlot(const MachineInstr *MI,
63 int &FrameIndex) const;
Venkatraman Govindarajuc1a62832011-01-16 03:15:11 +000064
65
66 virtual bool AnalyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,
67 MachineBasicBlock *&FBB,
68 SmallVectorImpl<MachineOperand> &Cond,
69 bool AllowModify = false) const ;
70
71 virtual unsigned RemoveBranch(MachineBasicBlock &MBB) const;
72
Evan Cheng6ae36262007-05-18 00:18:17 +000073 virtual unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
74 MachineBasicBlock *FBB,
Stuart Hastings3bf91252010-06-17 22:43:56 +000075 const SmallVectorImpl<MachineOperand> &Cond,
76 DebugLoc DL) const;
Owen Andersond10fd972007-12-31 06:32:00 +000077
Jakob Stoklund Olesen8e18a1a2010-07-11 07:56:09 +000078 virtual void copyPhysReg(MachineBasicBlock &MBB,
79 MachineBasicBlock::iterator I, DebugLoc DL,
80 unsigned DestReg, unsigned SrcReg,
81 bool KillSrc) const;
Owen Andersonf6372aa2008-01-01 21:11:32 +000082
83 virtual void storeRegToStackSlot(MachineBasicBlock &MBB,
84 MachineBasicBlock::iterator MBBI,
85 unsigned SrcReg, bool isKill, int FrameIndex,
Evan Cheng746ad692010-05-06 19:06:44 +000086 const TargetRegisterClass *RC,
87 const TargetRegisterInfo *TRI) const;
Owen Andersonf6372aa2008-01-01 21:11:32 +000088
Owen Andersonf6372aa2008-01-01 21:11:32 +000089 virtual void loadRegFromStackSlot(MachineBasicBlock &MBB,
90 MachineBasicBlock::iterator MBBI,
91 unsigned DestReg, int FrameIndex,
Evan Cheng746ad692010-05-06 19:06:44 +000092 const TargetRegisterClass *RC,
93 const TargetRegisterInfo *TRI) const;
Owen Anderson43dbe052008-01-07 01:35:02 +000094
Chris Lattnerdb486a62009-09-15 17:46:24 +000095 unsigned getGlobalBaseReg(MachineFunction *MF) const;
Brian Gaekee785e532004-02-25 19:28:19 +000096};
97
98}
99
100#endif