a69153693158ed6d9e8a909763e374630bbed3b5
[oota-llvm.git] / lib / Target / R600 / AMDGPUTargetMachine.h
1 //===-- AMDGPUTargetMachine.h - AMDGPU TargetMachine Interface --*- 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 The AMDGPU TargetMachine interface definition for hw codgen targets.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #ifndef LLVM_LIB_TARGET_R600_AMDGPUTARGETMACHINE_H
16 #define LLVM_LIB_TARGET_R600_AMDGPUTARGETMACHINE_H
17
18 #include "AMDGPUFrameLowering.h"
19 #include "AMDGPUInstrInfo.h"
20 #include "AMDGPUIntrinsicInfo.h"
21 #include "AMDGPUSubtarget.h"
22 #include "R600ISelLowering.h"
23 #include "llvm/IR/DataLayout.h"
24
25 namespace llvm {
26
27 //===----------------------------------------------------------------------===//
28 // AMDGPU Target Machine (R600+)
29 //===----------------------------------------------------------------------===//
30
31 class AMDGPUTargetMachine : public LLVMTargetMachine {
32 private:
33   const DataLayout DL;
34
35 protected:
36   TargetLoweringObjectFile *TLOF;
37   AMDGPUSubtarget Subtarget;
38   AMDGPUIntrinsicInfo IntrinsicInfo;
39
40 public:
41   AMDGPUTargetMachine(const Target &T, StringRef TT, StringRef FS,
42                       StringRef CPU, TargetOptions Options, Reloc::Model RM,
43                       CodeModel::Model CM, CodeGenOpt::Level OL);
44   ~AMDGPUTargetMachine();
45   // FIXME: This is currently broken, the DataLayout needs to move to
46   // the target machine.
47   const DataLayout *getDataLayout() const override {
48     return &DL;
49   }
50   const AMDGPUSubtarget *getSubtargetImpl() const override {
51     return &Subtarget;
52   }
53   const AMDGPUIntrinsicInfo *getIntrinsicInfo() const override {
54     return &IntrinsicInfo;
55   }
56   TargetIRAnalysis getTargetIRAnalysis() override;
57
58   TargetLoweringObjectFile *getObjFileLowering() const override {
59     return TLOF;
60   }
61 };
62
63 //===----------------------------------------------------------------------===//
64 // R600 Target Machine (R600 -> Cayman)
65 //===----------------------------------------------------------------------===//
66
67 class R600TargetMachine : public AMDGPUTargetMachine {
68
69 public:
70   R600TargetMachine(const Target &T, StringRef TT, StringRef FS,
71                     StringRef CPU, TargetOptions Options, Reloc::Model RM,
72                     CodeModel::Model CM, CodeGenOpt::Level OL);
73
74   TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
75 };
76
77 //===----------------------------------------------------------------------===//
78 // GCN Target Machine (SI+)
79 //===----------------------------------------------------------------------===//
80
81 class GCNTargetMachine : public AMDGPUTargetMachine {
82
83 public:
84   GCNTargetMachine(const Target &T, StringRef TT, StringRef FS,
85                     StringRef CPU, TargetOptions Options, Reloc::Model RM,
86                     CodeModel::Model CM, CodeGenOpt::Level OL);
87
88   TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
89 };
90
91 } // End namespace llvm
92
93 #endif