[llvm-commits] [PATCH] Add InitializeNativeTargetDisassembler function

ojab ojab at ojab.ru
Mon Mar 26 08:02:15 PDT 2012


Hello again,

patch for r153438 in the attached file. Can I haz 
InitializeNativeTargetDisassembler?

//wbr ojab


On 03/14/12 18:01, ojab wrote:
> Patch, updated to r152715 in the attached file, please review.
>
> //wbr ojab
>
> On Tue, Mar 6, 2012 at 11:00 PM, ojab <ojab at ojab.ru> wrote:
>> Any additional feedback?
>>
>> //wbr ojab
>>
>>
>>
>> On Fri, Mar 2, 2012 at 12:45 AM, ojab <ojab at ojab.ru> wrote:
>>>
>>> One month from the first letter, heh.
>>> Updated patch to llvm r151833, please review.
>>>
>>> //wbr ojab
>>>
>>>
>>>
>>> On Tue, Feb 28, 2012 at 11:26 AM, ojab <ojab at ojab.ru> wrote:
>>>>
>>>> Updated patch to r151623.
>>>>
>>>> //wbr ojab
>>>>
>>>>
>>>>
>>>> On Wed, Feb 22, 2012 at 4:04 PM, ojab <ojab at ojab.ru> wrote:
>>>>>
>>>>> Chandler, any feedback?
>>>>>
>>>>> //wbr ojab
>>>>>
>>>>>
>>>>> On Fri, Feb 17, 2012 at 11:21 PM, Eric Christopher <echristo at apple.com>
>>>>> wrote:
>>>>>>
>>>>>> If it works I have no objections. Chandler?
>>>>>>
>>>>>> -eric
>>>>>>
>>>>>> On Feb 16, 2012, at 9:56 AM, ojab <ojab at ojab.ru> wrote:
>>>>>>
>>>>>>> ook! In the attached file, updated to r150707.
>>>>>>>
>>>>>>> //wbr ojab
>>>>>>>
>>>>>>>
>>>>>>> On Thu, Feb 16, 2012 at 9:48 PM, Eric Christopher
>>>>>>> <echristo at apple.com> wrote:
>>>>>>> When you ping a patch it's useful to have it attached again :)
>>>>>>>
>>>>>>> -eric
>>>>>>>
>>>>>>> On Feb 16, 2012, at 7:48 AM, ojab wrote:
>>>>>>>
>>>>>>>> Any feedback?
>>>>>>>>
>>>>>>>> //wbr ojab
>>>>>>>>
>>>>>>>>
>>>>>>>> On Mon, Feb 13, 2012 at 6:06 PM, ojab <ojab at ojab.ru> wrote:
>>>>>>>> Updated patch (to LLVM r150383), please review.
>>>>>>>>
>>>>>>>> //wbr ojab
>>>>>>>>
>>>>>>>>
>>>>>>>> On Tue, Feb 7, 2012 at 2:50 PM, ojab <ojab at ojab.ru> wrote:
>>>>>>>> Hello,
>>>>>>>>
>>>>>>>> can I have review?
>>>>>>>>
>>>>>>>> //wbr ojab
>>>>>>>>
>>>>>>>>
>>>>>>>> On Wed, Feb 1, 2012 at 9:48 AM, ojab <ojab at ojab.ru> wrote:
>>>>>>>> Hello,
>>>>>>>>
>>>>>>>> I would be useful to have InitializeNativeTargetDisassembler()
>>>>>>>> function to initialize the native target disassembler, similar to
>>>>>>>> InitializeNativeTargetAsmPrinter/InitializeNativeTargetAsmParser/etc, patch
>>>>>>>> in the attached file.
>>>>>>>>
>>>>>>>> //wbr ojab
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> llvm-commits mailing list
>>>>>>>> llvm-commits at cs.uiuc.edu
>>>>>>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>>>>>>
>>>>>>>
>>>>>>> <InitializeNativeTargetDisassembler.patch>
>>>>>>
>>>>>
>>>>
>>>
>>
>


-------------- next part --------------
Index: cmake/config-ix.cmake
===================================================================
--- cmake/config-ix.cmake	(revision 153438)
+++ cmake/config-ix.cmake	(working copy)
@@ -340,6 +340,11 @@
   if (EXISTS ${CMAKE_SOURCE_DIR}/lib/Target/${LLVM_NATIVE_ARCH}/AsmParser/CMakeLists.txt)
     set(LLVM_NATIVE_ASMPARSER LLVMInitialize${LLVM_NATIVE_ARCH}AsmParser)
   endif ()
+
+  # We don't have an disassembler for all architectures yet.
+  if (EXISTS ${CMAKE_SOURCE_DIR}/lib/Target/${LLVM_NATIVE_ARCH}/Disassembler/CMakeLists.txt)
+    set(LLVM_NATIVE_DISASSEMBLER LLVMInitialize${LLVM_NATIVE_ARCH}Disassembler)
+  endif ()
 endif ()
 
 if( MINGW )
