blob: 182aa32f447ae01ee1cfe7d4abde3f2ac6272862 [file] [log] [blame]
Misha Brukmanbc9ccf62005-02-04 20:25:52 +00001//===- AlphaInstrInfo.h - Alpha Instruction Information ---------*- C++ -*-===//
Misha Brukman4633f1c2005-04-21 23:13:11 +00002//
Andrew Lenharth304d0f32005-01-22 23:41:55 +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 Brukman4633f1c2005-04-21 23:13:11 +00007//
Andrew Lenharth304d0f32005-01-22 23:41:55 +00008//===----------------------------------------------------------------------===//
9//
10// This file contains the Alpha implementation of the TargetInstrInfo class.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef ALPHAINSTRUCTIONINFO_H
15#define ALPHAINSTRUCTIONINFO_H
16
17#include "llvm/Target/TargetInstrInfo.h"
18#include "AlphaRegisterInfo.h"
19
20namespace llvm {
21
Chris Lattner64105522008-01-01 01:03:04 +000022class AlphaInstrInfo : public TargetInstrInfoImpl {
Andrew Lenharth304d0f32005-01-22 23:41:55 +000023 const AlphaRegisterInfo RI;
24public:
25 AlphaInstrInfo();
26
27 /// getRegisterInfo - TargetInstrInfo is a superset of MRegister info. As
28 /// such, whenever a client has an instance of instruction info, it should
29 /// always be able to get register info as well (through this method).
30 ///
Dan Gohmanc9f5f3f2008-05-14 01:58:56 +000031 virtual const AlphaRegisterInfo &getRegisterInfo() const { return RI; }
Andrew Lenharth304d0f32005-01-22 23:41:55 +000032
Evan Cheng04ee5a12009-01-20 19:12:24 +000033 /// Return true if the instruction is a register to register move and return
34 /// the source and dest operands and their sub-register indices by reference.
Andrew Lenharth304d0f32005-01-22 23:41:55 +000035 virtual bool isMoveInstr(const MachineInstr &MI,
Evan Cheng04ee5a12009-01-20 19:12:24 +000036 unsigned &SrcReg, unsigned &DstReg,
37 unsigned &SrcSubIdx, unsigned &DstSubIdx) const;
Chris Lattner40839602006-02-02 20:12:32 +000038
Dan Gohmancbad42c2008-11-18 19:49:32 +000039 virtual unsigned isLoadFromStackSlot(const MachineInstr *MI,
40 int &FrameIndex) const;
41 virtual unsigned isStoreToStackSlot(const MachineInstr *MI,
42 int &FrameIndex) const;
Chris Lattner0476b282006-10-24 16:41:36 +000043
Evan Chengb5cdaa22007-05-18 00:05:48 +000044 virtual unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
Chris Lattner0476b282006-10-24 16:41:36 +000045 MachineBasicBlock *FBB,
Owen Anderson44eb65c2008-08-14 22:49:33 +000046 const SmallVectorImpl<MachineOperand> &Cond) const;
Owen Anderson940f83e2008-08-26 18:03:31 +000047 virtual bool copyRegToReg(MachineBasicBlock &MBB,
Owen Andersond10fd972007-12-31 06:32:00 +000048 MachineBasicBlock::iterator MI,
49 unsigned DestReg, unsigned SrcReg,
50 const TargetRegisterClass *DestRC,
51 const TargetRegisterClass *SrcRC) const;
Owen Andersonf6372aa2008-01-01 21:11:32 +000052 virtual void storeRegToStackSlot(MachineBasicBlock &MBB,
53 MachineBasicBlock::iterator MBBI,
54 unsigned SrcReg, bool isKill, int FrameIndex,
55 const TargetRegisterClass *RC) const;
56
57 virtual void storeRegToAddr(MachineFunction &MF, unsigned SrcReg, bool isKill,
58 SmallVectorImpl<MachineOperand> &Addr,
59 const TargetRegisterClass *RC,
60 SmallVectorImpl<MachineInstr*> &NewMIs) const;
61
62 virtual void loadRegFromStackSlot(MachineBasicBlock &MBB,
63 MachineBasicBlock::iterator MBBI,
64 unsigned DestReg, int FrameIndex,
65 const TargetRegisterClass *RC) const;
66
67 virtual void loadRegFromAddr(MachineFunction &MF, unsigned DestReg,
68 SmallVectorImpl<MachineOperand> &Addr,
69 const TargetRegisterClass *RC,
70 SmallVectorImpl<MachineInstr*> &NewMIs) const;
Owen Anderson43dbe052008-01-07 01:35:02 +000071
Dan Gohmanc54baa22008-12-03 18:43:12 +000072 virtual MachineInstr* foldMemoryOperandImpl(MachineFunction &MF,
73 MachineInstr* MI,
74 const SmallVectorImpl<unsigned> &Ops,
75 int FrameIndex) const;
Owen Anderson43dbe052008-01-07 01:35:02 +000076
Dan Gohmanc54baa22008-12-03 18:43:12 +000077 virtual MachineInstr* foldMemoryOperandImpl(MachineFunction &MF,
78 MachineInstr* MI,
79 const SmallVectorImpl<unsigned> &Ops,
80 MachineInstr* LoadMI) const {
Owen Anderson43dbe052008-01-07 01:35:02 +000081 return 0;
82 }
83
Andrew Lenharthf81173f2006-10-31 16:49:55 +000084 bool AnalyzeBranch(MachineBasicBlock &MBB,MachineBasicBlock *&TBB,
85 MachineBasicBlock *&FBB,
Evan Chengdc54d312009-02-09 07:14:22 +000086 SmallVectorImpl<MachineOperand> &Cond,
87 bool AllowModify) const;
Evan Chengb5cdaa22007-05-18 00:05:48 +000088 unsigned RemoveBranch(MachineBasicBlock &MBB) const;
Andrew Lenharthf81173f2006-10-31 16:49:55 +000089 void insertNoop(MachineBasicBlock &MBB,
90 MachineBasicBlock::iterator MI) const;
Dan Gohman8e8b8a22008-10-16 01:49:15 +000091 bool BlockHasNoFallThrough(const MachineBasicBlock &MBB) const;
Owen Anderson44eb65c2008-08-14 22:49:33 +000092 bool ReverseBranchCondition(SmallVectorImpl<MachineOperand> &Cond) const;
Andrew Lenharth304d0f32005-01-22 23:41:55 +000093};
94
95}
96
97#endif