mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 11:13:28 +01:00
[BPF] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).
llvm-svn: 291297
This commit is contained in:
parent
93fad2f404
commit
eca96fb4b9
@ -13,15 +13,13 @@
|
||||
|
||||
#include "BPF.h"
|
||||
#include "BPFInstrInfo.h"
|
||||
#include "BPFSubtarget.h"
|
||||
#include "BPFTargetMachine.h"
|
||||
#include "llvm/CodeGen/MachineFunctionPass.h"
|
||||
#include "llvm/CodeGen/MachineInstrBuilder.h"
|
||||
#include "llvm/CodeGen/MachineRegisterInfo.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/TargetRegistry.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/CodeGen/MachineBasicBlock.h"
|
||||
#include "llvm/CodeGen/MachineInstrBuilder.h"
|
||||
#include "llvm/IR/DebugLoc.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include <cassert>
|
||||
#include <iterator>
|
||||
|
||||
#define GET_INSTRINFO_CTOR_DTOR
|
||||
#include "BPFGenInstrInfo.inc"
|
||||
@ -109,11 +107,11 @@ bool BPFInstrInfo::analyzeBranch(MachineBasicBlock &MBB,
|
||||
while (std::next(I) != MBB.end())
|
||||
std::next(I)->eraseFromParent();
|
||||
Cond.clear();
|
||||
FBB = 0;
|
||||
FBB = nullptr;
|
||||
|
||||
// Delete the J if it's equivalent to a fall-through.
|
||||
if (MBB.isLayoutSuccessor(I->getOperand(0).getMBB())) {
|
||||
TBB = 0;
|
||||
TBB = nullptr;
|
||||
I->eraseFromParent();
|
||||
I = MBB.end();
|
||||
continue;
|
||||
|
@ -12,16 +12,15 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "BPF.h"
|
||||
#include "BPFRegisterInfo.h"
|
||||
#include "BPFSubtarget.h"
|
||||
#include "MCTargetDesc/BPFMCTargetDesc.h"
|
||||
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/MC/MCDisassembler/MCDisassembler.h"
|
||||
#include "llvm/MC/MCFixedLenDisassembler.h"
|
||||
#include "llvm/MC/MCInst.h"
|
||||
#include "llvm/MC/MCContext.h"
|
||||
#include "llvm/MC/MCAsmInfo.h"
|
||||
#include "llvm/Support/MathExtras.h"
|
||||
#include "llvm/Support/TargetRegistry.h"
|
||||
#include <cstdint>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
@ -36,14 +35,15 @@ class BPFDisassembler : public MCDisassembler {
|
||||
public:
|
||||
BPFDisassembler(const MCSubtargetInfo &STI, MCContext &Ctx)
|
||||
: MCDisassembler(STI, Ctx) {}
|
||||
virtual ~BPFDisassembler() {}
|
||||
~BPFDisassembler() override = default;
|
||||
|
||||
DecodeStatus getInstruction(MCInst &Instr, uint64_t &Size,
|
||||
ArrayRef<uint8_t> Bytes, uint64_t Address,
|
||||
raw_ostream &VStream,
|
||||
raw_ostream &CStream) const override;
|
||||
};
|
||||
}
|
||||
|
||||
} // end anonymous namespace
|
||||
|
||||
static MCDisassembler *createBPFDisassembler(const Target &T,
|
||||
const MCSubtargetInfo &STI,
|
||||
|
@ -8,28 +8,24 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "MCTargetDesc/BPFMCTargetDesc.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/MC/MCAsmBackend.h"
|
||||
#include "llvm/MC/MCAssembler.h"
|
||||
#include "llvm/MC/MCDirectives.h"
|
||||
#include "llvm/MC/MCELFObjectWriter.h"
|
||||
#include "llvm/MC/MCFixupKindInfo.h"
|
||||
#include "llvm/MC/MCFixup.h"
|
||||
#include "llvm/MC/MCObjectWriter.h"
|
||||
#include "llvm/MC/MCSubtargetInfo.h"
|
||||
#include "llvm/MC/MCExpr.h"
|
||||
#include "llvm/MC/MCSymbol.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
namespace {
|
||||
|
||||
class BPFAsmBackend : public MCAsmBackend {
|
||||
public:
|
||||
bool IsLittleEndian;
|
||||
|
||||
BPFAsmBackend(bool IsLittleEndian)
|
||||
: MCAsmBackend(), IsLittleEndian(IsLittleEndian) {}
|
||||
~BPFAsmBackend() override {}
|
||||
~BPFAsmBackend() override = default;
|
||||
|
||||
void applyFixup(const MCFixup &Fixup, char *Data, unsigned DataSize,
|
||||
uint64_t Value, bool IsPCRel) const override;
|
||||
@ -53,6 +49,8 @@ public:
|
||||
bool writeNopData(uint64_t Count, MCObjectWriter *OW) const override;
|
||||
};
|
||||
|
||||
} // end anonymous namespace
|
||||
|
||||
bool BPFAsmBackend::writeNopData(uint64_t Count, MCObjectWriter *OW) const {
|
||||
if ((Count % 8) != 0)
|
||||
return false;
|
||||
@ -66,7 +64,6 @@ bool BPFAsmBackend::writeNopData(uint64_t Count, MCObjectWriter *OW) const {
|
||||
void BPFAsmBackend::applyFixup(const MCFixup &Fixup, char *Data,
|
||||
unsigned DataSize, uint64_t Value,
|
||||
bool IsPCRel) const {
|
||||
|
||||
if (Fixup.getKind() == FK_SecRel_4 || Fixup.getKind() == FK_SecRel_8) {
|
||||
assert(Value == 0);
|
||||
} else if (Fixup.getKind() == FK_Data_4 || Fixup.getKind() == FK_Data_8) {
|
||||
@ -92,7 +89,6 @@ void BPFAsmBackend::applyFixup(const MCFixup &Fixup, char *Data,
|
||||
MCObjectWriter *BPFAsmBackend::createObjectWriter(raw_pwrite_stream &OS) const {
|
||||
return createBPFELFObjectWriter(OS, 0, IsLittleEndian);
|
||||
}
|
||||
}
|
||||
|
||||
MCAsmBackend *llvm::createBPFAsmBackend(const Target &T,
|
||||
const MCRegisterInfo &MRI,
|
||||
|
@ -10,29 +10,30 @@
|
||||
#include "MCTargetDesc/BPFMCTargetDesc.h"
|
||||
#include "llvm/MC/MCELFObjectWriter.h"
|
||||
#include "llvm/MC/MCFixup.h"
|
||||
#include "llvm/Support/ELF.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include <cstdint>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
namespace {
|
||||
|
||||
class BPFELFObjectWriter : public MCELFObjectTargetWriter {
|
||||
public:
|
||||
BPFELFObjectWriter(uint8_t OSABI);
|
||||
|
||||
~BPFELFObjectWriter() override;
|
||||
~BPFELFObjectWriter() override = default;
|
||||
|
||||
protected:
|
||||
unsigned getRelocType(MCContext &Ctx, const MCValue &Target,
|
||||
const MCFixup &Fixup, bool IsPCRel) const override;
|
||||
};
|
||||
}
|
||||
|
||||
} // end anonymous namespace
|
||||
|
||||
BPFELFObjectWriter::BPFELFObjectWriter(uint8_t OSABI)
|
||||
: MCELFObjectTargetWriter(/*Is64Bit*/ true, OSABI, ELF::EM_BPF,
|
||||
/*HasRelocationAddend*/ false) {}
|
||||
|
||||
BPFELFObjectWriter::~BPFELFObjectWriter() {}
|
||||
|
||||
unsigned BPFELFObjectWriter::getRelocType(MCContext &Ctx, const MCValue &Target,
|
||||
const MCFixup &Fixup,
|
||||
bool IsPCRel) const {
|
||||
|
@ -12,24 +12,25 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "MCTargetDesc/BPFMCTargetDesc.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/MC/MCCodeEmitter.h"
|
||||
#include "llvm/MC/MCFixup.h"
|
||||
#include "llvm/MC/MCInst.h"
|
||||
#include "llvm/MC/MCInstrInfo.h"
|
||||
#include "llvm/MC/MCRegisterInfo.h"
|
||||
#include "llvm/MC/MCSubtargetInfo.h"
|
||||
#include "llvm/MC/MCSymbol.h"
|
||||
#include "llvm/ADT/Statistic.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
#include "llvm/Support/EndianStream.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
#define DEBUG_TYPE "mccodeemitter"
|
||||
|
||||
namespace {
|
||||
|
||||
class BPFMCCodeEmitter : public MCCodeEmitter {
|
||||
BPFMCCodeEmitter(const BPFMCCodeEmitter &) = delete;
|
||||
void operator=(const BPFMCCodeEmitter &) = delete;
|
||||
const MCInstrInfo &MCII;
|
||||
const MCRegisterInfo &MRI;
|
||||
bool IsLittleEndian;
|
||||
@ -38,8 +39,9 @@ public:
|
||||
BPFMCCodeEmitter(const MCInstrInfo &mcii, const MCRegisterInfo &mri,
|
||||
bool IsLittleEndian)
|
||||
: MCII(mcii), MRI(mri), IsLittleEndian(IsLittleEndian) {}
|
||||
|
||||
~BPFMCCodeEmitter() {}
|
||||
BPFMCCodeEmitter(const BPFMCCodeEmitter &) = delete;
|
||||
void operator=(const BPFMCCodeEmitter &) = delete;
|
||||
~BPFMCCodeEmitter() override = default;
|
||||
|
||||
// getBinaryCodeForInstr - TableGen'erated function for getting the
|
||||
// binary encoding for an instruction.
|
||||
@ -66,7 +68,8 @@ private:
|
||||
void verifyInstructionPredicates(const MCInst &MI,
|
||||
uint64_t AvailableFeatures) const;
|
||||
};
|
||||
}
|
||||
|
||||
} // end anonymous namespace
|
||||
|
||||
MCCodeEmitter *llvm::createBPFMCCodeEmitter(const MCInstrInfo &MCII,
|
||||
const MCRegisterInfo &MRI,
|
||||
|
@ -12,14 +12,13 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "BPF.h"
|
||||
#include "BPFMCTargetDesc.h"
|
||||
#include "BPFMCAsmInfo.h"
|
||||
#include "InstPrinter/BPFInstPrinter.h"
|
||||
#include "MCTargetDesc/BPFMCTargetDesc.h"
|
||||
#include "MCTargetDesc/BPFMCAsmInfo.h"
|
||||
#include "llvm/MC/MCInstrInfo.h"
|
||||
#include "llvm/MC/MCRegisterInfo.h"
|
||||
#include "llvm/MC/MCStreamer.h"
|
||||
#include "llvm/MC/MCSubtargetInfo.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/Host.h"
|
||||
#include "llvm/Support/TargetRegistry.h"
|
||||
|
||||
#define GET_INSTRINFO_MC_DESC
|
||||
@ -64,7 +63,7 @@ static MCInstPrinter *createBPFMCInstPrinter(const Triple &T,
|
||||
const MCRegisterInfo &MRI) {
|
||||
if (SyntaxVariant == 0)
|
||||
return new BPFInstPrinter(MAI, MII, MRI);
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
extern "C" void LLVMInitializeBPFTargetMC() {
|
||||
|
Loading…
Reference in New Issue
Block a user