Index: configure
===================================================================
--- configure	(revision 153438)
+++ configure	(working copy)
@@ -5365,6 +5365,9 @@
     if test -f ${srcdir}/lib/Target/${LLVM_NATIVE_ARCH}/AsmParser/Makefile ; then
       LLVM_NATIVE_ASMPARSER="LLVMInitialize${LLVM_NATIVE_ARCH}AsmParser"
     fi
+    if test -f ${srcdir}/lib/Target/${LLVM_NATIVE_ARCH}/Disassembler/Makefile ; then
+      LLVM_NATIVE_DISASSEMBLER="LLVMInitialize${LLVM_NATIVE_ARCH}Disassembler"
+    fi
 
 cat >>confdefs.h <<_ACEOF
 #define LLVM_NATIVE_TARGET $LLVM_NATIVE_TARGET
@@ -5392,6 +5395,13 @@
 _ACEOF
 
     fi
+    if test -f ${srcdir}/lib/Target/${LLVM_NATIVE_ARCH}/Disassembler/Makefile ; then
+
+cat >>confdefs.h <<_ACEOF
+#define LLVM_NATIVE_DISASSEMBLER $LLVM_NATIVE_DISASSEMBLER
+_ACEOF
+
+    fi
   fi
 done
 
@@ -10374,7 +10384,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 10377 "configure"
+#line 10387 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
Index: autoconf/configure.ac
===================================================================
--- autoconf/configure.ac	(revision 153438)
+++ autoconf/configure.ac	(working copy)
@@ -684,6 +684,9 @@
     if test -f ${srcdir}/lib/Target/${LLVM_NATIVE_ARCH}/AsmParser/Makefile ; then
       LLVM_NATIVE_ASMPARSER="LLVMInitialize${LLVM_NATIVE_ARCH}AsmParser"
     fi
+    if test -f ${srcdir}/lib/Target/${LLVM_NATIVE_ARCH}/Disassembler/Makefile ; then
+      LLVM_NATIVE_DISASSEMBLER="LLVMInitialize${LLVM_NATIVE_ARCH}Disassembler"
+    fi
     AC_DEFINE_UNQUOTED(LLVM_NATIVE_TARGET, $LLVM_NATIVE_TARGET,
       [LLVM name for the native Target init function, if available])
     AC_DEFINE_UNQUOTED(LLVM_NATIVE_TARGETINFO, $LLVM_NATIVE_TARGETINFO,
@@ -696,6 +699,10 @@
       AC_DEFINE_UNQUOTED(LLVM_NATIVE_ASMPARSER, $LLVM_NATIVE_ASMPARSER,
        [LLVM name for the native AsmParser init function, if available])
     fi
+    if test -f ${srcdir}/lib/Target/${LLVM_NATIVE_ARCH}/Disassembler/Makefile ; then
+      AC_DEFINE_UNQUOTED(LLVM_NATIVE_DISASSEMBLER, $LLVM_NATIVE_DISASSEMBLER,
+       [LLVM name for the native Disassembler init function, if available])
+    fi
   fi
 done
 
Index: include/llvm/Support/TargetSelect.h
===================================================================
--- include/llvm/Support/TargetSelect.h	(revision 153438)
+++ include/llvm/Support/TargetSelect.h	(working copy)
@@ -149,6 +149,18 @@
 #endif
   }  
 
+  /// InitializeNativeTargetDisassembler - The main program should call
+  /// this function to initialize the native target disassembler.
+  inline bool InitializeNativeTargetDisassembler() {
+  // If we have a native target, initialize the corresponding disassembler.
+#ifdef LLVM_NATIVE_DISASSEMBLER
+    LLVM_NATIVE_DISASSEMBLER();
+    return false;
+#else
+    return true;
+#endif
+  }  
+
 }
 
 #endif
Index: include/llvm/Config/llvm-config.h.cmake
===================================================================
--- include/llvm/Config/llvm-config.h.cmake	(revision 153438)
+++ include/llvm/Config/llvm-config.h.cmake	(working copy)
@@ -61,6 +61,9 @@
 /* LLVM name for the native AsmPrinter init function, if available */
 #cmakedefine LLVM_NATIVE_ASMPRINTER LLVMInitialize${LLVM_NATIVE_ARCH}AsmPrinter
 
+/* LLVM name for the native Disassembler init function, if available */
+#cmakedefine LLVM_NATIVE_DISASSEMBLER LLVMInitialize${LLVM_NATIVE_ARCH}Disassembler
+
 /* LLVM name for the native Target init function, if available */
 #cmakedefine LLVM_NATIVE_TARGET LLVMInitialize${LLVM_NATIVE_ARCH}Target
 
Index: include/llvm/Config/config.h.in
===================================================================
--- include/llvm/Config/config.h.in	(revision 153438)
+++ include/llvm/Config/config.h.in	(working copy)
@@ -567,6 +567,9 @@
 /* LLVM name for the native AsmPrinter init function, if available */
 #undef LLVM_NATIVE_ASMPRINTER
 
