2010-09-07 18:14:24 +00:00
|
|
|
//===-- PTXTargetMachine.h - Define TargetMachine for PTX -------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file declares the PTX specific subclass of TargetMachine.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef PTX_TARGET_MACHINE_H
|
|
|
|
#define PTX_TARGET_MACHINE_H
|
|
|
|
|
2010-09-18 18:52:28 +00:00
|
|
|
#include "PTXISelLowering.h"
|
|
|
|
#include "PTXInstrInfo.h"
|
2011-01-10 12:39:04 +00:00
|
|
|
#include "PTXFrameLowering.h"
|
2011-09-26 18:57:27 +00:00
|
|
|
#include "PTXSelectionDAGInfo.h"
|
2010-09-18 18:52:28 +00:00
|
|
|
#include "PTXSubtarget.h"
|
|
|
|
#include "llvm/Target/TargetData.h"
|
2011-01-10 12:39:04 +00:00
|
|
|
#include "llvm/Target/TargetFrameLowering.h"
|
2010-09-07 18:14:24 +00:00
|
|
|
#include "llvm/Target/TargetMachine.h"
|
|
|
|
|
|
|
|
namespace llvm {
|
2010-09-18 18:52:28 +00:00
|
|
|
class PTXTargetMachine : public LLVMTargetMachine {
|
|
|
|
private:
|
2011-09-26 18:57:27 +00:00
|
|
|
const TargetData DataLayout;
|
|
|
|
PTXSubtarget Subtarget; // has to be initialized before FrameLowering
|
|
|
|
PTXFrameLowering FrameLowering;
|
|
|
|
PTXInstrInfo InstrInfo;
|
|
|
|
PTXSelectionDAGInfo TSInfo;
|
|
|
|
PTXTargetLowering TLInfo;
|
2010-09-18 18:52:28 +00:00
|
|
|
|
|
|
|
public:
|
2011-07-19 06:37:02 +00:00
|
|
|
PTXTargetMachine(const Target &T, StringRef TT,
|
2011-12-02 22:16:29 +00:00
|
|
|
StringRef CPU, StringRef FS, const TargetOptions &Options,
|
2011-07-20 07:51:56 +00:00
|
|
|
Reloc::Model RM, CodeModel::Model CM,
|
2011-11-16 08:38:26 +00:00
|
|
|
CodeGenOpt::Level OL,
|
2011-06-30 01:53:36 +00:00
|
|
|
bool is64Bit);
|
2010-09-18 18:52:28 +00:00
|
|
|
|
|
|
|
virtual const TargetData *getTargetData() const { return &DataLayout; }
|
|
|
|
|
2011-01-10 12:39:04 +00:00
|
|
|
virtual const TargetFrameLowering *getFrameLowering() const {
|
|
|
|
return &FrameLowering;
|
|
|
|
}
|
2010-09-18 18:52:28 +00:00
|
|
|
|
|
|
|
virtual const PTXInstrInfo *getInstrInfo() const { return &InstrInfo; }
|
|
|
|
virtual const TargetRegisterInfo *getRegisterInfo() const {
|
|
|
|
return &InstrInfo.getRegisterInfo(); }
|
|
|
|
|
|
|
|
virtual const PTXTargetLowering *getTargetLowering() const {
|
|
|
|
return &TLInfo; }
|
|
|
|
|
2011-09-26 18:57:27 +00:00
|
|
|
virtual const PTXSelectionDAGInfo* getSelectionDAGInfo() const {
|
|
|
|
return &TSInfo;
|
|
|
|
}
|
|
|
|
|
2010-09-18 18:52:28 +00:00
|
|
|
virtual const PTXSubtarget *getSubtargetImpl() const { return &Subtarget; }
|
|
|
|
|
2011-11-16 08:38:26 +00:00
|
|
|
virtual bool addInstSelector(PassManagerBase &PM);
|
|
|
|
virtual bool addPostRegAlloc(PassManagerBase &PM);
|
2011-09-22 16:45:37 +00:00
|
|
|
|
|
|
|
// We override this method to supply our own set of codegen passes.
|
|
|
|
virtual bool addPassesToEmitFile(PassManagerBase &,
|
|
|
|
formatted_raw_ostream &,
|
|
|
|
CodeGenFileType,
|
|
|
|
bool = true);
|
|
|
|
|
|
|
|
// Emission of machine code through JITCodeEmitter is not supported.
|
|
|
|
virtual bool addPassesToEmitMachineCode(PassManagerBase &,
|
|
|
|
JITCodeEmitter &,
|
|
|
|
bool = true) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Emission of machine code through MCJIT is not supported.
|
|
|
|
virtual bool addPassesToEmitMC(PassManagerBase &,
|
|
|
|
MCContext *&,
|
|
|
|
raw_ostream &,
|
|
|
|
bool = true) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
2011-11-16 08:38:26 +00:00
|
|
|
bool addCommonCodeGenPasses(PassManagerBase &,
|
2011-09-22 16:45:37 +00:00
|
|
|
bool DisableVerify, MCContext *&OutCtx);
|
2010-09-18 18:52:28 +00:00
|
|
|
}; // class PTXTargetMachine
|
2011-04-20 15:37:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
class PTX32TargetMachine : public PTXTargetMachine {
|
2011-12-20 02:50:00 +00:00
|
|
|
virtual void anchor();
|
2011-04-20 15:37:17 +00:00
|
|
|
public:
|
|
|
|
|
2011-07-19 06:37:02 +00:00
|
|
|
PTX32TargetMachine(const Target &T, StringRef TT,
|
2011-12-02 22:16:29 +00:00
|
|
|
StringRef CPU, StringRef FS, const TargetOptions &Options,
|
2011-11-16 08:38:26 +00:00
|
|
|
Reloc::Model RM, CodeModel::Model CM,
|
|
|
|
CodeGenOpt::Level OL);
|
2011-04-20 15:37:17 +00:00
|
|
|
}; // class PTX32TargetMachine
|
|
|
|
|
|
|
|
class PTX64TargetMachine : public PTXTargetMachine {
|
2011-12-20 02:50:00 +00:00
|
|
|
virtual void anchor();
|
2011-04-20 15:37:17 +00:00
|
|
|
public:
|
|
|
|
|
2011-07-19 06:37:02 +00:00
|
|
|
PTX64TargetMachine(const Target &T, StringRef TT,
|
2011-12-02 22:16:29 +00:00
|
|
|
StringRef CPU, StringRef FS, const TargetOptions &Options,
|
2011-11-16 08:38:26 +00:00
|
|
|
Reloc::Model RM, CodeModel::Model CM,
|
|
|
|
CodeGenOpt::Level OL);
|
2011-04-20 15:37:17 +00:00
|
|
|
}; // class PTX32TargetMachine
|
|
|
|
|
2010-09-07 18:14:24 +00:00
|
|
|
} // namespace llvm
|
|
|
|
|
|
|
|
#endif // PTX_TARGET_MACHINE_H
|