1cd287301ec598d2811f3f85c03d23bae01be2359Tom Stellard//=====-- AMDGPUSubtarget.h - Define Subtarget for the AMDIL ---*- C++ -*-====//
2cd287301ec598d2811f3f85c03d23bae01be2359Tom Stellard//
3cd287301ec598d2811f3f85c03d23bae01be2359Tom Stellard//                     The LLVM Compiler Infrastructure
4cd287301ec598d2811f3f85c03d23bae01be2359Tom Stellard//
5cd287301ec598d2811f3f85c03d23bae01be2359Tom Stellard// This file is distributed under the University of Illinois Open Source
6cd287301ec598d2811f3f85c03d23bae01be2359Tom Stellard// License. See LICENSE.TXT for details.
7cd287301ec598d2811f3f85c03d23bae01be2359Tom Stellard//
8cd287301ec598d2811f3f85c03d23bae01be2359Tom Stellard//==-----------------------------------------------------------------------===//
9cd287301ec598d2811f3f85c03d23bae01be2359Tom Stellard//
10cd287301ec598d2811f3f85c03d23bae01be2359Tom Stellard// This file declares the AMDGPU specific subclass of TargetSubtarget.
11cd287301ec598d2811f3f85c03d23bae01be2359Tom Stellard//
12cd287301ec598d2811f3f85c03d23bae01be2359Tom Stellard//===----------------------------------------------------------------------===//
13cd287301ec598d2811f3f85c03d23bae01be2359Tom Stellard
14cd287301ec598d2811f3f85c03d23bae01be2359Tom Stellard#ifndef _AMDGPUSUBTARGET_H_
15cd287301ec598d2811f3f85c03d23bae01be2359Tom Stellard#define _AMDGPUSUBTARGET_H_
16b72ab79d73b29ec087d90cf2c698adbab4db5defTom Stellard#include "AMDILDevice.h"
179c42fb6f26bb7db1bc793f5fcc922bbae6700d74Tom Stellard#include "llvm/ADT/StringExtras.h"
189c42fb6f26bb7db1bc793f5fcc922bbae6700d74Tom Stellard#include "llvm/ADT/StringRef.h"
19b72ab79d73b29ec087d90cf2c698adbab4db5defTom Stellard#include "llvm/Target/TargetSubtargetInfo.h"
20b72ab79d73b29ec087d90cf2c698adbab4db5defTom Stellard
21b72ab79d73b29ec087d90cf2c698adbab4db5defTom Stellard#define GET_SUBTARGETINFO_HEADER
22b72ab79d73b29ec087d90cf2c698adbab4db5defTom Stellard#include "AMDGPUGenSubtargetInfo.inc"
23b72ab79d73b29ec087d90cf2c698adbab4db5defTom Stellard
24b72ab79d73b29ec087d90cf2c698adbab4db5defTom Stellard#define MAX_CB_SIZE (1 << 16)
25cd287301ec598d2811f3f85c03d23bae01be2359Tom Stellard
26cd287301ec598d2811f3f85c03d23bae01be2359Tom Stellardnamespace llvm {
27cd287301ec598d2811f3f85c03d23bae01be2359Tom Stellard
28b72ab79d73b29ec087d90cf2c698adbab4db5defTom Stellardclass AMDGPUSubtarget : public AMDGPUGenSubtargetInfo
29cd287301ec598d2811f3f85c03d23bae01be2359Tom Stellard{
30b72ab79d73b29ec087d90cf2c698adbab4db5defTom Stellardprivate:
312f921101c0826dc52a2c69f85c3da0f7f6e8212aTom Stellard  bool CapsOverride[AMDGPUDeviceInfo::MaxNumberCapabilities];
322f921101c0826dc52a2c69f85c3da0f7f6e8212aTom Stellard  const AMDGPUDevice *mDevice;
33b72ab79d73b29ec087d90cf2c698adbab4db5defTom Stellard  size_t mDefaultSize[3];
34b72ab79d73b29ec087d90cf2c698adbab4db5defTom Stellard  size_t mMinimumSize[3];
35b72ab79d73b29ec087d90cf2c698adbab4db5defTom Stellard  std::string mDevName;
36b72ab79d73b29ec087d90cf2c698adbab4db5defTom Stellard  bool mIs64bit;
37b72ab79d73b29ec087d90cf2c698adbab4db5defTom Stellard  bool mIs32on64bit;
38b72ab79d73b29ec087d90cf2c698adbab4db5defTom Stellard  bool mDumpCode;
39b72ab79d73b29ec087d90cf2c698adbab4db5defTom Stellard
40cd287301ec598d2811f3f85c03d23bae01be2359Tom Stellard  InstrItineraryData InstrItins;
41cd287301ec598d2811f3f85c03d23bae01be2359Tom Stellard
42cd287301ec598d2811f3f85c03d23bae01be2359Tom Stellardpublic:
439c42fb6f26bb7db1bc793f5fcc922bbae6700d74Tom Stellard  AMDGPUSubtarget(StringRef TT, StringRef CPU, StringRef FS);
44b72ab79d73b29ec087d90cf2c698adbab4db5defTom Stellard  virtual ~AMDGPUSubtarget();
45cd287301ec598d2811f3f85c03d23bae01be2359Tom Stellard
46cd287301ec598d2811f3f85c03d23bae01be2359Tom Stellard  const InstrItineraryData &getInstrItineraryData() const { return InstrItins; }
479c42fb6f26bb7db1bc793f5fcc922bbae6700d74Tom Stellard  virtual void ParseSubtargetFeatures(llvm::StringRef CPU, llvm::StringRef FS);
489c42fb6f26bb7db1bc793f5fcc922bbae6700d74Tom Stellard
492f921101c0826dc52a2c69f85c3da0f7f6e8212aTom Stellard  bool isOverride(AMDGPUDeviceInfo::Caps) const;
50b72ab79d73b29ec087d90cf2c698adbab4db5defTom Stellard  bool is64bit() const;
51b72ab79d73b29ec087d90cf2c698adbab4db5defTom Stellard
52b72ab79d73b29ec087d90cf2c698adbab4db5defTom Stellard  // Helper functions to simplify if statements
53b72ab79d73b29ec087d90cf2c698adbab4db5defTom Stellard  bool isTargetELF() const;
542f921101c0826dc52a2c69f85c3da0f7f6e8212aTom Stellard  const AMDGPUDevice* device() const;
55b72ab79d73b29ec087d90cf2c698adbab4db5defTom Stellard  std::string getDataLayout() const;
56b72ab79d73b29ec087d90cf2c698adbab4db5defTom Stellard  std::string getDeviceName() const;
57b72ab79d73b29ec087d90cf2c698adbab4db5defTom Stellard  virtual size_t getDefaultSize(uint32_t dim) const;
58b72ab79d73b29ec087d90cf2c698adbab4db5defTom Stellard  bool dumpCode() const { return mDumpCode; }
59b72ab79d73b29ec087d90cf2c698adbab4db5defTom Stellard
60cd287301ec598d2811f3f85c03d23bae01be2359Tom Stellard};
61cd287301ec598d2811f3f85c03d23bae01be2359Tom Stellard
62cd287301ec598d2811f3f85c03d23bae01be2359Tom Stellard} // End namespace llvm
63cd287301ec598d2811f3f85c03d23bae01be2359Tom Stellard
64cd287301ec598d2811f3f85c03d23bae01be2359Tom Stellard#endif // AMDGPUSUBTARGET_H_
65