Path: blob/main/contrib/llvm-project/llvm/lib/Target/VE/VEInstrInfo.h
35269 views
//===-- VEInstrInfo.h - VE 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 VE implementation of the TargetInstrInfo class.9//10//===----------------------------------------------------------------------===//1112#ifndef LLVM_LIB_TARGET_VE_VEINSTRINFO_H13#define LLVM_LIB_TARGET_VE_VEINSTRINFO_H1415#include "VERegisterInfo.h"16#include "llvm/CodeGen/TargetInstrInfo.h"1718#define GET_INSTRINFO_HEADER19#include "VEGenInstrInfo.inc"2021namespace llvm {2223class VESubtarget;2425/// VEII - This namespace holds all of the Aurora VE target-specific26/// per-instruction flags. These must match the corresponding definitions in27/// VEInstrFormats.td.28namespace VEII {29enum {30// Aurora VE Instruction Flags. These flags describe the characteristics of31// the Aurora VE instructions for vector handling.3233/// VE_Vector - This instruction is Vector Instruction.34VE_Vector = 0x1,3536/// VE_VLInUse - This instruction has a vector register in its operands.37VE_VLInUse = 0x2,3839/// VE_VLMask/Shift - This is a bitmask that selects the index number where40/// an instruction holds vector length informatio (0 to 6, 7 means undef).n41VE_VLShift = 2,42VE_VLMask = 0x07 << VE_VLShift,43};4445#define HAS_VLINDEX(TSF) ((TSF)&VEII::VE_VLInUse)46#define GET_VLINDEX(TSF) \47(HAS_VLINDEX(TSF) ? (int)(((TSF)&VEII::VE_VLMask) >> VEII::VE_VLShift) : -1)48} // end namespace VEII4950class VEInstrInfo : public VEGenInstrInfo {51const VERegisterInfo RI;52virtual void anchor();5354public:55explicit VEInstrInfo(VESubtarget &ST);5657/// getRegisterInfo - TargetInstrInfo is a superset of MRegister info. As58/// such, whenever a client has an instance of instruction info, it should59/// always be able to get register info as well (through this method).60///61const VERegisterInfo &getRegisterInfo() const { return RI; }6263/// Branch Analysis & Modification {64bool analyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,65MachineBasicBlock *&FBB,66SmallVectorImpl<MachineOperand> &Cond,67bool AllowModify = false) const override;6869unsigned removeBranch(MachineBasicBlock &MBB,70int *BytesRemoved = nullptr) const override;7172unsigned insertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,73MachineBasicBlock *FBB, ArrayRef<MachineOperand> Cond,74const DebugLoc &DL,75int *BytesAdded = nullptr) const override;7677bool78reverseBranchCondition(SmallVectorImpl<MachineOperand> &Cond) const override;79/// } Branch Analysis & Modification8081void copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,82const DebugLoc &DL, MCRegister DestReg, MCRegister SrcReg,83bool KillSrc) const override;8485/// Stack Spill & Reload {86Register isLoadFromStackSlot(const MachineInstr &MI,87int &FrameIndex) const override;88Register isStoreToStackSlot(const MachineInstr &MI,89int &FrameIndex) const override;90void storeRegToStackSlot(MachineBasicBlock &MBB,91MachineBasicBlock::iterator MBBI, Register SrcReg,92bool isKill, int FrameIndex,93const TargetRegisterClass *RC,94const TargetRegisterInfo *TRI,95Register VReg) const override;9697void loadRegFromStackSlot(MachineBasicBlock &MBB,98MachineBasicBlock::iterator MBBI, Register DestReg,99int FrameIndex, const TargetRegisterClass *RC,100const TargetRegisterInfo *TRI,101Register VReg) const override;102/// } Stack Spill & Reload103104/// Optimization {105106bool foldImmediate(MachineInstr &UseMI, MachineInstr &DefMI, Register Reg,107MachineRegisterInfo *MRI) const override;108109/// } Optimization110111Register getGlobalBaseReg(MachineFunction *MF) const;112113// Lower pseudo instructions after register allocation.114bool expandPostRAPseudo(MachineInstr &MI) const override;115116bool expandExtendStackPseudo(MachineInstr &MI) const;117bool expandGetStackTopPseudo(MachineInstr &MI) const;118};119120} // namespace llvm121122#endif123124125