Silence -Wunused-variable in release builds.
[llvm/stm8.git] / lib / Target / PTX / PTXTargetMachine.cpp
blobcaeb851657f6f0da5b3515a3ab0b1dbb7d67db94
1 //===-- 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.
12 //===----------------------------------------------------------------------===//
14 #include "PTX.h"
15 #include "PTXMCAsmInfo.h"
16 #include "PTXTargetMachine.h"
17 #include "llvm/PassManager.h"
18 #include "llvm/Target/TargetRegistry.h"
19 #include "llvm/Support/raw_ostream.h"
21 using namespace llvm;
23 namespace llvm {
24 MCStreamer *createPTXAsmStreamer(MCContext &Ctx, formatted_raw_ostream &OS,
25 bool isVerboseAsm, bool useLoc,
26 bool useCFI,
27 MCInstPrinter *InstPrint,
28 MCCodeEmitter *CE,
29 TargetAsmBackend *TAB,
30 bool ShowInst);
33 extern "C" void LLVMInitializePTXTarget() {
35 RegisterTargetMachine<PTX32TargetMachine> X(ThePTX32Target);
36 RegisterTargetMachine<PTX64TargetMachine> Y(ThePTX64Target);
38 RegisterAsmInfo<PTXMCAsmInfo> Z(ThePTX32Target);
39 RegisterAsmInfo<PTXMCAsmInfo> W(ThePTX64Target);
41 TargetRegistry::RegisterAsmStreamer(ThePTX32Target, createPTXAsmStreamer);
42 TargetRegistry::RegisterAsmStreamer(ThePTX64Target, createPTXAsmStreamer);
45 namespace {
46 const char* DataLayout32 =
47 "e-p:32:32-i64:32:32-f64:32:32-v128:32:128-v64:32:64-n32:64";
48 const char* DataLayout64 =
49 "e-p:64:64-i64:32:32-f64:32:32-v128:32:128-v64:32:64-n32:64";
52 // DataLayout and FrameLowering are filled with dummy data
53 PTXTargetMachine::PTXTargetMachine(const Target &T,
54 const std::string &TT,
55 const std::string &CPU,
56 const std::string &FS,
57 bool is64Bit)
58 : LLVMTargetMachine(T, TT, CPU, FS),
59 DataLayout(is64Bit ? DataLayout64 : DataLayout32),
60 Subtarget(TT, CPU, FS, is64Bit),
61 FrameLowering(Subtarget),
62 InstrInfo(*this),
63 TLInfo(*this) {
66 PTX32TargetMachine::PTX32TargetMachine(const Target &T,
67 const std::string& TT,
68 const std::string& CPU,
69 const std::string& FS)
70 : PTXTargetMachine(T, TT, CPU, FS, false) {
73 PTX64TargetMachine::PTX64TargetMachine(const Target &T,
74 const std::string& TT,
75 const std::string& CPU,
76 const std::string& FS)
77 : PTXTargetMachine(T, TT, CPU, FS, true) {
80 bool PTXTargetMachine::addInstSelector(PassManagerBase &PM,
81 CodeGenOpt::Level OptLevel) {
82 PM.add(createPTXISelDag(*this, OptLevel));
83 return false;
86 bool PTXTargetMachine::addPostRegAlloc(PassManagerBase &PM,
87 CodeGenOpt::Level OptLevel) {
88 // PTXMFInfoExtract must after register allocation!
89 PM.add(createPTXMFInfoExtract(*this, OptLevel));
90 return false;