[llvm-commits] [llvm] r170292 - in /llvm/trunk/lib/Target/XCore: CMakeLists.txt Disassembler/ Disassembler/CMakeLists.txt Disassembler/LLVMBuild.txt Disassembler/Makefile Disassembler/XCoreDisassembler.cpp LLVMBuild.txt Makefile
Richard Osborne
richard at xmos.com
Sun Dec 16 09:29:15 PST 2012
Author: friedgold
Date: Sun Dec 16 11:29:14 2012
New Revision: 170292
URL: http://llvm.org/viewvc/llvm-project?rev=170292&view=rev
Log:
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.
Added:
llvm/trunk/lib/Target/XCore/Disassembler/
llvm/trunk/lib/Target/XCore/Disassembler/CMakeLists.txt
llvm/trunk/lib/Target/XCore/Disassembler/LLVMBuild.txt
- copied, changed from r170291, llvm/trunk/lib/Target/XCore/LLVMBuild.txt
llvm/trunk/lib/Target/XCore/Disassembler/Makefile
llvm/trunk/lib/Target/XCore/Disassembler/XCoreDisassembler.cpp
Modified:
llvm/trunk/lib/Target/XCore/CMakeLists.txt
llvm/trunk/lib/Target/XCore/LLVMBuild.txt
llvm/trunk/lib/Target/XCore/Makefile
Modified: llvm/trunk/lib/Target/XCore/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/CMakeLists.txt?rev=170292&r1=170291&r2=170292&view=diff
==============================================================================
--- llvm/trunk/lib/Target/XCore/CMakeLists.txt (original)
+++ llvm/trunk/lib/Target/XCore/CMakeLists.txt Sun Dec 16 11:29:14 2012
@@ -25,6 +25,7 @@
add_dependencies(LLVMXCoreCodeGen intrinsics_gen)
+add_subdirectory(Disassembler)
add_subdirectory(InstPrinter)
add_subdirectory(TargetInfo)
add_subdirectory(MCTargetDesc)
Added: llvm/trunk/lib/Target/XCore/Disassembler/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/Disassembler/CMakeLists.txt?rev=170292&view=auto
==============================================================================
--- llvm/trunk/lib/Target/XCore/Disassembler/CMakeLists.txt (added)
+++ llvm/trunk/lib/Target/XCore/Disassembler/CMakeLists.txt Sun Dec 16 11:29:14 2012
@@ -0,0 +1,5 @@
+add_llvm_library(LLVMXCoreDisassembler
+ XCoreDisassembler.cpp
+ )
+
+add_dependencies(LLVMXCoreDisassembler XCoreCommonTableGen)
Copied: llvm/trunk/lib/Target/XCore/Disassembler/LLVMBuild.txt (from r170291, llvm/trunk/lib/Target/XCore/LLVMBuild.txt)
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/Disassembler/LLVMBuild.txt?p2=llvm/trunk/lib/Target/XCore/Disassembler/LLVMBuild.txt&p1=llvm/trunk/lib/Target/XCore/LLVMBuild.txt&r1=170291&r2=170292&rev=170292&view=diff
==============================================================================
--- llvm/trunk/lib/Target/XCore/LLVMBuild.txt (original)
+++ llvm/trunk/lib/Target/XCore/Disassembler/LLVMBuild.txt Sun Dec 16 11:29:14 2012
@@ -1,4 +1,4 @@
-;===- ./lib/Target/XCore/LLVMBuild.txt -------------------------*- Conf -*--===;
+;===- ./lib/Target/XCore/Disassembler/LLVMBuild.txt ------------*- Conf -*--===;
;
; The LLVM Compiler Infrastructure
;
@@ -15,18 +15,9 @@
;
;===------------------------------------------------------------------------===;
-[common]
-subdirectories = InstPrinter MCTargetDesc TargetInfo
-
[component_0]
-type = TargetGroup
-name = XCore
-parent = Target
-has_asmprinter = 1
-
-[component_1]
type = Library
-name = XCoreCodeGen
+name = XCoreDisassembler
parent = XCore
-required_libraries = AsmPrinter CodeGen Core MC SelectionDAG Support Target XCoreDesc XCoreInfo
+required_libraries = MC Support XCoreInfo
add_to_library_groups = XCore
Added: llvm/trunk/lib/Target/XCore/Disassembler/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/Disassembler/Makefile?rev=170292&view=auto
==============================================================================
--- llvm/trunk/lib/Target/XCore/Disassembler/Makefile (added)
+++ llvm/trunk/lib/Target/XCore/Disassembler/Makefile Sun Dec 16 11:29:14 2012
@@ -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
Added: llvm/trunk/lib/Target/XCore/Disassembler/XCoreDisassembler.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/Disassembler/XCoreDisassembler.cpp?rev=170292&view=auto
==============================================================================
--- llvm/trunk/lib/Target/XCore/Disassembler/XCoreDisassembler.cpp (added)
+++ llvm/trunk/lib/Target/XCore/Disassembler/XCoreDisassembler.cpp Sun Dec 16 11:29:14 2012
@@ -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);
+}
Modified: llvm/trunk/lib/Target/XCore/LLVMBuild.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/LLVMBuild.txt?rev=170292&r1=170291&r2=170292&view=diff
==============================================================================
--- llvm/trunk/lib/Target/XCore/LLVMBuild.txt (original)
+++ llvm/trunk/lib/Target/XCore/LLVMBuild.txt Sun Dec 16 11:29:14 2012
@@ -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
Modified: llvm/trunk/lib/Target/XCore/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/Makefile?rev=170292&r1=170291&r2=170292&view=diff
==============================================================================
--- llvm/trunk/lib/Target/XCore/Makefile (original)
+++ llvm/trunk/lib/Target/XCore/Makefile Sun Dec 16 11:29:14 2012
@@ -17,7 +17,7 @@
XCoreGenDAGISel.inc XCoreGenCallingConv.inc \
XCoreGenSubtargetInfo.inc
-DIRS = InstPrinter TargetInfo MCTargetDesc
+DIRS = Disassembler InstPrinter TargetInfo MCTargetDesc
include $(LEVEL)/Makefile.common
More information about the llvm-commits
mailing list