mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-28 06:24:57 +00:00
Add XCore disassembler.
Currently there is no instruction encoding info and XCoreDisassembler::getInstruction() always returns Fail. I intend to add instruction encodings and tests in follow on commits. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170292 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
68
lib/Target/XCore/Disassembler/XCoreDisassembler.cpp
Normal file
68
lib/Target/XCore/Disassembler/XCoreDisassembler.cpp
Normal file
@ -0,0 +1,68 @@
|
||||
//===- XCoreDisassembler.cpp - Disassembler for XCore -----------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file is part of the XCore Disassembler.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/MC/MCDisassembler.h"
|
||||
#include "llvm/MC/MCFixedLenDisassembler.h"
|
||||
#include "llvm/MC/MCSubtargetInfo.h"
|
||||
#include "llvm/Support/MemoryObject.h"
|
||||
#include "llvm/Support/TargetRegistry.h"
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
typedef MCDisassembler::DecodeStatus DecodeStatus;
|
||||
|
||||
namespace {
|
||||
|
||||
/// XCoreDisassembler - a disasembler class for XCore.
|
||||
class XCoreDisassembler : public MCDisassembler {
|
||||
public:
|
||||
/// Constructor - Initializes the disassembler.
|
||||
///
|
||||
XCoreDisassembler(const MCSubtargetInfo &STI) :
|
||||
MCDisassembler(STI) {}
|
||||
|
||||
/// getInstruction - See MCDisassembler.
|
||||
virtual DecodeStatus getInstruction(MCInst &instr,
|
||||
uint64_t &size,
|
||||
const MemoryObject ®ion,
|
||||
uint64_t address,
|
||||
raw_ostream &vStream,
|
||||
raw_ostream &cStream) const;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
MCDisassembler::DecodeStatus
|
||||
XCoreDisassembler::getInstruction(MCInst &instr,
|
||||
uint64_t &Size,
|
||||
const MemoryObject &Region,
|
||||
uint64_t Address,
|
||||
raw_ostream &vStream,
|
||||
raw_ostream &cStream) const {
|
||||
return Fail;
|
||||
}
|
||||
|
||||
namespace llvm {
|
||||
extern Target TheXCoreTarget;
|
||||
}
|
||||
|
||||
static MCDisassembler *createXCoreDisassembler(const Target &T,
|
||||
const MCSubtargetInfo &STI) {
|
||||
return new XCoreDisassembler(STI);
|
||||
}
|
||||
|
||||
extern "C" void LLVMInitializeXCoreDisassembler() {
|
||||
// Register the disassembler.
|
||||
TargetRegistry::RegisterMCDisassembler(TheXCoreTarget,
|
||||
createXCoreDisassembler);
|
||||
}
|
Reference in New Issue
Block a user