LLVM  7.0.0
MSP430InstrInfo.h
Go to the documentation of this file.
1 //===-- MSP430InstrInfo.h - MSP430 Instruction Information ------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file contains the MSP430 implementation of the TargetInstrInfo class.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_LIB_TARGET_MSP430_MSP430INSTRINFO_H
15 #define LLVM_LIB_TARGET_MSP430_MSP430INSTRINFO_H
16 
17 #include "MSP430RegisterInfo.h"
19 
20 #define GET_INSTRINFO_HEADER
21 #include "MSP430GenInstrInfo.inc"
22 
23 namespace llvm {
24 
25 class MSP430Subtarget;
26 
27 /// MSP430II - This namespace holds all of the target specific flags that
28 /// instruction info tracks.
29 ///
30 namespace MSP430II {
31  enum {
32  SizeShift = 2,
34 
40  };
41 }
42 
44  const MSP430RegisterInfo RI;
45  virtual void anchor();
46 public:
47  explicit MSP430InstrInfo(MSP430Subtarget &STI);
48 
49  /// getRegisterInfo - TargetInstrInfo is a superset of MRegister info. As
50  /// such, whenever a client has an instance of instruction info, it should
51  /// always be able to get register info as well (through this method).
52  ///
53  const TargetRegisterInfo &getRegisterInfo() const { return RI; }
54 
55  void copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,
56  const DebugLoc &DL, unsigned DestReg, unsigned SrcReg,
57  bool KillSrc) const override;
58 
59  void storeRegToStackSlot(MachineBasicBlock &MBB,
61  unsigned SrcReg, bool isKill,
62  int FrameIndex,
63  const TargetRegisterClass *RC,
64  const TargetRegisterInfo *TRI) const override;
65  void loadRegFromStackSlot(MachineBasicBlock &MBB,
67  unsigned DestReg, int FrameIdx,
68  const TargetRegisterClass *RC,
69  const TargetRegisterInfo *TRI) const override;
70 
71  unsigned getInstSizeInBytes(const MachineInstr &MI) const override;
72 
73  // Branch folding goodness
74  bool
75  reverseBranchCondition(SmallVectorImpl<MachineOperand> &Cond) const override;
76  bool isUnpredicatedTerminator(const MachineInstr &MI) const override;
77  bool analyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,
78  MachineBasicBlock *&FBB,
80  bool AllowModify) const override;
81 
82  unsigned removeBranch(MachineBasicBlock &MBB,
83  int *BytesRemoved = nullptr) const override;
84  unsigned insertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
86  const DebugLoc &DL,
87  int *BytesAdded = nullptr) const override;
88 
89  int64_t getFramePoppedByCallee(const MachineInstr &I) const {
90  assert(isFrameInstr(I) && "Not a frame instruction");
91  assert(I.getOperand(1).getImm() >= 0 && "Size must not be negative");
92  return I.getOperand(1).getImm();
93  }
94 };
95 
96 }
97 
98 #endif
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
unsigned const TargetRegisterInfo * TRI
A debug info location.
Definition: DebugLoc.h:34
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: APFloat.h:42
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
Definition: APInt.h:33
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
int64_t getImm() const
int64_t getFramePoppedByCallee(const MachineInstr &I) const
Representation of each machine instruction.
Definition: MachineInstr.h:60
#define I(x, y, z)
Definition: MD5.cpp:58
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
IRTranslator LLVM IR MI
const MachineOperand & getOperand(unsigned i) const
Definition: MachineInstr.h:316
const TargetRegisterInfo & getRegisterInfo() const
getRegisterInfo - TargetInstrInfo is a superset of MRegister info.