diff options
author | Eugene Zelenko <eugene.zelenko@gmail.com> | 2017-02-01 01:22:51 +0000 |
---|---|---|
committer | Eugene Zelenko <eugene.zelenko@gmail.com> | 2017-02-01 01:22:51 +0000 |
commit | 926883e1c2a39baabc67cfd5ec0d913c9851af68 (patch) | |
tree | 535a2aa5ae9a86193f97b143e65c62d6cba3182c /llvm/lib/Target/Mips/Disassembler/MipsDisassembler.cpp | |
parent | 70c245e92dc7bad7588a542abc84a138a2eacc60 (diff) | |
download | llvm-926883e1c2a39baabc67cfd5ec0d913c9851af68.zip llvm-926883e1c2a39baabc67cfd5ec0d913c9851af68.tar.gz llvm-926883e1c2a39baabc67cfd5ec0d913c9851af68.tar.bz2 |
[Mips] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).
llvm-svn: 293729
Diffstat (limited to 'llvm/lib/Target/Mips/Disassembler/MipsDisassembler.cpp')
-rw-r--r-- | llvm/lib/Target/Mips/Disassembler/MipsDisassembler.cpp | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/llvm/lib/Target/Mips/Disassembler/MipsDisassembler.cpp b/llvm/lib/Target/Mips/Disassembler/MipsDisassembler.cpp index f80efb1..2f709c6 100644 --- a/llvm/lib/Target/Mips/Disassembler/MipsDisassembler.cpp +++ b/llvm/lib/Target/Mips/Disassembler/MipsDisassembler.cpp @@ -1,4 +1,4 @@ -//===- MipsDisassembler.cpp - Disassembler for Mips -------------*- C++ -*-===// +//===- MipsDisassembler.cpp - Disassembler for Mips -----------------------===// // // The LLVM Compiler Infrastructure // @@ -12,15 +12,21 @@ //===----------------------------------------------------------------------===// #include "Mips.h" -#include "MipsRegisterInfo.h" -#include "MipsSubtarget.h" +#include "llvm/ADT/ArrayRef.h" #include "llvm/MC/MCContext.h" #include "llvm/MC/MCDisassembler/MCDisassembler.h" #include "llvm/MC/MCFixedLenDisassembler.h" #include "llvm/MC/MCInst.h" #include "llvm/MC/MCSubtargetInfo.h" +#include "llvm/MC/MCRegisterInfo.h" +#include "llvm/Support/Compiler.h" +#include "llvm/Support/Debug.h" +#include "llvm/Support/ErrorHandling.h" #include "llvm/Support/MathExtras.h" +#include "llvm/Support/raw_ostream.h" #include "llvm/Support/TargetRegistry.h" +#include <cassert> +#include <cstdint> using namespace llvm; @@ -33,6 +39,7 @@ namespace { class MipsDisassembler : public MCDisassembler { bool IsMicroMips; bool IsBigEndian; + public: MipsDisassembler(const MCSubtargetInfo &STI, MCContext &Ctx, bool IsBigEndian) : MCDisassembler(STI, Ctx), @@ -42,9 +49,11 @@ public: bool hasMips2() const { return STI.getFeatureBits()[Mips::FeatureMips2]; } bool hasMips3() const { return STI.getFeatureBits()[Mips::FeatureMips3]; } bool hasMips32() const { return STI.getFeatureBits()[Mips::FeatureMips32]; } + bool hasMips32r6() const { return STI.getFeatureBits()[Mips::FeatureMips32r6]; } + bool isFP64() const { return STI.getFeatureBits()[Mips::FeatureFP64Bit]; } bool isGP64() const { return STI.getFeatureBits()[Mips::FeatureGP64Bit]; } @@ -527,11 +536,13 @@ static DecodeStatus DecodeMovePRegPair(MCInst &Inst, unsigned Insn, const void *Decoder); namespace llvm { + Target &getTheMipselTarget(); Target &getTheMipsTarget(); Target &getTheMips64Target(); Target &getTheMips64elTarget(); -} + +} // end namespace llvm static MCDisassembler *createMipsDisassembler( const Target &T, @@ -1267,16 +1278,13 @@ static DecodeStatus DecodeCPU16RegsRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const void *Decoder) { - return MCDisassembler::Fail; - } static DecodeStatus DecodeGPR64RegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const void *Decoder) { - if (RegNo > 31) return MCDisassembler::Fail; @@ -1620,7 +1628,7 @@ static DecodeStatus DecodeMSA128Mem(MCInst &Inst, unsigned Insn, switch(Inst.getOpcode()) { default: - assert (0 && "Unexpected instruction"); + assert(false && "Unexpected instruction"); return MCDisassembler::Fail; break; case Mips::LD_B: @@ -1980,7 +1988,6 @@ static DecodeStatus DecodeAFGR64RegisterClass(MCInst &Inst, if (RegNo > 30 || RegNo %2) return MCDisassembler::Fail; - ; unsigned Reg = getReg(Decoder, Mips::AFGR64RegClassID, RegNo /2); Inst.addOperand(MCOperand::createReg(Reg)); return MCDisassembler::Success; @@ -2128,7 +2135,6 @@ static DecodeStatus DecodeJumpTarget(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder) { - unsigned JumpOffset = fieldFromInstruction(Insn, 0, 26) << 2; Inst.addOperand(MCOperand::createImm(JumpOffset)); return MCDisassembler::Success; @@ -2363,7 +2369,6 @@ static DecodeStatus DecodeRegListOperand16(MCInst &Inst, unsigned Insn, static DecodeStatus DecodeMovePRegPair(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder) { - unsigned RegPair = fieldFromInstruction(Insn, 7, 3); switch (RegPair) { |