109467b48Spatrick //=- WebAssemblyInstrInfo.h - WebAssembly Instruction Information -*- C++ -*-=// 209467b48Spatrick // 309467b48Spatrick // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 409467b48Spatrick // See https://llvm.org/LICENSE.txt for license information. 509467b48Spatrick // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 609467b48Spatrick // 709467b48Spatrick //===----------------------------------------------------------------------===// 809467b48Spatrick /// 909467b48Spatrick /// \file 1009467b48Spatrick /// This file contains the WebAssembly implementation of the 1109467b48Spatrick /// TargetInstrInfo class. 1209467b48Spatrick /// 1309467b48Spatrick //===----------------------------------------------------------------------===// 1409467b48Spatrick 1509467b48Spatrick #ifndef LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYINSTRINFO_H 1609467b48Spatrick #define LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYINSTRINFO_H 1709467b48Spatrick 1809467b48Spatrick #include "WebAssemblyRegisterInfo.h" 1909467b48Spatrick #include "llvm/ADT/ArrayRef.h" 2009467b48Spatrick #include "llvm/CodeGen/TargetInstrInfo.h" 2109467b48Spatrick 2209467b48Spatrick #define GET_INSTRINFO_HEADER 2309467b48Spatrick #include "WebAssemblyGenInstrInfo.inc" 2409467b48Spatrick 2509467b48Spatrick #define GET_INSTRINFO_OPERAND_ENUM 2609467b48Spatrick #include "WebAssemblyGenInstrInfo.inc" 2709467b48Spatrick 2809467b48Spatrick namespace llvm { 2909467b48Spatrick 3009467b48Spatrick namespace WebAssembly { 3109467b48Spatrick 3209467b48Spatrick int16_t getNamedOperandIdx(uint16_t Opcode, uint16_t NamedIndex); 3309467b48Spatrick 3409467b48Spatrick } 3509467b48Spatrick 3609467b48Spatrick class WebAssemblySubtarget; 3709467b48Spatrick 3809467b48Spatrick class WebAssemblyInstrInfo final : public WebAssemblyGenInstrInfo { 3909467b48Spatrick const WebAssemblyRegisterInfo RI; 4009467b48Spatrick 4109467b48Spatrick public: 4209467b48Spatrick explicit WebAssemblyInstrInfo(const WebAssemblySubtarget &STI); 4309467b48Spatrick getRegisterInfo()4409467b48Spatrick const WebAssemblyRegisterInfo &getRegisterInfo() const { return RI; } 4509467b48Spatrick 46*d415bd75Srobert bool isReallyTriviallyReMaterializable(const MachineInstr &MI) const override; 4709467b48Spatrick 4809467b48Spatrick void copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, 4909467b48Spatrick const DebugLoc &DL, MCRegister DestReg, MCRegister SrcReg, 5009467b48Spatrick bool KillSrc) const override; 5109467b48Spatrick MachineInstr *commuteInstructionImpl(MachineInstr &MI, bool NewMI, 5209467b48Spatrick unsigned OpIdx1, 5309467b48Spatrick unsigned OpIdx2) const override; 5409467b48Spatrick 5509467b48Spatrick bool analyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB, 5609467b48Spatrick MachineBasicBlock *&FBB, 5709467b48Spatrick SmallVectorImpl<MachineOperand> &Cond, 5809467b48Spatrick bool AllowModify = false) const override; 5909467b48Spatrick unsigned removeBranch(MachineBasicBlock &MBB, 6009467b48Spatrick int *BytesRemoved = nullptr) const override; 6109467b48Spatrick unsigned insertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, 6209467b48Spatrick MachineBasicBlock *FBB, ArrayRef<MachineOperand> Cond, 6309467b48Spatrick const DebugLoc &DL, 6409467b48Spatrick int *BytesAdded = nullptr) const override; 6509467b48Spatrick bool 6609467b48Spatrick reverseBranchCondition(SmallVectorImpl<MachineOperand> &Cond) const override; 6709467b48Spatrick 6809467b48Spatrick ArrayRef<std::pair<int, const char *>> 6909467b48Spatrick getSerializableTargetIndices() const override; 7073471bf0Spatrick 7173471bf0Spatrick const MachineOperand &getCalleeOperand(const MachineInstr &MI) const override; 72*d415bd75Srobert 73*d415bd75Srobert bool isExplicitTargetIndexDef(const MachineInstr &MI, int &Index, 74*d415bd75Srobert int64_t &Offset) const override; 7509467b48Spatrick }; 7609467b48Spatrick 7709467b48Spatrick } // end namespace llvm 7809467b48Spatrick 7909467b48Spatrick #endif 80