1 //=- WebAssemblyInstrInfo.h - WebAssembly Instruction Information -*- C++ -*-=//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
11 /// This file contains the WebAssembly implementation of the
12 /// TargetInstrInfo class.
14 //===----------------------------------------------------------------------===//
16 #ifndef LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYINSTRINFO_H
17 #define LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYINSTRINFO_H
19 #include "WebAssemblyRegisterInfo.h"
20 #include "llvm/CodeGen/TargetInstrInfo.h"
22 #define GET_INSTRINFO_HEADER
23 #include "WebAssemblyGenInstrInfo.inc"
27 class WebAssemblySubtarget;
29 class WebAssemblyInstrInfo final : public WebAssemblyGenInstrInfo {
30 const WebAssemblyRegisterInfo RI;
33 explicit WebAssemblyInstrInfo(const WebAssemblySubtarget &STI);
35 const WebAssemblyRegisterInfo &getRegisterInfo() const { return RI; }
37 bool isReallyTriviallyReMaterializable(const MachineInstr &MI,
38 AliasAnalysis *AA) const override;
40 void copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI,
41 const DebugLoc &DL, unsigned DestReg, unsigned SrcReg,
42 bool KillSrc) const override;
43 MachineInstr *commuteInstructionImpl(MachineInstr &MI, bool NewMI,
45 unsigned OpIdx2) const override;
47 bool analyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,
48 MachineBasicBlock *&FBB,
49 SmallVectorImpl<MachineOperand> &Cond,
50 bool AllowModify = false) const override;
51 unsigned removeBranch(MachineBasicBlock &MBB,
52 int *BytesRemoved = nullptr) const override;
53 unsigned insertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
54 MachineBasicBlock *FBB, ArrayRef<MachineOperand> Cond,
56 int *BytesAdded = nullptr) const override;
58 reverseBranchCondition(SmallVectorImpl<MachineOperand> &Cond) const override;
61 } // end namespace llvm