brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.0 KiB · c0a3984 Raw
79 lines · c
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-exception6//7//===----------------------------------------------------------------------===//8//9// This file contains the MSP430 implementation of the TargetInstrInfo class.10//11//===----------------------------------------------------------------------===//12 13#ifndef LLVM_LIB_TARGET_MSP430_MSP430INSTRINFO_H14#define LLVM_LIB_TARGET_MSP430_MSP430INSTRINFO_H15 16#include "MSP430RegisterInfo.h"17#include "llvm/CodeGen/TargetInstrInfo.h"18 19#define GET_INSTRINFO_HEADER20#include "MSP430GenInstrInfo.inc"21 22namespace llvm {23 24class MSP430Subtarget;25 26class MSP430InstrInfo : public MSP430GenInstrInfo {27  const MSP430RegisterInfo RI;28  virtual void anchor();29public:30  explicit MSP430InstrInfo(const MSP430Subtarget &STI);31 32  /// getRegisterInfo - TargetInstrInfo is a superset of MRegister info.  As33  /// such, whenever a client has an instance of instruction info, it should34  /// always be able to get register info as well (through this method).35  ///36  const MSP430RegisterInfo &getRegisterInfo() const { return RI; }37 38  void copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,39                   const DebugLoc &DL, Register DestReg, Register SrcReg,40                   bool KillSrc, bool RenamableDest = false,41                   bool RenamableSrc = false) const override;42 43  void storeRegToStackSlot(44      MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, Register SrcReg,45      bool isKill, int FrameIndex, const TargetRegisterClass *RC, Register VReg,46      MachineInstr::MIFlag Flags = MachineInstr::NoFlags) const override;47  void loadRegFromStackSlot(48      MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, Register DestReg,49      int FrameIdx, const TargetRegisterClass *RC, Register VReg,50      MachineInstr::MIFlag Flags = MachineInstr::NoFlags) const override;51 52  unsigned getInstSizeInBytes(const MachineInstr &MI) const override;53 54  // Branch folding goodness55  bool56  reverseBranchCondition(SmallVectorImpl<MachineOperand> &Cond) const override;57  bool analyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,58                     MachineBasicBlock *&FBB,59                     SmallVectorImpl<MachineOperand> &Cond,60                     bool AllowModify) const override;61 62  unsigned removeBranch(MachineBasicBlock &MBB,63                        int *BytesRemoved = nullptr) const override;64  unsigned insertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,65                        MachineBasicBlock *FBB, ArrayRef<MachineOperand> Cond,66                        const DebugLoc &DL,67                        int *BytesAdded = nullptr) const override;68 69  int64_t getFramePoppedByCallee(const MachineInstr &I) const {70    assert(isFrameInstr(I) && "Not a frame instruction");71    assert(I.getOperand(1).getImm() >= 0 && "Size must not be negative");72    return I.getOperand(1).getImm();73  }74};75 76}77 78#endif79