forked from OSchip/llvm-project
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. llvm-svn: 170292
This commit is contained in:
parent
872f51e301
commit
e31735a52b
|
@ -25,6 +25,7 @@ add_llvm_target(XCoreCodeGen
|
|||
|
||||
add_dependencies(LLVMXCoreCodeGen intrinsics_gen)
|
||||
|
||||
add_subdirectory(Disassembler)
|
||||
add_subdirectory(InstPrinter)
|
||||
add_subdirectory(TargetInfo)
|
||||
add_subdirectory(MCTargetDesc)
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
add_llvm_library(LLVMXCoreDisassembler
|
||||
XCoreDisassembler.cpp
|
||||
)
|
||||
|
||||
add_dependencies(LLVMXCoreDisassembler XCoreCommonTableGen)
|
|
@ -0,0 +1,23 @@
|
|||
;===- ./lib/Target/XCore/Disassembler/LLVMBuild.txt ------------*- Conf -*--===;
|
||||
;
|
||||
; The LLVM Compiler Infrastructure
|
||||
;
|
||||
; This file is distributed under the University of Illinois Open Source
|
||||
; License. See LICENSE.TXT for details.
|
||||
;
|
||||
;===------------------------------------------------------------------------===;
|
||||
;
|
||||
; This is an LLVMBuild description file for the components in this subdirectory.
|
||||
;
|
||||
; For more information on the LLVMBuild system, please see:
|
||||
;
|
||||
; http://llvm.org/docs/LLVMBuild.html
|
||||
;
|
||||
;===------------------------------------------------------------------------===;
|
||||
|
||||
[component_0]
|
||||
type = Library
|
||||
name = XCoreDisassembler
|
||||
parent = XCore
|
||||
required_libraries = MC Support XCoreInfo
|
||||
add_to_library_groups = XCore
|
|
@ -0,0 +1,13 @@
|
|||
##===- lib/Target/XCore/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 = LLVMXCoreDisassembler
|
||||
|
||||
include $(LEVEL)/Makefile.common
|
|
@ -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);
|
||||
}
|
|
@ -16,13 +16,14 @@
|
|||
;===------------------------------------------------------------------------===;
|
||||
|
||||
[common]
|
||||
subdirectories = InstPrinter MCTargetDesc TargetInfo
|
||||
subdirectories = Disassembler InstPrinter MCTargetDesc TargetInfo
|
||||
|
||||
[component_0]
|
||||
type = TargetGroup
|
||||
name = XCore
|
||||
parent = Target
|
||||
has_asmprinter = 1
|
||||
has_disassembler = 1
|
||||
|
||||
[component_1]
|
||||
type = Library
|
||||
|
|
|
@ -17,7 +17,7 @@ BUILT_SOURCES = XCoreGenRegisterInfo.inc XCoreGenInstrInfo.inc \
|
|||
XCoreGenDAGISel.inc XCoreGenCallingConv.inc \
|
||||
XCoreGenSubtargetInfo.inc
|
||||
|
||||
DIRS = InstPrinter TargetInfo MCTargetDesc
|
||||
DIRS = Disassembler InstPrinter TargetInfo MCTargetDesc
|
||||
|
||||
include $(LEVEL)/Makefile.common
|
||||
|
||||
|
|
Loading…
Reference in New Issue