llvm-project/llvm/lib/Target/Foot/MCTargetDesc/FootMCTargetDesc.cpp
2025-11-07 17:55:11 -05:00

77 lines
2.6 KiB
C++

#include "FootMCTargetDesc.h"
#include "FootAsmInfo.h"
#include "FootInstPrinter.h"
#include "FootTargetObjectFile.h"
#include "TargetInfo/FootTargetInfo.h"
#include "llvm/CodeGen/TargetSubtargetInfo.h"
#include "llvm/MC/MCELFStreamer.h"
#include "llvm/MC/MCInstrInfo.h"
#include "llvm/MC/MCRegisterInfo.h"
#include "llvm/MC/TargetRegistry.h"
#include "llvm/Support/Compiler.h"
#define GET_SUBTARGETINFO_MC_DESC
#include "FootGenSubtargetInfo.inc"
#define GET_REGINFO_MC_DESC
#include "FootGenRegisterInfo.inc"
#define GET_INSTRINFO_MC_DESC
#include "FootGenInstrInfo.inc"
using namespace llvm;
static MCSubtargetInfo *createFootSubtargetInfo(const Triple &TT, StringRef CPU, StringRef FS) {
return createFootMCSubtargetInfoImpl(TT, CPU, CPU, FS);
}
static MCInstrInfo *createFootInstrInfo() {
MCInstrInfo *X = new MCInstrInfo();
InitFootMCInstrInfo(X);
return X;
}
static MCRegisterInfo *createFootRegisterInfo(const Triple &Triple) {
MCRegisterInfo *X = new MCRegisterInfo();
InitFootMCRegisterInfo(X, Foot::RRA);
return X;
}
static MCAsmInfo *createFootMCAsmInfo(const MCRegisterInfo &MRI,
const Triple &TheTriple,
const MCTargetOptions &Options) {
return new FootMCAsmInfoELF();
}
static MCInstPrinter *createFootMCInstPrinter(const Triple &T,
unsigned SyntaxVariant,
const MCAsmInfo &MAI,
const MCInstrInfo &MII,
const MCRegisterInfo &MRI) {
if (SyntaxVariant == 0) {
return new FootInstPrinter(MAI, MII, MRI);
}
return nullptr;
}
static MCStreamer *createELFStreamer(const Triple &T,
MCContext &Ctx,
std::unique_ptr<MCAsmBackend> &&TAB,
std::unique_ptr<MCObjectWriter> &&OW,
std::unique_ptr<MCCodeEmitter> &&Emitter) {
return createELFStreamer(Ctx, std::move(TAB), std::move(OW), std::move(Emitter));
}
extern "C" LLVM_C_ABI void LLVMInitializeFootTargetMC() {
Target &TheTarget = getTheFootTarget();
TargetRegistry::RegisterMCSubtargetInfo(TheTarget, createFootSubtargetInfo);
TargetRegistry::RegisterMCInstrInfo(TheTarget, createFootInstrInfo);
TargetRegistry::RegisterMCRegInfo(TheTarget, createFootRegisterInfo);
TargetRegistry::RegisterMCInstPrinter(TheTarget, createFootMCInstPrinter);
TargetRegistry::RegisterMCCodeEmitter(TheTarget, createFootMCCodeEmitter);
TargetRegistry::RegisterMCAsmBackend(TheTarget, createFootAsmBackend);
TargetRegistry::RegisterELFStreamer(TheTarget, createELFStreamer);
RegisterMCAsmInfoFn X(TheTarget, createFootMCAsmInfo);
}