+/* LLVM name for the native Disassembler init function, if available */
+#undef LLVM_NATIVE_DISASSEMBLER
+
 /* LLVM name for the native Target init function, if available */
 #undef LLVM_NATIVE_TARGET
 
Index: include/llvm/Config/llvm-config.h.in
===================================================================
--- include/llvm/Config/llvm-config.h.in	(revision 153438)
+++ include/llvm/Config/llvm-config.h.in	(working copy)
@@ -61,6 +61,9 @@
 /* LLVM name for the native AsmPrinter init function, if available */
 #undef LLVM_NATIVE_ASMPRINTER
 
+/* LLVM name for the native Disassembler init function, if available */
+#undef LLVM_NATIVE_DISASSEMBLER
+
 /* LLVM name for the native Target init function, if available */
 #undef LLVM_NATIVE_TARGET
 
Index: include/llvm/Config/config.h.cmake
===================================================================
--- include/llvm/Config/config.h.cmake	(revision 153438)
+++ include/llvm/Config/config.h.cmake	(working copy)
@@ -572,6 +572,9 @@
 /* LLVM name for the native AsmPrinter init function, if available */
 #cmakedefine LLVM_NATIVE_ASMPRINTER LLVMInitialize${LLVM_NATIVE_ARCH}AsmPrinter
 
+/* LLVM name for the native Disassembler init function, if available */
+#cmakedefine LLVM_NATIVE_DISASSEMBLER LLVMInitialize${LLVM_NATIVE_ARCH}Disassembler
+
 /* LLVM name for the native Target init function, if available */
 #cmakedefine LLVM_NATIVE_TARGET LLVMInitialize${LLVM_NATIVE_ARCH}Target
 
Index: projects/sample/configure
===================================================================
--- projects/sample/configure	(revision 153438)
+++ projects/sample/configure	(working copy)
@@ -5306,6 +5306,9 @@
     if test -f ${srcdir}/lib/Target/${LLVM_NATIVE_ARCH}/AsmParser/Makefile ; then
       LLVM_NATIVE_ASMPARSER="LLVMInitialize${LLVM_NATIVE_ARCH}AsmParser"
     fi
+    if test -f ${srcdir}/lib/Target/${LLVM_NATIVE_ARCH}/Disassembler/Makefile ; then
+      LLVM_NATIVE_DISASSEMBLER="LLVMInitialize${LLVM_NATIVE_ARCH}Disassembler"
+    fi
 
 cat >>confdefs.h <<_ACEOF
 #define LLVM_NATIVE_TARGET $LLVM_NATIVE_TARGET
@@ -5333,6 +5336,13 @@
 _ACEOF
 
     fi
+    if test -f ${srcdir}/lib/Target/${LLVM_NATIVE_ARCH}/Disassembler/Makefile ; then
+
+cat >>confdefs.h <<_ACEOF
+#define LLVM_NATIVE_DISASSEMBLER $LLVM_NATIVE_DISASSEMBLER
+_ACEOF
+
+    fi
   fi
 done
 
@@ -10290,7 +10300,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 10293 "configure"
+#line 10303 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
Index: projects/sample/autoconf/configure.ac
===================================================================
--- projects/sample/autoconf/configure.ac	(revision 153438)
+++ projects/sample/autoconf/configure.ac	(working copy)
@@ -617,6 +617,9 @@
     if test -f ${srcdir}/lib/Target/${LLVM_NATIVE_ARCH}/AsmParser/Makefile ; then
       LLVM_NATIVE_ASMPARSER="LLVMInitialize${LLVM_NATIVE_ARCH}AsmParser"
     fi
+    if test -f ${srcdir}/lib/Target/${LLVM_NATIVE_ARCH}/Disassembler/Makefile ; then
+      LLVM_NATIVE_DISASSEMBLER="LLVMInitialize${LLVM_NATIVE_ARCH}Disassembler"
+    fi
     AC_DEFINE_UNQUOTED(LLVM_NATIVE_TARGET, $LLVM_NATIVE_TARGET,
       [LLVM name for the native Target init function, if available])
     AC_DEFINE_UNQUOTED(LLVM_NATIVE_TARGETINFO, $LLVM_NATIVE_TARGETINFO,
@@ -629,6 +632,10 @@
       AC_DEFINE_UNQUOTED(LLVM_NATIVE_ASMPARSER, $LLVM_NATIVE_ASMPARSER,
        [LLVM name for the native AsmParser init function, if available])
     fi
+    if test -f ${srcdir}/lib/Target/${LLVM_NATIVE_ARCH}/Disassembler/Makefile ; then
+      AC_DEFINE_UNQUOTED(LLVM_NATIVE_DISASSEMBLER, $LLVM_NATIVE_DISASSEMBLER,
+       [LLVM name for the native Disassembler init function, if available])
+    fi
   fi
 done
 


More information about the llvm-commits mailing list