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 virtual bool addInstSelector(PassManagerBase &PM);
63 virtual bool addPostRegAlloc(PassManagerBase &PM);
65 // We override this method to supply our own set of codegen passes.
66 virtual bool addPassesToEmitFile(PassManagerBase &,
67 formatted_raw_ostream &,
71 // Emission of machine code through JITCodeEmitter is not supported.
72 virtual bool addPassesToEmitMachineCode(PassManagerBase &,
78 // Emission of machine code through MCJIT is not supported.
79 virtual bool addPassesToEmitMC(PassManagerBase &,
88 bool addCommonCodeGenPasses(PassManagerBase &,
89 bool DisableVerify, MCContext *&OutCtx);
90 }; // class PTXTargetMachine
93 class PTX32TargetMachine : public PTXTargetMachine {
94 virtual void anchor();
97 PTX32TargetMachine(const Target &T, StringRef TT,
98 StringRef CPU, StringRef FS, const TargetOptions &Options,
99 Reloc::Model RM, CodeModel::Model CM,
100 CodeGenOpt::Level OL);
101 }; // class PTX32TargetMachine
103 class PTX64TargetMachine : public PTXTargetMachine {
104 virtual void anchor();
107 PTX64TargetMachine(const Target &T, StringRef TT,
108 StringRef CPU, StringRef FS, const TargetOptions &Options,
109 Reloc::Model RM, CodeModel::Model CM,
110 CodeGenOpt::Level OL);
111 }; // class PTX32TargetMachine
115 #endif // PTX_TARGET_MACHINE_H