NVPTXMCTargetDesc.cpp revision 239310
138061Smsmith//===-- NVPTXMCTargetDesc.cpp - NVPTX Target Descriptions -------*- C++ -*-===// 238061Smsmith// 338061Smsmith// The LLVM Compiler Infrastructure 438061Smsmith// 538061Smsmith// This file is distributed under the University of Illinois Open Source 638061Smsmith// License. See LICENSE.TXT for details. 738061Smsmith// 838061Smsmith//===----------------------------------------------------------------------===// 938061Smsmith// 1038061Smsmith// This file provides NVPTX specific target descriptions. 1138061Smsmith// 1238061Smsmith//===----------------------------------------------------------------------===// 1338061Smsmith 1438061Smsmith#include "NVPTXMCTargetDesc.h" 1538061Smsmith#include "NVPTXMCAsmInfo.h" 1638061Smsmith#include "llvm/MC/MCCodeGenInfo.h" 1738061Smsmith#include "llvm/MC/MCInstrInfo.h" 1838061Smsmith#include "llvm/MC/MCRegisterInfo.h" 1938061Smsmith#include "llvm/MC/MCSubtargetInfo.h" 2038061Smsmith#include "llvm/Support/TargetRegistry.h" 2138061Smsmith 2238061Smsmith#define GET_INSTRINFO_MC_DESC 2338061Smsmith#include "NVPTXGenInstrInfo.inc" 2438061Smsmith 2538061Smsmith#define GET_SUBTARGETINFO_MC_DESC 2638061Smsmith#include "NVPTXGenSubtargetInfo.inc" 2743433Snsouch 2838061Smsmith#define GET_REGINFO_MC_DESC 2938061Smsmith#include "NVPTXGenRegisterInfo.inc" 3038061Smsmith 3138061Smsmith 3238061Smsmithusing namespace llvm; 3338061Smsmith 3438061Smsmithstatic MCInstrInfo *createNVPTXMCInstrInfo() { 3538061Smsmith MCInstrInfo *X = new MCInstrInfo(); 3638061Smsmith InitNVPTXMCInstrInfo(X); 3738061Smsmith return X; 3838061Smsmith} 3938061Smsmith 4038061Smsmithstatic MCRegisterInfo *createNVPTXMCRegisterInfo(StringRef TT) { 4138061Smsmith MCRegisterInfo *X = new MCRegisterInfo(); 4238061Smsmith // PTX does not have a return address register. 4338061Smsmith InitNVPTXMCRegisterInfo(X, 0); 4438061Smsmith return X; 4538061Smsmith} 4638061Smsmith 4738061Smsmithstatic MCSubtargetInfo *createNVPTXMCSubtargetInfo(StringRef TT, StringRef CPU, 4838061Smsmith StringRef FS) { 4938061Smsmith MCSubtargetInfo *X = new MCSubtargetInfo(); 5038061Smsmith InitNVPTXMCSubtargetInfo(X, TT, CPU, FS); 5138061Smsmith return X; 5238061Smsmith} 5338061Smsmith 5438061Smsmithstatic MCCodeGenInfo *createNVPTXMCCodeGenInfo(StringRef TT, Reloc::Model RM, 5538061Smsmith CodeModel::Model CM, 5638061Smsmith CodeGenOpt::Level OL) { 5738061Smsmith MCCodeGenInfo *X = new MCCodeGenInfo(); 5838061Smsmith X->InitMCCodeGenInfo(RM, CM, OL); 5938061Smsmith return X; 6038061Smsmith} 6138061Smsmith 6238061Smsmith 6338061Smsmith// Force static initialization. 6438061Smsmithextern "C" void LLVMInitializeNVPTXTargetMC() { 6538061Smsmith // Register the MC asm info. 6638061Smsmith RegisterMCAsmInfo<NVPTXMCAsmInfo> X(TheNVPTXTarget32); 6738061Smsmith RegisterMCAsmInfo<NVPTXMCAsmInfo> Y(TheNVPTXTarget64); 6838061Smsmith 6938061Smsmith // Register the MC codegen info. 7038061Smsmith TargetRegistry::RegisterMCCodeGenInfo(TheNVPTXTarget32, 7138061Smsmith createNVPTXMCCodeGenInfo); 7238061Smsmith TargetRegistry::RegisterMCCodeGenInfo(TheNVPTXTarget64, 7338061Smsmith createNVPTXMCCodeGenInfo); 7438061Smsmith 7538061Smsmith // Register the MC instruction info. 7638061Smsmith TargetRegistry::RegisterMCInstrInfo(TheNVPTXTarget32, createNVPTXMCInstrInfo); 7738061Smsmith TargetRegistry::RegisterMCInstrInfo(TheNVPTXTarget64, createNVPTXMCInstrInfo); 7838061Smsmith 7938061Smsmith // Register the MC register info. 8038061Smsmith TargetRegistry::RegisterMCRegInfo(TheNVPTXTarget32, 8138061Smsmith createNVPTXMCRegisterInfo); 8238061Smsmith TargetRegistry::RegisterMCRegInfo(TheNVPTXTarget64, 8338061Smsmith createNVPTXMCRegisterInfo); 8438061Smsmith 8538061Smsmith // Register the MC subtarget info. 8638061Smsmith TargetRegistry::RegisterMCSubtargetInfo(TheNVPTXTarget32, 8738061Smsmith createNVPTXMCSubtargetInfo); 8838061Smsmith TargetRegistry::RegisterMCSubtargetInfo(TheNVPTXTarget64, 8938061Smsmith createNVPTXMCSubtargetInfo); 9038061Smsmith 9138061Smsmith} 9238061Smsmith