Path: blob/main/contrib/llvm-project/llvm/lib/Target/Sparc/SparcInstrInfo.h
35269 views
//===-- SparcInstrInfo.h - Sparc 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 Sparc implementation of the TargetInstrInfo class.9//10//===----------------------------------------------------------------------===//1112#ifndef LLVM_LIB_TARGET_SPARC_SPARCINSTRINFO_H13#define LLVM_LIB_TARGET_SPARC_SPARCINSTRINFO_H1415#include "SparcRegisterInfo.h"16#include "llvm/CodeGen/TargetInstrInfo.h"1718#define GET_INSTRINFO_HEADER19#include "SparcGenInstrInfo.inc"2021namespace llvm {2223class SparcSubtarget;2425/// SPII - This namespace holds all of the target specific flags that26/// instruction info tracks.27///28namespace SPII {29enum {30Pseudo = (1<<0),31Load = (1<<1),32Store = (1<<2),33DelaySlot = (1<<3)34};35}3637class SparcInstrInfo : public SparcGenInstrInfo {38const SparcRegisterInfo RI;39const SparcSubtarget& Subtarget;40virtual void anchor();41public:42explicit SparcInstrInfo(SparcSubtarget &ST);4344/// getRegisterInfo - TargetInstrInfo is a superset of MRegister info. As45/// such, whenever a client has an instance of instruction info, it should46/// always be able to get register info as well (through this method).47///48const SparcRegisterInfo &getRegisterInfo() const { return RI; }4950/// isLoadFromStackSlot - If the specified machine instruction is a direct51/// load from a stack slot, return the virtual or physical register number of52/// the destination along with the FrameIndex of the loaded stack slot. If53/// not, return 0. This predicate must return 0 if the instruction has54/// any side effects other than loading from the stack slot.55Register isLoadFromStackSlot(const MachineInstr &MI,56int &FrameIndex) const override;5758/// isStoreToStackSlot - If the specified machine instruction is a direct59/// store to a stack slot, return the virtual or physical register number of60/// the source reg along with the FrameIndex of the loaded stack slot. If61/// not, return 0. This predicate must return 0 if the instruction has62/// any side effects other than storing to the stack slot.63Register isStoreToStackSlot(const MachineInstr &MI,64int &FrameIndex) const override;6566MachineBasicBlock *getBranchDestBlock(const MachineInstr &MI) const override;6768bool analyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,69MachineBasicBlock *&FBB,70SmallVectorImpl<MachineOperand> &Cond,71bool AllowModify = false) const override;7273unsigned removeBranch(MachineBasicBlock &MBB,74int *BytesRemoved = nullptr) const override;7576unsigned insertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,77MachineBasicBlock *FBB, ArrayRef<MachineOperand> Cond,78const DebugLoc &DL,79int *BytesAdded = nullptr) const override;8081bool82reverseBranchCondition(SmallVectorImpl<MachineOperand> &Cond) const override;8384/// Determine if the branch target is in range.85bool isBranchOffsetInRange(unsigned BranchOpc, int64_t Offset) const override;8687void copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,88const DebugLoc &DL, MCRegister DestReg, MCRegister SrcReg,89bool KillSrc) const override;9091void storeRegToStackSlot(MachineBasicBlock &MBB,92MachineBasicBlock::iterator MBBI, Register SrcReg,93bool isKill, int FrameIndex,94const TargetRegisterClass *RC,95const TargetRegisterInfo *TRI,96Register VReg) const override;9798void loadRegFromStackSlot(MachineBasicBlock &MBB,99MachineBasicBlock::iterator MBBI, Register DestReg,100int FrameIndex, const TargetRegisterClass *RC,101const TargetRegisterInfo *TRI,102Register VReg) const override;103104Register getGlobalBaseReg(MachineFunction *MF) const;105106/// GetInstSize - Return the number of bytes of code the specified107/// instruction may be. This returns the maximum number of bytes.108unsigned getInstSizeInBytes(const MachineInstr &MI) const override;109110// Lower pseudo instructions after register allocation.111bool expandPostRAPseudo(MachineInstr &MI) const override;112};113114}115116#endif117118119