blob: 1e846e5059586562bf698c0f1121ce16c75ec489 [file] [log] [blame]
Nick Lewyckyf7a3c502010-09-07 18:14:24 +00001//===-- PTXTargetMachine.cpp - Define TargetMachine for PTX ---------------===//
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// Top-level implementation for the PTX target.
11//
12//===----------------------------------------------------------------------===//
13
14#include "PTX.h"
Eric Christopher50880d02010-09-18 18:52:28 +000015#include "PTXMCAsmInfo.h"
Nick Lewyckyf7a3c502010-09-07 18:14:24 +000016#include "PTXTargetMachine.h"
Eric Christopher50880d02010-09-18 18:52:28 +000017#include "llvm/PassManager.h"
Nick Lewyckyf7a3c502010-09-07 18:14:24 +000018#include "llvm/Target/TargetRegistry.h"
19
20using namespace llvm;
21
Eric Christopher50880d02010-09-18 18:52:28 +000022extern "C" void LLVMInitializePTXTarget() {
Nick Lewyckyf7a3c502010-09-07 18:14:24 +000023 RegisterTargetMachine<PTXTargetMachine> X(ThePTXTarget);
Eric Christopher50880d02010-09-18 18:52:28 +000024 RegisterAsmInfo<PTXMCAsmInfo> Y(ThePTXTarget);
Nick Lewyckyf7a3c502010-09-07 18:14:24 +000025}
26
Eric Christopher50880d02010-09-18 18:52:28 +000027// DataLayout and FrameInfo are filled with dummy data
Nick Lewyckyf7a3c502010-09-07 18:14:24 +000028PTXTargetMachine::PTXTargetMachine(const Target &T,
29 const std::string &TT,
Eric Christopher50880d02010-09-18 18:52:28 +000030 const std::string &FS)
31 : LLVMTargetMachine(T, TT),
32 DataLayout("e-p:32:32-i64:32:32-f64:32:32-v128:32:128-v64:32:64-n32:64"),
33 FrameInfo(TargetFrameInfo::StackGrowsDown, 2, -2),
34 InstrInfo(*this),
35 TLInfo(*this),
36 Subtarget(TT, FS) {
37}
38
39bool PTXTargetMachine::addInstSelector(PassManagerBase &PM,
40 CodeGenOpt::Level OptLevel) {
41 PM.add(createPTXISelDag(*this, OptLevel));
42 return false;
Nick Lewyckyf7a3c502010-09-07 18:14:24 +000043}