blob: 0e8b58aa3c5ff995e9719fd20b9eb9800eac60fa [file] [log] [blame]
Tom Stellard75aadc22012-12-11 21:25:42 +00001//=====-- AMDGPUSubtarget.h - Define Subtarget for the AMDIL ---*- 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 AMDGPU specific subclass of TargetSubtarget.
12//
13//===----------------------------------------------------------------------===//
14
15#ifndef AMDGPUSUBTARGET_H
16#define AMDGPUSUBTARGET_H
Tom Stellarda6c6e1b2013-06-07 20:37:48 +000017#include "AMDGPU.h"
Tom Stellard75aadc22012-12-11 21:25:42 +000018#include "llvm/ADT/StringExtras.h"
19#include "llvm/ADT/StringRef.h"
20#include "llvm/Target/TargetSubtargetInfo.h"
21
22#define GET_SUBTARGETINFO_HEADER
23#include "AMDGPUGenSubtargetInfo.inc"
24
25#define MAX_CB_SIZE (1 << 16)
26
27namespace llvm {
28
29class AMDGPUSubtarget : public AMDGPUGenSubtargetInfo {
Tom Stellarda6c6e1b2013-06-07 20:37:48 +000030public:
31 enum Generation {
32 R600 = 0,
33 R700,
34 EVERGREEN,
35 NORTHERN_ISLANDS,
36 SOUTHERN_ISLANDS
37 };
38
Tom Stellard75aadc22012-12-11 21:25:42 +000039private:
Tom Stellard75aadc22012-12-11 21:25:42 +000040 size_t DefaultSize[3];
41 std::string DevName;
42 bool Is64bit;
43 bool Is32on64bit;
44 bool DumpCode;
45 bool R600ALUInst;
Vincent Lejeunec2991642013-04-30 00:13:39 +000046 bool HasVertexCache;
Vincent Lejeunef9f4e1e2013-05-17 16:49:55 +000047 short TexVTXClauseSize;
Tom Stellarda6c6e1b2013-06-07 20:37:48 +000048 enum Generation Gen;
49 bool FP64;
50 bool CaymanISA;
Tom Stellard75aadc22012-12-11 21:25:42 +000051
52 InstrItineraryData InstrItins;
53
54public:
55 AMDGPUSubtarget(StringRef TT, StringRef CPU, StringRef FS);
Tom Stellard75aadc22012-12-11 21:25:42 +000056
57 const InstrItineraryData &getInstrItineraryData() const { return InstrItins; }
Dmitri Gribenko226fea52013-01-13 16:01:15 +000058 virtual void ParseSubtargetFeatures(StringRef CPU, StringRef FS);
Tom Stellard75aadc22012-12-11 21:25:42 +000059
Tom Stellard75aadc22012-12-11 21:25:42 +000060 bool is64bit() const;
Vincent Lejeunec2991642013-04-30 00:13:39 +000061 bool hasVertexCache() const;
Vincent Lejeunef9f4e1e2013-05-17 16:49:55 +000062 short getTexVTXClauseSize() const;
Tom Stellarda6c6e1b2013-06-07 20:37:48 +000063 enum Generation getGeneration() const;
64 bool hasHWFP64() const;
65 bool hasCaymanISA() const;
Tom Stellard75aadc22012-12-11 21:25:42 +000066
Andrew Trick978674b2013-09-20 05:14:41 +000067 virtual bool enableMachineScheduler() const {
68 return getGeneration() <= NORTHERN_ISLANDS;
69 }
70
Tom Stellard75aadc22012-12-11 21:25:42 +000071 // Helper functions to simplify if statements
72 bool isTargetELF() const;
Tom Stellard75aadc22012-12-11 21:25:42 +000073 std::string getDataLayout() const;
74 std::string getDeviceName() const;
75 virtual size_t getDefaultSize(uint32_t dim) const;
76 bool dumpCode() const { return DumpCode; }
77 bool r600ALUEncoding() const { return R600ALUInst; }
78
79};
80
81} // End namespace llvm
82
83#endif // AMDGPUSUBTARGET_H