diff options
Diffstat (limited to 'contrib/llvm/lib/Target/MBlaze/Disassembler')
4 files changed, 44 insertions, 73 deletions
diff --git a/contrib/llvm/lib/Target/MBlaze/Disassembler/CMakeLists.txt b/contrib/llvm/lib/Target/MBlaze/Disassembler/CMakeLists.txt deleted file mode 100644 index 9376e68..0000000 --- a/contrib/llvm/lib/Target/MBlaze/Disassembler/CMakeLists.txt +++ /dev/null @@ -1,16 +0,0 @@ -include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. - ${CMAKE_CURRENT_SOURCE_DIR}/.. ) - -add_llvm_library(LLVMMBlazeDisassembler - MBlazeDisassembler.cpp - ) - -# workaround for hanging compilation on MSVC9 and 10 -if( MSVC_VERSION EQUAL 1500 OR MSVC_VERSION EQUAL 1600 ) -set_property( - SOURCE MBlazeDisassembler.cpp - PROPERTY COMPILE_FLAGS "/Od" - ) -endif() - -add_dependencies(LLVMMBlazeDisassembler MBlazeCodeGenTable_gen) diff --git a/contrib/llvm/lib/Target/MBlaze/Disassembler/MBlazeDisassembler.cpp b/contrib/llvm/lib/Target/MBlaze/Disassembler/MBlazeDisassembler.cpp index 88d80a1..fd761f1 100644 --- a/contrib/llvm/lib/Target/MBlaze/Disassembler/MBlazeDisassembler.cpp +++ b/contrib/llvm/lib/Target/MBlaze/Disassembler/MBlazeDisassembler.cpp @@ -20,9 +20,9 @@ #include "llvm/MC/MCDisassembler.h" #include "llvm/MC/MCDisassembler.h" #include "llvm/MC/MCInst.h" -#include "llvm/Target/TargetRegistry.h" #include "llvm/Support/Debug.h" #include "llvm/Support/MemoryObject.h" +#include "llvm/Support/TargetRegistry.h" #include "llvm/Support/raw_ostream.h" // #include "MBlazeGenDecoderTables.inc" @@ -60,27 +60,27 @@ static unsigned mblazeBinary2Opcode[] = { }; static unsigned getRD(uint32_t insn) { - if (!MBlazeRegisterInfo::isRegister((insn>>21)&0x1F)) + if (!isMBlazeRegister((insn>>21)&0x1F)) return UNSUPPORTED; - return MBlazeRegisterInfo::getRegisterFromNumbering((insn>>21)&0x1F); + return getMBlazeRegisterFromNumbering((insn>>21)&0x1F); } static unsigned getRA(uint32_t insn) { - if (!MBlazeRegisterInfo::getRegisterFromNumbering((insn>>16)&0x1F)) + if (!getMBlazeRegisterFromNumbering((insn>>16)&0x1F)) return UNSUPPORTED; - return MBlazeRegisterInfo::getRegisterFromNumbering((insn>>16)&0x1F); + return getMBlazeRegisterFromNumbering((insn>>16)&0x1F); } static unsigned getRB(uint32_t insn) { - if (!MBlazeRegisterInfo::getRegisterFromNumbering((insn>>11)&0x1F)) + if (!getMBlazeRegisterFromNumbering((insn>>11)&0x1F)) return UNSUPPORTED; - return MBlazeRegisterInfo::getRegisterFromNumbering((insn>>11)&0x1F); + return getMBlazeRegisterFromNumbering((insn>>11)&0x1F); } static int64_t getRS(uint32_t insn) { - if (!MBlazeRegisterInfo::isSpecialRegister(insn&0x3FFF)) + if (!isSpecialMBlazeRegister(insn&0x3FFF)) return UNSUPPORTED; - return MBlazeRegisterInfo::getSpecialRegisterFromNumbering(insn&0x3FFF); + return getSpecialMBlazeRegisterFromNumbering(insn&0x3FFF); } static int64_t getIMM(uint32_t insn) { @@ -493,11 +493,12 @@ EDInstInfo *MBlazeDisassembler::getEDInfo() const { // Public interface for the disassembler // -bool MBlazeDisassembler::getInstruction(MCInst &instr, +MCDisassembler::DecodeStatus MBlazeDisassembler::getInstruction(MCInst &instr, uint64_t &size, const MemoryObject ®ion, uint64_t address, - raw_ostream &vStream) const { + raw_ostream &vStream, + raw_ostream &cStream) const { // The machine instruction. uint32_t insn; uint64_t read; @@ -508,7 +509,7 @@ bool MBlazeDisassembler::getInstruction(MCInst &instr, // We want to read exactly 4 bytes of data. if (region.readBytes(address, 4, (uint8_t*)bytes, &read) == -1 || read < 4) - return false; + return Fail; // Encoded as a big-endian 32-bit word in the stream. insn = (bytes[0]<<24) | (bytes[1]<<16) | (bytes[2]<< 8) | (bytes[3]<<0); @@ -517,7 +518,7 @@ bool MBlazeDisassembler::getInstruction(MCInst &instr, // that it is a valid instruction. unsigned opcode = getOPCODE(insn); if (opcode == UNSUPPORTED) - return false; + return Fail; instr.setOpcode(opcode); @@ -529,11 +530,11 @@ bool MBlazeDisassembler::getInstruction(MCInst &instr, uint64_t tsFlags = MBlazeInsts[opcode].TSFlags; switch ((tsFlags & MBlazeII::FormMask)) { default: - return false; + return Fail; case MBlazeII::FRRRR: if (RD == UNSUPPORTED || RA == UNSUPPORTED || RB == UNSUPPORTED) - return false; + return Fail; instr.addOperand(MCOperand::CreateReg(RD)); instr.addOperand(MCOperand::CreateReg(RB)); instr.addOperand(MCOperand::CreateReg(RA)); @@ -541,7 +542,7 @@ bool MBlazeDisassembler::getInstruction(MCInst &instr, case MBlazeII::FRRR: if (RD == UNSUPPORTED || RA == UNSUPPORTED || RB == UNSUPPORTED) - return false; + return Fail; instr.addOperand(MCOperand::CreateReg(RD)); instr.addOperand(MCOperand::CreateReg(RA)); instr.addOperand(MCOperand::CreateReg(RB)); @@ -550,23 +551,23 @@ bool MBlazeDisassembler::getInstruction(MCInst &instr, case MBlazeII::FRI: switch (opcode) { default: - return false; + return Fail; case MBlaze::MFS: if (RD == UNSUPPORTED) - return false; + return Fail; instr.addOperand(MCOperand::CreateReg(RD)); instr.addOperand(MCOperand::CreateImm(insn&0x3FFF)); break; case MBlaze::MTS: if (RA == UNSUPPORTED) - return false; + return Fail; instr.addOperand(MCOperand::CreateImm(insn&0x3FFF)); instr.addOperand(MCOperand::CreateReg(RA)); break; case MBlaze::MSRSET: case MBlaze::MSRCLR: if (RD == UNSUPPORTED) - return false; + return Fail; instr.addOperand(MCOperand::CreateReg(RD)); instr.addOperand(MCOperand::CreateImm(insn&0x7FFF)); break; @@ -575,7 +576,7 @@ bool MBlazeDisassembler::getInstruction(MCInst &instr, case MBlazeII::FRRI: if (RD == UNSUPPORTED || RA == UNSUPPORTED) - return false; + return Fail; instr.addOperand(MCOperand::CreateReg(RD)); instr.addOperand(MCOperand::CreateReg(RA)); switch (opcode) { @@ -592,35 +593,35 @@ bool MBlazeDisassembler::getInstruction(MCInst &instr, case MBlazeII::FCRR: if (RA == UNSUPPORTED || RB == UNSUPPORTED) - return false; + return Fail; instr.addOperand(MCOperand::CreateReg(RA)); instr.addOperand(MCOperand::CreateReg(RB)); break; case MBlazeII::FCRI: if (RA == UNSUPPORTED) - return false; + return Fail; instr.addOperand(MCOperand::CreateReg(RA)); instr.addOperand(MCOperand::CreateImm(getIMM(insn))); break; case MBlazeII::FRCR: if (RD == UNSUPPORTED || RB == UNSUPPORTED) - return false; + return Fail; instr.addOperand(MCOperand::CreateReg(RD)); instr.addOperand(MCOperand::CreateReg(RB)); break; case MBlazeII::FRCI: if (RD == UNSUPPORTED) - return false; + return Fail; instr.addOperand(MCOperand::CreateReg(RD)); instr.addOperand(MCOperand::CreateImm(getIMM(insn))); break; case MBlazeII::FCCR: if (RB == UNSUPPORTED) - return false; + return Fail; instr.addOperand(MCOperand::CreateReg(RB)); break; @@ -630,7 +631,7 @@ bool MBlazeDisassembler::getInstruction(MCInst &instr, case MBlazeII::FRRCI: if (RD == UNSUPPORTED || RA == UNSUPPORTED) - return false; + return Fail; instr.addOperand(MCOperand::CreateReg(RD)); instr.addOperand(MCOperand::CreateReg(RA)); instr.addOperand(MCOperand::CreateImm(getSHT(insn))); @@ -638,35 +639,35 @@ bool MBlazeDisassembler::getInstruction(MCInst &instr, case MBlazeII::FRRC: if (RD == UNSUPPORTED || RA == UNSUPPORTED) - return false; + return Fail; instr.addOperand(MCOperand::CreateReg(RD)); instr.addOperand(MCOperand::CreateReg(RA)); break; case MBlazeII::FRCX: if (RD == UNSUPPORTED) - return false; + return Fail; instr.addOperand(MCOperand::CreateReg(RD)); instr.addOperand(MCOperand::CreateImm(getFSL(insn))); break; case MBlazeII::FRCS: if (RD == UNSUPPORTED || RS == UNSUPPORTED) - return false; + return Fail; instr.addOperand(MCOperand::CreateReg(RD)); instr.addOperand(MCOperand::CreateReg(RS)); break; case MBlazeII::FCRCS: if (RS == UNSUPPORTED || RA == UNSUPPORTED) - return false; + return Fail; instr.addOperand(MCOperand::CreateReg(RS)); instr.addOperand(MCOperand::CreateReg(RA)); break; case MBlazeII::FCRCX: if (RA == UNSUPPORTED) - return false; + return Fail; instr.addOperand(MCOperand::CreateReg(RA)); instr.addOperand(MCOperand::CreateImm(getFSL(insn))); break; @@ -677,13 +678,13 @@ bool MBlazeDisassembler::getInstruction(MCInst &instr, case MBlazeII::FCR: if (RB == UNSUPPORTED) - return false; + return Fail; instr.addOperand(MCOperand::CreateReg(RB)); break; case MBlazeII::FRIR: if (RD == UNSUPPORTED || RA == UNSUPPORTED) - return false; + return Fail; instr.addOperand(MCOperand::CreateReg(RD)); instr.addOperand(MCOperand::CreateImm(getIMM(insn))); instr.addOperand(MCOperand::CreateReg(RA)); @@ -693,11 +694,12 @@ bool MBlazeDisassembler::getInstruction(MCInst &instr, // We always consume 4 bytes of data on success size = 4; - return true; + return Success; } -static MCDisassembler *createMBlazeDisassembler(const Target &T) { - return new MBlazeDisassembler; +static MCDisassembler *createMBlazeDisassembler(const Target &T, + const MCSubtargetInfo &STI) { + return new MBlazeDisassembler(STI); } extern "C" void LLVMInitializeMBlazeDisassembler() { diff --git a/contrib/llvm/lib/Target/MBlaze/Disassembler/MBlazeDisassembler.h b/contrib/llvm/lib/Target/MBlaze/Disassembler/MBlazeDisassembler.h index d05eced..0ac0d89 100644 --- a/contrib/llvm/lib/Target/MBlaze/Disassembler/MBlazeDisassembler.h +++ b/contrib/llvm/lib/Target/MBlaze/Disassembler/MBlazeDisassembler.h @@ -32,19 +32,20 @@ class MBlazeDisassembler : public MCDisassembler { public: /// Constructor - Initializes the disassembler. /// - MBlazeDisassembler() : - MCDisassembler() { + MBlazeDisassembler(const MCSubtargetInfo &STI) : + MCDisassembler(STI) { } ~MBlazeDisassembler() { } /// getInstruction - See MCDisassembler. - bool getInstruction(MCInst &instr, + MCDisassembler::DecodeStatus getInstruction(MCInst &instr, uint64_t &size, const MemoryObject ®ion, uint64_t address, - raw_ostream &vStream) const; + raw_ostream &vStream, + raw_ostream &cStream) const; /// getEDInfo - See MCDisassembler. EDInstInfo *getEDInfo() const; diff --git a/contrib/llvm/lib/Target/MBlaze/Disassembler/Makefile b/contrib/llvm/lib/Target/MBlaze/Disassembler/Makefile deleted file mode 100644 index 0530b32..0000000 --- a/contrib/llvm/lib/Target/MBlaze/Disassembler/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -##===- lib/Target/MBlaze/Disassembler/Makefile -------------*- Makefile -*-===## -# -# The LLVM Compiler Infrastructure -# -# This file is distributed under the University of Illinois Open Source -# License. See LICENSE.TXT for details. -# -##===----------------------------------------------------------------------===## - -LEVEL = ../../../.. -LIBRARYNAME = LLVMMBlazeDisassembler - -# Hack: we need to include 'main' MBlaze target directory to grab headers -CPP.Flags += -I$(PROJ_OBJ_DIR)/.. -I$(PROJ_SRC_DIR)/.. - -include $(LEVEL)/Makefile.common |