blob: b2d24f52503b9c3d329bea58844b8a57f87988c5 [file] [log] [blame]
Chris Lattner158e1f52006-02-05 05:50:24 +00001//===- SparcInstrInfo.h - Sparc Instruction Information ---------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
Chris Lattnerf3ebc3f2007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Chris Lattner158e1f52006-02-05 05:50:24 +00007//
8//===----------------------------------------------------------------------===//
9//
10// This file contains the Sparc implementation of the TargetInstrInfo class.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef SPARCINSTRUCTIONINFO_H
15#define SPARCINSTRUCTIONINFO_H
16
17#include "llvm/Target/TargetInstrInfo.h"
18#include "SparcRegisterInfo.h"
19
20namespace llvm {
21
22/// SPII - This namespace holds all of the target specific flags that
23/// instruction info tracks.
24///
25namespace SPII {
26 enum {
27 Pseudo = (1<<0),
28 Load = (1<<1),
29 Store = (1<<2),
30 DelaySlot = (1<<3)
31 };
Chris Lattneraa2372562006-05-24 17:04:05 +000032}
Chris Lattner158e1f52006-02-05 05:50:24 +000033
Chris Lattner25568e42008-01-01 01:03:04 +000034class SparcInstrInfo : public TargetInstrInfoImpl {
Chris Lattner158e1f52006-02-05 05:50:24 +000035 const SparcRegisterInfo RI;
Owen Anderson7a73ae92007-12-31 06:32:00 +000036 const SparcSubtarget& Subtarget;
Chris Lattner158e1f52006-02-05 05:50:24 +000037public:
Dan Gohmanc60c67f2008-03-25 22:06:05 +000038 explicit SparcInstrInfo(SparcSubtarget &ST);
Chris Lattner158e1f52006-02-05 05:50:24 +000039
40 /// getRegisterInfo - TargetInstrInfo is a superset of MRegister info. As
41 /// such, whenever a client has an instance of instruction info, it should
42 /// always be able to get register info as well (through this method).
43 ///
Dan Gohmaneabd6472008-05-14 01:58:56 +000044 virtual const SparcRegisterInfo &getRegisterInfo() const { return RI; }
Chris Lattner158e1f52006-02-05 05:50:24 +000045
Chris Lattner158e1f52006-02-05 05:50:24 +000046 /// isLoadFromStackSlot - If the specified machine instruction is a direct
47 /// load from a stack slot, return the virtual or physical register number of
48 /// the destination along with the FrameIndex of the loaded stack slot. If
49 /// not, return 0. This predicate must return 0 if the instruction has
50 /// any side effects other than loading from the stack slot.
Dan Gohman0b273252008-11-18 19:49:32 +000051 virtual unsigned isLoadFromStackSlot(const MachineInstr *MI,
52 int &FrameIndex) const;
Chris Lattner158e1f52006-02-05 05:50:24 +000053
54 /// isStoreToStackSlot - If the specified machine instruction is a direct
55 /// store to a stack slot, return the virtual or physical register number of
56 /// the source reg along with the FrameIndex of the loaded stack slot. If
57 /// not, return 0. This predicate must return 0 if the instruction has
58 /// any side effects other than storing to the stack slot.
Dan Gohman0b273252008-11-18 19:49:32 +000059 virtual unsigned isStoreToStackSlot(const MachineInstr *MI,
60 int &FrameIndex) const;
Venkatraman Govindaraju1b0e2cb2011-01-16 03:15:11 +000061
62
63 virtual bool AnalyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,
64 MachineBasicBlock *&FBB,
65 SmallVectorImpl<MachineOperand> &Cond,
66 bool AllowModify = false) const ;
67
68 virtual unsigned RemoveBranch(MachineBasicBlock &MBB) const;
69
Evan Chenge20dd922007-05-18 00:18:17 +000070 virtual unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
71 MachineBasicBlock *FBB,
Stuart Hastings0125b642010-06-17 22:43:56 +000072 const SmallVectorImpl<MachineOperand> &Cond,
73 DebugLoc DL) const;
Owen Anderson7a73ae92007-12-31 06:32:00 +000074
Jakob Stoklund Olesen976b7b62010-07-11 07:56:09 +000075 virtual void copyPhysReg(MachineBasicBlock &MBB,
76 MachineBasicBlock::iterator I, DebugLoc DL,
77 unsigned DestReg, unsigned SrcReg,
78 bool KillSrc) const;
Owen Andersoneee14602008-01-01 21:11:32 +000079
80 virtual void storeRegToStackSlot(MachineBasicBlock &MBB,
81 MachineBasicBlock::iterator MBBI,
82 unsigned SrcReg, bool isKill, int FrameIndex,
Evan Chengefb126a2010-05-06 19:06:44 +000083 const TargetRegisterClass *RC,
84 const TargetRegisterInfo *TRI) const;
Owen Andersoneee14602008-01-01 21:11:32 +000085
Owen Andersoneee14602008-01-01 21:11:32 +000086 virtual void loadRegFromStackSlot(MachineBasicBlock &MBB,
87 MachineBasicBlock::iterator MBBI,
88 unsigned DestReg, int FrameIndex,
Evan Chengefb126a2010-05-06 19:06:44 +000089 const TargetRegisterClass *RC,
90 const TargetRegisterInfo *TRI) const;
Owen Anderson2a3be7b2008-01-07 01:35:02 +000091
Chris Lattner840c7002009-09-15 17:46:24 +000092 unsigned getGlobalBaseReg(MachineFunction *MF) const;
Chris Lattner158e1f52006-02-05 05:50:24 +000093};
94
95}
96
97#endif