Tom Stellard | 75aadc2 | 2012-12-11 21:25:42 +0000 | [diff] [blame] | 1 | //===-- AMDGPUInstrInfo.h - AMDGPU 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 Contains the definition of a TargetInstrInfo class that is common |
| 12 | /// to all AMD GPUs. |
| 13 | // |
| 14 | //===----------------------------------------------------------------------===// |
| 15 | |
Matt Arsenault | 6b6a2c3 | 2016-03-11 08:00:27 +0000 | [diff] [blame] | 16 | #ifndef LLVM_LIB_TARGET_AMDGPU_AMDGPUINSTRINFO_H |
| 17 | #define LLVM_LIB_TARGET_AMDGPU_AMDGPUINSTRINFO_H |
Tom Stellard | 75aadc2 | 2012-12-11 21:25:42 +0000 | [diff] [blame] | 18 | |
Tom Stellard | 75aadc2 | 2012-12-11 21:25:42 +0000 | [diff] [blame] | 19 | #include "llvm/Target/TargetInstrInfo.h" |
Tom Stellard | 75aadc2 | 2012-12-11 21:25:42 +0000 | [diff] [blame] | 20 | |
| 21 | #define GET_INSTRINFO_HEADER |
| 22 | #define GET_INSTRINFO_ENUM |
Tom Stellard | 02661d9 | 2013-06-25 21:22:18 +0000 | [diff] [blame] | 23 | #define GET_INSTRINFO_OPERAND_ENUM |
Tom Stellard | 75aadc2 | 2012-12-11 21:25:42 +0000 | [diff] [blame] | 24 | #include "AMDGPUGenInstrInfo.inc" |
| 25 | |
| 26 | #define OPCODE_IS_ZERO_INT AMDGPU::PRED_SETE_INT |
| 27 | #define OPCODE_IS_NOT_ZERO_INT AMDGPU::PRED_SETNE_INT |
| 28 | #define OPCODE_IS_ZERO AMDGPU::PRED_SETE |
| 29 | #define OPCODE_IS_NOT_ZERO AMDGPU::PRED_SETNE |
| 30 | |
| 31 | namespace llvm { |
| 32 | |
Tom Stellard | 2e59a45 | 2014-06-13 01:32:00 +0000 | [diff] [blame] | 33 | class AMDGPUSubtarget; |
Tom Stellard | 75aadc2 | 2012-12-11 21:25:42 +0000 | [diff] [blame] | 34 | class MachineFunction; |
| 35 | class MachineInstr; |
| 36 | class MachineInstrBuilder; |
| 37 | |
| 38 | class AMDGPUInstrInfo : public AMDGPUGenInstrInfo { |
| 39 | private: |
Tom Stellard | 2e59a45 | 2014-06-13 01:32:00 +0000 | [diff] [blame] | 40 | const AMDGPUSubtarget &ST; |
Matt Arsenault | 43e92fe | 2016-06-24 06:30:11 +0000 | [diff] [blame] | 41 | |
| 42 | virtual void anchor(); |
| 43 | |
Tom Stellard | 75aadc2 | 2012-12-11 21:25:42 +0000 | [diff] [blame] | 44 | public: |
Tom Stellard | 2e59a45 | 2014-06-13 01:32:00 +0000 | [diff] [blame] | 45 | explicit AMDGPUInstrInfo(const AMDGPUSubtarget &st); |
Tom Stellard | 75aadc2 | 2012-12-11 21:25:42 +0000 | [diff] [blame] | 46 | |
Matt Arsenault | 034d666 | 2014-07-24 02:10:17 +0000 | [diff] [blame] | 47 | bool enableClusterLoads() const override; |
| 48 | |
Tom Stellard | 75aadc2 | 2012-12-11 21:25:42 +0000 | [diff] [blame] | 49 | bool shouldScheduleLoadsNear(SDNode *Load1, SDNode *Load2, |
| 50 | int64_t Offset1, int64_t Offset2, |
Craig Topper | 5656db4 | 2014-04-29 07:57:24 +0000 | [diff] [blame] | 51 | unsigned NumLoads) const override; |
Tom Stellard | 75aadc2 | 2012-12-11 21:25:42 +0000 | [diff] [blame] | 52 | |
Marek Olsak | a93603d | 2015-01-15 18:42:51 +0000 | [diff] [blame] | 53 | /// \brief Return a target-specific opcode if Opcode is a pseudo instruction. |
| 54 | /// Return -1 if the target-specific opcode for the pseudo instruction does |
| 55 | /// not exist. If Opcode is not a pseudo instruction, this is identity. |
| 56 | int pseudoToMCOpcode(int Opcode) const; |
| 57 | |
Tom Stellard | 682bfbc | 2013-10-10 17:11:24 +0000 | [diff] [blame] | 58 | /// \brief Given a MIMG \p Opcode that writes all 4 channels, return the |
| 59 | /// equivalent opcode that writes \p Channels Channels. |
| 60 | int getMaskedMIMGOp(uint16_t Opcode, unsigned Channels) const; |
Tom Stellard | 75aadc2 | 2012-12-11 21:25:42 +0000 | [diff] [blame] | 61 | }; |
| 62 | |
Tom Stellard | 02661d9 | 2013-06-25 21:22:18 +0000 | [diff] [blame] | 63 | namespace AMDGPU { |
Matt Arsenault | f743b83 | 2015-09-25 18:09:15 +0000 | [diff] [blame] | 64 | LLVM_READONLY |
Tom Stellard | 02661d9 | 2013-06-25 21:22:18 +0000 | [diff] [blame] | 65 | int16_t getNamedOperandIdx(uint16_t Opcode, uint16_t NamedIndex); |
| 66 | } // End namespace AMDGPU |
| 67 | |
Alexander Kornienko | f00654e | 2015-06-23 09:49:53 +0000 | [diff] [blame] | 68 | } // End llvm namespace |
Tom Stellard | 75aadc2 | 2012-12-11 21:25:42 +0000 | [diff] [blame] | 69 | |
Tom Stellard | f3b2a1e | 2013-02-06 17:32:29 +0000 | [diff] [blame] | 70 | #define AMDGPU_FLAG_REGISTER_LOAD (UINT64_C(1) << 63) |
| 71 | #define AMDGPU_FLAG_REGISTER_STORE (UINT64_C(1) << 62) |
| 72 | |
Benjamin Kramer | a7c40ef | 2014-08-13 16:26:38 +0000 | [diff] [blame] | 73 | #endif |