blob: 3dca4da724a315352c608db061813dd83fdc00a5 [file] [log] [blame]
Justin Holewinskiae556d32012-05-04 20:18:50 +00001//===-- NVPTXTargetMachine.h - Define TargetMachine for NVPTX ---*- 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// This file declares the NVPTX specific subclass of TargetMachine.
11//
12//===----------------------------------------------------------------------===//
13
Benjamin Kramera7c40ef2014-08-13 16:26:38 +000014#ifndef LLVM_LIB_TARGET_NVPTX_NVPTXTARGETMACHINE_H
15#define LLVM_LIB_TARGET_NVPTX_NVPTXTARGETMACHINE_H
Justin Holewinskiae556d32012-05-04 20:18:50 +000016
Justin Holewinskiae556d32012-05-04 20:18:50 +000017#include "NVPTXSubtarget.h"
Eric Christopher493f91b2014-06-27 04:33:14 +000018#include "ManagedStringPool.h"
Justin Holewinskiae556d32012-05-04 20:18:50 +000019#include "llvm/Target/TargetFrameLowering.h"
20#include "llvm/Target/TargetMachine.h"
21#include "llvm/Target/TargetSelectionDAGInfo.h"
22
23namespace llvm {
24
25/// NVPTXTargetMachine
26///
27class NVPTXTargetMachine : public LLVMTargetMachine {
Justin Holewinski0497ab12013-03-30 14:29:21 +000028 NVPTXSubtarget Subtarget;
Justin Holewinskiae556d32012-05-04 20:18:50 +000029
30 // Hold Strings that can be free'd all together with NVPTXTargetMachine
Justin Holewinski0497ab12013-03-30 14:29:21 +000031 ManagedStringPool ManagedStrPool;
Justin Holewinskiae556d32012-05-04 20:18:50 +000032
Justin Holewinskiae556d32012-05-04 20:18:50 +000033public:
Justin Holewinski0497ab12013-03-30 14:29:21 +000034 NVPTXTargetMachine(const Target &T, StringRef TT, StringRef CPU, StringRef FS,
35 const TargetOptions &Options, Reloc::Model RM,
36 CodeModel::Model CM, CodeGenOpt::Level OP, bool is64bit);
Justin Holewinskiae556d32012-05-04 20:18:50 +000037
Craig Topper2865c982014-04-29 07:57:44 +000038 const NVPTXSubtarget *getSubtargetImpl() const override { return &Subtarget; }
Justin Holewinskiae556d32012-05-04 20:18:50 +000039
Justin Holewinskiae556d32012-05-04 20:18:50 +000040 ManagedStringPool *getManagedStrPool() const {
Justin Holewinski0497ab12013-03-30 14:29:21 +000041 return const_cast<ManagedStringPool *>(&ManagedStrPool);
Justin Holewinskiae556d32012-05-04 20:18:50 +000042 }
43
Craig Topper2865c982014-04-29 07:57:44 +000044 TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
Justin Holewinskiae556d32012-05-04 20:18:50 +000045
Justin Holewinskiae556d32012-05-04 20:18:50 +000046 // Emission of machine code through MCJIT is not supported.
Craig Topper2865c982014-04-29 07:57:44 +000047 bool addPassesToEmitMC(PassManagerBase &, MCContext *&, raw_ostream &,
48 bool = true) override {
Justin Holewinskiae556d32012-05-04 20:18:50 +000049 return true;
50 }
51
52}; // NVPTXTargetMachine.
53
54class NVPTXTargetMachine32 : public NVPTXTargetMachine {
55 virtual void anchor();
56public:
57 NVPTXTargetMachine32(const Target &T, StringRef TT, StringRef CPU,
58 StringRef FS, const TargetOptions &Options,
59 Reloc::Model RM, CodeModel::Model CM,
60 CodeGenOpt::Level OL);
61};
62
63class NVPTXTargetMachine64 : public NVPTXTargetMachine {
64 virtual void anchor();
65public:
66 NVPTXTargetMachine64(const Target &T, StringRef TT, StringRef CPU,
67 StringRef FS, const TargetOptions &Options,
68 Reloc::Model RM, CodeModel::Model CM,
69 CodeGenOpt::Level OL);
70};
71
Justin Holewinskiae556d32012-05-04 20:18:50 +000072} // end namespace llvm
73
74#endif