1 //===-- PTXTargetMachine.h - Define TargetMachine for PTX -------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file declares the PTX specific subclass of TargetMachine.
12 //===----------------------------------------------------------------------===//
14 #ifndef PTX_TARGET_MACHINE_H
15 #define PTX_TARGET_MACHINE_H
17 #include "PTXISelLowering.h"
18 #include "PTXInstrInfo.h"
19 #include "PTXFrameLowering.h"
20 #include "PTXSelectionDAGInfo.h"
21 #include "PTXSubtarget.h"
22 #include "llvm/Target/TargetData.h"
23 #include "llvm/Target/TargetFrameLowering.h"
24 #include "llvm/Target/TargetMachine.h"
27 class PTXTargetMachine : public LLVMTargetMachine {
29 const TargetData DataLayout;
30 PTXSubtarget Subtarget; // has to be initialized before FrameLowering
31 PTXFrameLowering FrameLowering;
32 PTXInstrInfo InstrInfo;
33 PTXSelectionDAGInfo TSInfo;
34 PTXTargetLowering TLInfo;
37 PTXTargetMachine(const Target &T, StringRef TT,
38 StringRef CPU, StringRef FS, const TargetOptions &Options,
39 Reloc::Model RM, CodeModel::Model CM,
43 virtual const TargetData *getTargetData() const { return &DataLayout; }
45 virtual const TargetFrameLowering *getFrameLowering() const {
46 return &FrameLowering;
49 virtual const PTXInstrInfo *getInstrInfo() const { return &InstrInfo; }
50 virtual const TargetRegisterInfo *getRegisterInfo() const {
51 return &InstrInfo.getRegisterInfo(); }
53 virtual const PTXTargetLowering *getTargetLowering() const {
56 virtual const PTXSelectionDAGInfo* getSelectionDAGInfo() const {
60 virtual const PTXSubtarget *getSubtargetImpl() const { return &Subtarget; }
62 // Emission of machine code through JITCodeEmitter is not supported.
63 virtual bool addPassesToEmitMachineCode(PassManagerBase &,
69 // Emission of machine code through MCJIT is not supported.
70 virtual bool addPassesToEmitMC(PassManagerBase &,
77 // Pass Pipeline Configuration
78 virtual TargetPassConfig *createPassConfig(PassManagerBase &PM);
79 }; // class PTXTargetMachine
82 class PTX32TargetMachine : public PTXTargetMachine {
83 virtual void anchor();
86 PTX32TargetMachine(const Target &T, StringRef TT,
87 StringRef CPU, StringRef FS, const TargetOptions &Options,
88 Reloc::Model RM, CodeModel::Model CM,
89 CodeGenOpt::Level OL);
90 }; // class PTX32TargetMachine
92 class PTX64TargetMachine : public PTXTargetMachine {
93 virtual void anchor();
96 PTX64TargetMachine(const Target &T, StringRef TT,
97 StringRef CPU, StringRef FS, const TargetOptions &Options,
98 Reloc::Model RM, CodeModel::Model CM,
99 CodeGenOpt::Level OL);
100 }; // class PTX32TargetMachine
104 #endif // PTX_TARGET_MACHINE_H