2012-12-12 05:25:42 +08:00
|
|
|
//===-- AMDGPUMCTargetDesc.cpp - AMDGPU Target Descriptions ---------------===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
/// \file
|
|
|
|
/// \brief This file provides AMDGPU specific target descriptions.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "AMDGPUMCTargetDesc.h"
|
|
|
|
#include "AMDGPUMCAsmInfo.h"
|
2015-06-27 05:15:07 +08:00
|
|
|
#include "AMDGPUTargetStreamer.h"
|
2012-12-12 05:25:42 +08:00
|
|
|
#include "InstPrinter/AMDGPUInstPrinter.h"
|
2015-01-14 19:23:27 +08:00
|
|
|
#include "SIDefines.h"
|
2012-12-12 05:25:42 +08:00
|
|
|
#include "llvm/MC/MCCodeGenInfo.h"
|
2015-03-11 06:03:14 +08:00
|
|
|
#include "llvm/MC/MCContext.h"
|
2012-12-12 05:25:42 +08:00
|
|
|
#include "llvm/MC/MCInstrInfo.h"
|
|
|
|
#include "llvm/MC/MCRegisterInfo.h"
|
|
|
|
#include "llvm/MC/MCStreamer.h"
|
|
|
|
#include "llvm/MC/MCSubtargetInfo.h"
|
2013-01-02 18:22:59 +08:00
|
|
|
#include "llvm/MC/MachineLocation.h"
|
2012-12-12 05:25:42 +08:00
|
|
|
#include "llvm/Support/ErrorHandling.h"
|
|
|
|
#include "llvm/Support/TargetRegistry.h"
|
|
|
|
|
2014-04-22 10:03:14 +08:00
|
|
|
using namespace llvm;
|
|
|
|
|
2012-12-12 05:25:42 +08:00
|
|
|
#define GET_INSTRINFO_MC_DESC
|
|
|
|
#include "AMDGPUGenInstrInfo.inc"
|
|
|
|
|
|
|
|
#define GET_SUBTARGETINFO_MC_DESC
|
|
|
|
#include "AMDGPUGenSubtargetInfo.inc"
|
|
|
|
|
|
|
|
#define GET_REGINFO_MC_DESC
|
|
|
|
#include "AMDGPUGenRegisterInfo.inc"
|
|
|
|
|
|
|
|
static MCInstrInfo *createAMDGPUMCInstrInfo() {
|
|
|
|
MCInstrInfo *X = new MCInstrInfo();
|
|
|
|
InitAMDGPUMCInstrInfo(X);
|
|
|
|
return X;
|
|
|
|
}
|
|
|
|
|
2015-07-07 00:56:07 +08:00
|
|
|
static MCRegisterInfo *createAMDGPUMCRegisterInfo(const Triple &TT) {
|
2012-12-12 05:25:42 +08:00
|
|
|
MCRegisterInfo *X = new MCRegisterInfo();
|
|
|
|
InitAMDGPUMCRegisterInfo(X, 0);
|
|
|
|
return X;
|
|
|
|
}
|
|
|
|
|
2015-06-10 20:11:26 +08:00
|
|
|
static MCSubtargetInfo *
|
|
|
|
createAMDGPUMCSubtargetInfo(const Triple &TT, StringRef CPU, StringRef FS) {
|
2012-12-12 05:25:42 +08:00
|
|
|
MCSubtargetInfo * X = new MCSubtargetInfo();
|
|
|
|
InitAMDGPUMCSubtargetInfo(X, TT, CPU, FS);
|
|
|
|
return X;
|
|
|
|
}
|
|
|
|
|
2015-07-07 00:56:07 +08:00
|
|
|
static MCCodeGenInfo *createAMDGPUMCCodeGenInfo(const Triple &TT,
|
|
|
|
Reloc::Model RM,
|
|
|
|
CodeModel::Model CM,
|
|
|
|
CodeGenOpt::Level OL) {
|
2012-12-12 05:25:42 +08:00
|
|
|
MCCodeGenInfo *X = new MCCodeGenInfo();
|
2015-05-16 03:13:31 +08:00
|
|
|
X->initMCCodeGenInfo(RM, CM, OL);
|
2012-12-12 05:25:42 +08:00
|
|
|
return X;
|
|
|
|
}
|
|
|
|
|
2015-03-31 08:10:04 +08:00
|
|
|
static MCInstPrinter *createAMDGPUMCInstPrinter(const Triple &T,
|
|
|
|
unsigned SyntaxVariant,
|
2012-12-12 05:25:42 +08:00
|
|
|
const MCAsmInfo &MAI,
|
|
|
|
const MCInstrInfo &MII,
|
2015-03-31 08:10:04 +08:00
|
|
|
const MCRegisterInfo &MRI) {
|
2012-12-12 05:25:42 +08:00
|
|
|
return new AMDGPUInstPrinter(MAI, MII, MRI);
|
|
|
|
}
|
|
|
|
|
2015-06-27 05:15:07 +08:00
|
|
|
static MCTargetStreamer *createAMDGPUAsmTargetStreamer(MCStreamer &S,
|
|
|
|
formatted_raw_ostream &OS,
|
|
|
|
MCInstPrinter *InstPrint,
|
|
|
|
bool isVerboseAsm) {
|
|
|
|
return new AMDGPUTargetAsmStreamer(S, OS);
|
|
|
|
}
|
|
|
|
|
|
|
|
static MCTargetStreamer * createAMDGPUObjectTargetStreamer(
|
|
|
|
MCStreamer &S,
|
|
|
|
const MCSubtargetInfo &STI) {
|
|
|
|
return new AMDGPUTargetELFStreamer(S);
|
|
|
|
}
|
|
|
|
|
2015-06-13 11:28:10 +08:00
|
|
|
extern "C" void LLVMInitializeAMDGPUTargetMC() {
|
2015-03-19 07:15:49 +08:00
|
|
|
for (Target *T : {&TheAMDGPUTarget, &TheGCNTarget}) {
|
|
|
|
RegisterMCAsmInfo<AMDGPUMCAsmInfo> X(*T);
|
|
|
|
|
|
|
|
TargetRegistry::RegisterMCCodeGenInfo(*T, createAMDGPUMCCodeGenInfo);
|
|
|
|
TargetRegistry::RegisterMCInstrInfo(*T, createAMDGPUMCInstrInfo);
|
|
|
|
TargetRegistry::RegisterMCRegInfo(*T, createAMDGPUMCRegisterInfo);
|
|
|
|
TargetRegistry::RegisterMCSubtargetInfo(*T, createAMDGPUMCSubtargetInfo);
|
|
|
|
TargetRegistry::RegisterMCInstPrinter(*T, createAMDGPUMCInstPrinter);
|
|
|
|
TargetRegistry::RegisterMCAsmBackend(*T, createAMDGPUAsmBackend);
|
|
|
|
}
|
|
|
|
|
2015-06-27 05:15:07 +08:00
|
|
|
// R600 specific registration
|
2015-03-19 07:15:49 +08:00
|
|
|
TargetRegistry::RegisterMCCodeEmitter(TheAMDGPUTarget,
|
|
|
|
createR600MCCodeEmitter);
|
2015-06-27 05:15:07 +08:00
|
|
|
|
|
|
|
// GCN specific registration
|
2015-03-11 05:57:34 +08:00
|
|
|
TargetRegistry::RegisterMCCodeEmitter(TheGCNTarget, createSIMCCodeEmitter);
|
2015-06-27 05:15:07 +08:00
|
|
|
|
|
|
|
TargetRegistry::RegisterAsmTargetStreamer(TheGCNTarget,
|
|
|
|
createAMDGPUAsmTargetStreamer);
|
|
|
|
TargetRegistry::RegisterObjectTargetStreamer(TheGCNTarget,
|
|
|
|
createAMDGPUObjectTargetStreamer);
|
2012-12-12 05:25:42 +08:00
|
|
|
}
|