#include "ARCMCTargetDesc.h"
#include "ARCInstPrinter.h"
#include "ARCMCAsmInfo.h"
#include "ARCTargetStreamer.h"
#include "TargetInfo/ARCTargetInfo.h"
#include "llvm/MC/MCDwarf.h"
#include "llvm/MC/MCInstrInfo.h"
#include "llvm/MC/MCRegisterInfo.h"
#include "llvm/MC/MCSubtargetInfo.h"
#include "llvm/MC/TargetRegistry.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/FormattedStream.h"
using namespace llvm;
#define GET_INSTRINFO_MC_DESC
#define ENABLE_INSTR_PREDICATE_VERIFIER
#include "ARCGenInstrInfo.inc"
#define GET_SUBTARGETINFO_MC_DESC
#include "ARCGenSubtargetInfo.inc"
#define GET_REGINFO_MC_DESC
#include "ARCGenRegisterInfo.inc"
static MCInstrInfo *createARCMCInstrInfo() {
auto *X = new MCInstrInfo();
InitARCMCInstrInfo(X);
return X;
}
static MCRegisterInfo *createARCMCRegisterInfo(const Triple &TT) {
auto *X = new MCRegisterInfo();
InitARCMCRegisterInfo(X, ARC::BLINK);
return X;
}
static MCSubtargetInfo *createARCMCSubtargetInfo(const Triple &TT,
StringRef CPU, StringRef FS) {
return createARCMCSubtargetInfoImpl(TT, CPU, CPU, FS);
}
static MCAsmInfo *createARCMCAsmInfo(const MCRegisterInfo &MRI,
const Triple &TT,
const MCTargetOptions &Options) {
MCAsmInfo *MAI = new ARCMCAsmInfo(TT);
MCCFIInstruction Inst = MCCFIInstruction::cfiDefCfa(nullptr, ARC::SP, 0);
MAI->addInitialFrameState(Inst);
return MAI;
}
static MCInstPrinter *createARCMCInstPrinter(const Triple &T,
unsigned SyntaxVariant,
const MCAsmInfo &MAI,
const MCInstrInfo &MII,
const MCRegisterInfo &MRI) {
return new ARCInstPrinter(MAI, MII, MRI);
}
ARCTargetStreamer::ARCTargetStreamer(MCStreamer &S) : MCTargetStreamer(S) {}
ARCTargetStreamer::~ARCTargetStreamer() = default;
static MCTargetStreamer *createTargetAsmStreamer(MCStreamer &S,
formatted_raw_ostream &OS,
MCInstPrinter *InstPrint,
bool isVerboseAsm) {
return new ARCTargetStreamer(S);
}
extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeARCTargetMC() {
Target &TheARCTarget = getTheARCTarget();
RegisterMCAsmInfoFn X(TheARCTarget, createARCMCAsmInfo);
TargetRegistry::RegisterMCInstrInfo(TheARCTarget, createARCMCInstrInfo);
TargetRegistry::RegisterMCRegInfo(TheARCTarget, createARCMCRegisterInfo);
TargetRegistry::RegisterMCSubtargetInfo(TheARCTarget,
createARCMCSubtargetInfo);
TargetRegistry::RegisterMCInstPrinter(TheARCTarget, createARCMCInstPrinter);
TargetRegistry::RegisterAsmTargetStreamer(TheARCTarget,
createTargetAsmStreamer);
}