Dan Gohman | 10e730a | 2015-06-29 23:51:55 +0000 | [diff] [blame] | 1 | //=- WebAssemblyInstrInfo.h - WebAssembly Instruction Information -*- C++ -*-=// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | /// |
| 10 | /// \file |
| 11 | /// \brief This file contains the WebAssembly implementation of the |
| 12 | /// TargetInstrInfo class. |
| 13 | /// |
| 14 | //===----------------------------------------------------------------------===// |
| 15 | |
| 16 | #ifndef LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYINSTRINFO_H |
| 17 | #define LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYINSTRINFO_H |
| 18 | |
| 19 | #include "WebAssemblyRegisterInfo.h" |
David Blaikie | 3f833ed | 2017-11-08 01:01:31 +0000 | [diff] [blame] | 20 | #include "llvm/CodeGen/TargetInstrInfo.h" |
Dan Gohman | 10e730a | 2015-06-29 23:51:55 +0000 | [diff] [blame] | 21 | |
JF Bastien | b9073fb | 2015-07-22 21:28:15 +0000 | [diff] [blame] | 22 | #define GET_INSTRINFO_HEADER |
| 23 | #include "WebAssemblyGenInstrInfo.inc" |
| 24 | |
Dan Gohman | 10e730a | 2015-06-29 23:51:55 +0000 | [diff] [blame] | 25 | namespace llvm { |
| 26 | |
| 27 | class WebAssemblySubtarget; |
| 28 | |
JF Bastien | b9073fb | 2015-07-22 21:28:15 +0000 | [diff] [blame] | 29 | class WebAssemblyInstrInfo final : public WebAssemblyGenInstrInfo { |
Dan Gohman | 10e730a | 2015-06-29 23:51:55 +0000 | [diff] [blame] | 30 | const WebAssemblyRegisterInfo RI; |
| 31 | |
| 32 | public: |
| 33 | explicit WebAssemblyInstrInfo(const WebAssemblySubtarget &STI); |
| 34 | |
| 35 | const WebAssemblyRegisterInfo &getRegisterInfo() const { return RI; } |
Dan Gohman | 4f52e00 | 2015-09-09 00:52:47 +0000 | [diff] [blame] | 36 | |
Duncan P. N. Exon Smith | 9cfc75c | 2016-06-30 00:01:54 +0000 | [diff] [blame] | 37 | bool isReallyTriviallyReMaterializable(const MachineInstr &MI, |
Dan Gohman | b6fd39a | 2016-01-19 16:59:23 +0000 | [diff] [blame] | 38 | AliasAnalysis *AA) const override; |
| 39 | |
Dan Gohman | 4f52e00 | 2015-09-09 00:52:47 +0000 | [diff] [blame] | 40 | void copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, |
Benjamin Kramer | bdc4956 | 2016-06-12 15:39:02 +0000 | [diff] [blame] | 41 | const DebugLoc &DL, unsigned DestReg, unsigned SrcReg, |
Dan Gohman | 4f52e00 | 2015-09-09 00:52:47 +0000 | [diff] [blame] | 42 | bool KillSrc) const override; |
Duncan P. N. Exon Smith | 9cfc75c | 2016-06-30 00:01:54 +0000 | [diff] [blame] | 43 | MachineInstr *commuteInstructionImpl(MachineInstr &MI, bool NewMI, |
Dan Gohman | adf2817 | 2016-01-28 01:22:44 +0000 | [diff] [blame] | 44 | unsigned OpIdx1, |
| 45 | unsigned OpIdx2) const override; |
Dan Gohman | 950a13c | 2015-09-16 16:51:30 +0000 | [diff] [blame] | 46 | |
Jacques Pienaar | 71c30a1 | 2016-07-15 14:41:04 +0000 | [diff] [blame] | 47 | bool analyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB, |
Dan Gohman | 950a13c | 2015-09-16 16:51:30 +0000 | [diff] [blame] | 48 | MachineBasicBlock *&FBB, |
| 49 | SmallVectorImpl<MachineOperand> &Cond, |
| 50 | bool AllowModify = false) const override; |
Matt Arsenault | 1b9fc8e | 2016-09-14 20:43:16 +0000 | [diff] [blame] | 51 | unsigned removeBranch(MachineBasicBlock &MBB, |
Matt Arsenault | a2b036e | 2016-09-14 17:23:48 +0000 | [diff] [blame] | 52 | int *BytesRemoved = nullptr) const override; |
Matt Arsenault | e8e0f5c | 2016-09-14 17:24:15 +0000 | [diff] [blame] | 53 | unsigned insertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, |
Dan Gohman | 7a6b982 | 2015-11-29 22:32:02 +0000 | [diff] [blame] | 54 | MachineBasicBlock *FBB, ArrayRef<MachineOperand> Cond, |
Matt Arsenault | a2b036e | 2016-09-14 17:23:48 +0000 | [diff] [blame] | 55 | const DebugLoc &DL, |
| 56 | int *BytesAdded = nullptr) const override; |
Dan Gohman | 950a13c | 2015-09-16 16:51:30 +0000 | [diff] [blame] | 57 | bool |
Matt Arsenault | 1b9fc8e | 2016-09-14 20:43:16 +0000 | [diff] [blame] | 58 | reverseBranchCondition(SmallVectorImpl<MachineOperand> &Cond) const override; |
Dan Gohman | 10e730a | 2015-06-29 23:51:55 +0000 | [diff] [blame] | 59 | }; |
| 60 | |
| 61 | } // end namespace llvm |
| 62 | |
| 63 | #endif |