LLVM  14.0.0git
MSP430InstrInfo.h
Go to the documentation of this file.
1 //===-- MSP430InstrInfo.h - MSP430 Instruction Information ------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file contains the MSP430 implementation of the TargetInstrInfo class.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_LIB_TARGET_MSP430_MSP430INSTRINFO_H
14 #define LLVM_LIB_TARGET_MSP430_MSP430INSTRINFO_H
15 
16 #include "MSP430RegisterInfo.h"
18 
19 #define GET_INSTRINFO_HEADER
20 #include "MSP430GenInstrInfo.inc"
21 
22 namespace llvm {
23 
24 class MSP430Subtarget;
25 
27  const MSP430RegisterInfo RI;
28  virtual void anchor();
29 public:
30  explicit MSP430InstrInfo(MSP430Subtarget &STI);
31 
32  /// getRegisterInfo - TargetInstrInfo is a superset of MRegister info. As
33  /// such, whenever a client has an instance of instruction info, it should
34  /// always be able to get register info as well (through this method).
35  ///
36  const TargetRegisterInfo &getRegisterInfo() const { return RI; }
37 
39  const DebugLoc &DL, MCRegister DestReg, MCRegister SrcReg,
40  bool KillSrc) const override;
41 
44  Register SrcReg, bool isKill,
45  int FrameIndex,
46  const TargetRegisterClass *RC,
47  const TargetRegisterInfo *TRI) const override;
50  Register DestReg, int FrameIdx,
51  const TargetRegisterClass *RC,
52  const TargetRegisterInfo *TRI) const override;
53 
54  unsigned getInstSizeInBytes(const MachineInstr &MI) const override;
55 
56  // Branch folding goodness
57  bool
60  MachineBasicBlock *&FBB,
62  bool AllowModify) const override;
63 
65  int *BytesRemoved = nullptr) const override;
68  const DebugLoc &DL,
69  int *BytesAdded = nullptr) const override;
70 
71  int64_t getFramePoppedByCallee(const MachineInstr &I) const {
72  assert(isFrameInstr(I) && "Not a frame instruction");
73  assert(I.getOperand(1).getImm() >= 0 && "Size must not be negative");
74  return I.getOperand(1).getImm();
75  }
76 };
77 
78 }
79 
80 #endif
MI
IRTranslator LLVM IR MI
Definition: IRTranslator.cpp:103
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
MSP430GenInstrInfo
llvm::MSP430InstrInfo::removeBranch
unsigned removeBranch(MachineBasicBlock &MBB, int *BytesRemoved=nullptr) const override
Definition: MSP430InstrInfo.cpp:106
llvm::TargetRegisterInfo
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
Definition: TargetRegisterInfo.h:233
TargetInstrInfo.h
llvm::MSP430InstrInfo::MSP430InstrInfo
MSP430InstrInfo(MSP430Subtarget &STI)
Definition: MSP430InstrInfo.cpp:32
llvm::MSP430RegisterInfo
Definition: MSP430RegisterInfo.h:23
TRI
unsigned const TargetRegisterInfo * TRI
Definition: MachineSink.cpp:1567
llvm::TargetRegisterClass
Definition: TargetRegisterInfo.h:46
llvm::MSP430Subtarget
Definition: MSP430Subtarget.h:31
llvm::MachineBasicBlock
Definition: MachineBasicBlock.h:95
llvm::MSP430InstrInfo::getRegisterInfo
const TargetRegisterInfo & getRegisterInfo() const
getRegisterInfo - TargetInstrInfo is a superset of MRegister info.
Definition: MSP430InstrInfo.h:36
llvm::MSP430InstrInfo
Definition: MSP430InstrInfo.h:26
llvm::MachineInstr
Representation of each machine instruction.
Definition: MachineInstr.h:64
llvm::MSP430InstrInfo::analyzeBranch
bool analyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB, MachineBasicBlock *&FBB, SmallVectorImpl< MachineOperand > &Cond, bool AllowModify) const override
Definition: MSP430InstrInfo.cpp:163
I
#define I(x, y, z)
Definition: MD5.cpp:59
llvm::MSP430InstrInfo::storeRegToStackSlot
void storeRegToStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, Register SrcReg, bool isKill, int FrameIndex, const TargetRegisterClass *RC, const TargetRegisterInfo *TRI) const override
Definition: MSP430InstrInfo.cpp:36
llvm::MSP430InstrInfo::copyPhysReg
void copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, const DebugLoc &DL, MCRegister DestReg, MCRegister SrcReg, bool KillSrc) const override
Definition: MSP430InstrInfo.cpp:90
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: APInt.h:32
Cond
SmallVector< MachineOperand, 4 > Cond
Definition: BasicBlockSections.cpp:179
DL
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Definition: AArch64SLSHardening.cpp:76
llvm::Register
Wrapper class representing virtual and physical registers.
Definition: Register.h:19
llvm::ISD::FrameIndex
@ FrameIndex
Definition: ISDOpcodes.h:80
MBB
MachineBasicBlock & MBB
Definition: AArch64SLSHardening.cpp:74
llvm::MSP430InstrInfo::loadRegFromStackSlot
void loadRegFromStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, Register DestReg, int FrameIdx, const TargetRegisterClass *RC, const TargetRegisterInfo *TRI) const override
Definition: MSP430InstrInfo.cpp:63
llvm::MSP430InstrInfo::getInstSizeInBytes
unsigned getInstSizeInBytes(const MachineInstr &MI) const override
GetInstSize - Return the number of bytes of code the specified instruction may be.
Definition: MSP430InstrInfo.cpp:288
llvm::MSP430InstrInfo::insertBranch
unsigned insertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, MachineBasicBlock *FBB, ArrayRef< MachineOperand > Cond, const DebugLoc &DL, int *BytesAdded=nullptr) const override
Definition: MSP430InstrInfo.cpp:253
llvm::SmallVectorImpl
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: APFloat.h:43
llvm::MSP430InstrInfo::getFramePoppedByCallee
int64_t getFramePoppedByCallee(const MachineInstr &I) const
Definition: MSP430InstrInfo.h:71
llvm::DebugLoc
A debug info location.
Definition: DebugLoc.h:33
MSP430RegisterInfo.h
llvm::MachineInstrBundleIterator< MachineInstr >
llvm::MSP430InstrInfo::reverseBranchCondition
bool reverseBranchCondition(SmallVectorImpl< MachineOperand > &Cond) const override
Definition: MSP430InstrInfo.cpp:132
llvm::MCRegister
Wrapper class representing physical registers. Should be passed by value.
Definition: MCRegister.h:23