LLVM  8.0.1
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 
28  const MSP430RegisterInfo RI;
29  virtual void anchor();
30 public:
31  explicit MSP430InstrInfo(MSP430Subtarget &STI);
32 
33  /// getRegisterInfo - TargetInstrInfo is a superset of MRegister info. As
34  /// such, whenever a client has an instance of instruction info, it should
35  /// always be able to get register info as well (through this method).
36  ///
37  const TargetRegisterInfo &getRegisterInfo() const { return RI; }
38 
40  const DebugLoc &DL, unsigned DestReg, unsigned SrcReg,
41  bool KillSrc) const override;
42 
45  unsigned SrcReg, bool isKill,
46  int FrameIndex,
47  const TargetRegisterClass *RC,
48  const TargetRegisterInfo *TRI) const override;
51  unsigned DestReg, int FrameIdx,
52  const TargetRegisterClass *RC,
53  const TargetRegisterInfo *TRI) const override;
54 
55  unsigned getInstSizeInBytes(const MachineInstr &MI) const override;
56 
57  // Branch folding goodness
58  bool
60  bool isUnpredicatedTerminator(const MachineInstr &MI) const override;
62  MachineBasicBlock *&FBB,
64  bool AllowModify) const override;
65 
66  unsigned removeBranch(MachineBasicBlock &MBB,
67  int *BytesRemoved = nullptr) const override;
70  const DebugLoc &DL,
71  int *BytesAdded = nullptr) const override;
72 
73  int64_t getFramePoppedByCallee(const MachineInstr &I) const {
74  assert(isFrameInstr(I) && "Not a frame instruction");
75  assert(I.getOperand(1).getImm() >= 0 && "Size must not be negative");
76  return I.getOperand(1).getImm();
77  }
78 };
79 
80 }
81 
82 #endif
This class represents lattice values for constants.
Definition: AllocatorList.h:24
unsigned const TargetRegisterInfo * TRI
A debug info location.
Definition: DebugLoc.h:34
bool isUnpredicatedTerminator(const MachineInstr &MI) const override
void loadRegFromStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, unsigned DestReg, int FrameIdx, const TargetRegisterClass *RC, const TargetRegisterInfo *TRI) const override
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: APFloat.h:42
void copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, const DebugLoc &DL, unsigned DestReg, unsigned SrcReg, bool KillSrc) const override
bool analyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB, MachineBasicBlock *&FBB, SmallVectorImpl< MachineOperand > &Cond, bool AllowModify) const override
unsigned insertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, MachineBasicBlock *FBB, ArrayRef< MachineOperand > Cond, const DebugLoc &DL, int *BytesAdded=nullptr) const override
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
Definition: APInt.h:33
bool reverseBranchCondition(SmallVectorImpl< MachineOperand > &Cond) const override
unsigned getInstSizeInBytes(const MachineInstr &MI) const override
GetInstSize - Return the number of bytes of code the specified instruction may be.
void storeRegToStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, unsigned SrcReg, bool isKill, int FrameIndex, const TargetRegisterClass *RC, const TargetRegisterInfo *TRI) const override
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
unsigned removeBranch(MachineBasicBlock &MBB, int *BytesRemoved=nullptr) const override
MSP430InstrInfo(MSP430Subtarget &STI)
int64_t getImm() const
int64_t getFramePoppedByCallee(const MachineInstr &I) const
Representation of each machine instruction.
Definition: MachineInstr.h:64
#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:414
const TargetRegisterInfo & getRegisterInfo() const
getRegisterInfo - TargetInstrInfo is a superset of MRegister info.