From 900f2ce31c0a39a5542f104e9430835fc811be8b Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Wed, 25 Nov 2009 06:53:08 +0000 Subject: [PATCH] Sketch structure for X86 disassembler. llvm-svn: 89850 --- .../Target/X86/Disassembler/CMakeLists.txt | 6 ++++ llvm/lib/Target/X86/Disassembler/Makefile | 16 ++++++++++ .../X86/Disassembler/X86Disassembler.cpp | 29 +++++++++++++++++++ llvm/lib/Target/X86/Makefile | 2 +- 4 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 llvm/lib/Target/X86/Disassembler/CMakeLists.txt create mode 100644 llvm/lib/Target/X86/Disassembler/Makefile create mode 100644 llvm/lib/Target/X86/Disassembler/X86Disassembler.cpp diff --git a/llvm/lib/Target/X86/Disassembler/CMakeLists.txt b/llvm/lib/Target/X86/Disassembler/CMakeLists.txt new file mode 100644 index 000000000000..b329e897b980 --- /dev/null +++ b/llvm/lib/Target/X86/Disassembler/CMakeLists.txt @@ -0,0 +1,6 @@ +include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/.. ) + +add_llvm_library(LLVMX86Disassembler + X86Disassembler.cpp + ) +add_dependencies(LLVMX86Disassembler X86CodeGenTable_gen) diff --git a/llvm/lib/Target/X86/Disassembler/Makefile b/llvm/lib/Target/X86/Disassembler/Makefile new file mode 100644 index 000000000000..b2896477df48 --- /dev/null +++ b/llvm/lib/Target/X86/Disassembler/Makefile @@ -0,0 +1,16 @@ +##===- lib/Target/X86/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 = LLVMX86Disassembler + +# Hack: we need to include 'main' x86 target directory to grab private headers +CPPFLAGS = -I$(PROJ_OBJ_DIR)/.. -I$(PROJ_SRC_DIR)/.. + +include $(LEVEL)/Makefile.common diff --git a/llvm/lib/Target/X86/Disassembler/X86Disassembler.cpp b/llvm/lib/Target/X86/Disassembler/X86Disassembler.cpp new file mode 100644 index 000000000000..2ebbc9bdbdb6 --- /dev/null +++ b/llvm/lib/Target/X86/Disassembler/X86Disassembler.cpp @@ -0,0 +1,29 @@ +//===- X86Disassembler.cpp - Disassembler for x86 and x86_64 ----*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "llvm/MC/MCDisassembler.h" +#include "llvm/Target/TargetRegistry.h" +#include "X86.h" +using namespace llvm; + +static const MCDisassembler *createX86_32Disassembler(const Target &T) { + return 0; +} + +static const MCDisassembler *createX86_64Disassembler(const Target &T) { + return 0; +} + +extern "C" void LLVMInitializeX86Disassembler() { + // Register the disassembler. + TargetRegistry::RegisterMCDisassembler(TheX86_32Target, + createX86_32Disassembler); + TargetRegistry::RegisterMCDisassembler(TheX86_64Target, + createX86_64Disassembler); +} diff --git a/llvm/lib/Target/X86/Makefile b/llvm/lib/Target/X86/Makefile index 220831d88db3..b311a6ed86a9 100644 --- a/llvm/lib/Target/X86/Makefile +++ b/llvm/lib/Target/X86/Makefile @@ -18,6 +18,6 @@ BUILT_SOURCES = X86GenRegisterInfo.h.inc X86GenRegisterNames.inc \ X86GenFastISel.inc \ X86GenCallingConv.inc X86GenSubtarget.inc -DIRS = AsmPrinter AsmParser TargetInfo +DIRS = AsmPrinter AsmParser Disassembler TargetInfo include $(LEVEL)/Makefile.common