[llvm-commits] [llvm] r100910 - in /llvm/trunk/tools: Makefile edis/EDDisassembler.cpp edis/Makefile

Daniel Dunbar daniel at zuster.org
Fri Apr 9 18:23:01 PDT 2010


Hi Sean,

On Fri, Apr 9, 2010 at 5:48 PM, Sean Callanan <scallanan at apple.com> wrote:
> Author: spyffe
> Date: Fri Apr  9 19:48:10 2010
> New Revision: 100910
>
> URL: http://llvm.org/viewvc/llvm-project?rev=100910&view=rev
> Log:
> Updated the edis build mechanism to allow for builds
> that do not build some (or all) of the targets that
> edis supports.

This is better than nothing, but it is still a layering violation.
This isn't ok:
  #include "../../lib/Target/X86/X86GenEDInfo.inc"
instead such uses should live behind a real API.

To put another way, things outside of lib/Target should be "target
independent", in that they don't require custom logic for individual
targets.

Is there a reason this stuff can't be pushed through the
MCDisassembler interface?

 - Daniel

> Modified:
>    llvm/trunk/tools/Makefile
>    llvm/trunk/tools/edis/EDDisassembler.cpp
>    llvm/trunk/tools/edis/Makefile
>
> Modified: llvm/trunk/tools/Makefile
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/Makefile?rev=100910&r1=100909&r2=100910&view=diff
> ==============================================================================
> --- llvm/trunk/tools/Makefile (original)
> +++ llvm/trunk/tools/Makefile Fri Apr  9 19:48:10 2010
> @@ -36,7 +36,7 @@
>  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.
>
> Modified: llvm/trunk/tools/edis/EDDisassembler.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/edis/EDDisassembler.cpp?rev=100910&r1=100909&r2=100910&view=diff
> ==============================================================================
> --- llvm/trunk/tools/edis/EDDisassembler.cpp (original)
> +++ llvm/trunk/tools/edis/EDDisassembler.cpp Fri Apr  9 19:48:10 2010
> @@ -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 @@
>  };
>
>  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 @@
>
>   sInitialized = true;
>
> +#ifdef EDIS_X86
>   BRINGUP_TARGET(X86)
> +#endif
> +#ifdef EDIS_ARM
>   BRINGUP_TARGET(ARM)
> +#endif
>  }
>
>  #undef BRINGUP_TARGET
> @@ -295,6 +308,7 @@
>   switch (Key.Arch) {
>   default:
>     break;
> +#ifdef EDIS_X86
>   case Triple::x86:
>   case Triple::x86_64:
>     stackPointers.insert(registerIDWithName("SP"));
> @@ -305,12 +319,15 @@
>     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
>   }
>  }
>
>
> Modified: llvm/trunk/tools/edis/Makefile
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/edis/Makefile?rev=100910&r1=100909&r2=100910&view=diff
> ==============================================================================
> --- llvm/trunk/tools/edis/Makefile (original)
> +++ llvm/trunk/tools/edis/Makefile Fri Apr  9 19:48:10 2010
> @@ -45,6 +45,19 @@
>     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
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>




More information about the llvm-commits mailing list