blob: 001e03748ab7e2e9731eb5a4e2fae887e0609f3a [file] [log] [blame]
Tom Stellard75aadc22012-12-11 21:25:42 +00001//===-- 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 Arsenault6b6a2c32016-03-11 08:00:27 +000016#ifndef LLVM_LIB_TARGET_AMDGPU_AMDGPUINSTRINFO_H
17#define LLVM_LIB_TARGET_AMDGPU_AMDGPUINSTRINFO_H
Tom Stellard75aadc22012-12-11 21:25:42 +000018
Tom Stellard75aadc22012-12-11 21:25:42 +000019#include "llvm/Target/TargetInstrInfo.h"
Tom Stellard75aadc22012-12-11 21:25:42 +000020
21#define GET_INSTRINFO_HEADER
22#define GET_INSTRINFO_ENUM
Tom Stellard02661d92013-06-25 21:22:18 +000023#define GET_INSTRINFO_OPERAND_ENUM
Tom Stellard75aadc22012-12-11 21:25:42 +000024#include "AMDGPUGenInstrInfo.inc"
25
Tom Stellard75aadc22012-12-11 21:25:42 +000026namespace llvm {
27
Tom Stellard2e59a452014-06-13 01:32:00 +000028class AMDGPUSubtarget;
Tom Stellard75aadc22012-12-11 21:25:42 +000029class MachineFunction;
30class MachineInstr;
31class MachineInstrBuilder;
32
33class AMDGPUInstrInfo : public AMDGPUGenInstrInfo {
34private:
Tom Stellard2e59a452014-06-13 01:32:00 +000035 const AMDGPUSubtarget &ST;
Matt Arsenault43e92fe2016-06-24 06:30:11 +000036
37 virtual void anchor();
38
Tom Stellard75aadc22012-12-11 21:25:42 +000039public:
Tom Stellard2e59a452014-06-13 01:32:00 +000040 explicit AMDGPUInstrInfo(const AMDGPUSubtarget &st);
Tom Stellard75aadc22012-12-11 21:25:42 +000041
Matt Arsenault034d6662014-07-24 02:10:17 +000042 bool enableClusterLoads() const override;
43
Tom Stellard75aadc22012-12-11 21:25:42 +000044 bool shouldScheduleLoadsNear(SDNode *Load1, SDNode *Load2,
45 int64_t Offset1, int64_t Offset2,
Craig Topper5656db42014-04-29 07:57:24 +000046 unsigned NumLoads) const override;
Tom Stellard75aadc22012-12-11 21:25:42 +000047
Marek Olsaka93603d2015-01-15 18:42:51 +000048 /// \brief Return a target-specific opcode if Opcode is a pseudo instruction.
49 /// Return -1 if the target-specific opcode for the pseudo instruction does
50 /// not exist. If Opcode is not a pseudo instruction, this is identity.
51 int pseudoToMCOpcode(int Opcode) const;
52
Tom Stellard682bfbc2013-10-10 17:11:24 +000053 /// \brief Given a MIMG \p Opcode that writes all 4 channels, return the
54 /// equivalent opcode that writes \p Channels Channels.
55 int getMaskedMIMGOp(uint16_t Opcode, unsigned Channels) const;
Tom Stellard75aadc22012-12-11 21:25:42 +000056};
57
Tom Stellard02661d92013-06-25 21:22:18 +000058namespace AMDGPU {
Matt Arsenaultf743b832015-09-25 18:09:15 +000059 LLVM_READONLY
Tom Stellard02661d92013-06-25 21:22:18 +000060 int16_t getNamedOperandIdx(uint16_t Opcode, uint16_t NamedIndex);
61} // End namespace AMDGPU
62
Alexander Kornienkof00654e2015-06-23 09:49:53 +000063} // End llvm namespace
Tom Stellard75aadc22012-12-11 21:25:42 +000064
Benjamin Kramera7c40ef2014-08-13 16:26:38 +000065#endif