blob: 74e14ef8fbd870eb7549d761a95e6c097a6cba26 [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
Yaxun Liu1a14bfa2017-03-27 14:04:01 +000019#include "AMDGPU.h"
Sam Koltona3ec5c12016-10-07 14:46:06 +000020#include "Utils/AMDGPUBaseInfo.h"
David Blaikie3f833ed2017-11-08 01:01:31 +000021#include "llvm/CodeGen/TargetInstrInfo.h"
Tom Stellard75aadc22012-12-11 21:25:42 +000022
23#define GET_INSTRINFO_HEADER
Tom Stellard75aadc22012-12-11 21:25:42 +000024#include "AMDGPUGenInstrInfo.inc"
Matt Arsenaultcad7fa82017-12-13 21:07:51 +000025#undef GET_INSTRINFO_HEADER
Tom Stellard75aadc22012-12-11 21:25:42 +000026
Tom Stellard75aadc22012-12-11 21:25:42 +000027namespace llvm {
28
Tom Stellard2e59a452014-06-13 01:32:00 +000029class AMDGPUSubtarget;
Tom Stellard75aadc22012-12-11 21:25:42 +000030class MachineFunction;
31class MachineInstr;
32class MachineInstrBuilder;
33
34class AMDGPUInstrInfo : public AMDGPUGenInstrInfo {
35private:
Tom Stellard2e59a452014-06-13 01:32:00 +000036 const AMDGPUSubtarget &ST;
Matt Arsenault43e92fe2016-06-24 06:30:11 +000037
38 virtual void anchor();
Yaxun Liu1a14bfa2017-03-27 14:04:01 +000039protected:
40 AMDGPUAS AMDGPUASI;
Matt Arsenault43e92fe2016-06-24 06:30:11 +000041
Tom Stellard75aadc22012-12-11 21:25:42 +000042public:
Tom Stellard2e59a452014-06-13 01:32:00 +000043 explicit AMDGPUInstrInfo(const AMDGPUSubtarget &st);
Tom Stellard75aadc22012-12-11 21:25:42 +000044
Tom Stellard75aadc22012-12-11 21:25:42 +000045 bool shouldScheduleLoadsNear(SDNode *Load1, SDNode *Load2,
46 int64_t Offset1, int64_t Offset2,
Craig Topper5656db42014-04-29 07:57:24 +000047 unsigned NumLoads) const override;
Tom Stellard75aadc22012-12-11 21:25:42 +000048
Marek Olsaka93603d2015-01-15 18:42:51 +000049 /// \brief Return a target-specific opcode if Opcode is a pseudo instruction.
50 /// Return -1 if the target-specific opcode for the pseudo instruction does
51 /// not exist. If Opcode is not a pseudo instruction, this is identity.
52 int pseudoToMCOpcode(int Opcode) const;
Matt Arsenaultbcf7bec2018-02-09 16:57:48 +000053
54 static bool isUniformMMO(const MachineMemOperand *MMO);
Tom Stellard75aadc22012-12-11 21:25:42 +000055};
Alexander Kornienkof00654e2015-06-23 09:49:53 +000056} // End llvm namespace
Tom Stellard75aadc22012-12-11 21:25:42 +000057
Benjamin Kramera7c40ef2014-08-13 16:26:38 +000058#endif