mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-30 05:29:47 +00:00
(including compilation, assembly). Move relocation model Reloc::Model from TargetMachine to MCCodeGenInfo so it's accessible even without TargetMachine. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135468 91177308-0d34-0410-b5e6-96231b3b80d8
101 lines
3.1 KiB
C++
101 lines
3.1 KiB
C++
//===-- MipsMCTargetDesc.cpp - Mips Target Descriptions ---------*- C++ -*-===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This file provides Mips specific target descriptions.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "MipsMCTargetDesc.h"
|
|
#include "MipsMCAsmInfo.h"
|
|
#include "llvm/MC/MachineLocation.h"
|
|
#include "llvm/MC/MCInstrInfo.h"
|
|
#include "llvm/MC/MCRegisterInfo.h"
|
|
#include "llvm/MC/MCSubtargetInfo.h"
|
|
#include "llvm/Target/TargetRegistry.h"
|
|
|
|
#define GET_INSTRINFO_MC_DESC
|
|
#include "MipsGenInstrInfo.inc"
|
|
|
|
#define GET_SUBTARGETINFO_MC_DESC
|
|
#include "MipsGenSubtargetInfo.inc"
|
|
|
|
#define GET_REGINFO_MC_DESC
|
|
#include "MipsGenRegisterInfo.inc"
|
|
|
|
using namespace llvm;
|
|
|
|
static MCInstrInfo *createMipsMCInstrInfo() {
|
|
MCInstrInfo *X = new MCInstrInfo();
|
|
InitMipsMCInstrInfo(X);
|
|
return X;
|
|
}
|
|
|
|
extern "C" void LLVMInitializeMipsMCInstrInfo() {
|
|
TargetRegistry::RegisterMCInstrInfo(TheMipsTarget, createMipsMCInstrInfo);
|
|
}
|
|
|
|
static MCRegisterInfo *createMipsMCRegisterInfo(StringRef TT) {
|
|
MCRegisterInfo *X = new MCRegisterInfo();
|
|
InitMipsMCRegisterInfo(X, Mips::RA);
|
|
return X;
|
|
}
|
|
|
|
extern "C" void LLVMInitializeMipsMCRegisterInfo() {
|
|
TargetRegistry::RegisterMCRegInfo(TheMipsTarget, createMipsMCRegisterInfo);
|
|
TargetRegistry::RegisterMCRegInfo(TheMipselTarget, createMipsMCRegisterInfo);
|
|
}
|
|
|
|
static MCSubtargetInfo *createMipsMCSubtargetInfo(StringRef TT, StringRef CPU,
|
|
StringRef FS) {
|
|
MCSubtargetInfo *X = new MCSubtargetInfo();
|
|
InitMipsMCSubtargetInfo(X, TT, CPU, FS);
|
|
return X;
|
|
}
|
|
|
|
extern "C" void LLVMInitializeMipsMCSubtargetInfo() {
|
|
TargetRegistry::RegisterMCSubtargetInfo(TheMipsTarget,
|
|
createMipsMCSubtargetInfo);
|
|
}
|
|
|
|
static MCAsmInfo *createMipsMCAsmInfo(const Target &T, StringRef TT) {
|
|
MCAsmInfo *MAI = new MipsMCAsmInfo(T, TT);
|
|
|
|
MachineLocation Dst(MachineLocation::VirtualFP);
|
|
MachineLocation Src(Mips::SP, 0);
|
|
MAI->addInitialFrameState(0, Dst, Src);
|
|
|
|
return MAI;
|
|
}
|
|
|
|
extern "C" void LLVMInitializeMipsMCAsmInfo() {
|
|
RegisterMCAsmInfoFn X(TheMipsTarget, createMipsMCAsmInfo);
|
|
RegisterMCAsmInfoFn Y(TheMipselTarget, createMipsMCAsmInfo);
|
|
}
|
|
|
|
MCCodeGenInfo *createMipsMCCodeGenInfo(StringRef TT, Reloc::Model RM) {
|
|
MCCodeGenInfo *X = new MCCodeGenInfo();
|
|
if (RM == Reloc::Default) {
|
|
// Abicall enables PIC by default
|
|
if (TT.find("mipsallegrex") != std::string::npos ||
|
|
TT.find("psp") != std::string::npos)
|
|
RM = Reloc::Static;
|
|
else
|
|
RM = Reloc::PIC_;
|
|
}
|
|
X->InitMCCodeGenInfo(RM);
|
|
return X;
|
|
}
|
|
|
|
extern "C" void LLVMInitializeMipsMCCodeGenInfo() {
|
|
TargetRegistry::RegisterMCCodeGenInfo(TheMipsTarget,
|
|
createMipsMCCodeGenInfo);
|
|
TargetRegistry::RegisterMCCodeGenInfo(TheMipselTarget,
|
|
createMipsMCCodeGenInfo);
|
|
}
|