From 2ec5514c48f8a9e9915b8f481726ceabc64e00e7 Mon Sep 17 00:00:00 2001 From: Sean Callanan Date: Sat, 10 Apr 2010 00:48:10 +0000 Subject: [PATCH] Updated the edis build mechanism to allow for builds that do not build some (or all) of the targets that edis supports. llvm-svn: 100910 --- tools/Makefile | 2 +- tools/edis/EDDisassembler.cpp | 17 +++++++++++++++++ tools/edis/Makefile | 13 +++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/tools/Makefile b/tools/Makefile index e124422cd6d..8205568c2f5 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -36,7 +36,7 @@ include $(LEVEL)/Makefile.config ifeq ($(ENABLE_PIC),1) # No support for dynamic libraries on windows targets. ifneq ($(TARGET_OS), $(filter $(TARGET_OS), Cygwin MingW)) - PARALLEL_DIRS += edis + DIRS += edis # gold only builds if binutils is around. It requires "lto" to build before # it so it is added to DIRS. diff --git a/tools/edis/EDDisassembler.cpp b/tools/edis/EDDisassembler.cpp index ed7dfb1a412..a766d2fc2b4 100644 --- a/tools/edis/EDDisassembler.cpp +++ b/tools/edis/EDDisassembler.cpp @@ -39,8 +39,13 @@ #include "llvm/Target/TargetRegisterInfo.h" #include "llvm/Target/TargetSelect.h" +#ifdef EDIS_X86 #include "../../lib/Target/X86/X86GenEDInfo.inc" +#endif + +#ifdef EDIS_ARM #include "../../lib/Target/ARM/ARMGenEDInfo.inc" +#endif using namespace llvm; @@ -54,10 +59,14 @@ struct InfoMap { }; static struct InfoMap infomap[] = { +#ifdef EDIS_X86 { Triple::x86, "i386-unknown-unknown", instInfoX86 }, { Triple::x86_64, "x86_64-unknown-unknown", instInfoX86 }, +#endif +#ifdef EDIS_ARM { Triple::arm, "arm-unknown-unknown", instInfoARM }, { Triple::thumb, "thumb-unknown-unknown", instInfoARM }, +#endif { Triple::InvalidArch, NULL, NULL } }; @@ -119,8 +128,12 @@ void EDDisassembler::initialize() { sInitialized = true; +#ifdef EDIS_X86 BRINGUP_TARGET(X86) +#endif +#ifdef EDIS_ARM BRINGUP_TARGET(ARM) +#endif } #undef BRINGUP_TARGET @@ -295,6 +308,7 @@ void EDDisassembler::initMaps(const TargetRegisterInfo ®isterInfo) { switch (Key.Arch) { default: break; +#ifdef EDIS_X86 case Triple::x86: case Triple::x86_64: stackPointers.insert(registerIDWithName("SP")); @@ -305,12 +319,15 @@ void EDDisassembler::initMaps(const TargetRegisterInfo ®isterInfo) { programCounters.insert(registerIDWithName("EIP")); programCounters.insert(registerIDWithName("RIP")); break; +#endif +#ifdef EDIS_ARM case Triple::arm: case Triple::thumb: stackPointers.insert(registerIDWithName("SP")); programCounters.insert(registerIDWithName("PC")); break; +#endif } } diff --git a/tools/edis/Makefile b/tools/edis/Makefile index 7f7b097e2ce..a5ec82ba7e4 100644 --- a/tools/edis/Makefile +++ b/tools/edis/Makefile @@ -45,6 +45,19 @@ ifeq ($(HOST_OS),Darwin) endif endif +EDIS_DEFINES = + +ifneq (,$(findstring X86,$(TARGETS_TO_BUILD))) + EDIS_DEFINES := $(EDIS_DEFINES) -DEDIS_X86 +endif + +ifneq (,$(findstring ARM,$(TARGETS_TO_BUILD))) + EDIS_DEFINES := $(EDIS_DEFINES) -DEDIS_ARM +endif + +CXXFLAGS := $(CXXFLAGS) +#$(EDIS_DEFINES) + EDInfo.inc: $(TBLGEN) $(Echo) "Building semantic information header" $(Verb) $(TableGen) -o $(call SYSPATH, $@) -gen-enhanced-disassembly-header /dev/null