mirror of
https://github.com/RPCS3/llvm.git
synced 2026-01-31 01:25:19 +01:00
I did this a long time ago with a janky python script, but now clang-format has built-in support for this. I fed clang-format every line with a #include and let it re-sort things according to the precise LLVM rules for include ordering baked into clang-format these days. I've reverted a number of files where the results of sorting includes isn't healthy. Either places where we have legacy code relying on particular include ordering (where possible, I'll fix these separately) or where we have particular formatting around #include lines that I didn't want to disturb in this patch. This patch is *entirely* mechanical. If you get merge conflicts or anything, just ignore the changes in this patch and run clang-format over your #include lines in the files. Sorry for any noise here, but it is important to keep these things stable. I was seeing an increasing number of patches with irrelevant re-ordering of #include lines because clang-format was used. This patch at least isolates that churn, makes it easy to skip when resolving conflicts, and gets us to a clean baseline (again). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304787 91177308-0d34-0410-b5e6-96231b3b80d8
116 lines
4.1 KiB
C++
116 lines
4.1 KiB
C++
//===-- BPFMCTargetDesc.cpp - BPF Target Descriptions ---------------------===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This file provides BPF specific target descriptions.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "MCTargetDesc/BPFMCTargetDesc.h"
|
|
#include "BPF.h"
|
|
#include "InstPrinter/BPFInstPrinter.h"
|
|
#include "MCTargetDesc/BPFMCAsmInfo.h"
|
|
#include "llvm/MC/MCInstrInfo.h"
|
|
#include "llvm/MC/MCRegisterInfo.h"
|
|
#include "llvm/MC/MCSubtargetInfo.h"
|
|
#include "llvm/Support/Host.h"
|
|
#include "llvm/Support/TargetRegistry.h"
|
|
|
|
#define GET_INSTRINFO_MC_DESC
|
|
#include "BPFGenInstrInfo.inc"
|
|
|
|
#define GET_SUBTARGETINFO_MC_DESC
|
|
#include "BPFGenSubtargetInfo.inc"
|
|
|
|
#define GET_REGINFO_MC_DESC
|
|
#include "BPFGenRegisterInfo.inc"
|
|
|
|
using namespace llvm;
|
|
|
|
static MCInstrInfo *createBPFMCInstrInfo() {
|
|
MCInstrInfo *X = new MCInstrInfo();
|
|
InitBPFMCInstrInfo(X);
|
|
return X;
|
|
}
|
|
|
|
static MCRegisterInfo *createBPFMCRegisterInfo(const Triple &TT) {
|
|
MCRegisterInfo *X = new MCRegisterInfo();
|
|
InitBPFMCRegisterInfo(X, BPF::R11 /* RAReg doesn't exist */);
|
|
return X;
|
|
}
|
|
|
|
static MCSubtargetInfo *createBPFMCSubtargetInfo(const Triple &TT,
|
|
StringRef CPU, StringRef FS) {
|
|
return createBPFMCSubtargetInfoImpl(TT, CPU, FS);
|
|
}
|
|
|
|
static MCStreamer *createBPFMCStreamer(const Triple &T,
|
|
MCContext &Ctx, MCAsmBackend &MAB,
|
|
raw_pwrite_stream &OS, MCCodeEmitter *Emitter,
|
|
bool RelaxAll) {
|
|
return createELFStreamer(Ctx, MAB, OS, Emitter, RelaxAll);
|
|
}
|
|
|
|
static MCInstPrinter *createBPFMCInstPrinter(const Triple &T,
|
|
unsigned SyntaxVariant,
|
|
const MCAsmInfo &MAI,
|
|
const MCInstrInfo &MII,
|
|
const MCRegisterInfo &MRI) {
|
|
if (SyntaxVariant == 0)
|
|
return new BPFInstPrinter(MAI, MII, MRI);
|
|
return nullptr;
|
|
}
|
|
|
|
extern "C" void LLVMInitializeBPFTargetMC() {
|
|
for (Target *T :
|
|
{&getTheBPFleTarget(), &getTheBPFbeTarget(), &getTheBPFTarget()}) {
|
|
// Register the MC asm info.
|
|
RegisterMCAsmInfo<BPFMCAsmInfo> X(*T);
|
|
|
|
// Register the MC instruction info.
|
|
TargetRegistry::RegisterMCInstrInfo(*T, createBPFMCInstrInfo);
|
|
|
|
// Register the MC register info.
|
|
TargetRegistry::RegisterMCRegInfo(*T, createBPFMCRegisterInfo);
|
|
|
|
// Register the MC subtarget info.
|
|
TargetRegistry::RegisterMCSubtargetInfo(*T,
|
|
createBPFMCSubtargetInfo);
|
|
|
|
// Register the object streamer
|
|
TargetRegistry::RegisterELFStreamer(*T, createBPFMCStreamer);
|
|
|
|
// Register the MCInstPrinter.
|
|
TargetRegistry::RegisterMCInstPrinter(*T, createBPFMCInstPrinter);
|
|
}
|
|
|
|
// Register the MC code emitter
|
|
TargetRegistry::RegisterMCCodeEmitter(getTheBPFleTarget(),
|
|
createBPFMCCodeEmitter);
|
|
TargetRegistry::RegisterMCCodeEmitter(getTheBPFbeTarget(),
|
|
createBPFbeMCCodeEmitter);
|
|
|
|
// Register the ASM Backend
|
|
TargetRegistry::RegisterMCAsmBackend(getTheBPFleTarget(),
|
|
createBPFAsmBackend);
|
|
TargetRegistry::RegisterMCAsmBackend(getTheBPFbeTarget(),
|
|
createBPFbeAsmBackend);
|
|
|
|
if (sys::IsLittleEndianHost) {
|
|
TargetRegistry::RegisterMCCodeEmitter(getTheBPFTarget(),
|
|
createBPFMCCodeEmitter);
|
|
TargetRegistry::RegisterMCAsmBackend(getTheBPFTarget(),
|
|
createBPFAsmBackend);
|
|
} else {
|
|
TargetRegistry::RegisterMCCodeEmitter(getTheBPFTarget(),
|
|
createBPFbeMCCodeEmitter);
|
|
TargetRegistry::RegisterMCAsmBackend(getTheBPFTarget(),
|
|
createBPFbeAsmBackend);
|
|
}
|
|
}
|