2010-09-07 20:14:24 +02:00
|
|
|
//===-- PTXTargetMachine.cpp - Define TargetMachine for PTX ---------------===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// Top-level implementation for the PTX target.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "PTX.h"
|
2010-09-18 20:52:28 +02:00
|
|
|
#include "PTXMCAsmInfo.h"
|
2010-09-07 20:14:24 +02:00
|
|
|
#include "PTXTargetMachine.h"
|
2010-09-18 20:52:28 +02:00
|
|
|
#include "llvm/PassManager.h"
|
2010-09-07 20:14:24 +02:00
|
|
|
#include "llvm/Target/TargetRegistry.h"
|
|
|
|
|
|
|
|
using namespace llvm;
|
|
|
|
|
2010-11-28 15:48:34 +01:00
|
|
|
namespace llvm {
|
|
|
|
MCStreamer *createPTXAsmStreamer(MCContext &Ctx, formatted_raw_ostream &OS,
|
2010-12-10 08:39:47 +01:00
|
|
|
bool isVerboseAsm, bool useLoc,
|
2010-11-28 15:48:34 +01:00
|
|
|
MCInstPrinter *InstPrint,
|
|
|
|
MCCodeEmitter *CE,
|
2010-12-16 04:05:59 +01:00
|
|
|
TargetAsmBackend *TAB,
|
2010-11-28 15:48:34 +01:00
|
|
|
bool ShowInst);
|
|
|
|
}
|
|
|
|
|
2010-09-18 20:52:28 +02:00
|
|
|
extern "C" void LLVMInitializePTXTarget() {
|
2010-09-07 20:14:24 +02:00
|
|
|
RegisterTargetMachine<PTXTargetMachine> X(ThePTXTarget);
|
2010-09-18 20:52:28 +02:00
|
|
|
RegisterAsmInfo<PTXMCAsmInfo> Y(ThePTXTarget);
|
2010-11-08 03:58:44 +01:00
|
|
|
TargetRegistry::RegisterAsmStreamer(ThePTXTarget, createPTXAsmStreamer);
|
2010-09-07 20:14:24 +02:00
|
|
|
}
|
|
|
|
|
2010-09-18 20:52:28 +02:00
|
|
|
// DataLayout and FrameInfo are filled with dummy data
|
2010-09-07 20:14:24 +02:00
|
|
|
PTXTargetMachine::PTXTargetMachine(const Target &T,
|
|
|
|
const std::string &TT,
|
2010-09-18 20:52:28 +02:00
|
|
|
const std::string &FS)
|
|
|
|
: LLVMTargetMachine(T, TT),
|
|
|
|
DataLayout("e-p:32:32-i64:32:32-f64:32:32-v128:32:128-v64:32:64-n32:64"),
|
2010-11-15 01:06:54 +01:00
|
|
|
FrameInfo(Subtarget),
|
2010-09-18 20:52:28 +02:00
|
|
|
InstrInfo(*this),
|
|
|
|
TLInfo(*this),
|
|
|
|
Subtarget(TT, FS) {
|
|
|
|
}
|
|
|
|
|
|
|
|
bool PTXTargetMachine::addInstSelector(PassManagerBase &PM,
|
|
|
|
CodeGenOpt::Level OptLevel) {
|
|
|
|
PM.add(createPTXISelDag(*this, OptLevel));
|
2011-01-01 11:50:37 +01:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool PTXTargetMachine::addPostRegAlloc(PassManagerBase &PM,
|
|
|
|
CodeGenOpt::Level OptLevel) {
|
|
|
|
// PTXMFInfoExtract must after register allocation!
|
2010-11-08 04:00:52 +01:00
|
|
|
PM.add(createPTXMFInfoExtract(*this, OptLevel));
|
2010-09-18 20:52:28 +02:00
|
|
|
return false;
|
2010-09-07 20:14:24 +02:00
|
|
|
}
|