Path: blob/main/contrib/llvm-project/llvm/lib/Target/MSP430/MSP430InstrInfo.h
35269 views
//===-- MSP430InstrInfo.h - MSP430 Instruction Information ------*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7//8// This file contains the MSP430 implementation of the TargetInstrInfo class.9//10//===----------------------------------------------------------------------===//1112#ifndef LLVM_LIB_TARGET_MSP430_MSP430INSTRINFO_H13#define LLVM_LIB_TARGET_MSP430_MSP430INSTRINFO_H1415#include "MSP430RegisterInfo.h"16#include "llvm/CodeGen/TargetInstrInfo.h"1718#define GET_INSTRINFO_HEADER19#include "MSP430GenInstrInfo.inc"2021namespace llvm {2223class MSP430Subtarget;2425class MSP430InstrInfo : public MSP430GenInstrInfo {26const MSP430RegisterInfo RI;27virtual void anchor();28public:29explicit MSP430InstrInfo(MSP430Subtarget &STI);3031/// getRegisterInfo - TargetInstrInfo is a superset of MRegister info. As32/// such, whenever a client has an instance of instruction info, it should33/// always be able to get register info as well (through this method).34///35const MSP430RegisterInfo &getRegisterInfo() const { return RI; }3637void copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,38const DebugLoc &DL, MCRegister DestReg, MCRegister SrcReg,39bool KillSrc) const override;4041void storeRegToStackSlot(MachineBasicBlock &MBB,42MachineBasicBlock::iterator MI, Register SrcReg,43bool isKill, int FrameIndex,44const TargetRegisterClass *RC,45const TargetRegisterInfo *TRI,46Register VReg) const override;47void loadRegFromStackSlot(MachineBasicBlock &MBB,48MachineBasicBlock::iterator MI, Register DestReg,49int FrameIdx, const TargetRegisterClass *RC,50const TargetRegisterInfo *TRI,51Register VReg) const override;5253unsigned getInstSizeInBytes(const MachineInstr &MI) const override;5455// Branch folding goodness56bool57reverseBranchCondition(SmallVectorImpl<MachineOperand> &Cond) const override;58bool analyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,59MachineBasicBlock *&FBB,60SmallVectorImpl<MachineOperand> &Cond,61bool AllowModify) const override;6263unsigned removeBranch(MachineBasicBlock &MBB,64int *BytesRemoved = nullptr) const override;65unsigned insertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,66MachineBasicBlock *FBB, ArrayRef<MachineOperand> Cond,67const DebugLoc &DL,68int *BytesAdded = nullptr) const override;6970int64_t getFramePoppedByCallee(const MachineInstr &I) const {71assert(isFrameInstr(I) && "Not a frame instruction");72assert(I.getOperand(1).getImm() >= 0 && "Size must not be negative");73return I.getOperand(1).getImm();74}75};7677}7879#endif808182