From daniel at zuster.org Mon Sep 14 00:22:47 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 14 Sep 2009 05:22:47 -0000 Subject: [llvm-commits] [llvm] r81757 - /llvm/trunk/lib/MC/CMakeLists.txt Message-ID: <200909140522.n8E5MlLt023041@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Sep 14 00:22:47 2009 New Revision: 81757 URL: http://llvm.org/viewvc/llvm-project?rev=81757&view=rev Log: Update CMake. Modified: llvm/trunk/lib/MC/CMakeLists.txt Modified: llvm/trunk/lib/MC/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/CMakeLists.txt?rev=81757&r1=81756&r2=81757&view=diff ============================================================================== --- llvm/trunk/lib/MC/CMakeLists.txt (original) +++ llvm/trunk/lib/MC/CMakeLists.txt Mon Sep 14 00:22:47 2009 @@ -11,6 +11,7 @@ MCDisassembler.cpp MCExpr.cpp MCInst.cpp + MCInstPrinter.cpp MCMachOStreamer.cpp MCNullStreamer.cpp MCSection.cpp From daniel at zuster.org Mon Sep 14 00:22:54 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 14 Sep 2009 05:22:54 -0000 Subject: [llvm-commits] [llvm] r81758 - /llvm/trunk/cmake/modules/LLVMLibDeps.cmake Message-ID: <200909140522.n8E5Ms1T023067@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Sep 14 00:22:54 2009 New Revision: 81758 URL: http://llvm.org/viewvc/llvm-project?rev=81758&view=rev Log: Update CMake dependencies. Modified: llvm/trunk/cmake/modules/LLVMLibDeps.cmake Modified: llvm/trunk/cmake/modules/LLVMLibDeps.cmake URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/LLVMLibDeps.cmake?rev=81758&r1=81757&r2=81758&view=diff ============================================================================== --- llvm/trunk/cmake/modules/LLVMLibDeps.cmake (original) +++ llvm/trunk/cmake/modules/LLVMLibDeps.cmake Mon Sep 14 00:22:54 2009 @@ -1,7 +1,7 @@ -set(MSVC_LIB_DEPS_LLVMARMAsmPrinter LLVMARMCodeGen LLVMARMInfo LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMSupport LLVMSystem LLVMTarget) +set(MSVC_LIB_DEPS_LLVMARMAsmPrinter LLVMARMCodeGen LLVMARMInfo LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMSupport LLVMSystem LLVMTarget) set(MSVC_LIB_DEPS_LLVMARMCodeGen LLVMARMInfo LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport LLVMSystem LLVMTarget) set(MSVC_LIB_DEPS_LLVMARMInfo LLVMSupport) -set(MSVC_LIB_DEPS_LLVMAlphaAsmPrinter LLVMAlphaInfo LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMSupport LLVMSystem LLVMTarget) +set(MSVC_LIB_DEPS_LLVMAlphaAsmPrinter LLVMAlphaInfo LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMSupport LLVMSystem LLVMTarget) set(MSVC_LIB_DEPS_LLVMAlphaCodeGen LLVMAlphaInfo LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport LLVMSystem LLVMTarget) set(MSVC_LIB_DEPS_LLVMAlphaInfo LLVMSupport) set(MSVC_LIB_DEPS_LLVMAnalysis LLVMCore LLVMSupport LLVMSystem LLVMTarget) @@ -10,12 +10,12 @@ set(MSVC_LIB_DEPS_LLVMAsmPrinter LLVMAnalysis LLVMCodeGen LLVMCore LLVMMC LLVMSupport LLVMSystem LLVMTarget) set(MSVC_LIB_DEPS_LLVMBitReader LLVMCore LLVMSupport LLVMSystem) set(MSVC_LIB_DEPS_LLVMBitWriter LLVMCore LLVMSupport LLVMSystem) -set(MSVC_LIB_DEPS_LLVMBlackfinAsmPrinter LLVMAsmPrinter LLVMBlackfinInfo LLVMCodeGen LLVMCore LLVMSupport LLVMSystem LLVMTarget) +set(MSVC_LIB_DEPS_LLVMBlackfinAsmPrinter LLVMAsmPrinter LLVMBlackfinInfo LLVMCodeGen LLVMCore LLVMMC LLVMSupport LLVMSystem LLVMTarget) set(MSVC_LIB_DEPS_LLVMBlackfinCodeGen LLVMBlackfinInfo LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport LLVMTarget) set(MSVC_LIB_DEPS_LLVMBlackfinInfo LLVMSupport) set(MSVC_LIB_DEPS_LLVMCBackend LLVMAnalysis LLVMCBackendInfo LLVMCodeGen LLVMCore LLVMScalarOpts LLVMSupport LLVMSystem LLVMTarget LLVMTransformUtils LLVMipa) set(MSVC_LIB_DEPS_LLVMCBackendInfo LLVMSupport) -set(MSVC_LIB_DEPS_LLVMCellSPUAsmPrinter LLVMAsmPrinter LLVMCellSPUInfo LLVMCodeGen LLVMCore LLVMSupport LLVMSystem LLVMTarget) +set(MSVC_LIB_DEPS_LLVMCellSPUAsmPrinter LLVMAsmPrinter LLVMCellSPUInfo LLVMCodeGen LLVMCore LLVMMC LLVMSupport LLVMSystem LLVMTarget) set(MSVC_LIB_DEPS_LLVMCellSPUCodeGen LLVMCellSPUInfo LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport LLVMTarget) set(MSVC_LIB_DEPS_LLVMCellSPUInfo LLVMSupport) set(MSVC_LIB_DEPS_LLVMCodeGen LLVMAnalysis LLVMCore LLVMMC LLVMScalarOpts LLVMSupport LLVMSystem LLVMTarget LLVMTransformUtils) @@ -32,26 +32,26 @@ set(MSVC_LIB_DEPS_LLVMMC LLVMSupport LLVMSystem) set(MSVC_LIB_DEPS_LLVMMSIL LLVMAnalysis LLVMCodeGen LLVMCore LLVMMSILInfo LLVMScalarOpts LLVMSupport LLVMSystem LLVMTarget LLVMTransformUtils LLVMipa) set(MSVC_LIB_DEPS_LLVMMSILInfo LLVMSupport) -set(MSVC_LIB_DEPS_LLVMMSP430AsmPrinter LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMSP430Info LLVMSupport LLVMSystem LLVMTarget) +set(MSVC_LIB_DEPS_LLVMMSP430AsmPrinter LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMMSP430Info LLVMSupport LLVMSystem LLVMTarget) set(MSVC_LIB_DEPS_LLVMMSP430CodeGen LLVMCodeGen LLVMCore LLVMMC LLVMMSP430Info LLVMSelectionDAG LLVMSupport LLVMTarget) set(MSVC_LIB_DEPS_LLVMMSP430Info LLVMSupport) -set(MSVC_LIB_DEPS_LLVMMipsAsmPrinter LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMipsCodeGen LLVMMipsInfo LLVMSupport LLVMSystem LLVMTarget) +set(MSVC_LIB_DEPS_LLVMMipsAsmPrinter LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMMipsCodeGen LLVMMipsInfo LLVMSupport LLVMSystem LLVMTarget) set(MSVC_LIB_DEPS_LLVMMipsCodeGen LLVMCodeGen LLVMCore LLVMMC LLVMMipsInfo LLVMSelectionDAG LLVMSupport LLVMSystem LLVMTarget) set(MSVC_LIB_DEPS_LLVMMipsInfo LLVMSupport) set(MSVC_LIB_DEPS_LLVMPIC16 LLVMAnalysis LLVMCodeGen LLVMCore LLVMMC LLVMPIC16Info LLVMSelectionDAG LLVMSupport LLVMSystem LLVMTarget) -set(MSVC_LIB_DEPS_LLVMPIC16AsmPrinter LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMPIC16 LLVMPIC16Info LLVMSupport LLVMSystem LLVMTarget) +set(MSVC_LIB_DEPS_LLVMPIC16AsmPrinter LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMPIC16 LLVMPIC16Info LLVMSupport LLVMSystem LLVMTarget) set(MSVC_LIB_DEPS_LLVMPIC16Info LLVMSupport) -set(MSVC_LIB_DEPS_LLVMPowerPCAsmPrinter LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMPowerPCInfo LLVMSupport LLVMSystem LLVMTarget) +set(MSVC_LIB_DEPS_LLVMPowerPCAsmPrinter LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMPowerPCInfo LLVMSupport LLVMSystem LLVMTarget) set(MSVC_LIB_DEPS_LLVMPowerPCCodeGen LLVMCodeGen LLVMCore LLVMMC LLVMPowerPCInfo LLVMSelectionDAG LLVMSupport LLVMSystem LLVMTarget) set(MSVC_LIB_DEPS_LLVMPowerPCInfo LLVMSupport) set(MSVC_LIB_DEPS_LLVMScalarOpts LLVMAnalysis LLVMCore LLVMSupport LLVMSystem LLVMTarget LLVMTransformUtils) set(MSVC_LIB_DEPS_LLVMSelectionDAG LLVMAnalysis LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMSupport LLVMSystem LLVMTarget) -set(MSVC_LIB_DEPS_LLVMSparcAsmPrinter LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMSparcInfo LLVMSupport LLVMSystem LLVMTarget) +set(MSVC_LIB_DEPS_LLVMSparcAsmPrinter LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMSparcInfo LLVMSupport LLVMSystem LLVMTarget) set(MSVC_LIB_DEPS_LLVMSparcCodeGen LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSparcInfo LLVMSupport LLVMSystem LLVMTarget) set(MSVC_LIB_DEPS_LLVMSparcInfo LLVMSupport) set(MSVC_LIB_DEPS_LLVMSupport LLVMSystem) set(MSVC_LIB_DEPS_LLVMSystem ) -set(MSVC_LIB_DEPS_LLVMSystemZAsmPrinter LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMSupport LLVMSystem LLVMSystemZInfo LLVMTarget) +set(MSVC_LIB_DEPS_LLVMSystemZAsmPrinter LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMSupport LLVMSystem LLVMSystemZInfo LLVMTarget) set(MSVC_LIB_DEPS_LLVMSystemZCodeGen LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport LLVMSystemZInfo LLVMTarget) set(MSVC_LIB_DEPS_LLVMSystemZInfo LLVMSupport) set(MSVC_LIB_DEPS_LLVMTarget LLVMCore LLVMMC LLVMSupport LLVMSystem) @@ -61,7 +61,7 @@ set(MSVC_LIB_DEPS_LLVMX86CodeGen LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport LLVMSystem LLVMTarget LLVMX86Info) set(MSVC_LIB_DEPS_LLVMX86Info LLVMSupport) set(MSVC_LIB_DEPS_LLVMXCore LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport LLVMSystem LLVMTarget LLVMXCoreInfo) -set(MSVC_LIB_DEPS_LLVMXCoreAsmPrinter LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMSupport LLVMSystem LLVMTarget LLVMXCoreInfo) +set(MSVC_LIB_DEPS_LLVMXCoreAsmPrinter LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMSupport LLVMSystem LLVMTarget LLVMXCoreInfo) set(MSVC_LIB_DEPS_LLVMXCoreInfo LLVMSupport) set(MSVC_LIB_DEPS_LLVMipa LLVMAnalysis LLVMCore LLVMSupport LLVMSystem) set(MSVC_LIB_DEPS_LLVMipo LLVMAnalysis LLVMCore LLVMSupport LLVMSystem LLVMTarget LLVMTransformUtils LLVMipa) From eocallaghan at auroraux.org Mon Sep 14 07:45:07 2009 From: eocallaghan at auroraux.org (Edward O'Callaghan) Date: Mon, 14 Sep 2009 12:45:07 -0000 Subject: [llvm-commits] [compiler-rt] r81760 - in /compiler-rt/trunk: CMakeLists.txt lib/CMakeLists.txt lib/arm/CMakeLists.txt Message-ID: <200909141245.n8ECj8J8029513@zion.cs.uiuc.edu> Author: evocallaghan Date: Mon Sep 14 07:45:07 2009 New Revision: 81760 URL: http://llvm.org/viewvc/llvm-project?rev=81760&view=rev Log: Update cmake files for arm support hooks. Added: compiler-rt/trunk/lib/arm/CMakeLists.txt Modified: compiler-rt/trunk/CMakeLists.txt compiler-rt/trunk/lib/CMakeLists.txt Modified: compiler-rt/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/CMakeLists.txt?rev=81760&r1=81759&r2=81760&view=diff ============================================================================== --- compiler-rt/trunk/CMakeLists.txt (original) +++ compiler-rt/trunk/CMakeLists.txt Mon Sep 14 07:45:07 2009 @@ -34,7 +34,7 @@ ) SET( Achitectures - i386 ppc x86_64 + i386 x86_64 ppc arm ) SET( Configurations Modified: compiler-rt/trunk/lib/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/CMakeLists.txt?rev=81760&r1=81759&r2=81760&view=diff ============================================================================== --- compiler-rt/trunk/lib/CMakeLists.txt (original) +++ compiler-rt/trunk/lib/CMakeLists.txt Mon Sep 14 07:45:07 2009 @@ -51,6 +51,7 @@ # ADD_SUBDIRECTORY( ppc ) # ADD_SUBDIRECTORY( x86_64 ) # ADD_SUBDIRECTORY( i386 ) +# ADD_SUBDIRECTORY( arm ) #FOREACH( LOOP_VAR ${Achitectures} ) # See ARCHIVE_OUTPUT_DIRECTORY docs. Added: compiler-rt/trunk/lib/arm/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/arm/CMakeLists.txt?rev=81760&view=auto ============================================================================== (empty) From xerxes at zafena.se Mon Sep 14 07:59:02 2009 From: xerxes at zafena.se (=?ISO-8859-1?Q?Xerxes_R=E5nby?=) Date: Mon, 14 Sep 2009 14:59:02 +0200 Subject: [llvm-commits] ping - [patch] configure.ac ARM TARGET_HAS_JIT In-Reply-To: <4AA76A91.2030705@zafena.se> References: <4AA76A91.2030705@zafena.se> Message-ID: <4AAE3E16.1000508@zafena.se> Im just pinging this patch, I am looking for someone with access to the correct autotools to test the patch and to regenerate the configure script. Thanks! Xerxes R?nby skrev: > The current llvm-config suggests the Interpreter on ARM when running > llvm-config --libs engine > > $ llvm-config --libs engine > -lLLVMInterpreter -lLLVMExecutionEngine -lLLVMCodeGen -lLLVMScalarOpts > -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis -lLLVMTarget -lLLVMMC > -lLLVMCore -lLLVMSupport -lLLVMSystem > > expected result would be to output the JIT instead of the Interpreter: > > $ llvm-config --libs engine > -lLLVMARMAsmPrinter -lLLVMARMCodeGen -lLLVMSelectionDAG -lLLVMAsmPrinter > -lLLVMARMInfo -lLLVMJIT -lLLVMExecutionEngine -lLLVMCodeGen > -lLLVMScalarOpts -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis > -lLLVMTarget -lLLVMMC -lLLVMCore -lLLVMSupport -lLLVMSystem > > The attached patch fixes this issue. > I need someone to commit this for me since the configure script needs > regenerating from configure.ac with some specific version of autotools. > > Cheers > Xerxes > > ------------------------------------------------------------------------ > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From baldrick at free.fr Mon Sep 14 08:39:42 2009 From: baldrick at free.fr (Duncan Sands) Date: Mon, 14 Sep 2009 13:39:42 -0000 Subject: [llvm-commits] [gcc-plugin] r81761 - /gcc-plugin/trunk/Makefile Message-ID: <200909141339.n8EDdguo004107@zion.cs.uiuc.edu> Author: baldrick Date: Mon Sep 14 08:39:42 2009 New Revision: 81761 URL: http://llvm.org/viewvc/llvm-project?rev=81761&view=rev Log: Correct a build dependency. Modified: gcc-plugin/trunk/Makefile Modified: gcc-plugin/trunk/Makefile URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/Makefile?rev=81761&r1=81760&r2=81761&view=diff ============================================================================== --- gcc-plugin/trunk/Makefile (original) +++ gcc-plugin/trunk/Makefile Mon Sep 14 08:39:42 2009 @@ -30,7 +30,7 @@ llvm.so: $(PLUGIN_OBJECT_FILES) $(CXX) -shared $^ -o $@ $(LDFLAGS) -llvm-cache.c: gt-llvm-cache.h +llvm-cache.o: gt-llvm-cache.h gt-llvm-cache.h: cd $(GCCOBJECT_DIR)/gcc && ./build/gengtype \ From baldrick at free.fr Mon Sep 14 08:54:33 2009 From: baldrick at free.fr (Duncan Sands) Date: Mon, 14 Sep 2009 13:54:33 -0000 Subject: [llvm-commits] [gcc-plugin] r81762 - in /gcc-plugin/trunk: ./ gt-llvm-cache.h Message-ID: <200909141354.n8EDsYnw006148@zion.cs.uiuc.edu> Author: baldrick Date: Mon Sep 14 08:54:33 2009 New Revision: 81762 URL: http://llvm.org/viewvc/llvm-project?rev=81762&view=rev Log: The generated header containing garbage collector information is actually not host or target specific as far as I can see. Add it to the repository so everyone doesn't have to generate it (which requires a big gcc patch). Added: gcc-plugin/trunk/gt-llvm-cache.h Modified: gcc-plugin/trunk/ (props changed) Propchange: gcc-plugin/trunk/ ------------------------------------------------------------------------------ --- svn:ignore (original) +++ svn:ignore (removed) @@ -1 +0,0 @@ -gt-llvm-cache.h Added: gcc-plugin/trunk/gt-llvm-cache.h URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/gt-llvm-cache.h?rev=81762&view=auto ============================================================================== --- gcc-plugin/trunk/gt-llvm-cache.h (added) +++ gcc-plugin/trunk/gt-llvm-cache.h Mon Sep 14 08:54:33 2009 @@ -0,0 +1,1962 @@ +/* Type information for GCC. + Copyright (C) 2004, 2007, 2009 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +/* This file is machine generated. Do not edit. */ + +/* Dynamic enumeration of plugin types. */ +#ifdef GCC_PLUGIN_HAVE_PCH +static int gccplugin_type_base; +#define gt_ggc_e_13tree_llvm_map ((gccplugin_type_base>0)?(gccplugin_type_base+0):0) +#define gt_e_P13tree_llvm_map4htab ((gccplugin_type_base>0)?(gccplugin_type_base+1):0) + +#define GCCPLUGIN_TYPE_COUNT 2 +/* end ifdef GCC_PLUGIN_HAVE_PCH */ +#endif + +/* GC marker procedures. */ +#define gt_ggc_m_13tree_llvm_map(X) do { \ + if (X != NULL) gt_ggc_mx_tree_llvm_map (X);\ + } while (0) +extern void gt_ggc_mx_tree_llvm_map (void *); +#define gt_ggc_m_15interface_tuple(X) do { \ + if (X != NULL) gt_ggc_mx_interface_tuple (X);\ + } while (0) +extern void gt_ggc_mx_interface_tuple (void *); +#define gt_ggc_m_16volatilized_type(X) do { \ + if (X != NULL) gt_ggc_mx_volatilized_type (X);\ + } while (0) +extern void gt_ggc_mx_volatilized_type (void *); +#define gt_ggc_m_17string_descriptor(X) do { \ + if (X != NULL) gt_ggc_mx_string_descriptor (X);\ + } while (0) +extern void gt_ggc_mx_string_descriptor (void *); +#define gt_ggc_m_15c_inline_static(X) do { \ + if (X != NULL) gt_ggc_mx_c_inline_static (X);\ + } while (0) +extern void gt_ggc_mx_c_inline_static (void *); +#define gt_ggc_m_24VEC_c_goto_bindings_p_gc(X) do { \ + if (X != NULL) gt_ggc_mx_VEC_c_goto_bindings_p_gc (X);\ + } while (0) +extern void gt_ggc_mx_VEC_c_goto_bindings_p_gc (void *); +#define gt_ggc_m_15c_goto_bindings(X) do { \ + if (X != NULL) gt_ggc_mx_c_goto_bindings (X);\ + } while (0) +extern void gt_ggc_mx_c_goto_bindings (void *); +#define gt_ggc_m_7c_scope(X) do { \ + if (X != NULL) gt_ggc_mx_c_scope (X);\ + } while (0) +extern void gt_ggc_mx_c_scope (void *); +#define gt_ggc_m_9c_binding(X) do { \ + if (X != NULL) gt_ggc_mx_c_binding (X);\ + } while (0) +extern void gt_ggc_mx_c_binding (void *); +#define gt_ggc_m_12c_label_vars(X) do { \ + if (X != NULL) gt_ggc_mx_c_label_vars (X);\ + } while (0) +extern void gt_ggc_mx_c_label_vars (void *); +#define gt_ggc_m_8c_parser(X) do { \ + if (X != NULL) gt_ggc_mx_c_parser (X);\ + } while (0) +extern void gt_ggc_mx_c_parser (void *); +#define gt_ggc_m_9imp_entry(X) do { \ + if (X != NULL) gt_ggc_mx_imp_entry (X);\ + } while (0) +extern void gt_ggc_mx_imp_entry (void *); +#define gt_ggc_m_16hashed_attribute(X) do { \ + if (X != NULL) gt_ggc_mx_hashed_attribute (X);\ + } while (0) +extern void gt_ggc_mx_hashed_attribute (void *); +#define gt_ggc_m_12hashed_entry(X) do { \ + if (X != NULL) gt_ggc_mx_hashed_entry (X);\ + } while (0) +extern void gt_ggc_mx_hashed_entry (void *); +#define gt_ggc_m_14type_assertion(X) do { \ + if (X != NULL) gt_ggc_mx_type_assertion (X);\ + } while (0) +extern void gt_ggc_mx_type_assertion (void *); +#define gt_ggc_m_18treetreehash_entry(X) do { \ + if (X != NULL) gt_ggc_mx_treetreehash_entry (X);\ + } while (0) +extern void gt_ggc_mx_treetreehash_entry (void *); +#define gt_ggc_m_5CPool(X) do { \ + if (X != NULL) gt_ggc_mx_CPool (X);\ + } while (0) +extern void gt_ggc_mx_CPool (void *); +#define gt_ggc_m_3JCF(X) do { \ + if (X != NULL) gt_ggc_mx_JCF (X);\ + } while (0) +extern void gt_ggc_mx_JCF (void *); +#define gt_ggc_m_17module_htab_entry(X) do { \ + if (X != NULL) gt_ggc_mx_module_htab_entry (X);\ + } while (0) +extern void gt_ggc_mx_module_htab_entry (void *); +#define gt_ggc_m_13binding_level(X) do { \ + if (X != NULL) gt_ggc_mx_binding_level (X);\ + } while (0) +extern void gt_ggc_mx_binding_level (void *); +#define gt_ggc_m_9opt_stack(X) do { \ + if (X != NULL) gt_ggc_mx_opt_stack (X);\ + } while (0) +extern void gt_ggc_mx_opt_stack (void *); +#define gt_ggc_m_16def_pragma_macro(X) do { \ + if (X != NULL) gt_ggc_mx_def_pragma_macro (X);\ + } while (0) +extern void gt_ggc_mx_def_pragma_macro (void *); +#define gt_ggc_m_22def_pragma_macro_value(X) do { \ + if (X != NULL) gt_ggc_mx_def_pragma_macro_value (X);\ + } while (0) +extern void gt_ggc_mx_def_pragma_macro_value (void *); +#define gt_ggc_m_11align_stack(X) do { \ + if (X != NULL) gt_ggc_mx_align_stack (X);\ + } while (0) +extern void gt_ggc_mx_align_stack (void *); +#define gt_ggc_m_18VEC_tree_gc_vec_gc(X) do { \ + if (X != NULL) gt_ggc_mx_VEC_tree_gc_vec_gc (X);\ + } while (0) +extern void gt_ggc_mx_VEC_tree_gc_vec_gc (void *); +#define gt_ggc_m_19VEC_const_char_p_gc(X) do { \ + if (X != NULL) gt_ggc_mx_VEC_const_char_p_gc (X);\ + } while (0) +extern void gt_ggc_mx_VEC_const_char_p_gc (void *); +#define gt_ggc_m_21pending_abstract_type(X) do { \ + if (X != NULL) gt_ggc_mx_pending_abstract_type (X);\ + } while (0) +extern void gt_ggc_mx_pending_abstract_type (void *); +#define gt_ggc_m_9cp_parser(X) do { \ + if (X != NULL) gt_ggc_mx_cp_parser (X);\ + } while (0) +extern void gt_ggc_mx_cp_parser (void *); +#define gt_ggc_m_17cp_parser_context(X) do { \ + if (X != NULL) gt_ggc_mx_cp_parser_context (X);\ + } while (0) +extern void gt_ggc_mx_cp_parser_context (void *); +#define gt_ggc_m_8cp_lexer(X) do { \ + if (X != NULL) gt_ggc_mx_cp_lexer (X);\ + } while (0) +extern void gt_ggc_mx_cp_lexer (void *); +#define gt_ggc_m_10tree_check(X) do { \ + if (X != NULL) gt_ggc_mx_tree_check (X);\ + } while (0) +extern void gt_ggc_mx_tree_check (void *); +#define gt_ggc_m_22VEC_deferred_access_gc(X) do { \ + if (X != NULL) gt_ggc_mx_VEC_deferred_access_gc (X);\ + } while (0) +extern void gt_ggc_mx_VEC_deferred_access_gc (void *); +#define gt_ggc_m_10spec_entry(X) do { \ + if (X != NULL) gt_ggc_mx_spec_entry (X);\ + } while (0) +extern void gt_ggc_mx_spec_entry (void *); +#define gt_ggc_m_16pending_template(X) do { \ + if (X != NULL) gt_ggc_mx_pending_template (X);\ + } while (0) +extern void gt_ggc_mx_pending_template (void *); +#define gt_ggc_m_21named_label_use_entry(X) do { \ + if (X != NULL) gt_ggc_mx_named_label_use_entry (X);\ + } while (0) +extern void gt_ggc_mx_named_label_use_entry (void *); +#define gt_ggc_m_28VEC_deferred_access_check_gc(X) do { \ + if (X != NULL) gt_ggc_mx_VEC_deferred_access_check_gc (X);\ + } while (0) +extern void gt_ggc_mx_VEC_deferred_access_check_gc (void *); +#define gt_ggc_m_11tinst_level(X) do { \ + if (X != NULL) gt_ggc_mx_tinst_level (X);\ + } while (0) +extern void gt_ggc_mx_tinst_level (void *); +#define gt_ggc_m_18sorted_fields_type(X) do { \ + if (X != NULL) gt_ggc_mx_sorted_fields_type (X);\ + } while (0) +extern void gt_ggc_mx_sorted_fields_type (void *); +#define gt_ggc_m_18VEC_tree_pair_s_gc(X) do { \ + if (X != NULL) gt_ggc_mx_VEC_tree_pair_s_gc (X);\ + } while (0) +extern void gt_ggc_mx_VEC_tree_pair_s_gc (void *); +#define gt_ggc_m_17named_label_entry(X) do { \ + if (X != NULL) gt_ggc_mx_named_label_entry (X);\ + } while (0) +extern void gt_ggc_mx_named_label_entry (void *); +#define gt_ggc_m_14cp_token_cache(X) do { \ + if (X != NULL) gt_ggc_mx_cp_token_cache (X);\ + } while (0) +extern void gt_ggc_mx_cp_token_cache (void *); +#define gt_ggc_m_11saved_scope(X) do { \ + if (X != NULL) gt_ggc_mx_saved_scope (X);\ + } while (0) +extern void gt_ggc_mx_saved_scope (void *); +#define gt_ggc_m_16cxx_int_tree_map(X) do { \ + if (X != NULL) gt_ggc_mx_cxx_int_tree_map (X);\ + } while (0) +extern void gt_ggc_mx_cxx_int_tree_map (void *); +#define gt_ggc_m_23VEC_cp_class_binding_gc(X) do { \ + if (X != NULL) gt_ggc_mx_VEC_cp_class_binding_gc (X);\ + } while (0) +extern void gt_ggc_mx_VEC_cp_class_binding_gc (void *); +#define gt_ggc_m_24VEC_cxx_saved_binding_gc(X) do { \ + if (X != NULL) gt_ggc_mx_VEC_cxx_saved_binding_gc (X);\ + } while (0) +extern void gt_ggc_mx_VEC_cxx_saved_binding_gc (void *); +#define gt_ggc_m_16cp_binding_level(X) do { \ + if (X != NULL) gt_ggc_mx_cp_binding_level (X);\ + } while (0) +extern void gt_ggc_mx_cp_binding_level (void *); +#define gt_ggc_m_11cxx_binding(X) do { \ + if (X != NULL) gt_ggc_mx_cxx_binding (X);\ + } while (0) +extern void gt_ggc_mx_cxx_binding (void *); +#define gt_ggc_m_15binding_entry_s(X) do { \ + if (X != NULL) gt_ggc_mx_binding_entry_s (X);\ + } while (0) +extern void gt_ggc_mx_binding_entry_s (void *); +#define gt_ggc_m_15binding_table_s(X) do { \ + if (X != NULL) gt_ggc_mx_binding_table_s (X);\ + } while (0) +extern void gt_ggc_mx_binding_table_s (void *); +#define gt_ggc_m_14VEC_tinfo_s_gc(X) do { \ + if (X != NULL) gt_ggc_mx_VEC_tinfo_s_gc (X);\ + } while (0) +extern void gt_ggc_mx_VEC_tinfo_s_gc (void *); +#define gt_ggc_m_18gnat_binding_level(X) do { \ + if (X != NULL) gt_ggc_mx_gnat_binding_level (X);\ + } while (0) +extern void gt_ggc_mx_gnat_binding_level (void *); +#define gt_ggc_m_9elab_info(X) do { \ + if (X != NULL) gt_ggc_mx_elab_info (X);\ + } while (0) +extern void gt_ggc_mx_elab_info (void *); +#define gt_ggc_m_10stmt_group(X) do { \ + if (X != NULL) gt_ggc_mx_stmt_group (X);\ + } while (0) +extern void gt_ggc_mx_stmt_group (void *); +#define gt_ggc_m_16VEC_parm_attr_gc(X) do { \ + if (X != NULL) gt_ggc_mx_VEC_parm_attr_gc (X);\ + } while (0) +extern void gt_ggc_mx_VEC_parm_attr_gc (void *); +#define gt_ggc_m_11parm_attr_d(X) do { \ + if (X != NULL) gt_ggc_mx_parm_attr_d (X);\ + } while (0) +extern void gt_ggc_mx_parm_attr_d (void *); +#define gt_ggc_m_19lto_symtab_decl_def(X) do { \ + if (X != NULL) gt_ggc_mx_lto_symtab_decl_def (X);\ + } while (0) +extern void gt_ggc_mx_lto_symtab_decl_def (void *); +#define gt_ggc_m_25lto_symtab_identifier_def(X) do { \ + if (X != NULL) gt_ggc_mx_lto_symtab_identifier_def (X);\ + } while (0) +extern void gt_ggc_mx_lto_symtab_identifier_def (void *); +#define gt_ggc_m_20ssa_operand_memory_d(X) do { \ + if (X != NULL) gt_ggc_mx_ssa_operand_memory_d (X);\ + } while (0) +extern void gt_ggc_mx_ssa_operand_memory_d (void *); +#define gt_ggc_m_13scev_info_str(X) do { \ + if (X != NULL) gt_ggc_mx_scev_info_str (X);\ + } while (0) +extern void gt_ggc_mx_scev_info_str (void *); +#define gt_ggc_m_13VEC_gimple_gc(X) do { \ + if (X != NULL) gt_ggc_mx_VEC_gimple_gc (X);\ + } while (0) +extern void gt_ggc_mx_VEC_gimple_gc (void *); +#define gt_ggc_m_9type_hash(X) do { \ + if (X != NULL) gt_ggc_mx_type_hash (X);\ + } while (0) +extern void gt_ggc_mx_type_hash (void *); +#define gt_ggc_m_16string_pool_data(X) do { \ + if (X != NULL) gt_ggc_mx_string_pool_data (X);\ + } while (0) +extern void gt_ggc_mx_string_pool_data (void *); +#define gt_ggc_m_13libfunc_entry(X) do { \ + if (X != NULL) gt_ggc_mx_libfunc_entry (X);\ + } while (0) +extern void gt_ggc_mx_libfunc_entry (void *); +#define gt_ggc_m_23temp_slot_address_entry(X) do { \ + if (X != NULL) gt_ggc_mx_temp_slot_address_entry (X);\ + } while (0) +extern void gt_ggc_mx_temp_slot_address_entry (void *); +#define gt_ggc_m_15throw_stmt_node(X) do { \ + if (X != NULL) gt_ggc_mx_throw_stmt_node (X);\ + } while (0) +extern void gt_ggc_mx_throw_stmt_node (void *); +#define gt_ggc_m_16VEC_eh_region_gc(X) do { \ + if (X != NULL) gt_ggc_mx_VEC_eh_region_gc (X);\ + } while (0) +extern void gt_ggc_mx_VEC_eh_region_gc (void *); +#define gt_ggc_m_11eh_region_d(X) do { \ + if (X != NULL) gt_ggc_mx_eh_region_d (X);\ + } while (0) +extern void gt_ggc_mx_eh_region_d (void *); +#define gt_ggc_m_16var_loc_list_def(X) do { \ + if (X != NULL) gt_ggc_mx_var_loc_list_def (X);\ + } while (0) +extern void gt_ggc_mx_var_loc_list_def (void *); +#define gt_ggc_m_12var_loc_node(X) do { \ + if (X != NULL) gt_ggc_mx_var_loc_node (X);\ + } while (0) +extern void gt_ggc_mx_var_loc_node (void *); +#define gt_ggc_m_20VEC_die_arg_entry_gc(X) do { \ + if (X != NULL) gt_ggc_mx_VEC_die_arg_entry_gc (X);\ + } while (0) +extern void gt_ggc_mx_VEC_die_arg_entry_gc (void *); +#define gt_ggc_m_16limbo_die_struct(X) do { \ + if (X != NULL) gt_ggc_mx_limbo_die_struct (X);\ + } while (0) +extern void gt_ggc_mx_limbo_die_struct (void *); +#define gt_ggc_m_20VEC_pubname_entry_gc(X) do { \ + if (X != NULL) gt_ggc_mx_VEC_pubname_entry_gc (X);\ + } while (0) +extern void gt_ggc_mx_VEC_pubname_entry_gc (void *); +#define gt_ggc_m_19VEC_dw_attr_node_gc(X) do { \ + if (X != NULL) gt_ggc_mx_VEC_dw_attr_node_gc (X);\ + } while (0) +extern void gt_ggc_mx_VEC_dw_attr_node_gc (void *); +#define gt_ggc_m_25dw_ranges_by_label_struct(X) do { \ + if (X != NULL) gt_ggc_mx_dw_ranges_by_label_struct (X);\ + } while (0) +extern void gt_ggc_mx_dw_ranges_by_label_struct (void *); +#define gt_ggc_m_16dw_ranges_struct(X) do { \ + if (X != NULL) gt_ggc_mx_dw_ranges_struct (X);\ + } while (0) +extern void gt_ggc_mx_dw_ranges_struct (void *); +#define gt_ggc_m_28dw_separate_line_info_struct(X) do { \ + if (X != NULL) gt_ggc_mx_dw_separate_line_info_struct (X);\ + } while (0) +extern void gt_ggc_mx_dw_separate_line_info_struct (void *); +#define gt_ggc_m_19dw_line_info_struct(X) do { \ + if (X != NULL) gt_ggc_mx_dw_line_info_struct (X);\ + } while (0) +extern void gt_ggc_mx_dw_line_info_struct (void *); +#define gt_ggc_m_25VEC_deferred_locations_gc(X) do { \ + if (X != NULL) gt_ggc_mx_VEC_deferred_locations_gc (X);\ + } while (0) +extern void gt_ggc_mx_VEC_deferred_locations_gc (void *); +#define gt_ggc_m_18dw_loc_list_struct(X) do { \ + if (X != NULL) gt_ggc_mx_dw_loc_list_struct (X);\ + } while (0) +extern void gt_ggc_mx_dw_loc_list_struct (void *); +#define gt_ggc_m_15dwarf_file_data(X) do { \ + if (X != NULL) gt_ggc_mx_dwarf_file_data (X);\ + } while (0) +extern void gt_ggc_mx_dwarf_file_data (void *); +#define gt_ggc_m_15queued_reg_save(X) do { \ + if (X != NULL) gt_ggc_mx_queued_reg_save (X);\ + } while (0) +extern void gt_ggc_mx_queued_reg_save (void *); +#define gt_ggc_m_20indirect_string_node(X) do { \ + if (X != NULL) gt_ggc_mx_indirect_string_node (X);\ + } while (0) +extern void gt_ggc_mx_indirect_string_node (void *); +#define gt_ggc_m_19dw_loc_descr_struct(X) do { \ + if (X != NULL) gt_ggc_mx_dw_loc_descr_struct (X);\ + } while (0) +extern void gt_ggc_mx_dw_loc_descr_struct (void *); +#define gt_ggc_m_13dw_fde_struct(X) do { \ + if (X != NULL) gt_ggc_mx_dw_fde_struct (X);\ + } while (0) +extern void gt_ggc_mx_dw_fde_struct (void *); +#define gt_ggc_m_13dw_cfi_struct(X) do { \ + if (X != NULL) gt_ggc_mx_dw_cfi_struct (X);\ + } while (0) +extern void gt_ggc_mx_dw_cfi_struct (void *); +#define gt_ggc_m_8typeinfo(X) do { \ + if (X != NULL) gt_ggc_mx_typeinfo (X);\ + } while (0) +extern void gt_ggc_mx_typeinfo (void *); +#define gt_ggc_m_22VEC_alias_set_entry_gc(X) do { \ + if (X != NULL) gt_ggc_mx_VEC_alias_set_entry_gc (X);\ + } while (0) +extern void gt_ggc_mx_VEC_alias_set_entry_gc (void *); +#define gt_ggc_m_17alias_set_entry_d(X) do { \ + if (X != NULL) gt_ggc_mx_alias_set_entry_d (X);\ + } while (0) +extern void gt_ggc_mx_alias_set_entry_d (void *); +#define gt_ggc_m_24constant_descriptor_tree(X) do { \ + if (X != NULL) gt_ggc_mx_constant_descriptor_tree (X);\ + } while (0) +extern void gt_ggc_mx_constant_descriptor_tree (void *); +#define gt_ggc_m_15cgraph_asm_node(X) do { \ + if (X != NULL) gt_ggc_mx_cgraph_asm_node (X);\ + } while (0) +extern void gt_ggc_mx_cgraph_asm_node (void *); +#define gt_ggc_m_12varpool_node(X) do { \ + if (X != NULL) gt_ggc_mx_varpool_node (X);\ + } while (0) +extern void gt_ggc_mx_varpool_node (void *); +#define gt_ggc_m_22VEC_cgraph_node_set_gc(X) do { \ + if (X != NULL) gt_ggc_mx_VEC_cgraph_node_set_gc (X);\ + } while (0) +extern void gt_ggc_mx_VEC_cgraph_node_set_gc (void *); +#define gt_ggc_m_19cgraph_node_set_def(X) do { \ + if (X != NULL) gt_ggc_mx_cgraph_node_set_def (X);\ + } while (0) +extern void gt_ggc_mx_cgraph_node_set_def (void *); +#define gt_ggc_m_27cgraph_node_set_element_def(X) do { \ + if (X != NULL) gt_ggc_mx_cgraph_node_set_element_def (X);\ + } while (0) +extern void gt_ggc_mx_cgraph_node_set_element_def (void *); +#define gt_ggc_m_22VEC_cgraph_node_ptr_gc(X) do { \ + if (X != NULL) gt_ggc_mx_VEC_cgraph_node_ptr_gc (X);\ + } while (0) +extern void gt_ggc_mx_VEC_cgraph_node_ptr_gc (void *); +#define gt_ggc_m_11cgraph_edge(X) do { \ + if (X != NULL) gt_ggc_mx_cgraph_edge (X);\ + } while (0) +extern void gt_ggc_mx_cgraph_edge (void *); +#define gt_ggc_m_24VEC_ipa_replace_map_p_gc(X) do { \ + if (X != NULL) gt_ggc_mx_VEC_ipa_replace_map_p_gc (X);\ + } while (0) +extern void gt_ggc_mx_VEC_ipa_replace_map_p_gc (void *); +#define gt_ggc_m_15ipa_replace_map(X) do { \ + if (X != NULL) gt_ggc_mx_ipa_replace_map (X);\ + } while (0) +extern void gt_ggc_mx_ipa_replace_map (void *); +#define gt_ggc_m_11cgraph_node(X) do { \ + if (X != NULL) gt_ggc_mx_cgraph_node (X);\ + } while (0) +extern void gt_ggc_mx_cgraph_node (void *); +#define gt_ggc_m_18VEC_basic_block_gc(X) do { \ + if (X != NULL) gt_ggc_mx_VEC_basic_block_gc (X);\ + } while (0) +extern void gt_ggc_mx_VEC_basic_block_gc (void *); +#define gt_ggc_m_14gimple_bb_info(X) do { \ + if (X != NULL) gt_ggc_mx_gimple_bb_info (X);\ + } while (0) +extern void gt_ggc_mx_gimple_bb_info (void *); +#define gt_ggc_m_11rtl_bb_info(X) do { \ + if (X != NULL) gt_ggc_mx_rtl_bb_info (X);\ + } while (0) +extern void gt_ggc_mx_rtl_bb_info (void *); +#define gt_ggc_m_11VEC_edge_gc(X) do { \ + if (X != NULL) gt_ggc_mx_VEC_edge_gc (X);\ + } while (0) +extern void gt_ggc_mx_VEC_edge_gc (void *); +#define gt_ggc_m_17cselib_val_struct(X) do { \ + if (X != NULL) gt_ggc_mx_cselib_val_struct (X);\ + } while (0) +extern void gt_ggc_mx_cselib_val_struct (void *); +#define gt_ggc_m_12elt_loc_list(X) do { \ + if (X != NULL) gt_ggc_mx_elt_loc_list (X);\ + } while (0) +extern void gt_ggc_mx_elt_loc_list (void *); +#define gt_ggc_m_13VEC_loop_p_gc(X) do { \ + if (X != NULL) gt_ggc_mx_VEC_loop_p_gc (X);\ + } while (0) +extern void gt_ggc_mx_VEC_loop_p_gc (void *); +#define gt_ggc_m_4loop(X) do { \ + if (X != NULL) gt_ggc_mx_loop (X);\ + } while (0) +extern void gt_ggc_mx_loop (void *); +#define gt_ggc_m_9loop_exit(X) do { \ + if (X != NULL) gt_ggc_mx_loop_exit (X);\ + } while (0) +extern void gt_ggc_mx_loop_exit (void *); +#define gt_ggc_m_13nb_iter_bound(X) do { \ + if (X != NULL) gt_ggc_mx_nb_iter_bound (X);\ + } while (0) +extern void gt_ggc_mx_nb_iter_bound (void *); +#define gt_ggc_m_17language_function(X) do { \ + if (X != NULL) gt_ggc_mx_language_function (X);\ + } while (0) +extern void gt_ggc_mx_language_function (void *); +#define gt_ggc_m_5loops(X) do { \ + if (X != NULL) gt_ggc_mx_loops (X);\ + } while (0) +extern void gt_ggc_mx_loops (void *); +#define gt_ggc_m_18control_flow_graph(X) do { \ + if (X != NULL) gt_ggc_mx_control_flow_graph (X);\ + } while (0) +extern void gt_ggc_mx_control_flow_graph (void *); +#define gt_ggc_m_9eh_status(X) do { \ + if (X != NULL) gt_ggc_mx_eh_status (X);\ + } while (0) +extern void gt_ggc_mx_eh_status (void *); +#define gt_ggc_m_20initial_value_struct(X) do { \ + if (X != NULL) gt_ggc_mx_initial_value_struct (X);\ + } while (0) +extern void gt_ggc_mx_initial_value_struct (void *); +#define gt_ggc_m_17rtx_constant_pool(X) do { \ + if (X != NULL) gt_ggc_mx_rtx_constant_pool (X);\ + } while (0) +extern void gt_ggc_mx_rtx_constant_pool (void *); +#define gt_ggc_m_18VEC_temp_slot_p_gc(X) do { \ + if (X != NULL) gt_ggc_mx_VEC_temp_slot_p_gc (X);\ + } while (0) +extern void gt_ggc_mx_VEC_temp_slot_p_gc (void *); +#define gt_ggc_m_9temp_slot(X) do { \ + if (X != NULL) gt_ggc_mx_temp_slot (X);\ + } while (0) +extern void gt_ggc_mx_temp_slot (void *); +#define gt_ggc_m_9gimple_df(X) do { \ + if (X != NULL) gt_ggc_mx_gimple_df (X);\ + } while (0) +extern void gt_ggc_mx_gimple_df (void *); +#define gt_ggc_m_23VEC_call_site_record_gc(X) do { \ + if (X != NULL) gt_ggc_mx_VEC_call_site_record_gc (X);\ + } while (0) +extern void gt_ggc_mx_VEC_call_site_record_gc (void *); +#define gt_ggc_m_18call_site_record_d(X) do { \ + if (X != NULL) gt_ggc_mx_call_site_record_d (X);\ + } while (0) +extern void gt_ggc_mx_call_site_record_d (void *); +#define gt_ggc_m_14sequence_stack(X) do { \ + if (X != NULL) gt_ggc_mx_sequence_stack (X);\ + } while (0) +extern void gt_ggc_mx_sequence_stack (void *); +#define gt_ggc_m_8elt_list(X) do { \ + if (X != NULL) gt_ggc_mx_elt_list (X);\ + } while (0) +extern void gt_ggc_mx_elt_list (void *); +#define gt_ggc_m_17tree_priority_map(X) do { \ + if (X != NULL) gt_ggc_mx_tree_priority_map (X);\ + } while (0) +extern void gt_ggc_mx_tree_priority_map (void *); +#define gt_ggc_m_12tree_int_map(X) do { \ + if (X != NULL) gt_ggc_mx_tree_int_map (X);\ + } while (0) +extern void gt_ggc_mx_tree_int_map (void *); +#define gt_ggc_m_8tree_map(X) do { \ + if (X != NULL) gt_ggc_mx_tree_map (X);\ + } while (0) +extern void gt_ggc_mx_tree_map (void *); +#define gt_ggc_m_14lang_tree_node(X) do { \ + if (X != NULL) gt_ggc_mx_lang_tree_node (X);\ + } while (0) +extern void gt_ggc_mx_lang_tree_node (void *); +#define gt_ggc_m_24tree_statement_list_node(X) do { \ + if (X != NULL) gt_ggc_mx_tree_statement_list_node (X);\ + } while (0) +extern void gt_ggc_mx_tree_statement_list_node (void *); +#define gt_ggc_m_9lang_decl(X) do { \ + if (X != NULL) gt_ggc_mx_lang_decl (X);\ + } while (0) +extern void gt_ggc_mx_lang_decl (void *); +#define gt_ggc_m_9lang_type(X) do { \ + if (X != NULL) gt_ggc_mx_lang_type (X);\ + } while (0) +extern void gt_ggc_mx_lang_type (void *); +#define gt_ggc_m_10die_struct(X) do { \ + if (X != NULL) gt_ggc_mx_die_struct (X);\ + } while (0) +extern void gt_ggc_mx_die_struct (void *); +#define gt_ggc_m_15varray_head_tag(X) do { \ + if (X != NULL) gt_ggc_mx_varray_head_tag (X);\ + } while (0) +extern void gt_ggc_mx_varray_head_tag (void *); +#define gt_ggc_m_12ptr_info_def(X) do { \ + if (X != NULL) gt_ggc_mx_ptr_info_def (X);\ + } while (0) +extern void gt_ggc_mx_ptr_info_def (void *); +#define gt_ggc_m_22VEC_constructor_elt_gc(X) do { \ + if (X != NULL) gt_ggc_mx_VEC_constructor_elt_gc (X);\ + } while (0) +extern void gt_ggc_mx_VEC_constructor_elt_gc (void *); +#define gt_ggc_m_10tree_ann_d(X) do { \ + if (X != NULL) gt_ggc_mx_tree_ann_d (X);\ + } while (0) +extern void gt_ggc_mx_tree_ann_d (void *); +#define gt_ggc_m_17VEC_alias_pair_gc(X) do { \ + if (X != NULL) gt_ggc_mx_VEC_alias_pair_gc (X);\ + } while (0) +extern void gt_ggc_mx_VEC_alias_pair_gc (void *); +#define gt_ggc_m_11VEC_tree_gc(X) do { \ + if (X != NULL) gt_ggc_mx_VEC_tree_gc (X);\ + } while (0) +extern void gt_ggc_mx_VEC_tree_gc (void *); +#define gt_ggc_m_8function(X) do { \ + if (X != NULL) gt_ggc_mx_function (X);\ + } while (0) +extern void gt_ggc_mx_function (void *); +#define gt_ggc_m_23constant_descriptor_rtx(X) do { \ + if (X != NULL) gt_ggc_mx_constant_descriptor_rtx (X);\ + } while (0) +extern void gt_ggc_mx_constant_descriptor_rtx (void *); +#define gt_ggc_m_11fixed_value(X) do { \ + if (X != NULL) gt_ggc_mx_fixed_value (X);\ + } while (0) +extern void gt_ggc_mx_fixed_value (void *); +#define gt_ggc_m_10real_value(X) do { \ + if (X != NULL) gt_ggc_mx_real_value (X);\ + } while (0) +extern void gt_ggc_mx_real_value (void *); +#define gt_ggc_m_10VEC_rtx_gc(X) do { \ + if (X != NULL) gt_ggc_mx_VEC_rtx_gc (X);\ + } while (0) +extern void gt_ggc_mx_VEC_rtx_gc (void *); +#define gt_ggc_m_12object_block(X) do { \ + if (X != NULL) gt_ggc_mx_object_block (X);\ + } while (0) +extern void gt_ggc_mx_object_block (void *); +#define gt_ggc_m_9reg_attrs(X) do { \ + if (X != NULL) gt_ggc_mx_reg_attrs (X);\ + } while (0) +extern void gt_ggc_mx_reg_attrs (void *); +#define gt_ggc_m_9mem_attrs(X) do { \ + if (X != NULL) gt_ggc_mx_mem_attrs (X);\ + } while (0) +extern void gt_ggc_mx_mem_attrs (void *); +#define gt_ggc_m_14bitmap_obstack(X) do { \ + if (X != NULL) gt_ggc_mx_bitmap_obstack (X);\ + } while (0) +extern void gt_ggc_mx_bitmap_obstack (void *); +#define gt_ggc_m_18bitmap_element_def(X) do { \ + if (X != NULL) gt_ggc_mx_bitmap_element_def (X);\ + } while (0) +extern void gt_ggc_mx_bitmap_element_def (void *); +#define gt_ggc_m_16machine_function(X) do { \ + if (X != NULL) gt_ggc_mx_machine_function (X);\ + } while (0) +extern void gt_ggc_mx_machine_function (void *); +#define gt_ggc_m_17stack_local_entry(X) do { \ + if (X != NULL) gt_ggc_mx_stack_local_entry (X);\ + } while (0) +extern void gt_ggc_mx_stack_local_entry (void *); +#define gt_ggc_m_15basic_block_def(X) do { \ + if (X != NULL) gt_ggc_mx_basic_block_def (X);\ + } while (0) +extern void gt_ggc_mx_basic_block_def (void *); +#define gt_ggc_m_8edge_def(X) do { \ + if (X != NULL) gt_ggc_mx_edge_def (X);\ + } while (0) +extern void gt_ggc_mx_edge_def (void *); +#define gt_ggc_m_17gimple_seq_node_d(X) do { \ + if (X != NULL) gt_ggc_mx_gimple_seq_node_d (X);\ + } while (0) +extern void gt_ggc_mx_gimple_seq_node_d (void *); +#define gt_ggc_m_12gimple_seq_d(X) do { \ + if (X != NULL) gt_ggc_mx_gimple_seq_d (X);\ + } while (0) +extern void gt_ggc_mx_gimple_seq_d (void *); +#define gt_ggc_m_7section(X) do { \ + if (X != NULL) gt_ggc_mx_section (X);\ + } while (0) +extern void gt_ggc_mx_section (void *); +#define gt_ggc_m_18gimple_statement_d(X) do { \ + if (X != NULL) gt_ggc_mx_gimple_statement_d (X);\ + } while (0) +extern void gt_ggc_mx_gimple_statement_d (void *); +#define gt_ggc_m_9rtvec_def(X) do { \ + if (X != NULL) gt_ggc_mx_rtvec_def (X);\ + } while (0) +extern void gt_ggc_mx_rtvec_def (void *); +#define gt_ggc_m_7rtx_def(X) do { \ + if (X != NULL) gt_ggc_mx_rtx_def (X);\ + } while (0) +extern void gt_ggc_mx_rtx_def (void *); +#define gt_ggc_m_15bitmap_head_def(X) do { \ + if (X != NULL) gt_ggc_mx_bitmap_head_def (X);\ + } while (0) +extern void gt_ggc_mx_bitmap_head_def (void *); +#define gt_ggc_m_9tree_node(X) do { \ + if (X != NULL) gt_ggc_mx_tree_node (X);\ + } while (0) +#define gt_ggc_mx_tree_node gt_ggc_mx_lang_tree_node +#define gt_ggc_m_6answer(X) do { \ + if (X != NULL) gt_ggc_mx_answer (X);\ + } while (0) +extern void gt_ggc_mx_answer (void *); +#define gt_ggc_m_9cpp_macro(X) do { \ + if (X != NULL) gt_ggc_mx_cpp_macro (X);\ + } while (0) +extern void gt_ggc_mx_cpp_macro (void *); +#define gt_ggc_m_9cpp_token(X) do { \ + if (X != NULL) gt_ggc_mx_cpp_token (X);\ + } while (0) +extern void gt_ggc_mx_cpp_token (void *); +#define gt_ggc_m_9line_maps(X) do { \ + if (X != NULL) gt_ggc_mx_line_maps (X);\ + } while (0) +extern void gt_ggc_mx_line_maps (void *); +extern void gt_ggc_m_II17splay_tree_node_s (void *); +extern void gt_ggc_m_SP9tree_node17splay_tree_node_s (void *); +extern void gt_ggc_m_P9tree_nodeP9tree_node17splay_tree_node_s (void *); +extern void gt_ggc_m_IP9tree_node17splay_tree_node_s (void *); +extern void gt_ggc_m_P13tree_llvm_map4htab (void *); + +void +gt_ggc_m_P13tree_llvm_map4htab (void *x_p) +{ + struct htab * const x = (struct htab *)x_p; + if (ggc_test_and_set_mark (x)) + { + if ((*x).entries != NULL) { + size_t i0; + for (i0 = 0; i0 != (size_t)(((*x)).size); i0++) { + gt_ggc_m_13tree_llvm_map ((*x).entries[i0]); + } + ggc_mark ((*x).entries); + } + } +} +extern void gt_ggc_m_P15interface_tuple4htab (void *); +extern void gt_ggc_m_P16volatilized_type4htab (void *); +extern void gt_ggc_m_P17string_descriptor4htab (void *); +extern void gt_ggc_m_P14type_assertion4htab (void *); +extern void gt_ggc_m_P18treetreehash_entry4htab (void *); +extern void gt_ggc_m_P17module_htab_entry4htab (void *); +extern void gt_ggc_m_P16def_pragma_macro4htab (void *); +extern void gt_ggc_m_P21pending_abstract_type4htab (void *); +extern void gt_ggc_m_P10spec_entry4htab (void *); +extern void gt_ggc_m_P16cxx_int_tree_map4htab (void *); +extern void gt_ggc_m_P17named_label_entry4htab (void *); +extern void gt_ggc_m_P12tree_int_map4htab (void *); +extern void gt_ggc_m_P19lto_symtab_decl_def4htab (void *); +extern void gt_ggc_m_P25lto_symtab_identifier_def4htab (void *); +extern void gt_ggc_m_IP9tree_node12splay_tree_s (void *); +extern void gt_ggc_m_P9tree_nodeP9tree_node12splay_tree_s (void *); +extern void gt_ggc_m_P12varpool_node4htab (void *); +extern void gt_ggc_m_P13scev_info_str4htab (void *); +extern void gt_ggc_m_P23constant_descriptor_rtx4htab (void *); +extern void gt_ggc_m_P24constant_descriptor_tree4htab (void *); +extern void gt_ggc_m_P12object_block4htab (void *); +extern void gt_ggc_m_P7section4htab (void *); +extern void gt_ggc_m_P17tree_priority_map4htab (void *); +extern void gt_ggc_m_P8tree_map4htab (void *); +extern void gt_ggc_m_P9type_hash4htab (void *); +extern void gt_ggc_m_P13libfunc_entry4htab (void *); +extern void gt_ggc_m_P23temp_slot_address_entry4htab (void *); +extern void gt_ggc_m_P15throw_stmt_node4htab (void *); +extern void gt_ggc_m_P9reg_attrs4htab (void *); +extern void gt_ggc_m_P9mem_attrs4htab (void *); +extern void gt_ggc_m_P7rtx_def4htab (void *); +extern void gt_ggc_m_SP9tree_node12splay_tree_s (void *); +extern void gt_ggc_m_P16var_loc_list_def4htab (void *); +extern void gt_ggc_m_P10die_struct4htab (void *); +extern void gt_ggc_m_P15dwarf_file_data4htab (void *); +extern void gt_ggc_m_P20indirect_string_node4htab (void *); +extern void gt_ggc_m_P11cgraph_node4htab (void *); +extern void gt_ggc_m_II12splay_tree_s (void *); +extern void gt_ggc_m_P27cgraph_node_set_element_def4htab (void *); +extern void gt_ggc_m_P11cgraph_edge4htab (void *); +extern void gt_ggc_m_P9loop_exit4htab (void *); +extern void gt_ggc_m_P9tree_node4htab (void *); + +/* PCH type-walking procedures. */ +#define gt_pch_n_13tree_llvm_map(X) do { \ + if (X != NULL) gt_pch_nx_tree_llvm_map (X);\ + } while (0) +extern void gt_pch_nx_tree_llvm_map (void *); +#define gt_pch_n_15interface_tuple(X) do { \ + if (X != NULL) gt_pch_nx_interface_tuple (X);\ + } while (0) +extern void gt_pch_nx_interface_tuple (void *); +#define gt_pch_n_16volatilized_type(X) do { \ + if (X != NULL) gt_pch_nx_volatilized_type (X);\ + } while (0) +extern void gt_pch_nx_volatilized_type (void *); +#define gt_pch_n_17string_descriptor(X) do { \ + if (X != NULL) gt_pch_nx_string_descriptor (X);\ + } while (0) +extern void gt_pch_nx_string_descriptor (void *); +#define gt_pch_n_15c_inline_static(X) do { \ + if (X != NULL) gt_pch_nx_c_inline_static (X);\ + } while (0) +extern void gt_pch_nx_c_inline_static (void *); +#define gt_pch_n_24VEC_c_goto_bindings_p_gc(X) do { \ + if (X != NULL) gt_pch_nx_VEC_c_goto_bindings_p_gc (X);\ + } while (0) +extern void gt_pch_nx_VEC_c_goto_bindings_p_gc (void *); +#define gt_pch_n_15c_goto_bindings(X) do { \ + if (X != NULL) gt_pch_nx_c_goto_bindings (X);\ + } while (0) +extern void gt_pch_nx_c_goto_bindings (void *); +#define gt_pch_n_7c_scope(X) do { \ + if (X != NULL) gt_pch_nx_c_scope (X);\ + } while (0) +extern void gt_pch_nx_c_scope (void *); +#define gt_pch_n_9c_binding(X) do { \ + if (X != NULL) gt_pch_nx_c_binding (X);\ + } while (0) +extern void gt_pch_nx_c_binding (void *); +#define gt_pch_n_12c_label_vars(X) do { \ + if (X != NULL) gt_pch_nx_c_label_vars (X);\ + } while (0) +extern void gt_pch_nx_c_label_vars (void *); +#define gt_pch_n_8c_parser(X) do { \ + if (X != NULL) gt_pch_nx_c_parser (X);\ + } while (0) +extern void gt_pch_nx_c_parser (void *); +#define gt_pch_n_9imp_entry(X) do { \ + if (X != NULL) gt_pch_nx_imp_entry (X);\ + } while (0) +extern void gt_pch_nx_imp_entry (void *); +#define gt_pch_n_16hashed_attribute(X) do { \ + if (X != NULL) gt_pch_nx_hashed_attribute (X);\ + } while (0) +extern void gt_pch_nx_hashed_attribute (void *); +#define gt_pch_n_12hashed_entry(X) do { \ + if (X != NULL) gt_pch_nx_hashed_entry (X);\ + } while (0) +extern void gt_pch_nx_hashed_entry (void *); +#define gt_pch_n_14type_assertion(X) do { \ + if (X != NULL) gt_pch_nx_type_assertion (X);\ + } while (0) +extern void gt_pch_nx_type_assertion (void *); +#define gt_pch_n_18treetreehash_entry(X) do { \ + if (X != NULL) gt_pch_nx_treetreehash_entry (X);\ + } while (0) +extern void gt_pch_nx_treetreehash_entry (void *); +#define gt_pch_n_5CPool(X) do { \ + if (X != NULL) gt_pch_nx_CPool (X);\ + } while (0) +extern void gt_pch_nx_CPool (void *); +#define gt_pch_n_3JCF(X) do { \ + if (X != NULL) gt_pch_nx_JCF (X);\ + } while (0) +extern void gt_pch_nx_JCF (void *); +#define gt_pch_n_17module_htab_entry(X) do { \ + if (X != NULL) gt_pch_nx_module_htab_entry (X);\ + } while (0) +extern void gt_pch_nx_module_htab_entry (void *); +#define gt_pch_n_13binding_level(X) do { \ + if (X != NULL) gt_pch_nx_binding_level (X);\ + } while (0) +extern void gt_pch_nx_binding_level (void *); +#define gt_pch_n_9opt_stack(X) do { \ + if (X != NULL) gt_pch_nx_opt_stack (X);\ + } while (0) +extern void gt_pch_nx_opt_stack (void *); +#define gt_pch_n_16def_pragma_macro(X) do { \ + if (X != NULL) gt_pch_nx_def_pragma_macro (X);\ + } while (0) +extern void gt_pch_nx_def_pragma_macro (void *); +#define gt_pch_n_22def_pragma_macro_value(X) do { \ + if (X != NULL) gt_pch_nx_def_pragma_macro_value (X);\ + } while (0) +extern void gt_pch_nx_def_pragma_macro_value (void *); +#define gt_pch_n_11align_stack(X) do { \ + if (X != NULL) gt_pch_nx_align_stack (X);\ + } while (0) +extern void gt_pch_nx_align_stack (void *); +#define gt_pch_n_18VEC_tree_gc_vec_gc(X) do { \ + if (X != NULL) gt_pch_nx_VEC_tree_gc_vec_gc (X);\ + } while (0) +extern void gt_pch_nx_VEC_tree_gc_vec_gc (void *); +#define gt_pch_n_19VEC_const_char_p_gc(X) do { \ + if (X != NULL) gt_pch_nx_VEC_const_char_p_gc (X);\ + } while (0) +extern void gt_pch_nx_VEC_const_char_p_gc (void *); +#define gt_pch_n_21pending_abstract_type(X) do { \ + if (X != NULL) gt_pch_nx_pending_abstract_type (X);\ + } while (0) +extern void gt_pch_nx_pending_abstract_type (void *); +#define gt_pch_n_9cp_parser(X) do { \ + if (X != NULL) gt_pch_nx_cp_parser (X);\ + } while (0) +extern void gt_pch_nx_cp_parser (void *); +#define gt_pch_n_17cp_parser_context(X) do { \ + if (X != NULL) gt_pch_nx_cp_parser_context (X);\ + } while (0) +extern void gt_pch_nx_cp_parser_context (void *); +#define gt_pch_n_8cp_lexer(X) do { \ + if (X != NULL) gt_pch_nx_cp_lexer (X);\ + } while (0) +extern void gt_pch_nx_cp_lexer (void *); +#define gt_pch_n_10tree_check(X) do { \ + if (X != NULL) gt_pch_nx_tree_check (X);\ + } while (0) +extern void gt_pch_nx_tree_check (void *); +#define gt_pch_n_22VEC_deferred_access_gc(X) do { \ + if (X != NULL) gt_pch_nx_VEC_deferred_access_gc (X);\ + } while (0) +extern void gt_pch_nx_VEC_deferred_access_gc (void *); +#define gt_pch_n_10spec_entry(X) do { \ + if (X != NULL) gt_pch_nx_spec_entry (X);\ + } while (0) +extern void gt_pch_nx_spec_entry (void *); +#define gt_pch_n_16pending_template(X) do { \ + if (X != NULL) gt_pch_nx_pending_template (X);\ + } while (0) +extern void gt_pch_nx_pending_template (void *); +#define gt_pch_n_21named_label_use_entry(X) do { \ + if (X != NULL) gt_pch_nx_named_label_use_entry (X);\ + } while (0) +extern void gt_pch_nx_named_label_use_entry (void *); +#define gt_pch_n_28VEC_deferred_access_check_gc(X) do { \ + if (X != NULL) gt_pch_nx_VEC_deferred_access_check_gc (X);\ + } while (0) +extern void gt_pch_nx_VEC_deferred_access_check_gc (void *); +#define gt_pch_n_11tinst_level(X) do { \ + if (X != NULL) gt_pch_nx_tinst_level (X);\ + } while (0) +extern void gt_pch_nx_tinst_level (void *); +#define gt_pch_n_18sorted_fields_type(X) do { \ + if (X != NULL) gt_pch_nx_sorted_fields_type (X);\ + } while (0) +extern void gt_pch_nx_sorted_fields_type (void *); +#define gt_pch_n_18VEC_tree_pair_s_gc(X) do { \ + if (X != NULL) gt_pch_nx_VEC_tree_pair_s_gc (X);\ + } while (0) +extern void gt_pch_nx_VEC_tree_pair_s_gc (void *); +#define gt_pch_n_17named_label_entry(X) do { \ + if (X != NULL) gt_pch_nx_named_label_entry (X);\ + } while (0) +extern void gt_pch_nx_named_label_entry (void *); +#define gt_pch_n_14cp_token_cache(X) do { \ + if (X != NULL) gt_pch_nx_cp_token_cache (X);\ + } while (0) +extern void gt_pch_nx_cp_token_cache (void *); +#define gt_pch_n_11saved_scope(X) do { \ + if (X != NULL) gt_pch_nx_saved_scope (X);\ + } while (0) +extern void gt_pch_nx_saved_scope (void *); +#define gt_pch_n_16cxx_int_tree_map(X) do { \ + if (X != NULL) gt_pch_nx_cxx_int_tree_map (X);\ + } while (0) +extern void gt_pch_nx_cxx_int_tree_map (void *); +#define gt_pch_n_23VEC_cp_class_binding_gc(X) do { \ + if (X != NULL) gt_pch_nx_VEC_cp_class_binding_gc (X);\ + } while (0) +extern void gt_pch_nx_VEC_cp_class_binding_gc (void *); +#define gt_pch_n_24VEC_cxx_saved_binding_gc(X) do { \ + if (X != NULL) gt_pch_nx_VEC_cxx_saved_binding_gc (X);\ + } while (0) +extern void gt_pch_nx_VEC_cxx_saved_binding_gc (void *); +#define gt_pch_n_16cp_binding_level(X) do { \ + if (X != NULL) gt_pch_nx_cp_binding_level (X);\ + } while (0) +extern void gt_pch_nx_cp_binding_level (void *); +#define gt_pch_n_11cxx_binding(X) do { \ + if (X != NULL) gt_pch_nx_cxx_binding (X);\ + } while (0) +extern void gt_pch_nx_cxx_binding (void *); +#define gt_pch_n_15binding_entry_s(X) do { \ + if (X != NULL) gt_pch_nx_binding_entry_s (X);\ + } while (0) +extern void gt_pch_nx_binding_entry_s (void *); +#define gt_pch_n_15binding_table_s(X) do { \ + if (X != NULL) gt_pch_nx_binding_table_s (X);\ + } while (0) +extern void gt_pch_nx_binding_table_s (void *); +#define gt_pch_n_14VEC_tinfo_s_gc(X) do { \ + if (X != NULL) gt_pch_nx_VEC_tinfo_s_gc (X);\ + } while (0) +extern void gt_pch_nx_VEC_tinfo_s_gc (void *); +#define gt_pch_n_18gnat_binding_level(X) do { \ + if (X != NULL) gt_pch_nx_gnat_binding_level (X);\ + } while (0) +extern void gt_pch_nx_gnat_binding_level (void *); +#define gt_pch_n_9elab_info(X) do { \ + if (X != NULL) gt_pch_nx_elab_info (X);\ + } while (0) +extern void gt_pch_nx_elab_info (void *); +#define gt_pch_n_10stmt_group(X) do { \ + if (X != NULL) gt_pch_nx_stmt_group (X);\ + } while (0) +extern void gt_pch_nx_stmt_group (void *); +#define gt_pch_n_16VEC_parm_attr_gc(X) do { \ + if (X != NULL) gt_pch_nx_VEC_parm_attr_gc (X);\ + } while (0) +extern void gt_pch_nx_VEC_parm_attr_gc (void *); +#define gt_pch_n_11parm_attr_d(X) do { \ + if (X != NULL) gt_pch_nx_parm_attr_d (X);\ + } while (0) +extern void gt_pch_nx_parm_attr_d (void *); +#define gt_pch_n_19lto_symtab_decl_def(X) do { \ + if (X != NULL) gt_pch_nx_lto_symtab_decl_def (X);\ + } while (0) +extern void gt_pch_nx_lto_symtab_decl_def (void *); +#define gt_pch_n_25lto_symtab_identifier_def(X) do { \ + if (X != NULL) gt_pch_nx_lto_symtab_identifier_def (X);\ + } while (0) +extern void gt_pch_nx_lto_symtab_identifier_def (void *); +#define gt_pch_n_20ssa_operand_memory_d(X) do { \ + if (X != NULL) gt_pch_nx_ssa_operand_memory_d (X);\ + } while (0) +extern void gt_pch_nx_ssa_operand_memory_d (void *); +#define gt_pch_n_13scev_info_str(X) do { \ + if (X != NULL) gt_pch_nx_scev_info_str (X);\ + } while (0) +extern void gt_pch_nx_scev_info_str (void *); +#define gt_pch_n_13VEC_gimple_gc(X) do { \ + if (X != NULL) gt_pch_nx_VEC_gimple_gc (X);\ + } while (0) +extern void gt_pch_nx_VEC_gimple_gc (void *); +#define gt_pch_n_9type_hash(X) do { \ + if (X != NULL) gt_pch_nx_type_hash (X);\ + } while (0) +extern void gt_pch_nx_type_hash (void *); +#define gt_pch_n_16string_pool_data(X) do { \ + if (X != NULL) gt_pch_nx_string_pool_data (X);\ + } while (0) +extern void gt_pch_nx_string_pool_data (void *); +#define gt_pch_n_13libfunc_entry(X) do { \ + if (X != NULL) gt_pch_nx_libfunc_entry (X);\ + } while (0) +extern void gt_pch_nx_libfunc_entry (void *); +#define gt_pch_n_23temp_slot_address_entry(X) do { \ + if (X != NULL) gt_pch_nx_temp_slot_address_entry (X);\ + } while (0) +extern void gt_pch_nx_temp_slot_address_entry (void *); +#define gt_pch_n_15throw_stmt_node(X) do { \ + if (X != NULL) gt_pch_nx_throw_stmt_node (X);\ + } while (0) +extern void gt_pch_nx_throw_stmt_node (void *); +#define gt_pch_n_16VEC_eh_region_gc(X) do { \ + if (X != NULL) gt_pch_nx_VEC_eh_region_gc (X);\ + } while (0) +extern void gt_pch_nx_VEC_eh_region_gc (void *); +#define gt_pch_n_11eh_region_d(X) do { \ + if (X != NULL) gt_pch_nx_eh_region_d (X);\ + } while (0) +extern void gt_pch_nx_eh_region_d (void *); +#define gt_pch_n_16var_loc_list_def(X) do { \ + if (X != NULL) gt_pch_nx_var_loc_list_def (X);\ + } while (0) +extern void gt_pch_nx_var_loc_list_def (void *); +#define gt_pch_n_12var_loc_node(X) do { \ + if (X != NULL) gt_pch_nx_var_loc_node (X);\ + } while (0) +extern void gt_pch_nx_var_loc_node (void *); +#define gt_pch_n_20VEC_die_arg_entry_gc(X) do { \ + if (X != NULL) gt_pch_nx_VEC_die_arg_entry_gc (X);\ + } while (0) +extern void gt_pch_nx_VEC_die_arg_entry_gc (void *); +#define gt_pch_n_16limbo_die_struct(X) do { \ + if (X != NULL) gt_pch_nx_limbo_die_struct (X);\ + } while (0) +extern void gt_pch_nx_limbo_die_struct (void *); +#define gt_pch_n_20VEC_pubname_entry_gc(X) do { \ + if (X != NULL) gt_pch_nx_VEC_pubname_entry_gc (X);\ + } while (0) +extern void gt_pch_nx_VEC_pubname_entry_gc (void *); +#define gt_pch_n_19VEC_dw_attr_node_gc(X) do { \ + if (X != NULL) gt_pch_nx_VEC_dw_attr_node_gc (X);\ + } while (0) +extern void gt_pch_nx_VEC_dw_attr_node_gc (void *); +#define gt_pch_n_25dw_ranges_by_label_struct(X) do { \ + if (X != NULL) gt_pch_nx_dw_ranges_by_label_struct (X);\ + } while (0) +extern void gt_pch_nx_dw_ranges_by_label_struct (void *); +#define gt_pch_n_16dw_ranges_struct(X) do { \ + if (X != NULL) gt_pch_nx_dw_ranges_struct (X);\ + } while (0) +extern void gt_pch_nx_dw_ranges_struct (void *); +#define gt_pch_n_28dw_separate_line_info_struct(X) do { \ + if (X != NULL) gt_pch_nx_dw_separate_line_info_struct (X);\ + } while (0) +extern void gt_pch_nx_dw_separate_line_info_struct (void *); +#define gt_pch_n_19dw_line_info_struct(X) do { \ + if (X != NULL) gt_pch_nx_dw_line_info_struct (X);\ + } while (0) +extern void gt_pch_nx_dw_line_info_struct (void *); +#define gt_pch_n_25VEC_deferred_locations_gc(X) do { \ + if (X != NULL) gt_pch_nx_VEC_deferred_locations_gc (X);\ + } while (0) +extern void gt_pch_nx_VEC_deferred_locations_gc (void *); +#define gt_pch_n_18dw_loc_list_struct(X) do { \ + if (X != NULL) gt_pch_nx_dw_loc_list_struct (X);\ + } while (0) +extern void gt_pch_nx_dw_loc_list_struct (void *); +#define gt_pch_n_15dwarf_file_data(X) do { \ + if (X != NULL) gt_pch_nx_dwarf_file_data (X);\ + } while (0) +extern void gt_pch_nx_dwarf_file_data (void *); +#define gt_pch_n_15queued_reg_save(X) do { \ + if (X != NULL) gt_pch_nx_queued_reg_save (X);\ + } while (0) +extern void gt_pch_nx_queued_reg_save (void *); +#define gt_pch_n_20indirect_string_node(X) do { \ + if (X != NULL) gt_pch_nx_indirect_string_node (X);\ + } while (0) +extern void gt_pch_nx_indirect_string_node (void *); +#define gt_pch_n_19dw_loc_descr_struct(X) do { \ + if (X != NULL) gt_pch_nx_dw_loc_descr_struct (X);\ + } while (0) +extern void gt_pch_nx_dw_loc_descr_struct (void *); +#define gt_pch_n_13dw_fde_struct(X) do { \ + if (X != NULL) gt_pch_nx_dw_fde_struct (X);\ + } while (0) +extern void gt_pch_nx_dw_fde_struct (void *); +#define gt_pch_n_13dw_cfi_struct(X) do { \ + if (X != NULL) gt_pch_nx_dw_cfi_struct (X);\ + } while (0) +extern void gt_pch_nx_dw_cfi_struct (void *); +#define gt_pch_n_8typeinfo(X) do { \ + if (X != NULL) gt_pch_nx_typeinfo (X);\ + } while (0) +extern void gt_pch_nx_typeinfo (void *); +#define gt_pch_n_22VEC_alias_set_entry_gc(X) do { \ + if (X != NULL) gt_pch_nx_VEC_alias_set_entry_gc (X);\ + } while (0) +extern void gt_pch_nx_VEC_alias_set_entry_gc (void *); +#define gt_pch_n_17alias_set_entry_d(X) do { \ + if (X != NULL) gt_pch_nx_alias_set_entry_d (X);\ + } while (0) +extern void gt_pch_nx_alias_set_entry_d (void *); +#define gt_pch_n_24constant_descriptor_tree(X) do { \ + if (X != NULL) gt_pch_nx_constant_descriptor_tree (X);\ + } while (0) +extern void gt_pch_nx_constant_descriptor_tree (void *); +#define gt_pch_n_15cgraph_asm_node(X) do { \ + if (X != NULL) gt_pch_nx_cgraph_asm_node (X);\ + } while (0) +extern void gt_pch_nx_cgraph_asm_node (void *); +#define gt_pch_n_12varpool_node(X) do { \ + if (X != NULL) gt_pch_nx_varpool_node (X);\ + } while (0) +extern void gt_pch_nx_varpool_node (void *); +#define gt_pch_n_22VEC_cgraph_node_set_gc(X) do { \ + if (X != NULL) gt_pch_nx_VEC_cgraph_node_set_gc (X);\ + } while (0) +extern void gt_pch_nx_VEC_cgraph_node_set_gc (void *); +#define gt_pch_n_19cgraph_node_set_def(X) do { \ + if (X != NULL) gt_pch_nx_cgraph_node_set_def (X);\ + } while (0) +extern void gt_pch_nx_cgraph_node_set_def (void *); +#define gt_pch_n_27cgraph_node_set_element_def(X) do { \ + if (X != NULL) gt_pch_nx_cgraph_node_set_element_def (X);\ + } while (0) +extern void gt_pch_nx_cgraph_node_set_element_def (void *); +#define gt_pch_n_22VEC_cgraph_node_ptr_gc(X) do { \ + if (X != NULL) gt_pch_nx_VEC_cgraph_node_ptr_gc (X);\ + } while (0) +extern void gt_pch_nx_VEC_cgraph_node_ptr_gc (void *); +#define gt_pch_n_11cgraph_edge(X) do { \ + if (X != NULL) gt_pch_nx_cgraph_edge (X);\ + } while (0) +extern void gt_pch_nx_cgraph_edge (void *); +#define gt_pch_n_24VEC_ipa_replace_map_p_gc(X) do { \ + if (X != NULL) gt_pch_nx_VEC_ipa_replace_map_p_gc (X);\ + } while (0) +extern void gt_pch_nx_VEC_ipa_replace_map_p_gc (void *); +#define gt_pch_n_15ipa_replace_map(X) do { \ + if (X != NULL) gt_pch_nx_ipa_replace_map (X);\ + } while (0) +extern void gt_pch_nx_ipa_replace_map (void *); +#define gt_pch_n_11cgraph_node(X) do { \ + if (X != NULL) gt_pch_nx_cgraph_node (X);\ + } while (0) +extern void gt_pch_nx_cgraph_node (void *); +#define gt_pch_n_18VEC_basic_block_gc(X) do { \ + if (X != NULL) gt_pch_nx_VEC_basic_block_gc (X);\ + } while (0) +extern void gt_pch_nx_VEC_basic_block_gc (void *); +#define gt_pch_n_14gimple_bb_info(X) do { \ + if (X != NULL) gt_pch_nx_gimple_bb_info (X);\ + } while (0) +extern void gt_pch_nx_gimple_bb_info (void *); +#define gt_pch_n_11rtl_bb_info(X) do { \ + if (X != NULL) gt_pch_nx_rtl_bb_info (X);\ + } while (0) +extern void gt_pch_nx_rtl_bb_info (void *); +#define gt_pch_n_11VEC_edge_gc(X) do { \ + if (X != NULL) gt_pch_nx_VEC_edge_gc (X);\ + } while (0) +extern void gt_pch_nx_VEC_edge_gc (void *); +#define gt_pch_n_17cselib_val_struct(X) do { \ + if (X != NULL) gt_pch_nx_cselib_val_struct (X);\ + } while (0) +extern void gt_pch_nx_cselib_val_struct (void *); +#define gt_pch_n_12elt_loc_list(X) do { \ + if (X != NULL) gt_pch_nx_elt_loc_list (X);\ + } while (0) +extern void gt_pch_nx_elt_loc_list (void *); +#define gt_pch_n_13VEC_loop_p_gc(X) do { \ + if (X != NULL) gt_pch_nx_VEC_loop_p_gc (X);\ + } while (0) +extern void gt_pch_nx_VEC_loop_p_gc (void *); +#define gt_pch_n_4loop(X) do { \ + if (X != NULL) gt_pch_nx_loop (X);\ + } while (0) +extern void gt_pch_nx_loop (void *); +#define gt_pch_n_9loop_exit(X) do { \ + if (X != NULL) gt_pch_nx_loop_exit (X);\ + } while (0) +extern void gt_pch_nx_loop_exit (void *); +#define gt_pch_n_13nb_iter_bound(X) do { \ + if (X != NULL) gt_pch_nx_nb_iter_bound (X);\ + } while (0) +extern void gt_pch_nx_nb_iter_bound (void *); +#define gt_pch_n_17language_function(X) do { \ + if (X != NULL) gt_pch_nx_language_function (X);\ + } while (0) +extern void gt_pch_nx_language_function (void *); +#define gt_pch_n_5loops(X) do { \ + if (X != NULL) gt_pch_nx_loops (X);\ + } while (0) +extern void gt_pch_nx_loops (void *); +#define gt_pch_n_18control_flow_graph(X) do { \ + if (X != NULL) gt_pch_nx_control_flow_graph (X);\ + } while (0) +extern void gt_pch_nx_control_flow_graph (void *); +#define gt_pch_n_9eh_status(X) do { \ + if (X != NULL) gt_pch_nx_eh_status (X);\ + } while (0) +extern void gt_pch_nx_eh_status (void *); +#define gt_pch_n_20initial_value_struct(X) do { \ + if (X != NULL) gt_pch_nx_initial_value_struct (X);\ + } while (0) +extern void gt_pch_nx_initial_value_struct (void *); +#define gt_pch_n_17rtx_constant_pool(X) do { \ + if (X != NULL) gt_pch_nx_rtx_constant_pool (X);\ + } while (0) +extern void gt_pch_nx_rtx_constant_pool (void *); +#define gt_pch_n_18VEC_temp_slot_p_gc(X) do { \ + if (X != NULL) gt_pch_nx_VEC_temp_slot_p_gc (X);\ + } while (0) +extern void gt_pch_nx_VEC_temp_slot_p_gc (void *); +#define gt_pch_n_9temp_slot(X) do { \ + if (X != NULL) gt_pch_nx_temp_slot (X);\ + } while (0) +extern void gt_pch_nx_temp_slot (void *); +#define gt_pch_n_9gimple_df(X) do { \ + if (X != NULL) gt_pch_nx_gimple_df (X);\ + } while (0) +extern void gt_pch_nx_gimple_df (void *); +#define gt_pch_n_23VEC_call_site_record_gc(X) do { \ + if (X != NULL) gt_pch_nx_VEC_call_site_record_gc (X);\ + } while (0) +extern void gt_pch_nx_VEC_call_site_record_gc (void *); +#define gt_pch_n_18call_site_record_d(X) do { \ + if (X != NULL) gt_pch_nx_call_site_record_d (X);\ + } while (0) +extern void gt_pch_nx_call_site_record_d (void *); +#define gt_pch_n_14sequence_stack(X) do { \ + if (X != NULL) gt_pch_nx_sequence_stack (X);\ + } while (0) +extern void gt_pch_nx_sequence_stack (void *); +#define gt_pch_n_8elt_list(X) do { \ + if (X != NULL) gt_pch_nx_elt_list (X);\ + } while (0) +extern void gt_pch_nx_elt_list (void *); +#define gt_pch_n_17tree_priority_map(X) do { \ + if (X != NULL) gt_pch_nx_tree_priority_map (X);\ + } while (0) +extern void gt_pch_nx_tree_priority_map (void *); +#define gt_pch_n_12tree_int_map(X) do { \ + if (X != NULL) gt_pch_nx_tree_int_map (X);\ + } while (0) +extern void gt_pch_nx_tree_int_map (void *); +#define gt_pch_n_8tree_map(X) do { \ + if (X != NULL) gt_pch_nx_tree_map (X);\ + } while (0) +extern void gt_pch_nx_tree_map (void *); +#define gt_pch_n_14lang_tree_node(X) do { \ + if (X != NULL) gt_pch_nx_lang_tree_node (X);\ + } while (0) +extern void gt_pch_nx_lang_tree_node (void *); +#define gt_pch_n_24tree_statement_list_node(X) do { \ + if (X != NULL) gt_pch_nx_tree_statement_list_node (X);\ + } while (0) +extern void gt_pch_nx_tree_statement_list_node (void *); +#define gt_pch_n_9lang_decl(X) do { \ + if (X != NULL) gt_pch_nx_lang_decl (X);\ + } while (0) +extern void gt_pch_nx_lang_decl (void *); +#define gt_pch_n_9lang_type(X) do { \ + if (X != NULL) gt_pch_nx_lang_type (X);\ + } while (0) +extern void gt_pch_nx_lang_type (void *); +#define gt_pch_n_10die_struct(X) do { \ + if (X != NULL) gt_pch_nx_die_struct (X);\ + } while (0) +extern void gt_pch_nx_die_struct (void *); +#define gt_pch_n_15varray_head_tag(X) do { \ + if (X != NULL) gt_pch_nx_varray_head_tag (X);\ + } while (0) +extern void gt_pch_nx_varray_head_tag (void *); +#define gt_pch_n_12ptr_info_def(X) do { \ + if (X != NULL) gt_pch_nx_ptr_info_def (X);\ + } while (0) +extern void gt_pch_nx_ptr_info_def (void *); +#define gt_pch_n_22VEC_constructor_elt_gc(X) do { \ + if (X != NULL) gt_pch_nx_VEC_constructor_elt_gc (X);\ + } while (0) +extern void gt_pch_nx_VEC_constructor_elt_gc (void *); +#define gt_pch_n_10tree_ann_d(X) do { \ + if (X != NULL) gt_pch_nx_tree_ann_d (X);\ + } while (0) +extern void gt_pch_nx_tree_ann_d (void *); +#define gt_pch_n_17VEC_alias_pair_gc(X) do { \ + if (X != NULL) gt_pch_nx_VEC_alias_pair_gc (X);\ + } while (0) +extern void gt_pch_nx_VEC_alias_pair_gc (void *); +#define gt_pch_n_11VEC_tree_gc(X) do { \ + if (X != NULL) gt_pch_nx_VEC_tree_gc (X);\ + } while (0) +extern void gt_pch_nx_VEC_tree_gc (void *); +#define gt_pch_n_8function(X) do { \ + if (X != NULL) gt_pch_nx_function (X);\ + } while (0) +extern void gt_pch_nx_function (void *); +#define gt_pch_n_23constant_descriptor_rtx(X) do { \ + if (X != NULL) gt_pch_nx_constant_descriptor_rtx (X);\ + } while (0) +extern void gt_pch_nx_constant_descriptor_rtx (void *); +#define gt_pch_n_11fixed_value(X) do { \ + if (X != NULL) gt_pch_nx_fixed_value (X);\ + } while (0) +extern void gt_pch_nx_fixed_value (void *); +#define gt_pch_n_10real_value(X) do { \ + if (X != NULL) gt_pch_nx_real_value (X);\ + } while (0) +extern void gt_pch_nx_real_value (void *); +#define gt_pch_n_10VEC_rtx_gc(X) do { \ + if (X != NULL) gt_pch_nx_VEC_rtx_gc (X);\ + } while (0) +extern void gt_pch_nx_VEC_rtx_gc (void *); +#define gt_pch_n_12object_block(X) do { \ + if (X != NULL) gt_pch_nx_object_block (X);\ + } while (0) +extern void gt_pch_nx_object_block (void *); +#define gt_pch_n_9reg_attrs(X) do { \ + if (X != NULL) gt_pch_nx_reg_attrs (X);\ + } while (0) +extern void gt_pch_nx_reg_attrs (void *); +#define gt_pch_n_9mem_attrs(X) do { \ + if (X != NULL) gt_pch_nx_mem_attrs (X);\ + } while (0) +extern void gt_pch_nx_mem_attrs (void *); +#define gt_pch_n_14bitmap_obstack(X) do { \ + if (X != NULL) gt_pch_nx_bitmap_obstack (X);\ + } while (0) +extern void gt_pch_nx_bitmap_obstack (void *); +#define gt_pch_n_18bitmap_element_def(X) do { \ + if (X != NULL) gt_pch_nx_bitmap_element_def (X);\ + } while (0) +extern void gt_pch_nx_bitmap_element_def (void *); +#define gt_pch_n_16machine_function(X) do { \ + if (X != NULL) gt_pch_nx_machine_function (X);\ + } while (0) +extern void gt_pch_nx_machine_function (void *); +#define gt_pch_n_17stack_local_entry(X) do { \ + if (X != NULL) gt_pch_nx_stack_local_entry (X);\ + } while (0) +extern void gt_pch_nx_stack_local_entry (void *); +#define gt_pch_n_15basic_block_def(X) do { \ + if (X != NULL) gt_pch_nx_basic_block_def (X);\ + } while (0) +extern void gt_pch_nx_basic_block_def (void *); +#define gt_pch_n_8edge_def(X) do { \ + if (X != NULL) gt_pch_nx_edge_def (X);\ + } while (0) +extern void gt_pch_nx_edge_def (void *); +#define gt_pch_n_17gimple_seq_node_d(X) do { \ + if (X != NULL) gt_pch_nx_gimple_seq_node_d (X);\ + } while (0) +extern void gt_pch_nx_gimple_seq_node_d (void *); +#define gt_pch_n_12gimple_seq_d(X) do { \ + if (X != NULL) gt_pch_nx_gimple_seq_d (X);\ + } while (0) +extern void gt_pch_nx_gimple_seq_d (void *); +#define gt_pch_n_7section(X) do { \ + if (X != NULL) gt_pch_nx_section (X);\ + } while (0) +extern void gt_pch_nx_section (void *); +#define gt_pch_n_18gimple_statement_d(X) do { \ + if (X != NULL) gt_pch_nx_gimple_statement_d (X);\ + } while (0) +extern void gt_pch_nx_gimple_statement_d (void *); +#define gt_pch_n_9rtvec_def(X) do { \ + if (X != NULL) gt_pch_nx_rtvec_def (X);\ + } while (0) +extern void gt_pch_nx_rtvec_def (void *); +#define gt_pch_n_7rtx_def(X) do { \ + if (X != NULL) gt_pch_nx_rtx_def (X);\ + } while (0) +extern void gt_pch_nx_rtx_def (void *); +#define gt_pch_n_15bitmap_head_def(X) do { \ + if (X != NULL) gt_pch_nx_bitmap_head_def (X);\ + } while (0) +extern void gt_pch_nx_bitmap_head_def (void *); +#define gt_pch_n_9tree_node(X) do { \ + if (X != NULL) gt_pch_nx_tree_node (X);\ + } while (0) +#define gt_pch_nx_tree_node gt_pch_nx_lang_tree_node +#define gt_pch_n_6answer(X) do { \ + if (X != NULL) gt_pch_nx_answer (X);\ + } while (0) +extern void gt_pch_nx_answer (void *); +#define gt_pch_n_9cpp_macro(X) do { \ + if (X != NULL) gt_pch_nx_cpp_macro (X);\ + } while (0) +extern void gt_pch_nx_cpp_macro (void *); +#define gt_pch_n_9cpp_token(X) do { \ + if (X != NULL) gt_pch_nx_cpp_token (X);\ + } while (0) +extern void gt_pch_nx_cpp_token (void *); +#define gt_pch_n_9line_maps(X) do { \ + if (X != NULL) gt_pch_nx_line_maps (X);\ + } while (0) +extern void gt_pch_nx_line_maps (void *); +extern void gt_pch_n_II17splay_tree_node_s (void *); +extern void gt_pch_n_SP9tree_node17splay_tree_node_s (void *); +extern void gt_pch_n_P9tree_nodeP9tree_node17splay_tree_node_s (void *); +extern void gt_pch_n_IP9tree_node17splay_tree_node_s (void *); +extern void gt_pch_n_P13tree_llvm_map4htab (void *); + +void +gt_pch_n_P13tree_llvm_map4htab (void *x_p) +{ +#ifdef GCC_PLUGIN_HAVE_PCH + struct htab * const x = (struct htab *)x_p; + if (gt_pch_note_object (x, x, gt_pch_p_P13tree_llvm_map4htab, gt_e_P13tree_llvm_map4htab)) + { + if ((*x).entries != NULL) { + size_t i0; + for (i0 = 0; i0 != (size_t)(((*x)).size); i0++) { + gt_pch_n_13tree_llvm_map ((*x).entries[i0]); + } + gt_pch_note_object ((*x).entries, x, gt_pch_p_P13tree_llvm_map4htab, gt_types_enum_last); + } + } +/* end ifdef GCC_PLUGIN_HAVE_PCH*/ +#endif +} +extern void gt_pch_n_P15interface_tuple4htab (void *); +extern void gt_pch_n_P16volatilized_type4htab (void *); +extern void gt_pch_n_P17string_descriptor4htab (void *); +extern void gt_pch_n_P14type_assertion4htab (void *); +extern void gt_pch_n_P18treetreehash_entry4htab (void *); +extern void gt_pch_n_P17module_htab_entry4htab (void *); +extern void gt_pch_n_P16def_pragma_macro4htab (void *); +extern void gt_pch_n_P21pending_abstract_type4htab (void *); +extern void gt_pch_n_P10spec_entry4htab (void *); +extern void gt_pch_n_P16cxx_int_tree_map4htab (void *); +extern void gt_pch_n_P17named_label_entry4htab (void *); +extern void gt_pch_n_P12tree_int_map4htab (void *); +extern void gt_pch_n_P19lto_symtab_decl_def4htab (void *); +extern void gt_pch_n_P25lto_symtab_identifier_def4htab (void *); +extern void gt_pch_n_IP9tree_node12splay_tree_s (void *); +extern void gt_pch_n_P9tree_nodeP9tree_node12splay_tree_s (void *); +extern void gt_pch_n_P12varpool_node4htab (void *); +extern void gt_pch_n_P13scev_info_str4htab (void *); +extern void gt_pch_n_P23constant_descriptor_rtx4htab (void *); +extern void gt_pch_n_P24constant_descriptor_tree4htab (void *); +extern void gt_pch_n_P12object_block4htab (void *); +extern void gt_pch_n_P7section4htab (void *); +extern void gt_pch_n_P17tree_priority_map4htab (void *); +extern void gt_pch_n_P8tree_map4htab (void *); +extern void gt_pch_n_P9type_hash4htab (void *); +extern void gt_pch_n_P13libfunc_entry4htab (void *); +extern void gt_pch_n_P23temp_slot_address_entry4htab (void *); +extern void gt_pch_n_P15throw_stmt_node4htab (void *); +extern void gt_pch_n_P9reg_attrs4htab (void *); +extern void gt_pch_n_P9mem_attrs4htab (void *); +extern void gt_pch_n_P7rtx_def4htab (void *); +extern void gt_pch_n_SP9tree_node12splay_tree_s (void *); +extern void gt_pch_n_P16var_loc_list_def4htab (void *); +extern void gt_pch_n_P10die_struct4htab (void *); +extern void gt_pch_n_P15dwarf_file_data4htab (void *); +extern void gt_pch_n_P20indirect_string_node4htab (void *); +extern void gt_pch_n_P11cgraph_node4htab (void *); +extern void gt_pch_n_II12splay_tree_s (void *); +extern void gt_pch_n_P27cgraph_node_set_element_def4htab (void *); +extern void gt_pch_n_P11cgraph_edge4htab (void *); +extern void gt_pch_n_P9loop_exit4htab (void *); +extern void gt_pch_n_P9tree_node4htab (void *); + +/* Local pointer-walking routines. */ +extern void gt_pch_p_13tree_llvm_map + (void *, void *, gt_pointer_operator, void *); + +void +gt_pch_p_13tree_llvm_map (ATTRIBUTE_UNUSED void *this_obj, + void *x_p, + ATTRIBUTE_UNUSED gt_pointer_operator op, + ATTRIBUTE_UNUSED void *cookie) +{ +#ifdef GCC_PLUGIN_HAVE_PCH + struct tree_llvm_map * const x ATTRIBUTE_UNUSED = (struct tree_llvm_map *)x_p; + if ((void *)(x) == this_obj) + op (&((*x).base.from), cookie); +/* end ifdef GCC_PLUGIN_HAVE_PCH */ +#endif +} +extern void gt_pch_p_15interface_tuple + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_16volatilized_type + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_17string_descriptor + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_15c_inline_static + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_24VEC_c_goto_bindings_p_gc + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_15c_goto_bindings + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_7c_scope + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_9c_binding + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_12c_label_vars + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_8c_parser + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_9imp_entry + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_16hashed_attribute + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_12hashed_entry + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_14type_assertion + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_18treetreehash_entry + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_5CPool + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_3JCF + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_17module_htab_entry + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_13binding_level + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_9opt_stack + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_16def_pragma_macro + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_22def_pragma_macro_value + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_11align_stack + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_18VEC_tree_gc_vec_gc + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_19VEC_const_char_p_gc + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_21pending_abstract_type + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_9cp_parser + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_17cp_parser_context + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_8cp_lexer + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_10tree_check + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_22VEC_deferred_access_gc + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_10spec_entry + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_16pending_template + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_21named_label_use_entry + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_28VEC_deferred_access_check_gc + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_11tinst_level + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_18sorted_fields_type + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_18VEC_tree_pair_s_gc + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_17named_label_entry + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_14cp_token_cache + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_11saved_scope + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_16cxx_int_tree_map + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_23VEC_cp_class_binding_gc + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_24VEC_cxx_saved_binding_gc + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_16cp_binding_level + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_11cxx_binding + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_15binding_entry_s + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_15binding_table_s + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_14VEC_tinfo_s_gc + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_18gnat_binding_level + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_9elab_info + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_10stmt_group + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_16VEC_parm_attr_gc + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_11parm_attr_d + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_19lto_symtab_decl_def + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_25lto_symtab_identifier_def + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_20ssa_operand_memory_d + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_13scev_info_str + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_13VEC_gimple_gc + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_9type_hash + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_16string_pool_data + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_13libfunc_entry + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_23temp_slot_address_entry + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_15throw_stmt_node + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_16VEC_eh_region_gc + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_11eh_region_d + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_16var_loc_list_def + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_12var_loc_node + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_20VEC_die_arg_entry_gc + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_16limbo_die_struct + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_20VEC_pubname_entry_gc + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_19VEC_dw_attr_node_gc + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_25dw_ranges_by_label_struct + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_16dw_ranges_struct + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_28dw_separate_line_info_struct + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_19dw_line_info_struct + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_25VEC_deferred_locations_gc + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_18dw_loc_list_struct + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_15dwarf_file_data + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_15queued_reg_save + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_20indirect_string_node + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_19dw_loc_descr_struct + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_13dw_fde_struct + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_13dw_cfi_struct + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_8typeinfo + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_22VEC_alias_set_entry_gc + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_17alias_set_entry_d + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_24constant_descriptor_tree + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_15cgraph_asm_node + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_12varpool_node + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_22VEC_cgraph_node_set_gc + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_19cgraph_node_set_def + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_27cgraph_node_set_element_def + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_22VEC_cgraph_node_ptr_gc + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_11cgraph_edge + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_24VEC_ipa_replace_map_p_gc + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_15ipa_replace_map + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_11cgraph_node + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_18VEC_basic_block_gc + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_14gimple_bb_info + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_11rtl_bb_info + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_11VEC_edge_gc + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_17cselib_val_struct + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_12elt_loc_list + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_13VEC_loop_p_gc + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_4loop + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_9loop_exit + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_13nb_iter_bound + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_17language_function + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_5loops + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_18control_flow_graph + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_9eh_status + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_20initial_value_struct + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_17rtx_constant_pool + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_18VEC_temp_slot_p_gc + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_9temp_slot + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_9gimple_df + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_23VEC_call_site_record_gc + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_18call_site_record_d + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_14sequence_stack + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_8elt_list + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_17tree_priority_map + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_12tree_int_map + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_8tree_map + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_14lang_tree_node + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_24tree_statement_list_node + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_9lang_decl + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_9lang_type + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_10die_struct + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_15varray_head_tag + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_12ptr_info_def + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_22VEC_constructor_elt_gc + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_10tree_ann_d + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_17VEC_alias_pair_gc + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_11VEC_tree_gc + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_8function + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_23constant_descriptor_rtx + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_11fixed_value + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_10real_value + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_10VEC_rtx_gc + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_12object_block + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_9reg_attrs + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_9mem_attrs + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_14bitmap_obstack + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_18bitmap_element_def + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_16machine_function + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_17stack_local_entry + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_15basic_block_def + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_8edge_def + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_17gimple_seq_node_d + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_12gimple_seq_d + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_7section + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_18gimple_statement_d + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_9rtvec_def + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_7rtx_def + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_15bitmap_head_def + (void *, void *, gt_pointer_operator, void *); +#define gt_pch_p_9tree_node gt_pch_p_14lang_tree_node +extern void gt_pch_p_6answer + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_9cpp_macro + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_9cpp_token + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_9line_maps + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_II17splay_tree_node_s + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_SP9tree_node17splay_tree_node_s + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_P9tree_nodeP9tree_node17splay_tree_node_s + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_IP9tree_node17splay_tree_node_s + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_P13tree_llvm_map4htab + (void *, void *, gt_pointer_operator, void *); + +void +gt_pch_p_P13tree_llvm_map4htab (ATTRIBUTE_UNUSED void *this_obj, + void *x_p, + ATTRIBUTE_UNUSED gt_pointer_operator op, + ATTRIBUTE_UNUSED void *cookie) +{ +#ifdef GCC_PLUGIN_HAVE_PCH + struct htab * const x ATTRIBUTE_UNUSED = (struct htab *)x_p; + if ((*x).entries != NULL) { + size_t i0; + for (i0 = 0; i0 != (size_t)(((*x)).size); i0++) { + if ((void *)((*x).entries) == this_obj) + op (&((*x).entries[i0]), cookie); + } + if ((void *)(x) == this_obj) + op (&((*x).entries), cookie); + } +/* end ifdef GCC_PLUGIN_HAVE_PCH */ +#endif +} +extern void gt_pch_p_P15interface_tuple4htab + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_P16volatilized_type4htab + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_P17string_descriptor4htab + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_P14type_assertion4htab + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_P18treetreehash_entry4htab + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_P17module_htab_entry4htab + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_P16def_pragma_macro4htab + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_P21pending_abstract_type4htab + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_P10spec_entry4htab + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_P16cxx_int_tree_map4htab + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_P17named_label_entry4htab + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_P12tree_int_map4htab + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_P19lto_symtab_decl_def4htab + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_P25lto_symtab_identifier_def4htab + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_IP9tree_node12splay_tree_s + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_P9tree_nodeP9tree_node12splay_tree_s + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_P12varpool_node4htab + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_P13scev_info_str4htab + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_P23constant_descriptor_rtx4htab + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_P24constant_descriptor_tree4htab + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_P12object_block4htab + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_P7section4htab + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_P17tree_priority_map4htab + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_P8tree_map4htab + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_P9type_hash4htab + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_P13libfunc_entry4htab + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_P23temp_slot_address_entry4htab + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_P15throw_stmt_node4htab + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_P9reg_attrs4htab + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_P9mem_attrs4htab + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_P7rtx_def4htab + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_SP9tree_node12splay_tree_s + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_P16var_loc_list_def4htab + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_P10die_struct4htab + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_P15dwarf_file_data4htab + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_P20indirect_string_node4htab + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_P11cgraph_node4htab + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_II12splay_tree_s + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_P27cgraph_node_set_element_def4htab + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_P11cgraph_edge4htab + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_P9loop_exit4htab + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_P9tree_node4htab + (void *, void *, gt_pointer_operator, void *); + +/* GC roots. */ + +EXPORTED_CONST struct ggc_cache_tab gt_ggc_rc__gt_llvm_cache_h[] = { + { + &llvm_cache, + 1, + sizeof (llvm_cache), + >_ggc_mx_tree_llvm_map, + >_pch_nx_tree_llvm_map, + &tree_llvm_map_marked_p + }, + LAST_GGC_CACHE_TAB +}; + +EXPORTED_CONST struct ggc_root_tab gt_pch_rc__gt_llvm_cache_h[] = { + { + &llvm_cache, + 1, + sizeof (llvm_cache), + >_ggc_m_P13tree_llvm_map4htab, + >_pch_n_P13tree_llvm_map4htab + }, + LAST_GGC_ROOT_TAB +}; + + +void +gt_ggc_mx_tree_llvm_map (void *x_p) +{ + struct tree_llvm_map * const x = (struct tree_llvm_map *)x_p; + if (ggc_test_and_set_mark (x)) + { + gt_ggc_m_9tree_node ((*x).base.from); + } +} + +void +gt_pch_nx_tree_llvm_map (void *x_p) +{ +#ifdef GCC_PLUGIN_HAVE_PCH + struct tree_llvm_map * const x = (struct tree_llvm_map *)x_p; + if (gt_pch_note_object (x, x, gt_pch_p_13tree_llvm_map, gt_ggc_e_13tree_llvm_map)) + { + gt_pch_n_9tree_node ((*x).base.from); + } +/* end ifdef GCC_PLUGIN_HAVE_PCH*/ +#endif +} From baldrick at free.fr Mon Sep 14 09:03:12 2009 From: baldrick at free.fr (Duncan Sands) Date: Mon, 14 Sep 2009 14:03:12 -0000 Subject: [llvm-commits] [gcc-plugin] r81763 - /gcc-plugin/trunk/gcc-patches/gengtype.diff Message-ID: <200909141403.n8EE3C6L007411@zion.cs.uiuc.edu> Author: baldrick Date: Mon Sep 14 09:03:12 2009 New Revision: 81763 URL: http://llvm.org/viewvc/llvm-project?rev=81763&view=rev Log: This patch is no longer needed. Removed: gcc-plugin/trunk/gcc-patches/gengtype.diff Removed: gcc-plugin/trunk/gcc-patches/gengtype.diff URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/gcc-patches/gengtype.diff?rev=81762&view=auto ============================================================================== --- gcc-plugin/trunk/gcc-patches/gengtype.diff (original) +++ gcc-plugin/trunk/gcc-patches/gengtype.diff (removed) @@ -1,737 +0,0 @@ -Index: lto/gcc/doc/plugins.texi -=================================================================== ---- lto.orig/gcc/doc/plugins.texi 2009-09-01 00:16:27.962891836 +0200 -+++ lto/gcc/doc/plugins.texi 2009-09-01 10:21:15.728775623 +0200 -@@ -226,12 +226,16 @@ - their own @code{GTY}-ed data. This can be done with the - @code{PLUGIN_REGISTER_GGC_ROOTS} pseudo-event with a null callback and - the extra root table as @code{user_data}. Running the @code{gengtype ---p @var{source-dir} @var{file-list} @var{plugin*.c} ...} utility --generates this extra root table. -+-P @file{gt-plugin.h} @var{source-dir} @var{file-list} @var{plugin*.c} -+...} utility generates this extra root table, with the PCH related -+generated code kept wrapped with the @code{#ifdef -+GCC_PLUGIN_HAVE_PCH}, so disabled by default. - - You should understand the details of memory management inside GCC - before using @code{PLUGIN_GGC_MARKING} or -- at code{PLUGIN_REGISTER_GGC_ROOTS}. -+ at code{PLUGIN_REGISTER_GGC_ROOTS}. Notice that using plugins which -+need these features may break the generation of precompiled headers -+[PCH], unless these plugins take specific measures. - - - @section Giving information about a plugin -Index: lto/gcc/gengtype.c -=================================================================== ---- lto.orig/gcc/gengtype.c 2009-09-01 10:20:35.755693766 +0200 -+++ lto/gcc/gengtype.c 2009-09-01 10:21:15.732708428 +0200 -@@ -24,6 +24,7 @@ - #include "errors.h" /* for fatal */ - #include "double-int.h" - -+ - /* Data types, macros, etc. used only in this file. */ - - /* Kinds of types we can understand. */ -@@ -64,6 +65,7 @@ - type_p type; - struct fileloc line; - options_p opt; -+ bool inplugin; /* flag set if appearing inside a plugin */ - }; - - #define NUM_PARAM 10 -@@ -83,6 +85,7 @@ - type_p next; - type_p pointer_to; - enum gc_used_enum gc_used; -+ bool inplugin; - union { - type_p p; - struct { -@@ -145,6 +148,12 @@ - directory. */ - static char** plugin_files; - static int nb_plugin_files; -+/* index of first plugin file in gt_files */ -+static int first_plugin_file_ix= -1; -+/* the generated plugin output name & file */ -+static char* plugin_output_filename; -+static outf_p plugin_output; -+ - - /* The output header file that is included into pretty much every - source file. */ -@@ -167,12 +176,16 @@ - - - /* Nonzero iff an error has occurred. */ --bool hit_error = false; -+bool hit_error = FALSE; -+/* Flag set when parsing a plugin file */ -+bool is_plugin_file = FALSE; -+ - - static void gen_rtx_next (void); - static void write_rtx_next (void); - static void open_base_files (void); - static void close_output_files (void); -+static void output_delayed_functions (void); - - /* Report an error at POS, printing MSG. */ - -@@ -465,8 +478,19 @@ - if (plugin_files) - { - int i; -+ first_plugin_file_ix = nfiles; - for (i = 0; i < nb_plugin_files; i++) -- gt_files[nfiles++] = plugin_files[i]; -+ { -+ /* Each added entry in gt_files should have additional -+ space for its lang_bitmap before. */ -+ int plugfilen = strlen (plugin_files[i]); -+ char* plugent = -+ (char*) xcalloc (1, plugfilen+1 + sizeof (lang_bitmap)); -+ plugent += sizeof (lang_bitmap); -+ strcpy(plugent, plugin_files[i]); -+ gt_files[nfiles++] = plugent; -+ /* We don't bother freeing plugent ! */ -+ } - } - num_gt_files = nfiles; - } -@@ -512,17 +536,18 @@ - /* The one and only TYPE_STRING. */ - - static struct type string_type = { -- TYPE_STRING, 0, 0, GC_USED, {0} -+ TYPE_STRING, 0, 0, GC_USED, false, {0} - }; - - /* The two and only TYPE_SCALARs. Their u.scalar_is_char flags are - set to appropriate values at the beginning of main. */ - - static struct type scalar_nonchar = { -- TYPE_SCALAR, 0, 0, GC_USED, {0} -+ TYPE_SCALAR, 0, 0, GC_USED, false, {0} - }; -+ - static struct type scalar_char = { -- TYPE_SCALAR, 0, 0, GC_USED, {0} -+ TYPE_SCALAR, 0, 0, GC_USED, false, {0} - }; - - /* Lists of various things. */ -@@ -663,8 +688,9 @@ - isunion ? "union" : "struct", s->u.s.tag); - error_at_line (&s->u.s.line, "previous definition here"); - } -- -+ - s->kind = isunion ? TYPE_UNION : TYPE_STRUCT; -+ s->inplugin = is_plugin_file; - s->u.s.tag = name; - s->u.s.line = *pos; - s->u.s.fields = fields; -@@ -709,6 +735,7 @@ - s->next = structures; - structures = s; - s->kind = isunion ? TYPE_UNION : TYPE_STRUCT; -+ s->inplugin = is_plugin_file; - s->u.s.tag = name; - structures = s; - return s; -@@ -732,6 +759,7 @@ - { - res = XCNEW (struct type); - res->kind = TYPE_PARAM_STRUCT; -+ res->inplugin = is_plugin_file; - res->next = param_structs; - param_structs = res; - res->u.param_struct.stru = t; -@@ -760,6 +788,7 @@ - { - type_p r = XCNEW (struct type); - r->kind = TYPE_POINTER; -+ r->inplugin = is_plugin_file; - r->u.p = t; - t->pointer_to = r; - } -@@ -775,6 +804,7 @@ - - v = XCNEW (struct type); - v->kind = TYPE_ARRAY; -+ v->inplugin = is_plugin_file; - v->u.a.p = t; - v->u.a.len = len; - return v; -@@ -819,6 +849,7 @@ - n->line = *pos; - n->opt = o; - n->next = variables; -+ n->inplugin = is_plugin_file; - variables = n; - } - -@@ -1492,6 +1523,9 @@ - f = XCNEW (struct outf); - f->next = output_files; - f->name = oname; -+ i = f->buflength = 4096; -+ f->buf = XNEWVEC (char, i); -+ f->bufused = 0; - output_files = f; - - oprintf (f, "/* Type information for %s.\n", name); -@@ -1508,7 +1542,7 @@ - void - oprintf (outf_p o, const char *format, ...) - { -- char *s; -+ char *s = NULL; - size_t slength; - va_list ap; - -@@ -1516,7 +1550,11 @@ - in that case. */ - if (!o) - return; -- -+ -+ gcc_assert (o->buf != NULL); -+ -+ gcc_assert (o->bufused <= o->buflength); -+ - va_start (ap, format); - slength = vasprintf (&s, format, ap); - if (s == NULL || (int)slength < 0) -@@ -1526,16 +1564,24 @@ - if (o->bufused + slength > o->buflength) - { - size_t new_len = o->buflength; -+ char *oldbuf = o->buf; - if (new_len == 0) - new_len = 1024; - do { - new_len *= 2; - } while (o->bufused + slength >= new_len); -- o->buf = XRESIZEVEC (char, o->buf, new_len); -+ o->buf = XNEWVEC (char, new_len); -+ if (oldbuf) -+ { -+ memcpy(o->buf, oldbuf, o->bufused); -+ oldbuf[0] = 0; -+ } -+ free (oldbuf); - o->buflength = new_len; - } - memcpy (o->buf + o->bufused, s, slength); - o->bufused += slength; -+ gcc_assert (o->bufused <= o->buflength); - free (s); - } - -@@ -1546,10 +1592,13 @@ - { - size_t i; - -- if (nb_plugin_files > 0 && plugin_files) -+ if (nb_plugin_files > 0 && plugin_files) - return; -- -+ -+ /* header file should be generated even in plugin mode */ - header_file = create_file ("GCC", "gtype-desc.h"); -+ -+ - - base_files = XNEWVEC (outf_p, num_lang_dirs); - -@@ -1567,7 +1616,8 @@ - "hard-reg-set.h", "basic-block.h", "cselib.h", "insn-addr.h", - "optabs.h", "libfuncs.h", "debug.h", "ggc.h", "cgraph.h", - "tree-flow.h", "reload.h", "cpp-id-data.h", "tree-chrec.h", -- "cfglayout.h", "except.h", "output.h", "gimple.h", "cfgloop.h", NULL -+ "cfglayout.h", "except.h", "output.h", "gimple.h", "cfgloop.h", -+ NULL - }; - const char *const *ifp; - outf_p gtype_desc_c; -@@ -1712,15 +1762,19 @@ - input_file = "system.h"; - - /* In plugin mode, return NULL unless the input_file is one of the -- plugin_files. */ -+ plugin_files or is the specified plugin_output_filename. */ - if (plugin_files && nb_plugin_files > 0) - { - int ix= -1, i; - for (i = 0; i < nb_plugin_files && ix < 0; i++) -- if (strcmp (input_file, plugin_files[i]) == 0) -- ix = i; -- if (ix < 0) -+ if (strcmp (input_file, plugin_files[i]) == 0) -+ ix = i; -+ if (ix < 0 -+ && plugin_output_filename -+ && strcmp (input_file, plugin_output_filename)) - return NULL; -+ if (plugin_output_filename) -+ return plugin_output; - } - - /* Determine the output file name. */ -@@ -1763,9 +1817,9 @@ - - if (lang_index >= 0) - return base_files[lang_index]; -- -+ - output_name = "gtype-desc.c"; -- for_name = NULL; -+ for_name = "GCC"; - } - - /* Look through to see if we've ever seen this output filename before. */ -@@ -1832,6 +1886,9 @@ - fatal ("writing output file %s: %s", of->name, strerror (errno)); - if (fclose (newfile) != 0) - fatal ("closing output file %s: %s", of->name, strerror (errno)); -+ free(of->buf); -+ of->buf = NULL; -+ of->bufused = of->buflength = 0; - } - } - -@@ -1864,6 +1921,7 @@ - const char *reorder_note_routine; - const char *comment; - int skip_hooks; /* skip hook generation if non zero */ -+ int is_pch; /* set for PCH stuff to output ifndef */ - }; - - static void output_escaped_param (struct walk_type_data *d, -@@ -1873,6 +1931,7 @@ - static void write_func_for_structure - (type_p orig_s, type_p s, type_p * param, - const struct write_types_data *wtd); -+static void delay_func_for_structure (type_p s, const struct write_types_data* wtd); - static void write_types_process_field - (type_p f, const struct walk_type_data *d); - static void write_types (type_p structures, -@@ -2587,6 +2646,8 @@ - } - oprintf (d.of, " (void *x_p)\n"); - oprintf (d.of, "{\n"); -+ if (plugin_output && d.of == plugin_output && wtd->is_pch) -+ oprintf (d.of, "#ifdef GCC_PLUGIN_HAVE_PCH\n"); - oprintf (d.of, " %s %s * %sx = (%s %s *)x_p;\n", - s->kind == TYPE_UNION ? "union" : "struct", s->u.s.tag, - chain_next == NULL ? "const " : "", -@@ -2691,6 +2752,8 @@ - oprintf (d.of, " }\n"); - if (chain_circular != NULL) - oprintf (d.of, " while (x != xlimit);\n"); -+ if (plugin_output && d.of == plugin_output && wtd->is_pch) -+ oprintf (d.of, "/* end ifdef GCC_PLUGIN_HAVE_PCH*/\n#endif\n"); - oprintf (d.of, "}\n"); - } - -@@ -2701,8 +2764,9 @@ - const struct write_types_data *wtd) - { - type_p s; -- -- oprintf (header_file, "\n/* %s*/\n", wtd->comment); -+ outf_p outheadf = plugin_output_filename ? plugin_output : header_file; -+ -+ oprintf (outheadf, "\n/* %s*/\n", wtd->comment); - for (s = structures; s; s = s->next) - if (s->gc_used == GC_POINTED_TO - || s->gc_used == GC_MAYBE_POINTED_TO) -@@ -2713,13 +2777,13 @@ - && s->u.s.line.file == NULL) - continue; - -- oprintf (header_file, "#define gt_%s_", wtd->prefix); -- output_mangled_typename (header_file, s); -- oprintf (header_file, "(X) do { \\\n"); -- oprintf (header_file, -+ oprintf (outheadf, "#define gt_%s_", wtd->prefix); -+ output_mangled_typename (outheadf, s); -+ oprintf (outheadf, "(X) do { \\\n"); -+ oprintf (outheadf, - " if (X != NULL) gt_%sx_%s (X);\\\n", wtd->prefix, - s->u.s.tag); -- oprintf (header_file, -+ oprintf (outheadf, - " } while (0)\n"); - - for (opt = s->u.s.opt; opt; opt = opt->next) -@@ -2729,7 +2793,7 @@ - if (t->kind == TYPE_STRUCT - || t->kind == TYPE_UNION - || t->kind == TYPE_LANG_STRUCT) -- oprintf (header_file, -+ oprintf (outheadf, - "#define gt_%sx_%s gt_%sx_%s\n", - wtd->prefix, s->u.s.tag, wtd->prefix, t->u.s.tag); - else -@@ -2741,7 +2805,7 @@ - continue; - - /* Declare the marker procedure only once. */ -- oprintf (header_file, -+ oprintf (outheadf, - "extern void gt_%sx_%s (void *);\n", - wtd->prefix, s->u.s.tag); - -@@ -2752,7 +2816,10 @@ - continue; - } - -- if (s->kind == TYPE_LANG_STRUCT) -+ /* in plugin mode, the write_func_for_structure should be delayed */ -+ if (nb_plugin_files > 0 && plugin_output_filename) -+ delay_func_for_structure (s, wtd); -+ else if (s->kind == TYPE_LANG_STRUCT) - { - type_p ss; - for (ss = s->u.s.lang_struct; ss; ss = ss->next) -@@ -2769,9 +2836,9 @@ - type_p stru = s->u.param_struct.stru; - - /* Declare the marker procedure. */ -- oprintf (header_file, "extern void gt_%s_", wtd->prefix); -- output_mangled_typename (header_file, s); -- oprintf (header_file, " (void *);\n"); -+ oprintf (outheadf, "extern void gt_%s_", wtd->prefix); -+ output_mangled_typename (outheadf, s); -+ oprintf (outheadf, " (void *);\n"); - - if (stru->u.s.line.file == NULL) - { -@@ -2795,6 +2862,7 @@ - { - "ggc_m", NULL, "ggc_mark", "ggc_test_and_set_mark", NULL, - "GC marker procedures. ", -+ FALSE, - FALSE - }; - -@@ -2803,6 +2871,7 @@ - "pch_n", "pch_p", "gt_pch_note_object", "gt_pch_note_object", - "gt_pch_note_reorder", - "PCH type-walking procedures. ", -+ TRUE, - TRUE - }; - -@@ -2875,11 +2944,15 @@ - "\tATTRIBUTE_UNUSED gt_pointer_operator op,\n" - "\tATTRIBUTE_UNUSED void *cookie)\n"); - oprintf (d.of, "{\n"); -+ if (plugin_output && d.of == plugin_output) -+ oprintf (d.of, "#ifdef GCC_PLUGIN_HAVE_PCH\n"); - oprintf (d.of, " %s %s * const x ATTRIBUTE_UNUSED = (%s %s *)x_p;\n", - s->kind == TYPE_UNION ? "union" : "struct", s->u.s.tag, - s->kind == TYPE_UNION ? "union" : "struct", s->u.s.tag); - d.indent = 2; - walk_type (s, &d); -+ if (plugin_output && d.of == plugin_output) -+ oprintf (d.of, "/* end ifdef GCC_PLUGIN_HAVE_PCH */\n#endif\n"); - oprintf (d.of, "}\n"); - } - -@@ -2888,11 +2961,13 @@ - static void - write_local (type_p structures, type_p param_structs) - { -+ outf_p outheadf = plugin_output_filename ? plugin_output : header_file; -+ - type_p s; - -- if (!header_file) -+ if (!outheadf) - return; -- oprintf (header_file, "\n/* Local pointer-walking routines. */\n"); -+ oprintf (outheadf, "\n/* Local pointer-walking routines. */\n"); - for (s = structures; s; s = s->next) - if (s->gc_used == GC_POINTED_TO - || s->gc_used == GC_MAYBE_POINTED_TO) -@@ -2910,11 +2985,11 @@ - || t->kind == TYPE_UNION - || t->kind == TYPE_LANG_STRUCT) - { -- oprintf (header_file, "#define gt_pch_p_"); -- output_mangled_typename (header_file, s); -- oprintf (header_file, " gt_pch_p_"); -- output_mangled_typename (header_file, t); -- oprintf (header_file, "\n"); -+ oprintf (outheadf, "#define gt_pch_p_"); -+ output_mangled_typename (outheadf, s); -+ oprintf (outheadf, " gt_pch_p_"); -+ output_mangled_typename (outheadf, t); -+ oprintf (outheadf, "\n"); - } - else - error_at_line (&s->u.s.line, -@@ -2925,9 +3000,9 @@ - continue; - - /* Declare the marker procedure only once. */ -- oprintf (header_file, "extern void gt_pch_p_"); -- output_mangled_typename (header_file, s); -- oprintf (header_file, -+ oprintf (outheadf, "extern void gt_pch_p_"); -+ output_mangled_typename (outheadf, s); -+ oprintf (outheadf, - "\n (void *, void *, gt_pointer_operator, void *);\n"); - - if (s->kind == TYPE_LANG_STRUCT) -@@ -2947,9 +3022,9 @@ - type_p stru = s->u.param_struct.stru; - - /* Declare the marker procedure. */ -- oprintf (header_file, "extern void gt_pch_p_"); -- output_mangled_typename (header_file, s); -- oprintf (header_file, -+ oprintf (outheadf, "extern void gt_pch_p_"); -+ output_mangled_typename (outheadf, s); -+ oprintf (outheadf, - "\n (void *, void *, gt_pointer_operator, void *);\n"); - - if (stru->u.s.line.file == NULL) -@@ -2970,17 +3045,60 @@ - } - } - --/* Write out the 'enum' definition for gt_types_enum. */ -+/* Write out only to header_file the 'enum' definition for gt_types_enum. */ - - static void - write_enum_defn (type_p structures, type_p param_structs) - { -- type_p s; -- -+ type_p s = NULL; -+ /* in plugin mode, define dynamically the enumeration values */ -+ if (plugin_output) -+ { -+ int cnt = 0; -+ oprintf (plugin_output, "\n/* Dynamic enumeration of plugin types. */\n"); -+ oprintf (plugin_output, "#ifdef GCC_PLUGIN_HAVE_PCH\n"); -+ oprintf (plugin_output, "static int gccplugin_type_base;\n"); -+ -+ for (s = structures; s; s = s->next) -+ { -+ if (!s->inplugin) -+ continue; -+ if (s->gc_used == GC_POINTED_TO -+ || s->gc_used == GC_MAYBE_POINTED_TO) -+ { -+ if (s->gc_used == GC_MAYBE_POINTED_TO -+ && s->u.s.line.file == NULL) -+ continue; -+ oprintf (plugin_output, "#define gt_ggc_e_"); -+ output_mangled_typename (plugin_output, s); -+ oprintf (plugin_output, -+ " ((gccplugin_type_base>0)?(gccplugin_type_base+%d):0)\n", -+ cnt); -+ cnt++; -+ } -+ } -+ for (s = param_structs; s; s = s->next) -+ if (s->gc_used == GC_POINTED_TO && s->inplugin) -+ { -+ oprintf (plugin_output, "#define gt_e_"); -+ output_mangled_typename (plugin_output, s); -+ oprintf (plugin_output, -+ " ((gccplugin_type_base>0)?(gccplugin_type_base+%d):0)\n", -+ cnt); -+ cnt++; -+ } -+ oprintf (plugin_output, -+ "\n#define GCCPLUGIN_TYPE_COUNT %d\n", cnt); -+ oprintf (plugin_output, "/* end ifdef GCC_PLUGIN_HAVE_PCH */\n#endif\n"); -+ return; -+ } -+ -+ /* write only to header_file */ - if (!header_file) - return; -- oprintf (header_file, "\n/* Enumeration of types known. */\n"); -+ oprintf (header_file, "\n/* Enumeration of known types. */\n"); - oprintf (header_file, "enum gt_types_enum {\n"); -+ oprintf (header_file, " gt_types_enum_firstempty,\n"); - for (s = structures; s; s = s->next) - if (s->gc_used == GC_POINTED_TO - || s->gc_used == GC_MAYBE_POINTED_TO) -@@ -3332,12 +3450,15 @@ - - for (v = variables; v; v = v->next) - { -- outf_p f = get_output_file_with_visibility (v->line.file); -+ outf_p f = NULL; - struct flist *fli; - const char *length = NULL; - int deletable_p = 0; - options_p o; -- -+ if (nb_plugin_files > 0 && plugin_output_filename && v->inplugin) -+ f = plugin_output; -+ else -+ f = get_output_file_with_visibility (v->line.file); - for (o = v->opt; o; o = o->next) - if (strcmp (o->name, "length") == 0) - length = o->info; -@@ -3629,6 +3750,74 @@ - do_typedef (astratname, new_structure (astratname, 0, pos, field, 0), pos); - } - -+ -+/* in plugin mode, the write of functions for structure is delayed to -+ the end; we keep a vector of these */ -+struct delayedstructfunc_st -+{ -+ type_p dly_s; -+ const struct write_types_data* dly_wtd; -+}; -+static struct delayedstructfunc_st* dlystructab; -+static int dlystructsiz; -+static int dlystructcnt; -+ -+ -+ -+ -+static void -+delay_func_for_structure (type_p s, const struct write_types_data* wtd) -+{ -+ gcc_assert (s != NULL); -+ gcc_assert (wtd != NULL); -+ if (dlystructcnt + 1 >= dlystructsiz) -+ { -+ struct delayedstructfunc_st* oldtab = dlystructab; -+ int oldsiz = dlystructsiz; -+ int newsiz = (32 + oldsiz) * 2; -+ int i = 0; -+ gcc_assert (newsiz > dlystructcnt); -+ dlystructab = XNEWVEC(struct delayedstructfunc_st, newsiz); -+ for (i = 0; i < dlystructcnt; i++) -+ dlystructab[i] = oldtab[i]; -+ for (i = dlystructcnt; i < newsiz; i++) -+ { -+ dlystructab[i].dly_s = NULL; -+ dlystructab[i].dly_wtd = NULL; -+ } -+ dlystructsiz = newsiz; -+ free (oldtab); -+ } -+ dlystructab[dlystructcnt].dly_s = s; -+ dlystructab[dlystructcnt].dly_wtd = wtd; -+ dlystructcnt++; -+} -+ -+ -+static void -+output_delayed_functions(void) -+{ -+ int i = 0; -+ gcc_assert (plugin_output); -+ for (i = 0; ikind == TYPE_LANG_STRUCT) -+ { -+ type_p ss; -+ for (ss = s->u.s.lang_struct; ss; ss = ss->next) -+ write_func_for_structure (s, ss, NULL, wtd); -+ } -+ else -+ write_func_for_structure (s, s, NULL, wtd); -+ } -+ free (dlystructab); -+ dlystructab = NULL; -+ dlystructcnt = dlystructsiz = 0; -+} -+ - - int - main (int argc, char **argv) -@@ -3639,20 +3828,23 @@ - /* fatal uses this */ - progname = "gengtype"; - -- if (argc >= 5 && !strcmp (argv[1], "-p")) -+ if (argc >= 6 && !strcmp (argv[1], "-P")) - { -- srcdir = argv[2]; -- inputlist = argv[3]; -- plugin_files = argv+4; -- nb_plugin_files = argc-4; -+ plugin_output_filename = argv[2]; -+ plugin_output = create_file ("GCC", plugin_output_filename); -+ srcdir = argv[3]; -+ inputlist = argv[4]; -+ plugin_files = argv + 5; -+ nb_plugin_files = argc - 5; - } -+ - else if (argc == 3) - { - srcdir = argv[1]; - inputlist = argv[2]; - } - else -- fatal ("usage: gengtype [-p] srcdir input-list [file1 file2 ... fileN]"); -+ fatal ("usage: gengtype [-P pluginout.h] srcdir input-list [file1 file2 ... fileN]"); - - srcdir_len = strlen (srcdir); - -@@ -3678,9 +3870,14 @@ - do_scalar_typedef ("void", &pos); pos.line++; - do_typedef ("PTR", create_pointer (resolve_typedef ("void", &pos)), &pos); - -- for (i = 0; i < num_gt_files; i++) -- parse_file (gt_files[i]); -- -+ for (i = 0; i < num_gt_files; i++) -+ { -+ is_plugin_file = first_plugin_file_ix >= 0 -+ && (int)i >= first_plugin_file_ix; -+ parse_file (gt_files[i]); -+ is_plugin_file = false; -+ } -+ - if (hit_error) - return 1; - -@@ -3693,6 +3890,10 @@ - write_local (structures, param_structs); - write_roots (variables); - write_rtx_next (); -+ -+ if (plugin_output) -+ output_delayed_functions (); -+ - close_output_files (); - - if (hit_error) -Index: lto/gcc/gengtype.h -=================================================================== ---- lto.orig/gcc/gengtype.h 2009-09-01 00:16:27.942856818 +0200 -+++ lto/gcc/gengtype.h 2009-09-01 10:21:15.728775623 +0200 -@@ -76,6 +76,9 @@ - extern void parse_file (const char *name); - extern bool hit_error; - -+/* flag set when parsing a plugin file */ -+extern bool is_plugin_file; -+ - /* Token codes. */ - enum { - EOF_TOKEN = 0, From daniel at zuster.org Mon Sep 14 10:27:43 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 14 Sep 2009 15:27:43 -0000 Subject: [llvm-commits] [llvm] r81764 - /llvm/trunk/test/Makefile Message-ID: <200909141527.n8EFRiqq018327@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Sep 14 10:27:43 2009 New Revision: 81764 URL: http://llvm.org/viewvc/llvm-project?rev=81764&view=rev Log: Add a VALGRIND_EXTRA_ARGS makefile variable, with the obvious semantics. Modified: llvm/trunk/test/Makefile Modified: llvm/trunk/test/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Makefile?rev=81764&r1=81763&r2=81764&view=diff ============================================================================== --- llvm/trunk/test/Makefile (original) +++ llvm/trunk/test/Makefile Mon Sep 14 10:27:43 2009 @@ -43,7 +43,7 @@ endif ifdef VG -VALGRIND := valgrind --tool=memcheck --quiet --trace-children=yes --error-exitcode=3 --leak-check=full +VALGRIND := valgrind --tool=memcheck --quiet --trace-children=yes --error-exitcode=3 --leak-check=full $(VALGRIND_EXTRA_ARGS) endif IGNORE_TESTS := From baldrick at free.fr Mon Sep 14 10:44:04 2009 From: baldrick at free.fr (Duncan Sands) Date: Mon, 14 Sep 2009 15:44:04 -0000 Subject: [llvm-commits] [gcc-plugin] r81765 - /gcc-plugin/trunk/Makefile Message-ID: <200909141544.n8EFi46a020800@zion.cs.uiuc.edu> Author: baldrick Date: Mon Sep 14 10:44:04 2009 New Revision: 81765 URL: http://llvm.org/viewvc/llvm-project?rev=81765&view=rev Log: Don't remove gt-llvm-cache.h when doing "make clean" now that we distribute this file rather than always generating it. Modified: gcc-plugin/trunk/Makefile Modified: gcc-plugin/trunk/Makefile URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/Makefile?rev=81765&r1=81764&r2=81765&view=diff ============================================================================== --- gcc-plugin/trunk/Makefile (original) +++ gcc-plugin/trunk/Makefile Mon Sep 14 10:44:04 2009 @@ -40,4 +40,4 @@ sed -i "s/ggc_root_tab .*\[\]/ggc_root_tab gt_pch_rc__gt_llvm_cache_h[]/" $(GENGTYPE_OUTPUT) clean:: - rm -f *.o *.so $(ARCH_DIR)/*.o $(GENGTYPE_OUTPUT) + rm -f *.o *.so $(ARCH_DIR)/*.o From gohman at apple.com Mon Sep 14 10:54:19 2009 From: gohman at apple.com (Dan Gohman) Date: Mon, 14 Sep 2009 08:54:19 -0700 Subject: [llvm-commits] Static Profile Patch In-Reply-To: References: Message-ID: <030E9AA3-1AF1-433F-8807-9628E7155939@apple.com> Hi Andrei, Here are some review comments for this patch. I think it would be fine to check into the tree at this point, so that future changes can be reviewed incrementally instead of with monolithic patches. BranchPredictionPass has double getEdgeProbability(Edge &edge) const; as a public member function, but Edge is a private typedef, so one of these has the wrong visibility. The passes should override the Pass::releaseMemory virtual function. Some currently have a Clear member function; they should implement releaseMemory and have it call Clear, or perhaps Clear should be renamed releaseMemory, depending on how it's used. lib/Analysis/BranchPredictionPass.cpp has #include "llvm/Transforms/Utils/BasicBlockUtils.h" which is a red flag because lib/Analysis code is not allowed to depend on lib/Transforms code. However, this #include appears to be unneeded, so it should be removed. BranchHeuristicsInfo::MatchCallHeuristic and some of the others don't test whether the terminator is a BranchInst. It looks like there's nothing preventing them from analyzing a block with an InvokeInst as its terminator. Is that intended by the heuristics? BranchHeuristicsInfo::postDominates calls PostDominatorTree::properlyDominates. Since the distinction between domination and proper domination is often both subtle and critical for algorithm correctness, please either rename this function or add comments or both. BranchPredictionInfo::FindBackEdges does a DominatorTree query for every edge in the function. It would be possible to get a close approximation of this using LoopInfo. That would miss unnatural loops and spaghetti code though; is that the reason for doing the full traversal? Please add a comment about this. BranchPredictionInfo::FindExitEdges seems to be redundant with Loop::getExitEdges. Could BranchPredictionInfo::FindStores and FindCalls be combined to avoid doing so many function traversals? In its current form, BranchPredictionPass won't be usable in LLVM's default optimization pipeline because it requires post-dominator tree construction. None of LLVM's current default optimization passes require post-dominator trees, so constructing it just for this pass will likely be too slow. It could possibly be justified for -O3, if there are sufficient benefits to oughtweigh the costs. There are many LLVM users that don't use the standard -O2 or -O3 passes also, of course. Dan On Sep 11, 2009, at 6:46 PM, Andrei Alvares wrote: > Hello everyone, > Since this patch hasn't been applied yet, I'm taking the liberty > to send a more updated version. I made several changes in the branch > predictor (BranchPredictionPass) and in the intra procedural static > profiler (BlockEdgeFrequencyPass). > Attachment: stprof-11.09.09.patch. > > While I was debbuging the code, I've noticed that I was > maintaining data across multiple calls of runOnFunction on both > passes, which was indeed an undesirable behavior. After cleaning up, > both passes shown improved results. In fact, the branch predictor > produced very close related prediction as Ball's predictor. I ran > the branch predictor on the SPEC 2000 (int and float). I'm attaching > "heuristics.txt" which compared results separated by heuristic for > both predictors. While most heuristics predicted more accurately, > the call and opcode heuristics shown worst results. This means that > is still space for improvements. Also, I've found a bug in the way > the predictor threats a branch that have some backedge sucessors, > but not all. I expected that the other branches were always exit > edges, but there are cases that this situation is not true. > > Moreover, while calculating blocks and edge frequencies it is > possible to verify if it is calculating correct frequency > information. Since the entry block frequency is always one, is > expected that the exit's total frequency is also one. So, all we > need to do is check the sum of all predecessors edges of exit's > basic blocks to match one. However, I've found two cases of > miscalculation by the pass: (1) when the control flow graph is not > reducible; (2) when seems to be a loop that does not terminates (has > no exit blocks). Although this pass can calculate frequencies for > those situations, it might not be accurate. Nevertheless, seems like > the pass is doing what is supposed to. > > The global static profiler (inter procedural) is not as accurate > as Wu's paper yet. But after those fixes, it has improved quite > significantly. I'm attaching the results of the profiler comparing > the correct prediction rate of the top most executed blocks, edges, > and function call invocations (ranging from 10% to 50%). > Attachments: block.txt, edge.txt and call.txt. > > Thanks, > Andrei > > On Wed, Sep 2, 2009 at 3:37 PM, Andrei Alvares > wrote: > Hello everyone, > Here it follows the static profiler implementation, developed as > part of my google summer of code project. It performs branch > predictions in compilation time, i.e., assign probabilities to branch > outcomes using a set of predefined heuristics. Also, it calculates > intra and interprocedural profiling by staticly estimate basic blocks > and edges frequencies (local and global) and function call invocations > frequencies. > Attachment: stprof-02.02.09.patch > > I've run the static profiler on some of the SPECint 2000 programs > (those that I was able to compile and run). It has not yet achieved > the accuracy found in Wu's paper, but I believe it can still be > improved. > Best regards, > Andrei > > Youfeng Wu and James R. Larus. Static branch frequency and program > profile analysis. In MICRO 27: Proceedings of the 27th annual > international symposium on Microarchitecture. IEEE, 1994. > > < > heuristics > .txt > > > < > blocks > .txt > > > < > edge > .txt > > > < > call > .txt > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From daniel at zuster.org Mon Sep 14 11:10:32 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 14 Sep 2009 16:10:32 -0000 Subject: [llvm-commits] [llvm] r81766 - in /llvm/trunk/utils/valgrind: ./ x86_64-pc-linux-gnu_gcc-4.3.3.supp Message-ID: <200909141610.n8EGAWdQ024254@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Sep 14 11:10:32 2009 New Revision: 81766 URL: http://llvm.org/viewvc/llvm-project?rev=81766&view=rev Log: Add a valgrind suppressions file for x86_64/linux/4.3.3. Added: llvm/trunk/utils/valgrind/ llvm/trunk/utils/valgrind/x86_64-pc-linux-gnu_gcc-4.3.3.supp Added: llvm/trunk/utils/valgrind/x86_64-pc-linux-gnu_gcc-4.3.3.supp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/valgrind/x86_64-pc-linux-gnu_gcc-4.3.3.supp?rev=81766&view=auto ============================================================================== --- llvm/trunk/utils/valgrind/x86_64-pc-linux-gnu_gcc-4.3.3.supp (added) +++ llvm/trunk/utils/valgrind/x86_64-pc-linux-gnu_gcc-4.3.3.supp Mon Sep 14 11:10:32 2009 @@ -0,0 +1,23 @@ +{ + libstdcxx_overlapped_memcpy_in_stable_sort_1 + Memcheck:Overlap + fun:memcpy + ... + fun:_ZSt11stable_sortIN9__gnu_cxx17__normal_iteratorIPSt4pairIPKN4llvm5ValueEjESt6vectorIS7_SaIS7_EEEEN12_GLOBAL__N_116CstSortPredicateEEvT_SF_T0_ +} + +{ + libstdcxx_overlapped_memcpy_in_stable_sort_2 + Memcheck:Overlap + fun:memcpy + ... + fun:_ZSt11stable_sortIN9__gnu_cxx17__normal_iteratorIPSt4pairIPKN4llvm5ValueEjESt6vectorIS7_SaIS7_EEEEN12_GLOBAL__N_116CstSortPredicateEEvT_SF_T0_ +} + +{ + libstdcxx_overlapped_memcpy_in_stable_sort_3 + Memcheck:Overlap + fun:memcpy + ... + fun:_ZSt11stable_sortIN9__gnu_cxx17__normal_iteratorIPSt4pairIPKN4llvm4TypeEjESt6vectorIS7_SaIS7_EEEEPFbRKS7_SE_EEvT_SH_T0_ +} From echristo at apple.com Mon Sep 14 11:38:49 2009 From: echristo at apple.com (Eric Christopher) Date: Mon, 14 Sep 2009 16:38:49 -0000 Subject: [llvm-commits] [llvm] r81768 - in /llvm/trunk: autoconf/configure.ac configure Message-ID: <200909141638.n8EGcoZJ028249@zion.cs.uiuc.edu> Author: echristo Date: Mon Sep 14 11:38:49 2009 New Revision: 81768 URL: http://llvm.org/viewvc/llvm-project?rev=81768&view=rev Log: Enable the jit for llvm-config. Patch by Xerxes R?nby! Modified: llvm/trunk/autoconf/configure.ac llvm/trunk/configure Modified: llvm/trunk/autoconf/configure.ac URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/autoconf/configure.ac?rev=81768&r1=81767&r2=81768&view=diff ============================================================================== --- llvm/trunk/autoconf/configure.ac (original) +++ llvm/trunk/autoconf/configure.ac Mon Sep 14 11:38:49 2009 @@ -396,7 +396,7 @@ PowerPC) AC_SUBST(TARGET_HAS_JIT,1) ;; x86_64) AC_SUBST(TARGET_HAS_JIT,1) ;; Alpha) AC_SUBST(TARGET_HAS_JIT,1) ;; - ARM) AC_SUBST(TARGET_HAS_JIT,0) ;; + ARM) AC_SUBST(TARGET_HAS_JIT,1) ;; Mips) AC_SUBST(TARGET_HAS_JIT,0) ;; PIC16) AC_SUBST(TARGET_HAS_JIT,0) ;; XCore) AC_SUBST(TARGET_HAS_JIT,0) ;; Modified: llvm/trunk/configure URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/configure?rev=81768&r1=81767&r2=81768&view=diff ============================================================================== --- llvm/trunk/configure (original) +++ llvm/trunk/configure Mon Sep 14 11:38:49 2009 @@ -4902,7 +4902,7 @@ ;; Alpha) TARGET_HAS_JIT=1 ;; - ARM) TARGET_HAS_JIT=0 + ARM) TARGET_HAS_JIT=1 ;; Mips) TARGET_HAS_JIT=0 ;; From sabre at nondot.org Mon Sep 14 11:49:26 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 14 Sep 2009 16:49:26 -0000 Subject: [llvm-commits] [llvm] r81770 - /llvm/trunk/lib/Target/README.txt Message-ID: <200909141649.n8EGnQnb029947@zion.cs.uiuc.edu> Author: lattner Date: Mon Sep 14 11:49:26 2009 New Revision: 81770 URL: http://llvm.org/viewvc/llvm-project?rev=81770&view=rev Log: add PR# Modified: llvm/trunk/lib/Target/README.txt Modified: llvm/trunk/lib/Target/README.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/README.txt?rev=81770&r1=81769&r2=81770&view=diff ============================================================================== --- llvm/trunk/lib/Target/README.txt (original) +++ llvm/trunk/lib/Target/README.txt Mon Sep 14 11:49:26 2009 @@ -1653,6 +1653,7 @@ Instcombine should be able to optimize away the loads (and thus the globals). +See also PR4973 //===---------------------------------------------------------------------===// From baldrick at free.fr Mon Sep 14 12:19:46 2009 From: baldrick at free.fr (Duncan Sands) Date: Mon, 14 Sep 2009 17:19:46 -0000 Subject: [llvm-commits] [gcc-plugin] r81772 - /gcc-plugin/trunk/llvm-backend.cpp Message-ID: <200909141719.n8EHJkBF001549@zion.cs.uiuc.edu> Author: baldrick Date: Mon Sep 14 12:19:45 2009 New Revision: 81772 URL: http://llvm.org/viewvc/llvm-project?rev=81772&view=rev Log: Turn off a bunch more GCC optimizations (there are more we might want to turn off, but this is most of them). In particular, by turning off function cloning this works around GCC bug 41355, which was firing an assertion in EmitCallOf. With these changes sqlite3 compiles at all optimization levels. Modified: gcc-plugin/trunk/llvm-backend.cpp Modified: gcc-plugin/trunk/llvm-backend.cpp URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-backend.cpp?rev=81772&r1=81771&r2=81772&view=diff ============================================================================== --- gcc-plugin/trunk/llvm-backend.cpp (original) +++ gcc-plugin/trunk/llvm-backend.cpp Mon Sep 14 12:19:45 2009 @@ -1992,6 +1992,32 @@ } }; +/// pass_ipa_null - IPA pass that does nothing. +static struct ipa_opt_pass_d pass_ipa_null = { + { + IPA_PASS, + NULL, /* name */ + gate_null, /* gate */ + NULL, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + TV_NONE, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + 0 /* todo_flags_finish */ + }, + NULL, /* generate_summary */ + NULL, /* write_summary */ + NULL, /* read_summary */ + NULL, /* function_read_summary */ + 0, /* TODOs */ + NULL, /* function_transform */ + NULL /* variable_transform */ +}; + /// pass_rtl_null - RTL pass that does nothing. static struct rtl_opt_pass pass_rtl_null = { @@ -2012,6 +2038,26 @@ } }; +/// pass_simple_ipa_null - Simple IPA pass that does nothing. +static struct simple_ipa_opt_pass pass_simple_ipa_null = +{ + { + SIMPLE_IPA_PASS, + NULL, /* name */ + gate_null, /* gate */ + NULL, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + TV_NONE, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + 0 /* todo_flags_finish */ + } +}; + // Garbage collector roots. extern const struct ggc_cache_tab gt_ggc_rc__gt_llvm_cache_h[]; @@ -2114,6 +2160,85 @@ // TODO: figure out a good way of turning off ipa optimization passes. // Could just set optimize to zero (after taking a copy), but this would // also impact front-end optimizations. + + // Turn off pass_ipa_early_inline. + pass_info.pass = &pass_simple_ipa_null.pass; + pass_info.reference_pass_name = "einline_ipa"; + pass_info.ref_pass_instance_number = 0; + pass_info.pos_op = PASS_POS_REPLACE; + register_callback (plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &pass_info); + + // Turn off pass_all_early_optimizations. + pass_info.pass = &pass_gimple_null.pass; + pass_info.reference_pass_name = "early_optimizations"; + pass_info.ref_pass_instance_number = 0; + pass_info.pos_op = PASS_POS_REPLACE; + register_callback (plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &pass_info); + + // Turn off pass_ipa_increase_alignment. + pass_info.pass = &pass_simple_ipa_null.pass; + pass_info.reference_pass_name = "increase_alignment"; + pass_info.ref_pass_instance_number = 0; + pass_info.pos_op = PASS_POS_REPLACE; + register_callback (plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &pass_info); + + // Turn off pass_ipa_matrix_reorg. + pass_info.pass = &pass_simple_ipa_null.pass; + pass_info.reference_pass_name = "matrix-reorg"; + pass_info.ref_pass_instance_number = 0; + pass_info.pos_op = PASS_POS_REPLACE; + register_callback (plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &pass_info); + + // Turn off pass_ipa_cp. + pass_info.pass = &pass_ipa_null.pass; + pass_info.reference_pass_name = "cp"; + pass_info.ref_pass_instance_number = 0; + pass_info.pos_op = PASS_POS_REPLACE; + register_callback (plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &pass_info); + + // Turn off pass_ipa_inline. + pass_info.pass = &pass_ipa_null.pass; + pass_info.reference_pass_name = "inline"; + pass_info.ref_pass_instance_number = 0; + pass_info.pos_op = PASS_POS_REPLACE; + register_callback (plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &pass_info); + + // Turn off pass_ipa_reference. + pass_info.pass = &pass_ipa_null.pass; + pass_info.reference_pass_name = "static-var"; + pass_info.ref_pass_instance_number = 0; + pass_info.pos_op = PASS_POS_REPLACE; + register_callback (plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &pass_info); + + // Turn off pass_ipa_pure_const. + pass_info.pass = &pass_ipa_null.pass; + pass_info.reference_pass_name = "pure-const"; + pass_info.ref_pass_instance_number = 0; + pass_info.pos_op = PASS_POS_REPLACE; + register_callback (plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &pass_info); + + // Turn off pass_ipa_type_escape. + pass_info.pass = &pass_simple_ipa_null.pass; + pass_info.reference_pass_name = "type-escape-var"; + pass_info.ref_pass_instance_number = 0; + pass_info.pos_op = PASS_POS_REPLACE; + register_callback (plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &pass_info); + + // Turn off pass_ipa_pta. + pass_info.pass = &pass_simple_ipa_null.pass; + pass_info.reference_pass_name = "pta"; + pass_info.ref_pass_instance_number = 0; + pass_info.pos_op = PASS_POS_REPLACE; + register_callback (plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &pass_info); + + // Turn off pass_ipa_struct_reorg. + pass_info.pass = &pass_simple_ipa_null.pass; + pass_info.reference_pass_name = "ipa_struct_reorg"; + pass_info.ref_pass_instance_number = 0; + pass_info.pos_op = PASS_POS_REPLACE; + register_callback (plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &pass_info); + + // Turn off pass_all_optimizations. pass_info.pass = &pass_gimple_null.pass; pass_info.reference_pass_name = "*all_optimizations"; pass_info.ref_pass_instance_number = 0; From grosbach at apple.com Mon Sep 14 12:27:35 2009 From: grosbach at apple.com (Jim Grosbach) Date: Mon, 14 Sep 2009 17:27:35 -0000 Subject: [llvm-commits] [llvm] r81773 - /llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp Message-ID: <200909141727.n8EHRa2X002525@zion.cs.uiuc.edu> Author: grosbach Date: Mon Sep 14 12:27:35 2009 New Revision: 81773 URL: http://llvm.org/viewvc/llvm-project?rev=81773&view=rev Log: trivial whitespace cleanup Modified: llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp Modified: llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp?rev=81773&r1=81772&r2=81773&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp Mon Sep 14 12:27:35 2009 @@ -28,7 +28,7 @@ cl::desc("Disable if-conversion pass")); static const MCAsmInfo *createMCAsmInfo(const Target &T, - const StringRef &TT) { + const StringRef &TT) { Triple TheTriple(TT); switch (TheTriple.getOS()) { case Triple::Darwin: @@ -43,7 +43,7 @@ // Register the target. RegisterTargetMachine X(TheARMTarget); RegisterTargetMachine Y(TheThumbTarget); - + // Register the target asm info. RegisterAsmInfoFn A(TheARMTarget, createMCAsmInfo); RegisterAsmInfoFn B(TheThumbTarget, createMCAsmInfo); From gohman at apple.com Mon Sep 14 15:40:10 2009 From: gohman at apple.com (Dan Gohman) Date: Mon, 14 Sep 2009 20:40:10 -0000 Subject: [llvm-commits] [llvm] r81782 - /llvm/trunk/include/llvm/CodeGen/MachineMemOperand.h Message-ID: <200909142040.n8EKeAeI028387@zion.cs.uiuc.edu> Author: djg Date: Mon Sep 14 15:40:10 2009 New Revision: 81782 URL: http://llvm.org/viewvc/llvm-project?rev=81782&view=rev Log: Update a comment to match the source. PseudoSourceValues are now obtained via accessor functions. Modified: llvm/trunk/include/llvm/CodeGen/MachineMemOperand.h Modified: llvm/trunk/include/llvm/CodeGen/MachineMemOperand.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineMemOperand.h?rev=81782&r1=81781&r2=81782&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineMemOperand.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineMemOperand.h Mon Sep 14 15:40:10 2009 @@ -51,10 +51,13 @@ MachineMemOperand(const Value *v, unsigned int f, int64_t o, uint64_t s, unsigned int a); - /// getValue - Return the base address of the memory access. - /// Special values are PseudoSourceValue::FPRel, PseudoSourceValue::SPRel, - /// and the other PseudoSourceValue members which indicate references to - /// frame/stack pointer relative references and other special references. + /// getValue - Return the base address of the memory access. This may either + /// be a normal LLVM IR Value, or one of the special values used in CodeGen. + /// Special values are those obtained via + /// PseudoSourceValue::getFixedStack(int), PseudoSourceValue::getStack, and + /// other PseudoSourceValue member functions which return objects which stand + /// for frame/stack pointer relative references and other special references + /// which are not representable in the high-level IR. const Value *getValue() const { return V; } /// getFlags - Return the raw flags of the source value, \see MemOperandFlags. From isanbard at gmail.com Mon Sep 14 15:52:38 2009 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 14 Sep 2009 20:52:38 -0000 Subject: [llvm-commits] [llvm] r81785 - /llvm/trunk/lib/CodeGen/DwarfEHPrepare.cpp Message-ID: <200909142052.n8EKqcK0030132@zion.cs.uiuc.edu> Author: void Date: Mon Sep 14 15:52:37 2009 New Revision: 81785 URL: http://llvm.org/viewvc/llvm-project?rev=81785&view=rev Log: Pull the creation of the "RewindFunction" function out of the loop. It's only created once, so shouldn't be stuck in the middle of the loop. Also early exit if there are no uses of UnwindInst in the function. Modified: llvm/trunk/lib/CodeGen/DwarfEHPrepare.cpp Modified: llvm/trunk/lib/CodeGen/DwarfEHPrepare.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/DwarfEHPrepare.cpp?rev=81785&r1=81784&r2=81785&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/DwarfEHPrepare.cpp (original) +++ llvm/trunk/lib/CodeGen/DwarfEHPrepare.cpp Mon Sep 14 15:52:37 2009 @@ -219,29 +219,40 @@ /// at runtime if there is no such exception: using unwind to throw a new /// exception is currently not supported. bool DwarfEHPrepare::LowerUnwinds() { - bool Changed = false; + SmallVector UnwindInsts; for (Function::iterator I = F->begin(), E = F->end(); I != E; ++I) { TerminatorInst *TI = I->getTerminator(); - if (!isa(TI)) - continue; + if (isa(TI)) + UnwindInsts.push_back(TI); + } + + if (UnwindInsts.empty()) return false; + + // Find the rewind function if we didn't already. + if (!RewindFunction) { + LLVMContext &Ctx = UnwindInsts[0]->getContext(); + std::vector + Params(1, PointerType::getUnqual(Type::getInt8Ty(Ctx))); + FunctionType *FTy = FunctionType::get(Type::getVoidTy(Ctx), + Params, false); + const char *RewindName = TLI->getLibcallName(RTLIB::UNWIND_RESUME); + RewindFunction = F->getParent()->getOrInsertFunction(RewindName, FTy); + } + + bool Changed = false; + + for (SmallVectorImpl::iterator + I = UnwindInsts.begin(), E = UnwindInsts.end(); I != E; ++I) { + TerminatorInst *TI = *I; // Replace the unwind instruction with a call to _Unwind_Resume (or the // appropriate target equivalent) followed by an UnreachableInst. - // Find the rewind function if we didn't already. - if (!RewindFunction) { - std::vector Params(1, - PointerType::getUnqual(Type::getInt8Ty(TI->getContext()))); - FunctionType *FTy = FunctionType::get(Type::getVoidTy(TI->getContext()), - Params, false); - const char *RewindName = TLI->getLibcallName(RTLIB::UNWIND_RESUME); - RewindFunction = F->getParent()->getOrInsertFunction(RewindName, FTy); - } - // Create the call... CallInst *CI = CallInst::Create(RewindFunction, - CreateReadOfExceptionValue(I), "", TI); + CreateReadOfExceptionValue(TI->getParent()), + "", TI); CI->setCallingConv(TLI->getLibcallCallingConv(RTLIB::UNWIND_RESUME)); // ...followed by an UnreachableInst. new UnreachableInst(TI->getContext(), TI); From echristo at apple.com Mon Sep 14 16:13:49 2009 From: echristo at apple.com (Eric Christopher) Date: Mon, 14 Sep 2009 21:13:49 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r81788 - /llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/eh1.C Message-ID: <200909142113.n8ELDnQK000590@zion.cs.uiuc.edu> Author: echristo Date: Mon Sep 14 16:13:49 2009 New Revision: 81788 URL: http://llvm.org/viewvc/llvm-project?rev=81788&view=rev Log: Update this test, the except table is now in the data section. Modified: llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/eh1.C Modified: llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/eh1.C URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/g%2B%2B.apple/eh1.C?rev=81788&r1=81787&r2=81788&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/eh1.C (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/eh1.C Mon Sep 14 16:13:49 2009 @@ -1,6 +1,6 @@ -/* APPLE LOCAL file EH __TEXT __gcc_except_tab 5819051 */ +/* APPLE LOCAL file EH __DATA __gcc_except_tab 5819051 */ /* { dg-do compile { target *-*-darwin* } } */ -/* { dg-final { scan-assembler "section __TEXT,__gcc_except_tab" } } */ +/* { dg-final { scan-assembler "__DATA,__gcc_except_tab" } } */ /* Radar 5819051 */ #include From clattner at apple.com Mon Sep 14 16:31:59 2009 From: clattner at apple.com (Chris Lattner) Date: Mon, 14 Sep 2009 14:31:59 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r81788 - /llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/eh1.C In-Reply-To: <200909142113.n8ELDnQK000590@zion.cs.uiuc.edu> References: <200909142113.n8ELDnQK000590@zion.cs.uiuc.edu> Message-ID: On Sep 14, 2009, at 2:13 PM, Eric Christopher wrote: > Author: echristo > Date: Mon Sep 14 16:13:49 2009 > New Revision: 81788 > > URL: http://llvm.org/viewvc/llvm-project?rev=81788&view=rev > Log: > Update this test, the except table is now in the data section. But that is a "bug", so we want the test to continue failing? -Chris > > Modified: > llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/eh1.C > > Modified: llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/eh1.C > URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/g%2B%2B.apple/eh1.C?rev=81788&r1=81787&r2=81788&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/eh1.C (original) > +++ llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/eh1.C Mon Sep 14 > 16:13:49 2009 > @@ -1,6 +1,6 @@ > -/* APPLE LOCAL file EH __TEXT __gcc_except_tab 5819051 */ > +/* APPLE LOCAL file EH __DATA __gcc_except_tab 5819051 */ > /* { dg-do compile { target *-*-darwin* } } */ > -/* { dg-final { scan-assembler "section > __TEXT,__gcc_except_tab" } } */ > +/* { dg-final { scan-assembler "__DATA,__gcc_except_tab" } } */ > /* Radar 5819051 */ > > #include > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From evan.cheng at apple.com Mon Sep 14 16:33:43 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 14 Sep 2009 21:33:43 -0000 Subject: [llvm-commits] [llvm] r81796 - in /llvm/trunk: include/llvm/CodeGen/LiveInterval.h include/llvm/CodeGen/LiveIntervalAnalysis.h lib/CodeGen/LiveIntervalAnalysis.cpp Message-ID: <200909142133.n8ELXhcQ003245@zion.cs.uiuc.edu> Author: evancheng Date: Mon Sep 14 16:33:42 2009 New Revision: 81796 URL: http://llvm.org/viewvc/llvm-project?rev=81796&view=rev Log: Add early coalescing to liveintervals. This is work in progress and is known to miscompute some tests. Read it at your own rish, I have aged 10 year while writing this. The gist of this is if source of some of the copies that feed into a phi join is defined by the phi join, we'd like to eliminate them. However, if any of the non-identity source overlaps the live interval of the phi join then the coalescer won't be able to coalesce them. The early coalescer's job is to eliminate the identity copies by partially-coalescing the two live intervals. Modified: llvm/trunk/include/llvm/CodeGen/LiveInterval.h llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Modified: llvm/trunk/include/llvm/CodeGen/LiveInterval.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveInterval.h?rev=81796&r1=81795&r2=81796&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/LiveInterval.h (original) +++ llvm/trunk/include/llvm/CodeGen/LiveInterval.h Mon Sep 14 16:33:42 2009 @@ -584,7 +584,6 @@ /// for the Value number. VNInfo *createValueCopy(const VNInfo *orig, BumpPtrAllocator &VNInfoAllocator) { - VNInfo *VNI = static_cast(VNInfoAllocator.Allocate((unsigned)sizeof(VNInfo), alignof())); Modified: llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h?rev=81796&r1=81795&r2=81796&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h (original) +++ llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h Mon Sep 14 16:33:42 2009 @@ -65,9 +65,6 @@ AliasAnalysis *aa_; LiveVariables* lv_; - - - /// Special pool allocator for VNInfo's (LiveInterval val#). /// BumpPtrAllocator VNInfoAllocator; @@ -94,9 +91,14 @@ DenseMap terminatorGaps; + /// phiJoinCopies - Copy instructions which are PHI joins. + SmallVector phiJoinCopies; + + /// allocatableRegs_ - A bit vector of allocatable registers. BitVector allocatableRegs_; - std::vector ClonedMIs; + /// CloneMIs - A list of clones as result of re-materialization. + std::vector CloneMIs; typedef LiveInterval::InstrSlots InstrSlots; @@ -430,7 +432,14 @@ private: /// computeIntervals - Compute live intervals. void computeIntervals(); - + + bool isProfitableToCoalesce(LiveInterval &DstInt, LiveInterval &SrcInt, + SmallVector &IdentCopies, + SmallVector &OtherCopies, + bool &HaveConflict); + + void performEarlyCoalescing(); + /// handleRegisterDef - update intervals for a register def /// (calls handlePhysicalRegisterDef and /// handleVirtualRegisterDef) @@ -560,7 +569,8 @@ static LiveInterval* createInterval(unsigned Reg); - void printRegName(unsigned reg) const; + void printInstrs(raw_ostream &O) const; + void dumpInstrs() const; }; } // End llvm namespace Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=81796&r1=81795&r2=81796&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original) +++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Mon Sep 14 16:33:42 2009 @@ -49,19 +49,20 @@ static cl::opt DisableReMat("disable-rematerialization", cl::init(false), cl::Hidden); -static cl::opt SplitAtBB("split-intervals-at-bb", - cl::init(true), cl::Hidden); -static cl::opt SplitLimit("split-limit", - cl::init(-1), cl::Hidden); - static cl::opt EnableAggressiveRemat("aggressive-remat", cl::Hidden); static cl::opt EnableFastSpilling("fast-spill", cl::init(false), cl::Hidden); -STATISTIC(numIntervals, "Number of original intervals"); -STATISTIC(numFolds , "Number of loads/stores folded into instructions"); -STATISTIC(numSplits , "Number of intervals split"); +static cl::opt EarlyCoalescing("early-coalescing", cl::init(false)); + +static cl::opt CoalescingLimit("early-coalescing-limit", + cl::init(-1), cl::Hidden); + +STATISTIC(numIntervals , "Number of original intervals"); +STATISTIC(numFolds , "Number of loads/stores folded into instructions"); +STATISTIC(numSplits , "Number of intervals split"); +STATISTIC(numCoalescing, "Number of early coalescing performed"); char LiveIntervals::ID = 0; static RegisterPass X("liveintervals", "Live Interval Analysis"); @@ -96,12 +97,13 @@ i2miMap_.clear(); r2iMap_.clear(); terminatorGaps.clear(); + phiJoinCopies.clear(); // Release VNInfo memroy regions after all VNInfo objects are dtor'd. VNInfoAllocator.Reset(); - while (!ClonedMIs.empty()) { - MachineInstr *MI = ClonedMIs.back(); - ClonedMIs.pop_back(); + while (!CloneMIs.empty()) { + MachineInstr *MI = CloneMIs.back(); + CloneMIs.pop_back(); mf_->DeleteMachineInstr(MI); } } @@ -264,6 +266,7 @@ mi2iMap_.clear(); i2miMap_.clear(); terminatorGaps.clear(); + phiJoinCopies.clear(); FunctionSize = 0; @@ -518,6 +521,7 @@ processImplicitDefs(); computeNumbering(); computeIntervals(); + performEarlyCoalescing(); numIntervals += getNumIntervals(); @@ -533,6 +537,10 @@ OS << "\n"; } + printInstrs(OS); +} + +void LiveIntervals::printInstrs(raw_ostream &OS) const { OS << "********** MACHINEINSTRS **********\n"; for (MachineFunction::iterator mbbi = mf_->begin(), mbbe = mf_->end(); @@ -545,6 +553,10 @@ } } +void LiveIntervals::dumpInstrs() const { + printInstrs(errs()); +} + /// conflictsWithPhysRegDef - Returns true if the specified register /// is defined during the duration of the specified interval. bool LiveIntervals::conflictsWithPhysRegDef(const LiveInterval &li, @@ -626,7 +638,7 @@ } -void LiveIntervals::printRegName(unsigned reg) const { +static void printRegName(unsigned reg, const TargetRegisterInfo* tri_) { if (TargetRegisterInfo::isPhysicalRegister(reg)) errs() << tri_->getName(reg); else @@ -641,7 +653,7 @@ LiveInterval &interval) { DEBUG({ errs() << "\t\tregister: "; - printRegName(interval.reg); + printRegName(interval.reg, tri_); }); // Virtual registers may be defined multiple times (due to phi @@ -789,12 +801,10 @@ // first redefinition of the vreg that we have seen, go back and change // the live range in the PHI block to be a different value number. if (interval.containsOneValue()) { - assert(vi.Kills.size() == 1 && - "PHI elimination vreg should have one kill, the PHI itself!"); - // Remove the old range that we now know has an incorrect number. VNInfo *VNI = interval.getValNumInfo(0); MachineInstr *Killer = vi.Kills[0]; + phiJoinCopies.push_back(Killer); MachineInstrIndex Start = getMBBStartIdx(Killer->getParent()); MachineInstrIndex End = getNextSlot(getUseIndex(getInstructionIndex(Killer))); @@ -805,7 +815,7 @@ }); interval.removeRange(Start, End); assert(interval.ranges.size() == 1 && - "newly discovered PHI interval has >1 ranges."); + "Newly discovered PHI interval has >1 ranges."); MachineBasicBlock *killMBB = getMBBFromIndex(interval.endIndex()); VNI->addKill(terminatorGaps[killMBB]); VNI->setHasPHIKill(true); @@ -835,7 +845,7 @@ MachineInstrIndex defIndex = getDefIndex(MIIdx); if (MO.isEarlyClobber()) defIndex = getUseIndex(MIIdx); - + VNInfo *ValNo; MachineInstr *CopyMI = NULL; unsigned SrcReg, DstReg, SrcSubReg, DstSubReg; @@ -868,7 +878,7 @@ // lifetime must end somewhere in its defining basic block. DEBUG({ errs() << "\t\tregister: "; - printRegName(interval.reg); + printRegName(interval.reg, tri_); }); MachineInstrIndex baseIndex = MIIdx; @@ -977,7 +987,7 @@ LiveInterval &interval, bool isAlias) { DEBUG({ errs() << "\t\tlivein register: "; - printRegName(interval.reg); + printRegName(interval.reg, tri_); }); // Look for kills, if it reaches a def before it's killed, then it shouldn't @@ -1039,6 +1049,138 @@ DEBUG(errs() << " +" << LR << '\n'); } +bool +LiveIntervals::isProfitableToCoalesce(LiveInterval &DstInt, LiveInterval &SrcInt, + SmallVector &IdentCopies, + SmallVector &OtherCopies, + bool &HaveConflict) { + HaveConflict = false; + + unsigned NumIdent = 0; + unsigned NumSources = 0; + for (MachineRegisterInfo::reg_iterator ri = mri_->reg_begin(SrcInt.reg), + re = mri_->reg_end(); ri != re; ++ri) { + MachineOperand &O = ri.getOperand(); + if (!O.isDef()) + continue; + + ++NumSources; + MachineInstr *MI = &*ri; + unsigned SrcReg, DstReg, SrcSubReg, DstSubReg; + if (!tii_->isMoveInstr(*MI, SrcReg, DstReg, SrcSubReg, DstSubReg)) + continue; + if (SrcReg != DstInt.reg) { + OtherCopies.push_back(MI); + HaveConflict |= DstInt.liveAt(getInstructionIndex(MI)); + } else { + IdentCopies.push_back(MI); + ++NumIdent; + } + } + + return NumSources >= 5 && (((float)NumIdent) / NumSources) > 0.20F; +} + +void LiveIntervals::performEarlyCoalescing() { + if (!EarlyCoalescing) + return; + + /// Perform early coalescing: eliminate copies which feed into phi joins + /// and whose sources are defined by the phi joins. + for (unsigned i = 0, e = phiJoinCopies.size(); i != e; ++i) { + MachineInstr *Join = phiJoinCopies[i]; + if (CoalescingLimit != -1 && (int)numCoalescing == CoalescingLimit) + break; + + unsigned PHISrc, PHIDst, SrcSubReg, DstSubReg; + bool isMove= tii_->isMoveInstr(*Join, PHISrc, PHIDst, SrcSubReg, DstSubReg); +#ifndef NDEBUG + assert(isMove && "PHI join instruction must be a move!"); +#else + isMove = isMove; +#endif + + LiveInterval &DstInt = getInterval(PHIDst); + LiveInterval &SrcInt = getInterval(PHISrc); + SmallVector IdentCopies; + SmallVector OtherCopies; + bool HaveConflict; + if (!isProfitableToCoalesce(DstInt, SrcInt, IdentCopies, OtherCopies, + HaveConflict)) + continue; + + DEBUG(errs() << "PHI Join: " << *Join); + assert(DstInt.containsOneValue() && "PHI join should have just one val#!"); + VNInfo *VNI = DstInt.getValNumInfo(0); + VNInfo *NewVNI = HaveConflict + ? 0 : SrcInt.getNextValue(VNI->def, 0, false, VNInfoAllocator); + // Now let's eliminate all the would-be identity copies. + for (unsigned i = 0, e = IdentCopies.size(); i != e; ++i) { + MachineInstr *PHICopy = IdentCopies[i]; + DEBUG(errs() << "Coalescing: " << *PHICopy); + + MachineBasicBlock *PHIMBB = PHICopy->getParent(); + MachineInstrIndex MIIndex = getInstructionIndex(PHICopy); + MachineInstrIndex DefIndex = getDefIndex(MIIndex); + LiveRange *SLR = SrcInt.getLiveRangeContaining(DefIndex); + MachineInstrIndex StartIndex = HaveConflict + ? SLR->start : getMBBStartIdx(PHIMBB); + MachineInstrIndex EndIndex = SLR->end; + + // Delete val# defined by the now identity copy and add the range from + // beginning of the mbb to the end of the range. + SrcInt.removeValNo(SLR->valno); + if (HaveConflict) { + DEBUG(errs() << " added range [" << StartIndex << ',' + << EndIndex << "] to reg" << DstInt.reg << '\n'); + DstInt.addRange(LiveRange(StartIndex, EndIndex, VNI)); + // FIXME: Update uses of src to dst in this range? + } else { + DEBUG(errs() << " added range [" << StartIndex << ',' + << SLR->start << "] to reg" << SrcInt.reg << '\n'); + SrcInt.addRange(LiveRange(StartIndex, EndIndex, NewVNI)); + if (PHICopy->killsRegister(PHIDst)) + EndIndex = DefIndex; + DstInt.removeRange(StartIndex, EndIndex); + } + RemoveMachineInstrFromMaps(PHICopy); + PHICopy->eraseFromParent(); + } + if (HaveConflict) { + // First unset the kill. + for (unsigned i = 0, e = Join->getNumOperands(); i != e; ++i) { + MachineOperand &O = Join->getOperand(i); + if (!O.isReg() || O.getReg() != PHISrc) + continue; + if (O.isKill()) + O.setIsKill(false); + } + MachineInstrIndex MIIndex = getInstructionIndex(Join); + MachineInstrIndex UseIndex = getUseIndex(MIIndex); + MachineInstrIndex DefIndex = getDefIndex(MIIndex); + LiveRange *SLR = SrcInt.getLiveRangeContaining(UseIndex); + LiveRange *DLR = DstInt.getLiveRangeContaining(DefIndex); + SrcInt.addRange(LiveRange(DLR->start, DLR->end, SLR->valno)); + } else { + SrcInt.MergeValueInAsValue(DstInt, VNI, NewVNI); + + // Change all references of phi source to destination. + for (MachineRegisterInfo::reg_iterator ri = mri_->reg_begin(PHIDst), + re = mri_->reg_end(); ri != re; ) { + MachineOperand &O = ri.getOperand(); + ++ri; + O.setReg(PHISrc); + } + removeInterval(DstInt.reg); + + RemoveMachineInstrFromMaps(Join); + Join->eraseFromParent(); + } + + ++numCoalescing; + } +} + /// computeIntervals - computes the live intervals for virtual /// registers. for some ordering of the machine instructions [1,N] a /// live interval is an interval [i, j) where 1 <= i <= j < N for @@ -2230,9 +2372,7 @@ return NewLIs; } - bool TrySplit = SplitAtBB && !intervalIsInOneMBB(li); - if (SplitLimit != -1 && (int)numSplits >= SplitLimit) - TrySplit = false; + bool TrySplit = !intervalIsInOneMBB(li); if (TrySplit) ++numSplits; bool NeedStackSlot = false; @@ -2251,7 +2391,7 @@ ReMatOrigDefs[VN] = ReMatDefMI; // Original def may be modified so we have to make a copy here. MachineInstr *Clone = mf_->CloneMachineInstr(ReMatDefMI); - ClonedMIs.push_back(Clone); + CloneMIs.push_back(Clone); ReMatDefs[VN] = Clone; bool CanDelete = true; From wendling at apple.com Mon Sep 14 16:36:45 2009 From: wendling at apple.com (Bill Wendling) Date: Mon, 14 Sep 2009 14:36:45 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r81788 - /llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/eh1.C In-Reply-To: References: <200909142113.n8ELDnQK000590@zion.cs.uiuc.edu> Message-ID: On Sep 14, 2009, at 2:31 PM, Chris Lattner wrote: > On Sep 14, 2009, at 2:13 PM, Eric Christopher wrote: > >> Author: echristo >> Date: Mon Sep 14 16:13:49 2009 >> New Revision: 81788 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=81788&view=rev >> Log: >> Update this test, the except table is now in the data section. > > But that is a "bug", so we want the test to continue failing? > "Bug" is a bit harsh. :-) It's just not very optimal. Plastering a "FIXME" in there with the radar number would be fine, perhaps? -bw From echristo at apple.com Mon Sep 14 16:39:27 2009 From: echristo at apple.com (Eric Christopher) Date: Mon, 14 Sep 2009 14:39:27 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r81788 - /llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/eh1.C In-Reply-To: References: <200909142113.n8ELDnQK000590@zion.cs.uiuc.edu> Message-ID: <0F0E8899-5FF6-4605-8F4C-492718DC94E4@apple.com> On Sep 14, 2009, at 2:36 PM, Bill Wendling wrote: > On Sep 14, 2009, at 2:31 PM, Chris Lattner wrote: > >> On Sep 14, 2009, at 2:13 PM, Eric Christopher wrote: >> >>> Author: echristo >>> Date: Mon Sep 14 16:13:49 2009 >>> New Revision: 81788 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=81788&view=rev >>> Log: >>> Update this test, the except table is now in the data section. >> >> But that is a "bug", so we want the test to continue failing? >> > "Bug" is a bit harsh. :-) It's just not very optimal. Plastering a > "FIXME" in there with the radar number > would be fine, perhaps? Mmm.. either way. I'm happy to revert as it's a bug by that definition :) -eric From idadesub at users.sourceforge.net Mon Sep 14 16:54:15 2009 From: idadesub at users.sourceforge.net (Erick Tryzelaar) Date: Mon, 14 Sep 2009 21:54:15 -0000 Subject: [llvm-commits] [llvm] r81799 - in /llvm/trunk/docs/tutorial: OCamlLangImpl4.html OCamlLangImpl5.html OCamlLangImpl6.html OCamlLangImpl7.html Message-ID: <200909142154.n8ELsG6x006016@zion.cs.uiuc.edu> Author: erickt Date: Mon Sep 14 16:54:15 2009 New Revision: 81799 URL: http://llvm.org/viewvc/llvm-project?rev=81799&view=rev Log: Make sure to initialize the fpm in the ocaml tutorial. Modified: llvm/trunk/docs/tutorial/OCamlLangImpl4.html llvm/trunk/docs/tutorial/OCamlLangImpl5.html llvm/trunk/docs/tutorial/OCamlLangImpl6.html llvm/trunk/docs/tutorial/OCamlLangImpl7.html Modified: llvm/trunk/docs/tutorial/OCamlLangImpl4.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/OCamlLangImpl4.html?rev=81799&r1=81798&r2=81799&view=diff ============================================================================== --- llvm/trunk/docs/tutorial/OCamlLangImpl4.html (original) +++ llvm/trunk/docs/tutorial/OCamlLangImpl4.html Mon Sep 14 16:54:15 2009 @@ -206,6 +206,8 @@ (* Simplify the control flow graph (deleting unreachable blocks, etc). *) add_cfg_simplification the_fpm; + ignore (PassManager.initialize the_fpm); + (* Run the main "interpreter loop" now. *) Toplevel.main_loop the_fpm the_execution_engine stream; @@ -992,6 +994,8 @@ (* Simplify the control flow graph (deleting unreachable blocks, etc). *) add_cfg_simplification the_fpm; + ignore (PassManager.initialize the_fpm); + (* Run the main "interpreter loop" now. *) Toplevel.main_loop the_fpm the_execution_engine stream; Modified: llvm/trunk/docs/tutorial/OCamlLangImpl5.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/OCamlLangImpl5.html?rev=81799&r1=81798&r2=81799&view=diff ============================================================================== --- llvm/trunk/docs/tutorial/OCamlLangImpl5.html (original) +++ llvm/trunk/docs/tutorial/OCamlLangImpl5.html Mon Sep 14 16:54:15 2009 @@ -1519,6 +1519,8 @@ (* Simplify the control flow graph (deleting unreachable blocks, etc). *) add_cfg_simplification the_fpm; + ignore (PassManager.initialize the_fpm); + (* Run the main "interpreter loop" now. *) Toplevel.main_loop the_fpm the_execution_engine stream; Modified: llvm/trunk/docs/tutorial/OCamlLangImpl6.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/OCamlLangImpl6.html?rev=81799&r1=81798&r2=81799&view=diff ============================================================================== --- llvm/trunk/docs/tutorial/OCamlLangImpl6.html (original) +++ llvm/trunk/docs/tutorial/OCamlLangImpl6.html Mon Sep 14 16:54:15 2009 @@ -1518,6 +1518,8 @@ (* Simplify the control flow graph (deleting unreachable blocks, etc). *) add_cfg_simplification the_fpm; + ignore (PassManager.initialize the_fpm); + (* Run the main "interpreter loop" now. *) Toplevel.main_loop the_fpm the_execution_engine stream; Modified: llvm/trunk/docs/tutorial/OCamlLangImpl7.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/OCamlLangImpl7.html?rev=81799&r1=81798&r2=81799&view=diff ============================================================================== --- llvm/trunk/docs/tutorial/OCamlLangImpl7.html (original) +++ llvm/trunk/docs/tutorial/OCamlLangImpl7.html Mon Sep 14 16:54:15 2009 @@ -1852,6 +1852,8 @@ (* Simplify the control flow graph (deleting unreachable blocks, etc). *) add_cfg_simplification the_fpm; + ignore (PassManager.initialize the_fpm); + (* Run the main "interpreter loop" now. *) Toplevel.main_loop the_fpm the_execution_engine stream; From idadesub at users.sourceforge.net Mon Sep 14 16:54:32 2009 From: idadesub at users.sourceforge.net (Erick Tryzelaar) Date: Mon, 14 Sep 2009 21:54:32 -0000 Subject: [llvm-commits] [llvm] r81800 - in /llvm/trunk: bindings/ocaml/executionengine/executionengine_ocaml.c bindings/ocaml/executionengine/llvm_executionengine.ml bindings/ocaml/executionengine/llvm_executionengine.mli docs/tutorial/OCamlLangImpl4.html docs/tutorial/OCamlLangImpl5.html docs/tutorial/OCamlLangImpl6.html docs/tutorial/OCamlLangImpl7.html Message-ID: <200909142154.n8ELsWWG006068@zion.cs.uiuc.edu> Author: erickt Date: Mon Sep 14 16:54:32 2009 New Revision: 81800 URL: http://llvm.org/viewvc/llvm-project?rev=81800&view=rev Log: Expose initializing the native target for the execution engine. Modified: llvm/trunk/bindings/ocaml/executionengine/executionengine_ocaml.c llvm/trunk/bindings/ocaml/executionengine/llvm_executionengine.ml llvm/trunk/bindings/ocaml/executionengine/llvm_executionengine.mli llvm/trunk/docs/tutorial/OCamlLangImpl4.html llvm/trunk/docs/tutorial/OCamlLangImpl5.html llvm/trunk/docs/tutorial/OCamlLangImpl6.html llvm/trunk/docs/tutorial/OCamlLangImpl7.html Modified: llvm/trunk/bindings/ocaml/executionengine/executionengine_ocaml.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/executionengine/executionengine_ocaml.c?rev=81800&r1=81799&r2=81800&view=diff ============================================================================== --- llvm/trunk/bindings/ocaml/executionengine/executionengine_ocaml.c (original) +++ llvm/trunk/bindings/ocaml/executionengine/executionengine_ocaml.c Mon Sep 14 16:54:32 2009 @@ -24,11 +24,15 @@ #include #include -/* Force the LLVM interpreter, JIT, and native target to be linked in. */ +/* Force the LLVM interpreter and JIT to be linked in. */ void llvm_initialize(void) { LLVMLinkInInterpreter(); LLVMLinkInJIT(); - LLVMInitializeNativeTarget(); +} + +/* unit -> bool */ +CAMLprim value llvm_initialize_native_target(value Unit) { + return Val_bool(LLVMInitializeNativeTarget()); } /* Can't use the recommended caml_named_value mechanism for backwards Modified: llvm/trunk/bindings/ocaml/executionengine/llvm_executionengine.ml URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/executionengine/llvm_executionengine.ml?rev=81800&r1=81799&r2=81800&view=diff ============================================================================== --- llvm/trunk/bindings/ocaml/executionengine/llvm_executionengine.ml (original) +++ llvm/trunk/bindings/ocaml/executionengine/llvm_executionengine.ml Mon Sep 14 16:54:32 2009 @@ -109,3 +109,6 @@ *) end + +external initialize_native_target : unit -> bool + = "llvm_initialize_native_target" Modified: llvm/trunk/bindings/ocaml/executionengine/llvm_executionengine.mli URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/executionengine/llvm_executionengine.mli?rev=81800&r1=81799&r2=81800&view=diff ============================================================================== --- llvm/trunk/bindings/ocaml/executionengine/llvm_executionengine.mli (original) +++ llvm/trunk/bindings/ocaml/executionengine/llvm_executionengine.mli Mon Sep 14 16:54:32 2009 @@ -161,3 +161,6 @@ [ee]. *) val target_data: t -> Llvm_target.TargetData.t end + +external initialize_native_target : unit -> bool + = "llvm_initialize_native_target" Modified: llvm/trunk/docs/tutorial/OCamlLangImpl4.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/OCamlLangImpl4.html?rev=81800&r1=81799&r2=81800&view=diff ============================================================================== --- llvm/trunk/docs/tutorial/OCamlLangImpl4.html (original) +++ llvm/trunk/docs/tutorial/OCamlLangImpl4.html Mon Sep 14 16:54:32 2009 @@ -962,6 +962,8 @@ open Llvm_scalar_opts let main () = + ignore (initialize_native_target ()); + (* Install standard binary operators. * 1 is the lowest precedence. *) Hashtbl.add Parser.binop_precedence '<' 10; Modified: llvm/trunk/docs/tutorial/OCamlLangImpl5.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/OCamlLangImpl5.html?rev=81800&r1=81799&r2=81800&view=diff ============================================================================== --- llvm/trunk/docs/tutorial/OCamlLangImpl5.html (original) +++ llvm/trunk/docs/tutorial/OCamlLangImpl5.html Mon Sep 14 16:54:32 2009 @@ -1487,6 +1487,8 @@ open Llvm_scalar_opts let main () = + ignore (initialize_native_target ()); + (* Install standard binary operators. * 1 is the lowest precedence. *) Hashtbl.add Parser.binop_precedence '<' 10; Modified: llvm/trunk/docs/tutorial/OCamlLangImpl6.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/OCamlLangImpl6.html?rev=81800&r1=81799&r2=81800&view=diff ============================================================================== --- llvm/trunk/docs/tutorial/OCamlLangImpl6.html (original) +++ llvm/trunk/docs/tutorial/OCamlLangImpl6.html Mon Sep 14 16:54:32 2009 @@ -1486,6 +1486,8 @@ open Llvm_scalar_opts let main () = + ignore (initialize_native_target ()); + (* Install standard binary operators. * 1 is the lowest precedence. *) Hashtbl.add Parser.binop_precedence '<' 10; Modified: llvm/trunk/docs/tutorial/OCamlLangImpl7.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/OCamlLangImpl7.html?rev=81800&r1=81799&r2=81800&view=diff ============================================================================== --- llvm/trunk/docs/tutorial/OCamlLangImpl7.html (original) +++ llvm/trunk/docs/tutorial/OCamlLangImpl7.html Mon Sep 14 16:54:32 2009 @@ -1816,6 +1816,8 @@ open Llvm_scalar_opts let main () = + ignore (initialize_native_target ()); + (* Install standard binary operators. * 1 is the lowest precedence. *) Hashtbl.add Parser.binop_precedence '=' 2; From mrs at apple.com Mon Sep 14 16:58:46 2009 From: mrs at apple.com (Mike Stump) Date: Mon, 14 Sep 2009 14:58:46 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r81788 - /llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/eh1.C In-Reply-To: <0F0E8899-5FF6-4605-8F4C-492718DC94E4@apple.com> References: <200909142113.n8ELDnQK000590@zion.cs.uiuc.edu> <0F0E8899-5FF6-4605-8F4C-492718DC94E4@apple.com> Message-ID: <5650EAC4-4B8F-4FEB-BE0A-AF5E0FE2A101@apple.com> On Sep 14, 2009, at 2:39 PM, Eric Christopher wrote: > Mmm.. either way. I'm happy to revert as it's a bug by that > definition :) Reversion is best I think as I suspect there are many failures in the testsuite. The thing being tested is actually a feature of gcc. Testing for a non-feature, would be odd. If you wanted to test results to be cleaner, you can mark it as expected. I can dig up the older radar number for when we switched gcc to text, if you want (please don't ask though). From echristo at apple.com Mon Sep 14 17:07:32 2009 From: echristo at apple.com (Eric Christopher) Date: Mon, 14 Sep 2009 15:07:32 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r81788 - /llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/eh1.C In-Reply-To: <5650EAC4-4B8F-4FEB-BE0A-AF5E0FE2A101@apple.com> References: <200909142113.n8ELDnQK000590@zion.cs.uiuc.edu> <0F0E8899-5FF6-4605-8F4C-492718DC94E4@apple.com> <5650EAC4-4B8F-4FEB-BE0A-AF5E0FE2A101@apple.com> Message-ID: <74AAF02F-4ECA-4522-BE03-19EB3D1EFC78@apple.com> On Sep 14, 2009, at 2:58 PM, Mike Stump wrote: > On Sep 14, 2009, at 2:39 PM, Eric Christopher wrote: >> Mmm.. either way. I'm happy to revert as it's a bug by that >> definition :) > > Reversion is best I think as I suspect there are many failures in > the testsuite. The thing being tested is actually a feature of > gcc. Testing for a non-feature, would be odd. If you wanted to > test results to be cleaner, you can mark it as expected. I can dig > up the older radar number for when we switched gcc to text, if you > want (please don't ask though). Nah. At any rate, I'm talking with Bill about it. -eric From kledzik at apple.com Mon Sep 14 18:26:56 2009 From: kledzik at apple.com (Nick Kledzik) Date: Mon, 14 Sep 2009 23:26:56 -0000 Subject: [llvm-commits] [compiler-rt] r81809 - in /compiler-rt/trunk: lib/arm/ test/Unit/ Message-ID: <200909142326.n8ENQv9B018505@zion.cs.uiuc.edu> Author: kledzik Date: Mon Sep 14 18:26:56 2009 New Revision: 81809 URL: http://llvm.org/viewvc/llvm-project?rev=81809&view=rev Log: add conversion functions and test cases for ARM Added: compiler-rt/trunk/lib/arm/extendsfdf2vfp.S compiler-rt/trunk/lib/arm/fixdfsivfp.S compiler-rt/trunk/lib/arm/fixsfsivfp.S compiler-rt/trunk/lib/arm/fixunsdfsivfp.S compiler-rt/trunk/lib/arm/fixunssfsivfp.S compiler-rt/trunk/lib/arm/floatsidfvfp.S compiler-rt/trunk/lib/arm/floatsisfvfp.S compiler-rt/trunk/lib/arm/floatunssidfvfp.S compiler-rt/trunk/lib/arm/floatunssisfvfp.S compiler-rt/trunk/lib/arm/truncdfsf2vfp.S compiler-rt/trunk/test/Unit/extebdsfdf2vfp_test.c compiler-rt/trunk/test/Unit/fixdfsivfp_test.c compiler-rt/trunk/test/Unit/fixsfsivfp_test.c compiler-rt/trunk/test/Unit/fixunsdfsivfp_test.c compiler-rt/trunk/test/Unit/fixunssfsivfp_test.c compiler-rt/trunk/test/Unit/floatsidfvfp_test.c compiler-rt/trunk/test/Unit/floatsisfvfp_test.c compiler-rt/trunk/test/Unit/floatunssidfvfp_test.c compiler-rt/trunk/test/Unit/floatunssisfvfp_test.c compiler-rt/trunk/test/Unit/truncdfsf2vfp_test.c Added: compiler-rt/trunk/lib/arm/extendsfdf2vfp.S URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/arm/extendsfdf2vfp.S?rev=81809&view=auto ============================================================================== --- compiler-rt/trunk/lib/arm/extendsfdf2vfp.S (added) +++ compiler-rt/trunk/lib/arm/extendsfdf2vfp.S Mon Sep 14 18:26:56 2009 @@ -0,0 +1,23 @@ +//===-- extendsfdf2vfp.S - Implement extendsfdf2vfp -----------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + + +// +// extern double __extendsfdf2vfp(float a); +// +// Converts single precision float to double precision result. +// Uses Darwin calling convention where a single precision parameter is +// passed in a GPR and a double precision result is returned in R0/R1 pair. +// + .globl ___extendsfdf2vfp +___extendsfdf2vfp: + fmsr s15, r0 // load float register from R0 + fcvtds d7, s15 // convert single to double + fmrrd r0, r1, d7 // return result in r0/r1 pair + bx lr Added: compiler-rt/trunk/lib/arm/fixdfsivfp.S URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/arm/fixdfsivfp.S?rev=81809&view=auto ============================================================================== --- compiler-rt/trunk/lib/arm/fixdfsivfp.S (added) +++ compiler-rt/trunk/lib/arm/fixdfsivfp.S Mon Sep 14 18:26:56 2009 @@ -0,0 +1,23 @@ +//===-- fixdfsivfp.S - Implement fixdfsivfp -----------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + + +// +// extern int __fixdfsivfp(double a); +// +// Converts double precision float to a 32-bit int rounding towards zero. +// Uses Darwin calling convention where a double precision parameter is +// passed in GPR register pair. +// + .globl ___fixdfsivfp +___fixdfsivfp: + fmdrr d7, r0, r1 // load double register from R0/R1 + ftosizd s15, d7 // convert double to 32-bit int into s15 + fmrs r0, s15 // move s15 to result register + bx lr Added: compiler-rt/trunk/lib/arm/fixsfsivfp.S URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/arm/fixsfsivfp.S?rev=81809&view=auto ============================================================================== --- compiler-rt/trunk/lib/arm/fixsfsivfp.S (added) +++ compiler-rt/trunk/lib/arm/fixsfsivfp.S Mon Sep 14 18:26:56 2009 @@ -0,0 +1,23 @@ +//===-- fixsfsivfp.S - Implement fixsfsivfp -----------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + + +// +// extern int __fixsfsivfp(float a); +// +// Converts single precision float to a 32-bit int rounding towards zero. +// Uses Darwin calling convention where a single precision parameter is +// passed in a GPR.. +// + .globl ___fixsfsivfp +___fixsfsivfp: + fmsr s15, r0 // load float register from R0 + ftosizs s15, s15 // convert single to 32-bit int into s15 + fmrs r0, s15 // move s15 to result register + bx lr Added: compiler-rt/trunk/lib/arm/fixunsdfsivfp.S URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/arm/fixunsdfsivfp.S?rev=81809&view=auto ============================================================================== --- compiler-rt/trunk/lib/arm/fixunsdfsivfp.S (added) +++ compiler-rt/trunk/lib/arm/fixunsdfsivfp.S Mon Sep 14 18:26:56 2009 @@ -0,0 +1,24 @@ +//===-- fixunsdfsivfp.S - Implement fixunsdfsivfp -------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + + +// +// extern unsigned int __fixunsdfsivfp(double a); +// +// Converts double precision float to a 32-bit unsigned int rounding towards +// zero. All negative values become zero. +// Uses Darwin calling convention where a double precision parameter is +// passed in GPR register pair. +// + .globl ___fixunsdfsivfp +___fixunsdfsivfp: + fmdrr d7, r0, r1 // load double register from R0/R1 + ftouizd s15, d7 // convert double to 32-bit int into s15 + fmrs r0, s15 // move s15 to result register + bx lr Added: compiler-rt/trunk/lib/arm/fixunssfsivfp.S URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/arm/fixunssfsivfp.S?rev=81809&view=auto ============================================================================== --- compiler-rt/trunk/lib/arm/fixunssfsivfp.S (added) +++ compiler-rt/trunk/lib/arm/fixunssfsivfp.S Mon Sep 14 18:26:56 2009 @@ -0,0 +1,24 @@ +//===-- fixunssfsivfp.S - Implement fixunssfsivfp -------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + + +// +// extern unsigned int __fixunssfsivfp(float a); +// +// Converts single precision float to a 32-bit unsigned int rounding towards +// zero. All negative values become zero. +// Uses Darwin calling convention where a single precision parameter is +// passed in a GPR.. +// + .globl ___fixunssfsivfp +___fixunssfsivfp: + fmsr s15, r0 // load float register from R0 + ftouizs s15, s15 // convert single to 32-bit unsigned into s15 + fmrs r0, s15 // move s15 to result register + bx lr Added: compiler-rt/trunk/lib/arm/floatsidfvfp.S URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/arm/floatsidfvfp.S?rev=81809&view=auto ============================================================================== --- compiler-rt/trunk/lib/arm/floatsidfvfp.S (added) +++ compiler-rt/trunk/lib/arm/floatsidfvfp.S Mon Sep 14 18:26:56 2009 @@ -0,0 +1,23 @@ +//===-- floatsidfvfp.S - Implement floatsidfvfp ---------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + + +// +// extern double __floatsidfvfp(int a); +// +// Converts a 32-bit int to a double precision float. +// Uses Darwin calling convention where a double precision result is +// return in GPR register pair. +// + .globl ___floatsidfvfp +___floatsidfvfp: + fmsr s15, r0 // move int to float register s15 + fsitod d7, s15 // convert 32-bit int in s15 to double in d7 + fmrrd r0, r1, d7 // move d7 to result register pair r0/r1 + bx lr Added: compiler-rt/trunk/lib/arm/floatsisfvfp.S URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/arm/floatsisfvfp.S?rev=81809&view=auto ============================================================================== --- compiler-rt/trunk/lib/arm/floatsisfvfp.S (added) +++ compiler-rt/trunk/lib/arm/floatsisfvfp.S Mon Sep 14 18:26:56 2009 @@ -0,0 +1,23 @@ +//===-- floatsisfvfp.S - Implement floatsisfvfp ---------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + + +// +// extern float __floatsisfvfp(int a); +// +// Converts single precision float to a 32-bit int rounding towards zero. +// Uses Darwin calling convention where a single precision result is +// return in a GPR.. +// + .globl ___floatsisfvfp +___floatsisfvfp: + fmsr s15, r0 // move int to float register s15 + fsitos s15, s15 // convert 32-bit int in s15 to float in s15 + fmrs r0, s15 // move s15 to result register + bx lr Added: compiler-rt/trunk/lib/arm/floatunssidfvfp.S URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/arm/floatunssidfvfp.S?rev=81809&view=auto ============================================================================== --- compiler-rt/trunk/lib/arm/floatunssidfvfp.S (added) +++ compiler-rt/trunk/lib/arm/floatunssidfvfp.S Mon Sep 14 18:26:56 2009 @@ -0,0 +1,23 @@ +//===-- floatunssidfvfp.S - Implement floatunssidfvfp ---------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + + +// +// extern double __floatunssidfvfp(unsigned int a); +// +// Converts a 32-bit int to a double precision float. +// Uses Darwin calling convention where a double precision result is +// return in GPR register pair. +// + .globl ___floatunssidfvfp +___floatunssidfvfp: + fmsr s15, r0 // move int to float register s15 + fuitod d7, s15 // convert 32-bit int in s15 to double in d7 + fmrrd r0, r1, d7 // move d7 to result register pair r0/r1 + bx lr Added: compiler-rt/trunk/lib/arm/floatunssisfvfp.S URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/arm/floatunssisfvfp.S?rev=81809&view=auto ============================================================================== --- compiler-rt/trunk/lib/arm/floatunssisfvfp.S (added) +++ compiler-rt/trunk/lib/arm/floatunssisfvfp.S Mon Sep 14 18:26:56 2009 @@ -0,0 +1,23 @@ +//===-- floatunssisfvfp.S - Implement floatunssisfvfp ---------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + + +// +// extern float __floatunssisfvfp(unsigned int a); +// +// Converts single precision float to a 32-bit int rounding towards zero. +// Uses Darwin calling convention where a single precision result is +// return in a GPR.. +// + .globl ___floatunssisfvfp +___floatunssisfvfp: + fmsr s15, r0 // move int to float register s15 + fuitos s15, s15 // convert 32-bit int in s15 to float in s15 + fmrs r0, s15 // move s15 to result register + bx lr Added: compiler-rt/trunk/lib/arm/truncdfsf2vfp.S URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/arm/truncdfsf2vfp.S?rev=81809&view=auto ============================================================================== --- compiler-rt/trunk/lib/arm/truncdfsf2vfp.S (added) +++ compiler-rt/trunk/lib/arm/truncdfsf2vfp.S Mon Sep 14 18:26:56 2009 @@ -0,0 +1,23 @@ +//===-- truncdfsf2vfp.S - Implement truncdfsf2vfp -------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + + +// +// extern float __truncdfsf2vfp(double a); +// +// Converts double precision float to signle precision result. +// Uses Darwin calling convention where a double precision parameter is +// passed in a R0/R1 pair and a signle precision result is returned in R0. +// + .globl ___truncdfsf2vfp +___truncdfsf2vfp: + fmdrr d7, r0, r1 // load double from r0/r1 pair + fcvtsd s15, d7 // convert double to single (trucate precision) + fmrs r0, s15 // return result in r0 + bx lr Added: compiler-rt/trunk/test/Unit/extebdsfdf2vfp_test.c URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/Unit/extebdsfdf2vfp_test.c?rev=81809&view=auto ============================================================================== --- compiler-rt/trunk/test/Unit/extebdsfdf2vfp_test.c (added) +++ compiler-rt/trunk/test/Unit/extebdsfdf2vfp_test.c Mon Sep 14 18:26:56 2009 @@ -0,0 +1,46 @@ +//===-- extendsfdf2vfp_test.c - Test __extendsfdf2vfp ---------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file tests __extendsfdf2vfp for the compiler_rt library. +// +//===----------------------------------------------------------------------===// + +#include +#include +#include + + +extern double __extendsfdf2vfp(float a); + +#if __arm__ +int test__extendsfdf2vfp(float a) +{ + double actual = __extendsfdf2vfp(a); + double expected = a; + if (actual != expected) + printf("error in test__extendsfdf2vfp(%f) = %f, expected %f\n", + a, actual, expected); + return actual != expected; +} +#endif + +int main() +{ +#if __arm__ + if (test__extendsfdf2vfp(0.0)) + return 1; + if (test__extendsfdf2vfp(1.0)) + return 1; + if (test__extendsfdf2vfp(-1.0)) + return 1; + if (test__extendsfdf2vfp(3.1415926535)) + return 1; +#endif + return 0; +} Added: compiler-rt/trunk/test/Unit/fixdfsivfp_test.c URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/Unit/fixdfsivfp_test.c?rev=81809&view=auto ============================================================================== --- compiler-rt/trunk/test/Unit/fixdfsivfp_test.c (added) +++ compiler-rt/trunk/test/Unit/fixdfsivfp_test.c Mon Sep 14 18:26:56 2009 @@ -0,0 +1,48 @@ +//===-- fixdfsivfp_test.c - Test __fixdfsivfp -----------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file tests __fixdfsivfp for the compiler_rt library. +// +//===----------------------------------------------------------------------===// + +#include +#include +#include + + +extern int __fixdfsivfp(double a); + +#if __arm__ +int test__fixdfsivfp(double a) +{ + int actual = __fixdfsivfp(a); + int expected = a; + if (actual != expected) + printf("error in test__fixdfsivfp(%f) = %d, expected %d\n", + a, actual, expected); + return actual != expected; +} +#endif + +int main() +{ +#if __arm__ + if (test__fixdfsivfp(0.0)) + return 1; + if (test__fixdfsivfp(1.0)) + return 1; + if (test__fixdfsivfp(-1.0)) + return 1; + if (test__fixdfsivfp(2147483647)) + return 1; + if (test__fixdfsivfp(-2147483648.0)) + return 1; +#endif + return 0; +} Added: compiler-rt/trunk/test/Unit/fixsfsivfp_test.c URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/Unit/fixsfsivfp_test.c?rev=81809&view=auto ============================================================================== --- compiler-rt/trunk/test/Unit/fixsfsivfp_test.c (added) +++ compiler-rt/trunk/test/Unit/fixsfsivfp_test.c Mon Sep 14 18:26:56 2009 @@ -0,0 +1,50 @@ +//===-- fixsfsivfp_test.c - Test __fixsfsivfp -----------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file tests __fixsfsivfp for the compiler_rt library. +// +//===----------------------------------------------------------------------===// + +#include +#include +#include + + +extern int __fixsfsivfp(float a); + +#if __arm__ +int test__fixsfsivfp(float a) +{ + int actual = __fixsfsivfp(a); + int expected = a; + if (actual != expected) + printf("error in test__fixsfsivfp(%f) = %u, expected %u\n", + a, actual, expected); + return actual != expected; +} +#endif + +int main() +{ +#if __arm__ + if (test__fixsfsivfp(0.0)) + return 1; + if (test__fixsfsivfp(1.0)) + return 1; + if (test__fixsfsivfp(-1.0)) + return 1; + if (test__fixsfsivfp(2147483647.0)) + return 1; + if (test__fixsfsivfp(-2147483648.0)) + return 1; + if (test__fixsfsivfp(65536.0)) + return 1; +#endif + return 0; +} Added: compiler-rt/trunk/test/Unit/fixunsdfsivfp_test.c URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/Unit/fixunsdfsivfp_test.c?rev=81809&view=auto ============================================================================== --- compiler-rt/trunk/test/Unit/fixunsdfsivfp_test.c (added) +++ compiler-rt/trunk/test/Unit/fixunsdfsivfp_test.c Mon Sep 14 18:26:56 2009 @@ -0,0 +1,48 @@ +//===-- fixunsdfsivfp_test.c - Test __fixunsdfsivfp -----------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file tests __fixunsdfsivfp for the compiler_rt library. +// +//===----------------------------------------------------------------------===// + +#include +#include +#include + + +extern unsigned int __fixunsdfsivfp(double a); + +#if __arm__ +int test__fixunsdfsivfp(double a) +{ + unsigned int actual = __fixunsdfsivfp(a); + unsigned int expected = a; + if (actual != expected) + printf("error in test__fixunsdfsivfp(%f) = %u, expected %u\n", + a, actual, expected); + return actual != expected; +} +#endif + +int main() +{ +#if __arm__ + if (test__fixunsdfsivfp(0.0)) + return 1; + if (test__fixunsdfsivfp(1.0)) + return 1; + if (test__fixunsdfsivfp(-1.0)) + return 1; + if (test__fixunsdfsivfp(4294967295.0)) + return 1; + if (test__fixunsdfsivfp(65536.0)) + return 1; +#endif + return 0; +} Added: compiler-rt/trunk/test/Unit/fixunssfsivfp_test.c URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/Unit/fixunssfsivfp_test.c?rev=81809&view=auto ============================================================================== --- compiler-rt/trunk/test/Unit/fixunssfsivfp_test.c (added) +++ compiler-rt/trunk/test/Unit/fixunssfsivfp_test.c Mon Sep 14 18:26:56 2009 @@ -0,0 +1,48 @@ +//===-- fixunssfsivfp_test.c - Test __fixunssfsivfp -----------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file tests __fixunssfsivfp for the compiler_rt library. +// +//===----------------------------------------------------------------------===// + +#include +#include +#include + + +extern unsigned int __fixunssfsivfp(float a); + +#if __arm__ +int test__fixunssfsivfp(float a) +{ + unsigned int actual = __fixunssfsivfp(a); + unsigned int expected = a; + if (actual != expected) + printf("error in test__fixunssfsivfp(%f) = %u, expected %u\n", + a, actual, expected); + return actual != expected; +} +#endif + +int main() +{ +#if __arm__ + if (test__fixunssfsivfp(0.0)) + return 1; + if (test__fixunssfsivfp(1.0)) + return 1; + if (test__fixunssfsivfp(-1.0)) + return 1; + if (test__fixunssfsivfp(4294967295.0)) + return 1; + if (test__fixunssfsivfp(65536.0)) + return 1; +#endif + return 0; +} Added: compiler-rt/trunk/test/Unit/floatsidfvfp_test.c URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/Unit/floatsidfvfp_test.c?rev=81809&view=auto ============================================================================== --- compiler-rt/trunk/test/Unit/floatsidfvfp_test.c (added) +++ compiler-rt/trunk/test/Unit/floatsidfvfp_test.c Mon Sep 14 18:26:56 2009 @@ -0,0 +1,48 @@ +//===-- floatsidfvfp_test.c - Test __floatsidfvfp -------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file tests __floatsidfvfp for the compiler_rt library. +// +//===----------------------------------------------------------------------===// + +#include +#include +#include + + +extern double __floatsidfvfp(int a); + +#if __arm__ +int test__floatsidfvfp(int a) +{ + double actual = __floatsidfvfp(a); + double expected = a; + if (actual != expected) + printf("error in test__ floatsidfvfp(%d) = %f, expected %f\n", + a, actual, expected); + return actual != expected; +} +#endif + +int main() +{ +#if __arm__ + if (test__floatsidfvfp(0)) + return 1; + if (test__floatsidfvfp(1)) + return 1; + if (test__floatsidfvfp(-1)) + return 1; + if (test__floatsidfvfp(0x7FFFFFFF)) + return 1; + if (test__floatsidfvfp(0x80000000)) + return 1; +#endif + return 0; +} Added: compiler-rt/trunk/test/Unit/floatsisfvfp_test.c URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/Unit/floatsisfvfp_test.c?rev=81809&view=auto ============================================================================== --- compiler-rt/trunk/test/Unit/floatsisfvfp_test.c (added) +++ compiler-rt/trunk/test/Unit/floatsisfvfp_test.c Mon Sep 14 18:26:56 2009 @@ -0,0 +1,48 @@ +//===-- floatsisfvfp_test.c - Test __floatsisfvfp -------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file tests __floatsisfvfp for the compiler_rt library. +// +//===----------------------------------------------------------------------===// + +#include +#include +#include + + +extern float __floatsisfvfp(int a); + +#if __arm__ +int test__floatsisfvfp(int a) +{ + float actual = __floatsisfvfp(a); + float expected = a; + if (actual != expected) + printf("error in test__floatsisfvfp(%d) = %f, expected %f\n", + a, actual, expected); + return actual != expected; +} +#endif + +int main() +{ +#if __arm__ + if (test__floatsisfvfp(0)) + return 1; + if (test__floatsisfvfp(1)) + return 1; + if (test__floatsisfvfp(-1)) + return 1; + if (test__floatsisfvfp(0x7FFFFFFF)) + return 1; + if (test__floatsisfvfp(0x80000000)) + return 1; +#endif + return 0; +} Added: compiler-rt/trunk/test/Unit/floatunssidfvfp_test.c URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/Unit/floatunssidfvfp_test.c?rev=81809&view=auto ============================================================================== --- compiler-rt/trunk/test/Unit/floatunssidfvfp_test.c (added) +++ compiler-rt/trunk/test/Unit/floatunssidfvfp_test.c Mon Sep 14 18:26:56 2009 @@ -0,0 +1,48 @@ +//===-- floatunssidfvfp_test.c - Test __floatunssidfvfp -------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file tests __floatunssidfvfp for the compiler_rt library. +// +//===----------------------------------------------------------------------===// + +#include +#include +#include + + +extern double __floatunssidfvfp(unsigned int a); + +#if __arm__ +int test__floatunssidfvfp(unsigned int a) +{ + double actual = __floatunssidfvfp(a); + double expected = a; + if (actual != expected) + printf("error in test__floatunssidfvfp(%u) = %f, expected %f\n", + a, actual, expected); + return actual != expected; +} +#endif + +int main() +{ +#if __arm__ + if (test__floatunssidfvfp(0)) + return 1; + if (test__floatunssidfvfp(1)) + return 1; + if (test__floatunssidfvfp(0x7FFFFFFF)) + return 1; + if (test__floatunssidfvfp(0x80000000)) + return 1; + if (test__floatunssidfvfp(0xFFFFFFFF)) + return 1; +#endif + return 0; +} Added: compiler-rt/trunk/test/Unit/floatunssisfvfp_test.c URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/Unit/floatunssisfvfp_test.c?rev=81809&view=auto ============================================================================== --- compiler-rt/trunk/test/Unit/floatunssisfvfp_test.c (added) +++ compiler-rt/trunk/test/Unit/floatunssisfvfp_test.c Mon Sep 14 18:26:56 2009 @@ -0,0 +1,48 @@ +//===-- floatunssisfvfp_test.c - Test __floatunssisfvfp -------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file tests __floatunssisfvfp for the compiler_rt library. +// +//===----------------------------------------------------------------------===// + +#include +#include +#include + + +extern float __floatunssisfvfp(unsigned int a); + +#if __arm__ +int test__floatunssisfvfp(unsigned int a) +{ + float actual = __floatunssisfvfp(a); + float expected = a; + if (actual != expected) + printf("error in test__floatunssisfvfp(%u) = %f, expected %f\n", + a, actual, expected); + return actual != expected; +} +#endif + +int main() +{ +#if __arm__ + if (test__floatunssisfvfp(0)) + return 1; + if (test__floatunssisfvfp(1)) + return 1; + if (test__floatunssisfvfp(0x7FFFFFFF)) + return 1; + if (test__floatunssisfvfp(0x80000000)) + return 1; + if (test__floatunssisfvfp(0xFFFFFFFF)) + return 1; +#endif + return 0; +} Added: compiler-rt/trunk/test/Unit/truncdfsf2vfp_test.c URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/Unit/truncdfsf2vfp_test.c?rev=81809&view=auto ============================================================================== --- compiler-rt/trunk/test/Unit/truncdfsf2vfp_test.c (added) +++ compiler-rt/trunk/test/Unit/truncdfsf2vfp_test.c Mon Sep 14 18:26:56 2009 @@ -0,0 +1,48 @@ +//===-- truncdfsf2vfp_test.c - Test __truncdfsf2vfp -----------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file tests __truncdfsf2vfp for the compiler_rt library. +// +//===----------------------------------------------------------------------===// + +#include +#include +#include + + +extern float __truncdfsf2vfp(double a); + +#if __arm__ +int test__truncdfsf2vfp(double a) +{ + float actual = __truncdfsf2vfp(a); + float expected = a; + if (actual != expected) + printf("error in test__truncdfsf2vfp(%f) = %f, expected %f\n", + a, actual, expected); + return actual != expected; +} +#endif + +int main() +{ +#if __arm__ + if (test__truncdfsf2vfp(0.0)) + return 1; + if (test__truncdfsf2vfp(1.0)) + return 1; + if (test__truncdfsf2vfp(-1.0)) + return 1; + if (test__truncdfsf2vfp(3.1415926535)) + return 1; + if (test__truncdfsf2vfp(123.456)) + return 1; +#endif + return 0; +} From gohman at apple.com Mon Sep 14 18:39:10 2009 From: gohman at apple.com (Dan Gohman) Date: Mon, 14 Sep 2009 23:39:10 -0000 Subject: [llvm-commits] [llvm] r81810 - in /llvm/trunk: lib/Transforms/Scalar/MemCpyOptimizer.cpp test/Transforms/MemCpyOpt/align.ll Message-ID: <200909142339.n8ENdBg2020112@zion.cs.uiuc.edu> Author: djg Date: Mon Sep 14 18:39:10 2009 New Revision: 81810 URL: http://llvm.org/viewvc/llvm-project?rev=81810&view=rev Log: When extending a memset range past the front, set the alignment of the memset region to the alignment of the new start address. Added: llvm/trunk/test/Transforms/MemCpyOpt/align.ll Modified: llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp Modified: llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp?rev=81810&r1=81809&r2=81810&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp Mon Sep 14 18:39:10 2009 @@ -273,6 +273,7 @@ if (Start < I->Start) { I->Start = Start; I->StartPtr = SI->getPointerOperand(); + I->Alignment = SI->getAlignment(); } // Now we know that Start <= I->End and Start >= I->Start (so the startpoint Added: llvm/trunk/test/Transforms/MemCpyOpt/align.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/MemCpyOpt/align.ll?rev=81810&view=auto ============================================================================== --- llvm/trunk/test/Transforms/MemCpyOpt/align.ll (added) +++ llvm/trunk/test/Transforms/MemCpyOpt/align.ll Mon Sep 14 18:39:10 2009 @@ -0,0 +1,18 @@ +; RUN: opt < %s -S -memcpyopt | FileCheck %s + +; The resulting memset is only 4-byte aligned, despite containing +; a 16-byte alignmed store in the middle. + +; CHECK: call void @llvm.memset.i64(i8* %a01, i8 0, i64 16, i32 4) + +define void @foo(i32* %p) { + %a0 = getelementptr i32* %p, i64 0 + store i32 0, i32* %a0, align 4 + %a1 = getelementptr i32* %p, i64 1 + store i32 0, i32* %a1, align 16 + %a2 = getelementptr i32* %p, i64 2 + store i32 0, i32* %a2, align 4 + %a3 = getelementptr i32* %p, i64 3 + store i32 0, i32* %a3, align 4 + ret void +} From clattner at apple.com Mon Sep 14 18:40:14 2009 From: clattner at apple.com (Chris Lattner) Date: Mon, 14 Sep 2009 16:40:14 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r81788 - /llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/eh1.C In-Reply-To: <5650EAC4-4B8F-4FEB-BE0A-AF5E0FE2A101@apple.com> References: <200909142113.n8ELDnQK000590@zion.cs.uiuc.edu> <0F0E8899-5FF6-4605-8F4C-492718DC94E4@apple.com> <5650EAC4-4B8F-4FEB-BE0A-AF5E0FE2A101@apple.com> Message-ID: <9B99C10F-203C-4DB4-AFEF-47215F63F31D@apple.com> On Sep 14, 2009, at 2:58 PM, Mike Stump wrote: > On Sep 14, 2009, at 2:39 PM, Eric Christopher wrote: >> Mmm.. either way. I'm happy to revert as it's a bug by that >> definition :) > > Reversion is best I think as I suspect there are many failures in the > testsuite. Yes, I agree with mike, reverting is best IMO. If we were going from 1 failure to 0, I'd be ok with this, if we're going from 1000 failures to 999, it is best to leave it failing. Adding a comment to the testcase with a radar number pointing out the llvm issue would be a good idea though so that future people analyzing the issue won't redo the work you've done. -Chris > The thing being tested is actually a feature of gcc. > Testing for a non-feature, would be odd. If you wanted to test > results to be cleaner, you can mark it as expected. I can dig up the > older radar number for when we switched gcc to text, if you want > (please don't ask though). > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From natebegeman at mac.com Mon Sep 14 19:13:12 2009 From: natebegeman at mac.com (Nate Begeman) Date: Tue, 15 Sep 2009 00:13:12 -0000 Subject: [llvm-commits] [llvm] r81813 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAG.h include/llvm/CodeGen/SelectionDAGNodes.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Message-ID: <200909150013.n8F0DCbX024473@zion.cs.uiuc.edu> Author: sampo Date: Mon Sep 14 19:13:12 2009 New Revision: 81813 URL: http://llvm.org/viewvc/llvm-project?rev=81813&view=rev Log: Add an "original alignment" field to load and store nodes. This enables the DAG Combiner to disambiguate chains for loads and stores of types which are broken up by the Legalizer into smaller pieces. Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAG.h?rev=81813&r1=81812&r2=81813&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAG.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Mon Sep 14 19:13:12 2009 @@ -544,7 +544,7 @@ /// SDValue getLoad(EVT VT, DebugLoc dl, SDValue Chain, SDValue Ptr, const Value *SV, int SVOffset, bool isVolatile=false, - unsigned Alignment=0); + unsigned Alignment=0, unsigned OrigAlignment=0); SDValue getExtLoad(ISD::LoadExtType ExtType, DebugLoc dl, EVT VT, SDValue Chain, SDValue Ptr, const Value *SV, int SVOffset, EVT EVT, bool isVolatile=false, @@ -552,16 +552,16 @@ SDValue getIndexedLoad(SDValue OrigLoad, DebugLoc dl, SDValue Base, SDValue Offset, ISD::MemIndexedMode AM); SDValue getLoad(ISD::MemIndexedMode AM, DebugLoc dl, ISD::LoadExtType ExtType, - EVT VT, SDValue Chain, - SDValue Ptr, SDValue Offset, - const Value *SV, int SVOffset, EVT EVT, - bool isVolatile=false, unsigned Alignment=0); + EVT VT, SDValue Chain, SDValue Ptr, SDValue Offset, + const Value *SV, int SVOffset, EVT EVT, + bool isVolatile=false, unsigned Alignment=0, + unsigned OrigAlignment=0); /// getStore - Helper function to build ISD::STORE nodes. /// SDValue getStore(SDValue Chain, DebugLoc dl, SDValue Val, SDValue Ptr, const Value *SV, int SVOffset, bool isVolatile=false, - unsigned Alignment=0); + unsigned Alignment=0, unsigned OrigAlignment=0); SDValue getTruncStore(SDValue Chain, DebugLoc dl, SDValue Val, SDValue Ptr, const Value *SV, int SVOffset, EVT TVT, bool isVolatile=false, unsigned Alignment=0); Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h?rev=81813&r1=81812&r2=81813&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h Mon Sep 14 19:13:12 2009 @@ -1519,17 +1519,22 @@ //! SVOffset - Memory location offset. Note that base is defined in MemSDNode int SVOffset; + //! OrigAlign - The original alignment of this MemSDNode in the case where + // this node was created by legalize from a MemSDNode with known alignment. + unsigned OrigAlign; + public: MemSDNode(unsigned Opc, DebugLoc dl, SDVTList VTs, EVT MemoryVT, const Value *srcValue, int SVOff, - unsigned alignment, bool isvolatile); + unsigned alignment, bool isvolatile, unsigned oalign); MemSDNode(unsigned Opc, DebugLoc dl, SDVTList VTs, const SDValue *Ops, unsigned NumOps, EVT MemoryVT, const Value *srcValue, int SVOff, - unsigned alignment, bool isvolatile); + unsigned alignment, bool isvolatile, unsigned oalign); /// Returns alignment and volatility of the memory access unsigned getAlignment() const { return (1u << (SubclassData >> 6)) >> 1; } + unsigned getOriginalAlignment() const { return OrigAlign; } bool isVolatile() const { return (SubclassData >> 5) & 1; } /// getRawSubclassData - Return the SubclassData value, which contains an @@ -1600,14 +1605,14 @@ SDValue Cmp, SDValue Swp, const Value* SrcVal, unsigned Align=0) : MemSDNode(Opc, dl, VTL, MemVT, SrcVal, /*SVOffset=*/0, - Align, /*isVolatile=*/true) { + Align, /*isVolatile=*/true, /* OrigAlign=*/0) { InitOperands(Ops, Chain, Ptr, Cmp, Swp); } AtomicSDNode(unsigned Opc, DebugLoc dl, SDVTList VTL, EVT MemVT, SDValue Chain, SDValue Ptr, SDValue Val, const Value* SrcVal, unsigned Align=0) : MemSDNode(Opc, dl, VTL, MemVT, SrcVal, /*SVOffset=*/0, - Align, /*isVolatile=*/true) { + Align, /*isVolatile=*/true, /* OrigAlign=*/0) { InitOperands(Ops, Chain, Ptr, Val); } @@ -1648,7 +1653,8 @@ const SDValue *Ops, unsigned NumOps, EVT MemoryVT, const Value *srcValue, int SVO, unsigned Align, bool Vol, bool ReadMem, bool WriteMem) - : MemSDNode(Opc, dl, VTs, Ops, NumOps, MemoryVT, srcValue, SVO, Align, Vol), + : MemSDNode(Opc, dl, VTs, Ops, NumOps, MemoryVT, srcValue, SVO, Align, Vol, + /* OrigAlign=*/0), ReadMem(ReadMem), WriteMem(WriteMem) { } @@ -2263,8 +2269,9 @@ public: LSBaseSDNode(ISD::NodeType NodeTy, DebugLoc dl, SDValue *Operands, unsigned numOperands, SDVTList VTs, ISD::MemIndexedMode AM, - EVT VT, const Value *SV, int SVO, unsigned Align, bool Vol) - : MemSDNode(NodeTy, dl, VTs, VT, SV, SVO, Align, Vol) { + EVT VT, const Value *SV, int SVO, unsigned Align, bool Vol, + unsigned OAlign) + : MemSDNode(NodeTy, dl, VTs, VT, SV, SVO, Align, Vol, OAlign) { assert(Align != 0 && "Loads and stores should have non-zero aligment"); SubclassData |= AM << 2; assert(getAddressingMode() == AM && "MemIndexedMode encoding error!"); @@ -2302,9 +2309,10 @@ friend class SelectionDAG; LoadSDNode(SDValue *ChainPtrOff, DebugLoc dl, SDVTList VTs, ISD::MemIndexedMode AM, ISD::LoadExtType ETy, EVT LVT, - const Value *SV, int O=0, unsigned Align=0, bool Vol=false) + const Value *SV, int O=0, unsigned Align=0, bool Vol=false, + unsigned OAlign=0) : LSBaseSDNode(ISD::LOAD, dl, ChainPtrOff, 3, - VTs, AM, LVT, SV, O, Align, Vol) { + VTs, AM, LVT, SV, O, Align, Vol, OAlign) { SubclassData |= (unsigned short)ETy; assert(getExtensionType() == ETy && "LoadExtType encoding error!"); } @@ -2331,9 +2339,10 @@ friend class SelectionDAG; StoreSDNode(SDValue *ChainValuePtrOff, DebugLoc dl, SDVTList VTs, ISD::MemIndexedMode AM, bool isTrunc, EVT SVT, - const Value *SV, int O=0, unsigned Align=0, bool Vol=false) + const Value *SV, int O=0, unsigned Align=0, bool Vol=false, + unsigned OAlign=0) : LSBaseSDNode(ISD::STORE, dl, ChainValuePtrOff, 4, - VTs, AM, SVT, SV, O, Align, Vol) { + VTs, AM, SVT, SV, O, Align, Vol, OAlign) { SubclassData |= (unsigned short)isTrunc; assert(isTruncatingStore() == isTrunc && "isTrunc encoding error!"); } Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=81813&r1=81812&r2=81813&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Mon Sep 14 19:13:12 2009 @@ -3646,9 +3646,12 @@ ISD::LoadExtType ExtType, EVT VT, SDValue Chain, SDValue Ptr, SDValue Offset, const Value *SV, int SVOffset, EVT EVT, - bool isVolatile, unsigned Alignment) { + bool isVolatile, unsigned Alignment, + unsigned OrigAlignment) { if (Alignment == 0) // Ensure that codegen never sees alignment 0 Alignment = getEVTAlignment(VT); + if (OrigAlignment == 0) + OrigAlignment = Alignment; if (VT == EVT) { ExtType = ISD::NON_EXTLOAD; @@ -3679,12 +3682,13 @@ AddNodeIDNode(ID, ISD::LOAD, VTs, Ops, 3); ID.AddInteger(EVT.getRawBits()); ID.AddInteger(encodeMemSDNodeFlags(ExtType, AM, isVolatile, Alignment)); + ID.AddInteger(OrigAlignment); void *IP = 0; if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) return SDValue(E, 0); SDNode *N = NodeAllocator.Allocate(); new (N) LoadSDNode(Ops, dl, VTs, AM, ExtType, EVT, SV, SVOffset, - Alignment, isVolatile); + Alignment, isVolatile, OrigAlignment); CSEMap.InsertNode(N, IP); AllNodes.push_back(N); return SDValue(N, 0); @@ -3693,10 +3697,11 @@ SDValue SelectionDAG::getLoad(EVT VT, DebugLoc dl, SDValue Chain, SDValue Ptr, const Value *SV, int SVOffset, - bool isVolatile, unsigned Alignment) { + bool isVolatile, unsigned Alignment, + unsigned OrigAlignment) { SDValue Undef = getUNDEF(Ptr.getValueType()); return getLoad(ISD::UNINDEXED, dl, ISD::NON_EXTLOAD, VT, Chain, Ptr, Undef, - SV, SVOffset, VT, isVolatile, Alignment); + SV, SVOffset, VT, isVolatile, Alignment, OrigAlignment); } SDValue SelectionDAG::getExtLoad(ISD::LoadExtType ExtType, DebugLoc dl, EVT VT, @@ -3723,11 +3728,14 @@ SDValue SelectionDAG::getStore(SDValue Chain, DebugLoc dl, SDValue Val, SDValue Ptr, const Value *SV, int SVOffset, - bool isVolatile, unsigned Alignment) { + bool isVolatile, unsigned Alignment, + unsigned OrigAlignment) { EVT VT = Val.getValueType(); if (Alignment == 0) // Ensure that codegen never sees alignment 0 Alignment = getEVTAlignment(VT); + if (OrigAlignment == 0) + OrigAlignment = Alignment; SDVTList VTs = getVTList(MVT::Other); SDValue Undef = getUNDEF(Ptr.getValueType()); @@ -3737,12 +3745,13 @@ ID.AddInteger(VT.getRawBits()); ID.AddInteger(encodeMemSDNodeFlags(false, ISD::UNINDEXED, isVolatile, Alignment)); + ID.AddInteger(OrigAlignment); void *IP = 0; if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) return SDValue(E, 0); SDNode *N = NodeAllocator.Allocate(); new (N) StoreSDNode(Ops, dl, VTs, ISD::UNINDEXED, false, - VT, SV, SVOffset, Alignment, isVolatile); + VT, SV, SVOffset, Alignment, isVolatile, OrigAlignment); CSEMap.InsertNode(N, IP); AllNodes.push_back(N); return SDValue(N, 0); @@ -4968,9 +4977,10 @@ } MemSDNode::MemSDNode(unsigned Opc, DebugLoc dl, SDVTList VTs, EVT memvt, - const Value *srcValue, int SVO, - unsigned alignment, bool vol) - : SDNode(Opc, dl, VTs), MemoryVT(memvt), SrcValue(srcValue), SVOffset(SVO) { + const Value *srcValue, int SVO, unsigned alignment, + bool vol, unsigned origAlign) + : SDNode(Opc, dl, VTs), MemoryVT(memvt), SrcValue(srcValue), SVOffset(SVO), + OrigAlign(origAlign) { SubclassData = encodeMemSDNodeFlags(0, ISD::UNINDEXED, vol, alignment); assert(isPowerOf2_32(alignment) && "Alignment is not a power of 2!"); assert(getAlignment() == alignment && "Alignment representation error!"); @@ -4978,11 +4988,11 @@ } MemSDNode::MemSDNode(unsigned Opc, DebugLoc dl, SDVTList VTs, - const SDValue *Ops, - unsigned NumOps, EVT memvt, const Value *srcValue, - int SVO, unsigned alignment, bool vol) + const SDValue *Ops, unsigned NumOps, EVT memvt, + const Value *srcValue, int SVO, unsigned alignment, + bool vol, unsigned origAlign) : SDNode(Opc, dl, VTs, Ops, NumOps), - MemoryVT(memvt), SrcValue(srcValue), SVOffset(SVO) { + MemoryVT(memvt), SrcValue(srcValue), SVOffset(SVO), OrigAlign(origAlign) { SubclassData = encodeMemSDNodeFlags(0, ISD::UNINDEXED, vol, alignment); assert(isPowerOf2_32(alignment) && "Alignment is not a power of 2!"); assert(getAlignment() == alignment && "Alignment representation error!"); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp?rev=81813&r1=81812&r2=81813&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Mon Sep 14 19:13:12 2009 @@ -2812,11 +2812,10 @@ EVT PtrVT = Ptr.getValueType(); for (unsigned i = 0; i != NumValues; ++i) { SDValue L = DAG.getLoad(ValueVTs[i], getCurDebugLoc(), Root, - DAG.getNode(ISD::ADD, getCurDebugLoc(), - PtrVT, Ptr, - DAG.getConstant(Offsets[i], PtrVT)), - SV, Offsets[i], - isVolatile, Alignment); + DAG.getNode(ISD::ADD, getCurDebugLoc(), + PtrVT, Ptr, + DAG.getConstant(Offsets[i], PtrVT)), + SV, Offsets[i], isVolatile, Alignment, Alignment); Values[i] = L; Chains[i] = L.getValue(1); } @@ -2866,7 +2865,7 @@ PtrVT, Ptr, DAG.getConstant(Offsets[i], PtrVT)), PtrV, Offsets[i], - isVolatile, Alignment); + isVolatile, Alignment, Alignment); DAG.setRoot(DAG.getNode(ISD::TokenFactor, getCurDebugLoc(), MVT::Other, &Chains[0], NumValues)); From gohman at apple.com Mon Sep 14 19:14:11 2009 From: gohman at apple.com (Dan Gohman) Date: Tue, 15 Sep 2009 00:14:11 -0000 Subject: [llvm-commits] [llvm] r81814 - in /llvm/trunk: lib/Target/X86/X86Instr64bit.td test/CodeGen/X86/cmov-zext.ll Message-ID: <200909150014.n8F0EBt6024605@zion.cs.uiuc.edu> Author: djg Date: Mon Sep 14 19:14:11 2009 New Revision: 81814 URL: http://llvm.org/viewvc/llvm-project?rev=81814&view=rev Log: On x86-64, the 32-bit cmov doesn't actually clear the high 32-bit of its result if the condition is false. Added: llvm/trunk/test/CodeGen/X86/cmov-zext.ll Modified: llvm/trunk/lib/Target/X86/X86Instr64bit.td Modified: llvm/trunk/lib/Target/X86/X86Instr64bit.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Instr64bit.td?rev=81814&r1=81813&r2=81814&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86Instr64bit.td (original) +++ llvm/trunk/lib/Target/X86/X86Instr64bit.td Mon Sep 14 19:14:11 2009 @@ -387,13 +387,15 @@ [(set GR64:$dst, (zextloadi64i32 addr:$src))]>; // Any instruction that defines a 32-bit result leaves the high half of the -// register. Truncate can be lowered to EXTRACT_SUBREG, and CopyFromReg may -// be copying from a truncate, but any other 32-bit operation will zero-extend +// register. Truncate can be lowered to EXTRACT_SUBREG. CopyFromReg may +// be copying from a truncate. And x86's cmov doesn't do anything if the +// condition is false. But any other 32-bit operation will zero-extend // up to 64 bits. def def32 : PatLeaf<(i32 GR32:$src), [{ return N->getOpcode() != ISD::TRUNCATE && N->getOpcode() != TargetInstrInfo::EXTRACT_SUBREG && - N->getOpcode() != ISD::CopyFromReg; + N->getOpcode() != ISD::CopyFromReg && + N->getOpcode() != X86ISD::CMOV; }]>; // In the case of a 32-bit def that is known to implicitly zero-extend, Added: llvm/trunk/test/CodeGen/X86/cmov-zext.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/cmov-zext.ll?rev=81814&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/cmov-zext.ll (added) +++ llvm/trunk/test/CodeGen/X86/cmov-zext.ll Mon Sep 14 19:14:11 2009 @@ -0,0 +1,19 @@ +; RUN: llc < %s -march=x86-64 | FileCheck %s + +; x86's 32-bit cmov doesn't clobber the high 32 bits of the destination +; if the condition is false. An explicit zero-extend (movl) is needed +; after the cmov. + +; CHECK: cmovne %edi, %esi +; CHECK-NEXT: movl %esi, %edi + +declare void @bar(i64) nounwind + +define void @foo(i64 %a, i64 %b, i1 %p) nounwind { + %c = trunc i64 %a to i32 + %d = trunc i64 %b to i32 + %e = select i1 %p, i32 %c, i32 %d + %f = zext i32 %e to i64 + call void @bar(i64 %f) + ret void +} From natebegeman at mac.com Mon Sep 14 19:14:29 2009 From: natebegeman at mac.com (Nate Begeman) Date: Tue, 15 Sep 2009 00:14:29 -0000 Subject: [llvm-commits] [llvm] r81815 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp Message-ID: <200909150014.n8F0ETD1024652@zion.cs.uiuc.edu> Author: sampo Date: Mon Sep 14 19:14:28 2009 New Revision: 81815 URL: http://llvm.org/viewvc/llvm-project?rev=81815&view=rev Log: Teach the legalizer to propagate the original alignment of loads and store when it splits them. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp?rev=81815&r1=81814&r2=81815&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp Mon Sep 14 19:14:28 2009 @@ -170,7 +170,8 @@ DAG.getUNDEF(N->getBasePtr().getValueType()), N->getSrcValue(), N->getSrcValueOffset(), N->getMemoryVT().getVectorElementType(), - N->isVolatile(), N->getAlignment()); + N->isVolatile(), N->getAlignment(), + N->getOriginalAlignment()); // Legalized the chain result - switch anything that used the old chain to // use the new one. @@ -360,7 +361,8 @@ return DAG.getStore(N->getChain(), dl, GetScalarizedVector(N->getOperand(1)), N->getBasePtr(), N->getSrcValue(), N->getSrcValueOffset(), - N->isVolatile(), N->getAlignment()); + N->isVolatile(), N->getAlignment(), + N->getOriginalAlignment()); } @@ -715,13 +717,14 @@ int SVOffset = LD->getSrcValueOffset(); EVT MemoryVT = LD->getMemoryVT(); unsigned Alignment = LD->getAlignment(); + unsigned OrigAlignment = LD->getOriginalAlignment(); bool isVolatile = LD->isVolatile(); EVT LoMemVT, HiMemVT; GetSplitDestVTs(MemoryVT, LoMemVT, HiMemVT); Lo = DAG.getLoad(ISD::UNINDEXED, dl, ExtType, LoVT, Ch, Ptr, Offset, - SV, SVOffset, LoMemVT, isVolatile, Alignment); + SV, SVOffset, LoMemVT, isVolatile, Alignment, OrigAlignment); unsigned IncrementSize = LoMemVT.getSizeInBits()/8; Ptr = DAG.getNode(ISD::ADD, dl, Ptr.getValueType(), Ptr, @@ -729,7 +732,7 @@ SVOffset += IncrementSize; Alignment = MinAlign(Alignment, IncrementSize); Hi = DAG.getLoad(ISD::UNINDEXED, dl, ExtType, HiVT, Ch, Ptr, Offset, - SV, SVOffset, HiMemVT, isVolatile, Alignment); + SV, SVOffset, HiMemVT, isVolatile, Alignment, OrigAlignment); // Build a factor node to remember that this load is independent of the // other one. @@ -1079,6 +1082,7 @@ int SVOffset = N->getSrcValueOffset(); EVT MemoryVT = N->getMemoryVT(); unsigned Alignment = N->getAlignment(); + unsigned OrigAlignment = N->getOriginalAlignment(); bool isVol = N->isVolatile(); SDValue Lo, Hi; GetSplitVector(N->getOperand(1), Lo, Hi); @@ -1093,7 +1097,7 @@ LoMemVT, isVol, Alignment); else Lo = DAG.getStore(Ch, dl, Lo, Ptr, N->getSrcValue(), SVOffset, - isVol, Alignment); + isVol, Alignment, OrigAlignment); // Increment the pointer to the other half. Ptr = DAG.getNode(ISD::ADD, dl, Ptr.getValueType(), Ptr, @@ -1106,7 +1110,8 @@ isVol, MinAlign(Alignment, IncrementSize)); else Hi = DAG.getStore(Ch, dl, Hi, Ptr, N->getSrcValue(), SVOffset+IncrementSize, - isVol, MinAlign(Alignment, IncrementSize)); + isVol, MinAlign(Alignment, IncrementSize), + OrigAlignment); return DAG.getNode(ISD::TokenFactor, dl, MVT::Other, Lo, Hi); } From natebegeman at mac.com Mon Sep 14 19:18:30 2009 From: natebegeman at mac.com (Nate Begeman) Date: Tue, 15 Sep 2009 00:18:30 -0000 Subject: [llvm-commits] [llvm] r81816 - /llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Message-ID: <200909150018.n8F0IUmY025160@zion.cs.uiuc.edu> Author: sampo Date: Mon Sep 14 19:18:30 2009 New Revision: 81816 URL: http://llvm.org/viewvc/llvm-project?rev=81816&view=rev Log: Substantially speed up combiner-aa in the following ways: 1. Switch from an std::set to a SmallPtrSet for visited chain nodes. 2. Do not force the recursive flattening of token factor nodes, regardless of use count. 3. Immediately process newly created TokenFactor nodes. Also, improve combiner-aa by teaching it that loads to non-overlapping offsets of relatively aligned objects cannot alias. These changes result in a >5x speedup for combiner-aa on most testcases. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=81816&r1=81815&r2=81816&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Mon Sep 14 19:18:30 2009 @@ -239,14 +239,17 @@ /// overlap. bool isAlias(SDValue Ptr1, int64_t Size1, const Value *SrcValue1, int SrcValueOffset1, + unsigned SrcValueAlign1, SDValue Ptr2, int64_t Size2, - const Value *SrcValue2, int SrcValueOffset2) const; + const Value *SrcValue2, int SrcValueOffset2, + unsigned SrcValueAlign2) const; /// FindAliasInfo - Extracts the relevant alias information from the memory /// node. Returns true if the operand was a load. bool FindAliasInfo(SDNode *N, SDValue &Ptr, int64_t &Size, - const Value *&SrcValue, int &SrcValueOffset) const; + const Value *&SrcValue, int &SrcValueOffset, + unsigned &SrcValueAlignment) const; /// FindBetterChain - Walk up chain skipping non-aliasing memory nodes, /// looking for a better chain (aliasing node.) @@ -886,7 +889,7 @@ break; case ISD::TokenFactor: - if ((CombinerAA || Op.hasOneUse()) && + if (Op.hasOneUse() && std::find(TFs.begin(), TFs.end(), Op.getNode()) == TFs.end()) { // Queue up for processing. TFs.push_back(Op.getNode()); @@ -907,7 +910,7 @@ } } } - + SDValue Result; // If we've change things around then replace token factor. @@ -4959,7 +4962,10 @@ // Create token factor to keep old chain connected. SDValue Token = DAG.getNode(ISD::TokenFactor, N->getDebugLoc(), MVT::Other, Chain, ReplLoad.getValue(1)); - + + // Make sure the new and old chains are cleaned up. + AddToWorkList(Token.getNode()); + // Replace uses with load result and token factor. Don't add users // to work list. return CombineTo(N, ReplLoad.getValue(0), Token, false); @@ -5180,8 +5186,9 @@ // If there is a better chain. if (Chain != BetterChain) { - // Replace the chain to avoid dependency. SDValue ReplStore; + + // Replace the chain to avoid dependency. if (ST->isTruncatingStore()) { ReplStore = DAG.getTruncStore(BetterChain, N->getDebugLoc(), Value, Ptr, ST->getSrcValue(),ST->getSrcValueOffset(), @@ -5197,6 +5204,9 @@ SDValue Token = DAG.getNode(ISD::TokenFactor, N->getDebugLoc(), MVT::Other, Chain, ReplStore); + // Make sure the new and old chains are cleaned up. + AddToWorkList(Token.getNode()); + // Don't add users to work list. return CombineTo(N, Token, false); } @@ -6103,8 +6113,10 @@ /// overlap. bool DAGCombiner::isAlias(SDValue Ptr1, int64_t Size1, const Value *SrcValue1, int SrcValueOffset1, + unsigned SrcValueAlign1, SDValue Ptr2, int64_t Size2, - const Value *SrcValue2, int SrcValueOffset2) const { + const Value *SrcValue2, int SrcValueOffset2, + unsigned SrcValueAlign2) const { // If they are the same then they must be aliases. if (Ptr1 == Ptr2) return true; @@ -6122,6 +6134,22 @@ // If we know both bases then they can't alias. if (KnownBase1 && KnownBase2) return false; + // If we know required SrcValue1 and SrcValue2 have relatively large alignment + // compared to the size and offset of the access, we may be able to prove they + // do not alias. This check is conservative for now to catch cases created by + // splitting vector types. + if ((SrcValueAlign1 == SrcValueAlign2) && + (SrcValueOffset1 != SrcValueOffset2) && + (Size1 == Size2) && (SrcValueAlign1 > Size1)) { + int64_t OffAlign1 = SrcValueOffset1 % SrcValueAlign1; + int64_t OffAlign2 = SrcValueOffset2 % SrcValueAlign1; + + // There is no overlap between these relatively aligned accesses of similar + // size, return no alias. + if ((OffAlign1 + Size1) <= OffAlign2 || (OffAlign2 + Size2) <= OffAlign1) + return false; + } + if (CombinerGlobalAA) { // Use alias analysis information. int64_t MinOffset = std::min(SrcValueOffset1, SrcValueOffset2); @@ -6141,18 +6169,22 @@ /// node. Returns true if the operand was a load. bool DAGCombiner::FindAliasInfo(SDNode *N, SDValue &Ptr, int64_t &Size, - const Value *&SrcValue, int &SrcValueOffset) const { + const Value *&SrcValue, + int &SrcValueOffset, + unsigned &SrcValueAlign) const { if (LoadSDNode *LD = dyn_cast(N)) { Ptr = LD->getBasePtr(); Size = LD->getMemoryVT().getSizeInBits() >> 3; SrcValue = LD->getSrcValue(); SrcValueOffset = LD->getSrcValueOffset(); + SrcValueAlign = LD->getOriginalAlignment(); return true; } else if (StoreSDNode *ST = dyn_cast(N)) { Ptr = ST->getBasePtr(); Size = ST->getMemoryVT().getSizeInBits() >> 3; SrcValue = ST->getSrcValue(); SrcValueOffset = ST->getSrcValueOffset(); + SrcValueAlign = ST->getOriginalAlignment(); } else { llvm_unreachable("FindAliasInfo expected a memory operand"); } @@ -6165,14 +6197,16 @@ void DAGCombiner::GatherAllAliases(SDNode *N, SDValue OriginalChain, SmallVector &Aliases) { SmallVector Chains; // List of chains to visit. - std::set Visited; // Visited node set. + SmallPtrSet Visited; // Visited node set. // Get alias information for node. SDValue Ptr; - int64_t Size = 0; - const Value *SrcValue = 0; - int SrcValueOffset = 0; - bool IsLoad = FindAliasInfo(N, Ptr, Size, SrcValue, SrcValueOffset); + int64_t Size; + const Value *SrcValue; + int SrcValueOffset; + unsigned SrcValueAlign; + bool IsLoad = FindAliasInfo(N, Ptr, Size, SrcValue, SrcValueOffset, + SrcValueAlign); // Starting off. Chains.push_back(OriginalChain); @@ -6184,9 +6218,9 @@ SDValue Chain = Chains.back(); Chains.pop_back(); - // Don't bother if we've been before. - if (Visited.find(Chain.getNode()) != Visited.end()) continue; - Visited.insert(Chain.getNode()); + // Don't bother if we've been before. + if (!Visited.insert(Chain.getNode())) + continue; switch (Chain.getOpcode()) { case ISD::EntryToken: @@ -6197,16 +6231,19 @@ case ISD::STORE: { // Get alias information for Chain. SDValue OpPtr; - int64_t OpSize = 0; - const Value *OpSrcValue = 0; - int OpSrcValueOffset = 0; + int64_t OpSize; + const Value *OpSrcValue; + int OpSrcValueOffset; + unsigned OpSrcValueAlign; bool IsOpLoad = FindAliasInfo(Chain.getNode(), OpPtr, OpSize, - OpSrcValue, OpSrcValueOffset); + OpSrcValue, OpSrcValueOffset, + OpSrcValueAlign); // If chain is alias then stop here. if (!(IsLoad && IsOpLoad) && - isAlias(Ptr, Size, SrcValue, SrcValueOffset, - OpPtr, OpSize, OpSrcValue, OpSrcValueOffset)) { + isAlias(Ptr, Size, SrcValue, SrcValueOffset, SrcValueAlign, + OpPtr, OpSize, OpSrcValue, OpSrcValueOffset, + OpSrcValueAlign)) { Aliases.push_back(Chain); } else { // Look further up the chain. @@ -6218,10 +6255,14 @@ } case ISD::TokenFactor: - // We have to check each of the operands of the token factor, so we queue - // then up. Adding the operands to the queue (stack) in reverse order - // maintains the original order and increases the likelihood that getNode - // will find a matching token factor (CSE.) + // We have to check each of the operands of the token factor for "small" + // token factors, so we queue them up. Adding the operands to the queue + // (stack) in reverse order maintains the original order and increases the + // likelihood that getNode will find a matching token factor (CSE.) + if (Chain.getNumOperands() > 16) { + Aliases.push_back(Chain); + break; + } for (unsigned n = Chain.getNumOperands(); n;) Chains.push_back(Chain.getOperand(--n)); // Eliminate the token factor if we can. @@ -6253,13 +6294,8 @@ } // Construct a custom tailored token factor. - SDValue NewChain = DAG.getNode(ISD::TokenFactor, N->getDebugLoc(), MVT::Other, - &Aliases[0], Aliases.size()); - - // Make sure the old chain gets cleaned up. - if (NewChain != OldChain) AddToWorkList(OldChain.getNode()); - - return NewChain; + return DAG.getNode(ISD::TokenFactor, N->getDebugLoc(), MVT::Other, + &Aliases[0], Aliases.size()); } // SelectionDAG::Combine - This is the entry point for the file. From enderby at apple.com Mon Sep 14 19:27:26 2009 From: enderby at apple.com (Kevin Enderby) Date: Tue, 15 Sep 2009 00:27:26 -0000 Subject: [llvm-commits] [llvm] r81817 - in /llvm/trunk: lib/Target/ARM/AsmParser/ lib/Target/ARM/AsmParser/ARMAsmParser.cpp lib/Target/ARM/AsmParser/CMakeLists.txt lib/Target/ARM/AsmParser/Makefile lib/Target/ARM/Makefile test/MC/AsmParser/arm_word_directive.s test/MC/AsmParser/directive_values.s test/MC/AsmParser/x86_word_directive.s Message-ID: <200909150027.n8F0RQUw026432@zion.cs.uiuc.edu> Author: enderby Date: Mon Sep 14 19:27:25 2009 New Revision: 81817 URL: http://llvm.org/viewvc/llvm-project?rev=81817&view=rev Log: Added the first bits of the ARM target assembler to llvm-mc. For now it only parses the .word directive as 4 bytes and ARMAsmParser::ParseInstruction will give an error is called. Broke out the test of the .word directive into two different test cases, one for x86 and one for arm. Added: llvm/trunk/lib/Target/ARM/AsmParser/ llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp llvm/trunk/lib/Target/ARM/AsmParser/CMakeLists.txt llvm/trunk/lib/Target/ARM/AsmParser/Makefile llvm/trunk/test/MC/AsmParser/arm_word_directive.s llvm/trunk/test/MC/AsmParser/x86_word_directive.s Modified: llvm/trunk/lib/Target/ARM/Makefile llvm/trunk/test/MC/AsmParser/directive_values.s Added: llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp?rev=81817&view=auto ============================================================================== --- llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp (added) +++ llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp Mon Sep 14 19:27:25 2009 @@ -0,0 +1,93 @@ +//===-- ARMAsmParser.cpp - Parse ARM assembly to MCInst instructions ------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "ARM.h" +#include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/Twine.h" +#include "llvm/MC/MCAsmLexer.h" +#include "llvm/MC/MCAsmParser.h" +#include "llvm/MC/MCStreamer.h" +#include "llvm/MC/MCExpr.h" +#include "llvm/MC/MCInst.h" +#include "llvm/Support/SourceMgr.h" +#include "llvm/Target/TargetRegistry.h" +#include "llvm/Target/TargetAsmParser.h" +using namespace llvm; + +namespace { +struct ARMOperand; + +class ARMAsmParser : public TargetAsmParser { + MCAsmParser &Parser; + +private: + MCAsmParser &getParser() const { return Parser; } + + MCAsmLexer &getLexer() const { return Parser.getLexer(); } + + void Warning(SMLoc L, const Twine &Msg) { Parser.Warning(L, Msg); } + + bool Error(SMLoc L, const Twine &Msg) { return Parser.Error(L, Msg); } + + bool ParseDirectiveWord(unsigned Size, SMLoc L); + +public: + ARMAsmParser(const Target &T, MCAsmParser &_Parser) + : TargetAsmParser(T), Parser(_Parser) {} + + virtual bool ParseInstruction(const StringRef &Name, MCInst &Inst); + + virtual bool ParseDirective(AsmToken DirectiveID); +}; + +} // end anonymous namespace + +bool ARMAsmParser::ParseInstruction(const StringRef &Name, MCInst &Inst) { + SMLoc Loc = getLexer().getTok().getLoc(); + Error(Loc, "ARMAsmParser::ParseInstruction currently unimplemented"); + return true; +} + +bool ARMAsmParser::ParseDirective(AsmToken DirectiveID) { + StringRef IDVal = DirectiveID.getIdentifier(); + if (IDVal == ".word") + return ParseDirectiveWord(4, DirectiveID.getLoc()); + return true; +} + +/// ParseDirectiveWord +/// ::= .word [ expression (, expression)* ] +bool ARMAsmParser::ParseDirectiveWord(unsigned Size, SMLoc L) { + if (getLexer().isNot(AsmToken::EndOfStatement)) { + for (;;) { + const MCExpr *Value; + if (getParser().ParseExpression(Value)) + return true; + + getParser().getStreamer().EmitValue(Value, Size); + + if (getLexer().is(AsmToken::EndOfStatement)) + break; + + // FIXME: Improve diagnostic. + if (getLexer().isNot(AsmToken::Comma)) + return Error(L, "unexpected token in directive"); + getLexer().Lex(); + } + } + + getLexer().Lex(); + return false; +} + +// Force static initialization. +extern "C" void LLVMInitializeARMAsmParser() { + RegisterAsmParser X(TheARMTarget); + RegisterAsmParser Y(TheThumbTarget); +} Added: llvm/trunk/lib/Target/ARM/AsmParser/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmParser/CMakeLists.txt?rev=81817&view=auto ============================================================================== --- llvm/trunk/lib/Target/ARM/AsmParser/CMakeLists.txt (added) +++ llvm/trunk/lib/Target/ARM/AsmParser/CMakeLists.txt Mon Sep 14 19:27:25 2009 @@ -0,0 +1,6 @@ +include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/.. ) + +add_llvm_library(LLVMARMAsmParser + ARMAsmParser.cpp + ) +add_dependencies(LLVMARMAsmParser) Added: llvm/trunk/lib/Target/ARM/AsmParser/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmParser/Makefile?rev=81817&view=auto ============================================================================== --- llvm/trunk/lib/Target/ARM/AsmParser/Makefile (added) +++ llvm/trunk/lib/Target/ARM/AsmParser/Makefile Mon Sep 14 19:27:25 2009 @@ -0,0 +1,15 @@ +##===- lib/Target/ARM/AsmParser/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 = LLVMARMAsmParser + +# Hack: we need to include 'main' ARM target directory to grab private headers +CPPFLAGS = -I$(PROJ_OBJ_DIR)/.. -I$(PROJ_SRC_DIR)/.. + +include $(LEVEL)/Makefile.common Modified: llvm/trunk/lib/Target/ARM/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/Makefile?rev=81817&r1=81816&r2=81817&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/Makefile (original) +++ llvm/trunk/lib/Target/ARM/Makefile Mon Sep 14 19:27:25 2009 @@ -18,6 +18,6 @@ ARMGenDAGISel.inc ARMGenSubtarget.inc \ ARMGenCodeEmitter.inc ARMGenCallingConv.inc -DIRS = AsmPrinter TargetInfo +DIRS = AsmPrinter AsmParser TargetInfo include $(LEVEL)/Makefile.common Added: llvm/trunk/test/MC/AsmParser/arm_word_directive.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/arm_word_directive.s?rev=81817&view=auto ============================================================================== --- llvm/trunk/test/MC/AsmParser/arm_word_directive.s (added) +++ llvm/trunk/test/MC/AsmParser/arm_word_directive.s Mon Sep 14 19:27:25 2009 @@ -0,0 +1,6 @@ +@ RUN: llvm-mc -triple arm-unknown-unknown %s | FileCheck %s + +@ CHECK: TEST0: +@ CHECK: .long 3 +TEST0: + .word 3 Modified: llvm/trunk/test/MC/AsmParser/directive_values.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/directive_values.s?rev=81817&r1=81816&r2=81817&view=diff ============================================================================== --- llvm/trunk/test/MC/AsmParser/directive_values.s (original) +++ llvm/trunk/test/MC/AsmParser/directive_values.s Mon Sep 14 19:27:25 2009 @@ -19,8 +19,3 @@ # CHECK: .quad 9 TEST3: .quad 9 - -# CHECK: TEST4: -# CHECK: .short 3 -TEST4: - .word 3 Added: llvm/trunk/test/MC/AsmParser/x86_word_directive.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/x86_word_directive.s?rev=81817&view=auto ============================================================================== --- llvm/trunk/test/MC/AsmParser/x86_word_directive.s (added) +++ llvm/trunk/test/MC/AsmParser/x86_word_directive.s Mon Sep 14 19:27:25 2009 @@ -0,0 +1,6 @@ +# RUN: llvm-mc -triple i386-unknown-unknown %s | FileCheck %s + +# CHECK: TEST0: +# CHECK: .short 3 +TEST0: + .word 3 From scallanan at apple.com Mon Sep 14 19:35:17 2009 From: scallanan at apple.com (Sean Callanan) Date: Tue, 15 Sep 2009 00:35:17 -0000 Subject: [llvm-commits] [llvm] r81818 - in /llvm/trunk/lib/Target/X86: X86InstrFormats.td X86InstrInfo.td Message-ID: <200909150035.n8F0ZIBH027512@zion.cs.uiuc.edu> Author: spyffe Date: Mon Sep 14 19:35:17 2009 New Revision: 81818 URL: http://llvm.org/viewvc/llvm-project?rev=81818&view=rev Log: Modified the Intel instruction tables to include versions of CALL and JMP with segmented addresses provided in-line, as pairs of immediates. Modified: llvm/trunk/lib/Target/X86/X86InstrFormats.td llvm/trunk/lib/Target/X86/X86InstrInfo.td Modified: llvm/trunk/lib/Target/X86/X86InstrFormats.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrFormats.td?rev=81818&r1=81817&r2=81818&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrFormats.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrFormats.td Mon Sep 14 19:35:17 2009 @@ -143,6 +143,24 @@ let Pattern = pattern; } +// Templates for instructions that use a 16- or 32-bit segmented address as +// their only operand: lcall (FAR CALL) and ljmp (FAR JMP) +// +// Iseg16 - 16-bit segment selector, 16-bit offset +// Iseg32 - 16-bit segment selector, 32-bit offset + +class Iseg16 o, Format f, dag outs, dag ins, string asm, + list pattern> : X86Inst { + let Pattern = pattern; + let CodeSize = 3; +} + +class Iseg32 o, Format f, dag outs, dag ins, string asm, + list pattern> : X86Inst { + let Pattern = pattern; + let CodeSize = 3; +} + // SSE1 Instruction Templates: // // SSI - SSE1 instructions with XS prefix. Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=81818&r1=81817&r2=81818&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Mon Sep 14 19:35:17 2009 @@ -584,9 +584,17 @@ [(brind GR32:$dst)]>; def JMP32m : I<0xFF, MRM4m, (outs), (ins i32mem:$dst), "jmp{l}\t{*}$dst", [(brind (loadi32 addr:$dst))]>; - def FARJMP16 : I<0xFF, MRM5m, (outs), (ins opaque32mem:$dst), + + def FARJMP16i : Iseg16<0xEA, RawFrm, (outs), + (ins i16imm:$seg, i16imm:$off), + "ljmp{w}\t$seg, $off", []>, OpSize; + def FARJMP32i : Iseg32<0xEA, RawFrm, (outs), + (ins i16imm:$seg, i32imm:$off), + "ljmp{l}\t$seg, $off", []>; + + def FARJMP16m : I<0xFF, MRM5m, (outs), (ins opaque32mem:$dst), "ljmp{w}\t{*}$dst", []>, OpSize; - def FARJMP32 : I<0xFF, MRM5m, (outs), (ins opaque48mem:$dst), + def FARJMP32m : I<0xFF, MRM5m, (outs), (ins opaque48mem:$dst), "ljmp{l}\t{*}$dst", []>; } @@ -669,9 +677,16 @@ def CALL32m : I<0xFF, MRM2m, (outs), (ins i32mem:$dst, variable_ops), "call\t{*}$dst", [(X86call (loadi32 addr:$dst))]>; - def FARCALL16 : I<0xFF, MRM3m, (outs), (ins opaque32mem:$dst), + def FARCALL16i : Iseg16<0x9A, RawFrm, (outs), + (ins i16imm:$seg, i16imm:$off), + "lcall{w}\t$seg, $off", []>, OpSize; + def FARCALL32i : Iseg32<0x9A, RawFrm, (outs), + (ins i16imm:$seg, i32imm:$off), + "lcall{l}\t$seg, $off", []>; + + def FARCALL16m : I<0xFF, MRM3m, (outs), (ins opaque32mem:$dst), "lcall{w}\t{*}$dst", []>, OpSize; - def FARCALL32 : I<0xFF, MRM3m, (outs), (ins opaque48mem:$dst), + def FARCALL32m : I<0xFF, MRM3m, (outs), (ins opaque48mem:$dst), "lcall{l}\t{*}$dst", []>; } From natebegeman at mac.com Mon Sep 14 19:38:09 2009 From: natebegeman at mac.com (Nate Begeman) Date: Tue, 15 Sep 2009 00:38:09 -0000 Subject: [llvm-commits] [llvm] r81819 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Message-ID: <200909150038.n8F0c9Kq027893@zion.cs.uiuc.edu> Author: sampo Date: Mon Sep 14 19:38:09 2009 New Revision: 81819 URL: http://llvm.org/viewvc/llvm-project?rev=81819&view=rev Log: Remove incorrect CSE code from r81813. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=81819&r1=81818&r2=81819&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Mon Sep 14 19:38:09 2009 @@ -3682,7 +3682,6 @@ AddNodeIDNode(ID, ISD::LOAD, VTs, Ops, 3); ID.AddInteger(EVT.getRawBits()); ID.AddInteger(encodeMemSDNodeFlags(ExtType, AM, isVolatile, Alignment)); - ID.AddInteger(OrigAlignment); void *IP = 0; if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) return SDValue(E, 0); @@ -3745,7 +3744,6 @@ ID.AddInteger(VT.getRawBits()); ID.AddInteger(encodeMemSDNodeFlags(false, ISD::UNINDEXED, isVolatile, Alignment)); - ID.AddInteger(OrigAlignment); void *IP = 0; if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) return SDValue(E, 0); From wendling at apple.com Mon Sep 14 20:02:22 2009 From: wendling at apple.com (Bill Wendling) Date: Mon, 14 Sep 2009 18:02:22 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r81788 - /llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/eh1.C In-Reply-To: <5650EAC4-4B8F-4FEB-BE0A-AF5E0FE2A101@apple.com> References: <200909142113.n8ELDnQK000590@zion.cs.uiuc.edu> <0F0E8899-5FF6-4605-8F4C-492718DC94E4@apple.com> <5650EAC4-4B8F-4FEB-BE0A-AF5E0FE2A101@apple.com> Message-ID: <5F4B670F-0A52-4107-9805-2DCA43755206@apple.com> On Sep 14, 2009, at 2:58 PM, Mike Stump wrote: > On Sep 14, 2009, at 2:39 PM, Eric Christopher wrote: >> Mmm.. either way. I'm happy to revert as it's a bug by that >> definition :) > > Reversion is best I think as I suspect there are many failures in > the testsuite. The thing being tested is actually a feature of > gcc. Testing for a non-feature, would be odd. If you wanted to > test results to be cleaner, you can mark it as expected. I can dig > up the older radar number for when we switched gcc to text, if you > want (please don't ask though). No need. I have it in the radar I'm working on already to switch to __TEXT. -bw From gohman at apple.com Mon Sep 14 20:22:01 2009 From: gohman at apple.com (Dan Gohman) Date: Tue, 15 Sep 2009 01:22:01 -0000 Subject: [llvm-commits] [llvm] r81821 - in /llvm/trunk: lib/Target/X86/X86ISelDAGToDAG.cpp test/CodeGen/X86/combiner-aa-1.ll Message-ID: <200909150122.n8F1M1kC000958@zion.cs.uiuc.edu> Author: djg Date: Mon Sep 14 20:22:01 2009 New Revision: 81821 URL: http://llvm.org/viewvc/llvm-project?rev=81821&view=rev Log: Don't pull a load through a callseq_start if the load's chain has multiple uses, as one of the other uses may be on a path to a different node above the callseq_start, because that leads to a cyclic graph. This problem is exposed when -combiner-global-alias-analysis is used. This fixes PR4880. Added: llvm/trunk/test/CodeGen/X86/combiner-aa-1.ll Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp?rev=81821&r1=81820&r2=81821&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Mon Sep 14 20:22:01 2009 @@ -447,7 +447,8 @@ if (Chain.getOperand(0).getNode() == Callee.getNode()) return true; if (Chain.getOperand(0).getOpcode() == ISD::TokenFactor && - Callee.getValue(1).isOperandOf(Chain.getOperand(0).getNode())) + Callee.getValue(1).isOperandOf(Chain.getOperand(0).getNode()) && + Callee.getValue(1).hasOneUse()) return true; return false; } Added: llvm/trunk/test/CodeGen/X86/combiner-aa-1.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/combiner-aa-1.ll?rev=81821&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/combiner-aa-1.ll (added) +++ llvm/trunk/test/CodeGen/X86/combiner-aa-1.ll Mon Sep 14 20:22:01 2009 @@ -0,0 +1,23 @@ +; RUN: llc < %s --combiner-alias-analysis --combiner-global-alias-analysis +; PR4880 + +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32" +target triple = "i386-pc-linux-gnu" + +%struct.alst_node = type { %struct.node } +%struct.arg_node = type { %struct.node, i8*, %struct.alst_node* } +%struct.arglst_node = type { %struct.alst_node, %struct.arg_node*, %struct.arglst_node* } +%struct.lam_node = type { %struct.alst_node, %struct.arg_node*, %struct.alst_node* } +%struct.node = type { i32 (...)**, %struct.node* } + +define i32 @._ZN8lam_node18resolve_name_clashEP8arg_nodeP9alst_node._ZNK8lam_nodeeqERK8exp_node._ZN11arglst_nodeD0Ev(%struct.lam_node* %this.this, %struct.arg_node* %outer_arg, %struct.alst_node* %env.cmp, %struct.arglst_node* %this, i32 %functionID) { +comb_entry: + %.SV59 = alloca %struct.node* ; <%struct.node**> [#uses=1] + %0 = load i32 (...)*** null, align 4 ; [#uses=1] + %1 = getelementptr inbounds i32 (...)** %0, i32 3 ; [#uses=1] + %2 = load i32 (...)** %1, align 4 ; [#uses=1] + store %struct.node* undef, %struct.node** %.SV59 + %3 = bitcast i32 (...)* %2 to i32 (%struct.node*)* ; [#uses=1] + %4 = tail call i32 %3(%struct.node* undef) ; [#uses=0] + unreachable +} From evan.cheng at apple.com Mon Sep 14 20:32:25 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 14 Sep 2009 18:32:25 -0700 Subject: [llvm-commits] [llvm] r81657 - in /llvm/trunk: lib/Target/ARM/ARMRegisterInfo.td test/CodeGen/ARM/2009-09-13-InvalidSubreg.ll In-Reply-To: <200909130059.n8D0xhIF024496@zion.cs.uiuc.edu> References: <200909130059.n8D0xhIF024496@zion.cs.uiuc.edu> Message-ID: On Sep 12, 2009, at 5:59 PM, Anton Korobeynikov wrote: > > + > +// Dummy f32 regclass to represent impossible subreg indices. > +def SPR_INVALID : RegisterClass<"ARM", [f32], 32, [SDummy]> { > + let CopyCost = -1; > +} > + Hi Anton, Could you explain why this is needed? Evan > // Scalar double precision floating point / generic 64-bit vector > register > // class. > // ARM requires only word alignment for double. It's more performant > if it > @@ -262,7 +274,7 @@ > D8, D9, D10, D11, D12, D13, D14, D15, > D16, D17, D18, D19, D20, D21, D22, D23, > D24, D25, D26, D27, D28, D29, D30, D31]> { > - let SubRegClassList = [SPR, SPR]; > + let SubRegClassList = [SPR_INVALID, SPR_INVALID]; > let MethodProtos = [{ > iterator allocation_order_begin(const MachineFunction &MF) const; > iterator allocation_order_end(const MachineFunction &MF) const; > @@ -317,14 +329,22 @@ > // operations > def DPR_8 : RegisterClass<"ARM", [f64, v4i16, v2f32], 64, > [D0, D1, D2, D3, D4, D5, D6, D7]> { > - let SubRegClassList = [SPR, SPR]; > + let SubRegClassList = [SPR_8, SPR_8]; > } > > // Generic 128-bit vector register class. > def QPR : RegisterClass<"ARM", [v16i8, v8i16, v4i32, v2i64, v4f32, > v2f64], 128, > [Q0, Q1, Q2, Q3, Q4, Q5, Q6, Q7, > Q8, Q9, Q10, Q11, Q12, Q13, Q14, Q15]> { > - let SubRegClassList = [SPR, SPR, SPR, SPR, DPR, DPR]; > + let SubRegClassList = [SPR_INVALID, SPR_INVALID, SPR_INVALID, > SPR_INVALID, > + DPR, DPR]; > +} > + > +// Subset of QPR that have 32-bit SPR subregs. > +def QPR_VFP2 : RegisterClass<"ARM", [v16i8, v8i16, v4i32, v2i64, > v4f32, v2f64], > + 128, > + [Q0, Q1, Q2, Q3, Q4, Q5, Q6, Q7] > > { > + let SubRegClassList = [SPR, SPR, SPR, SPR, DPR_VFP2, DPR_VFP2]; > } > > // Subset of QPR that have 32-bit SPR subregs. > > Added: llvm/trunk/test/CodeGen/ARM/2009-09-13-InvalidSubreg.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2009-09-13-InvalidSubreg.ll?rev=81657&view=auto > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/CodeGen/ARM/2009-09-13-InvalidSubreg.ll (added) > +++ llvm/trunk/test/CodeGen/ARM/2009-09-13-InvalidSubreg.ll Sat Sep > 12 19:59:43 2009 > @@ -0,0 +1,61 @@ > +; RUN: llc -mattr=+neon < %s > +; PR4965 > +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32- > i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64" > +target triple = "armv7-eabi" > + > +%struct.fr = type { [6 x %struct.pl] } > +%struct.obb = type { %"struct.m4", %"struct.p3" } > +%struct.pl = type { %"struct.p3" } > +%"struct.m4" = type { %"struct.p3", %"struct.p3", %"struct.p3", > %"struct.p3" } > +%"struct.p3" = type { <4 x float> } > + > +declare <2 x float> @llvm.arm.neon.vpadd.v2f32(<2 x float>, <2 x > float>) nounwind readnone > + > +define arm_aapcs_vfpcc i8 @foo(%struct.fr* nocapture %this, > %struct.obb* %box) nounwind { > +entry: > + %val.i.i = load <4 x float>* undef ; <<4 x float>> > [#uses=1] > + %val2.i.i = load <4 x float>* null ; <<4 x float>> > [#uses=1] > + %elt3.i.i = getelementptr inbounds %struct.obb* %box, i32 0, i32 > 0, i32 2, i32 0 ; <<4 x float>*> [#uses=1] > + %val4.i.i = load <4 x float>* %elt3.i.i ; <<4 x float>> > [#uses=1] > + %0 = shufflevector <2 x float> undef, <2 x float> > zeroinitializer, <4 x i32> ; <<4 x > float>> [#uses=1] > + %1 = fadd <4 x float> undef, zeroinitializer ; <<4 x float>> > [#uses=1] > + br label %bb33 > + > +bb: ; preds = %bb33 > + %2 = fmul <4 x float> %val.i.i, undef ; <<4 x float>> > [#uses=1] > + %3 = fmul <4 x float> %val2.i.i, undef ; <<4 x float>> > [#uses=1] > + %4 = fadd <4 x float> %3, %2 ; <<4 x float>> > [#uses=1] > + %5 = fmul <4 x float> %val4.i.i, undef ; <<4 x float>> > [#uses=1] > + %6 = fadd <4 x float> %5, %4 ; <<4 x float>> > [#uses=1] > + %7 = bitcast <4 x float> %6 to <4 x i32> ; <<4 x i32>> > [#uses=1] > + %8 = and <4 x i32> %7, -2147483648, i32 -2147483648> ; <<4 x i32>> [#uses=1] > + %9 = or <4 x i32> %8, undef ; <<4 x i32>> > [#uses=1] > + %10 = bitcast <4 x i32> %9 to <4 x float> ; <<4 x float>> > [#uses=1] > + %11 = shufflevector <4 x float> %10, <4 x float> undef, <2 x i32> > ; <<2 x float>> [#uses=1] > + %12 = shufflevector <2 x float> %11, <2 x float> undef, <4 x i32> > zeroinitializer ; <<4 x float>> [#uses=1] > + %13 = fmul <4 x float> undef, %12 ; <<4 x float>> > [#uses=1] > + %14 = fmul <4 x float> %0, undef ; <<4 x float>> > [#uses=1] > + %15 = fadd <4 x float> %14, %13 ; <<4 x float>> > [#uses=1] > + %16 = fadd <4 x float> undef, %15 ; <<4 x float>> > [#uses=1] > + %17 = fadd <4 x float> %1, %16 ; <<4 x float>> > [#uses=1] > + %18 = fmul <4 x float> zeroinitializer, %17 ; <<4 x float>> > [#uses=1] > + %19 = insertelement <4 x float> %18, float 0.000000e+00, i32 3 ; > <<4 x float>> [#uses=2] > + %20 = shufflevector <4 x float> %19, <4 x float> undef, <2 x i32> > ; <<2 x float>> [#uses=1] > + %21 = shufflevector <4 x float> %19, <4 x float> undef, <2 x i32> > ; <<2 x float>> [#uses=1] > + %22 = tail call <2 x float> @llvm.arm.neon.vpadd.v2f32(<2 x > float> %20, <2 x float> %21) nounwind ; <<2 x float>> [#uses=2] > + %23 = tail call <2 x float> @llvm.arm.neon.vpadd.v2f32(<2 x > float> %22, <2 x float> %22) nounwind ; <<2 x float>> [#uses=2] > + %24 = shufflevector <2 x float> %23, <2 x float> %23, <4 x i32> > zeroinitializer ; <<4 x float>> [#uses=1] > + %25 = fadd <4 x float> %24, zeroinitializer ; <<4 x float>> > [#uses=1] > + %tmp46 = extractelement <4 x float> %25, i32 0 ; [#uses=1] > + %26 = fcmp olt float %tmp46, 0.000000e+00 ; [#uses=1] > + br i1 %26, label %bb41, label %bb33 > + > +bb33: ; preds = %bb, > %entry > + br i1 undef, label %bb34, label %bb > + > +bb34: ; preds = %bb33 > + ret i8 undef > + > +bb41: ; preds = %bb > + ret i8 1 > +} > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From gohman at apple.com Mon Sep 14 20:41:29 2009 From: gohman at apple.com (Dan Gohman) Date: Mon, 14 Sep 2009 18:41:29 -0700 Subject: [llvm-commits] [llvm] r80930 - in /llvm/trunk/lib/Target/X86: X86ISelLowering.cpp X86Instr64bit.td X86InstrInfo.td In-Reply-To: <4AA00AB1.8080304@free.fr> References: <200909031718.n83HIqqR031599@zion.cs.uiuc.edu> <4AA00AB1.8080304@free.fr> Message-ID: <3AC8C10E-B832-4870-A80F-97C1B3524C7F@apple.com> On Sep 3, 2009, at 11:28 AM, Duncan Sands wrote: > Hi Dan, > > > >> Add a -disable-16bit flag and associated support for experimenting >> with >> >> >> disabling the use of 16-bit operations on x86. This doesn't yet >> work for >> >> >> inline asms with 16-bit constraints, vectors with 16-bit elements, >> >> >> trampoline code, and perhaps other obscurities, but it's enough to >> try >> >> >> some experiments. >> >> > > not sure why you mention trampoline code here? All I know is that one of test failures happened to be in the vicinity of a trampoline setup, and there was nothing else suspicious around. If -disable-16bit is worth pursuing, I'll do more testing and figure out what's really going on there. Dan From sabre at nondot.org Mon Sep 14 21:22:48 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 15 Sep 2009 02:22:48 -0000 Subject: [llvm-commits] [llvm] r81822 - in /llvm/trunk/test/CodeGen/X86: cmov-zext.ll cmov.ll commute-cmov.ll Message-ID: <200909150222.n8F2Mmm9008567@zion.cs.uiuc.edu> Author: lattner Date: Mon Sep 14 21:22:47 2009 New Revision: 81822 URL: http://llvm.org/viewvc/llvm-project?rev=81822&view=rev Log: merge two cmov tests into one. Added: llvm/trunk/test/CodeGen/X86/cmov.ll - copied, changed from r81821, llvm/trunk/test/CodeGen/X86/commute-cmov.ll Removed: llvm/trunk/test/CodeGen/X86/cmov-zext.ll llvm/trunk/test/CodeGen/X86/commute-cmov.ll Removed: llvm/trunk/test/CodeGen/X86/cmov-zext.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/cmov-zext.ll?rev=81821&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/cmov-zext.ll (original) +++ llvm/trunk/test/CodeGen/X86/cmov-zext.ll (removed) @@ -1,19 +0,0 @@ -; RUN: llc < %s -march=x86-64 | FileCheck %s - -; x86's 32-bit cmov doesn't clobber the high 32 bits of the destination -; if the condition is false. An explicit zero-extend (movl) is needed -; after the cmov. - -; CHECK: cmovne %edi, %esi -; CHECK-NEXT: movl %esi, %edi - -declare void @bar(i64) nounwind - -define void @foo(i64 %a, i64 %b, i1 %p) nounwind { - %c = trunc i64 %a to i32 - %d = trunc i64 %b to i32 - %e = select i1 %p, i32 %c, i32 %d - %f = zext i32 %e to i64 - call void @bar(i64 %f) - ret void -} Copied: llvm/trunk/test/CodeGen/X86/cmov.ll (from r81821, llvm/trunk/test/CodeGen/X86/commute-cmov.ll) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/cmov.ll?p2=llvm/trunk/test/CodeGen/X86/cmov.ll&p1=llvm/trunk/test/CodeGen/X86/commute-cmov.ll&r1=81821&r2=81822&rev=81822&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/commute-cmov.ll (original) +++ llvm/trunk/test/CodeGen/X86/cmov.ll Mon Sep 14 21:22:47 2009 @@ -1,30 +1,48 @@ -; RUN: llc < %s -march=x86 | FileCheck %s +; RUN: llc < %s -march=x86-64 | FileCheck %s -define i32 @test1(i32 %x, i32 %n, i32 %w, i32 %v) nounwind readnone { +define i32 @test1(i32 %x, i32 %n, i32 %w, i32* %vp) nounwind readnone { entry: ; CHECK: test1: ; CHECK: btl ; CHECK-NEXT: movl $12, %eax -; CHECK-NEXT: cmovae 16(%esp), %eax +; CHECK-NEXT: cmovae (%rcx), %eax ; CHECK-NEXT: ret %0 = lshr i32 %x, %n ; [#uses=1] %1 = and i32 %0, 1 ; [#uses=1] %toBool = icmp eq i32 %1, 0 ; [#uses=1] + %v = load i32* %vp %.0 = select i1 %toBool, i32 %v, i32 12 ; [#uses=1] ret i32 %.0 } -define i32 @test2(i32 %x, i32 %n, i32 %w, i32 %v) nounwind readnone { +define i32 @test2(i32 %x, i32 %n, i32 %w, i32* %vp) nounwind readnone { entry: ; CHECK: test2: ; CHECK: btl ; CHECK-NEXT: movl $12, %eax -; CHECK-NEXT: cmovb 16(%esp), %eax +; CHECK-NEXT: cmovb (%rcx), %eax ; CHECK-NEXT: ret %0 = lshr i32 %x, %n ; [#uses=1] %1 = and i32 %0, 1 ; [#uses=1] %toBool = icmp eq i32 %1, 0 ; [#uses=1] + %v = load i32* %vp %.0 = select i1 %toBool, i32 12, i32 %v ; [#uses=1] ret i32 %.0 } + + +declare void @bar(i64) nounwind + +define void @test3(i64 %a, i64 %b, i1 %p) nounwind { +; CHECK: test3: +; CHECK: cmovne %edi, %esi +; CHECK-NEXT: movl %esi, %edi + + %c = trunc i64 %a to i32 + %d = trunc i64 %b to i32 + %e = select i1 %p, i32 %c, i32 %d + %f = zext i32 %e to i64 + call void @bar(i64 %f) + ret void +} Removed: llvm/trunk/test/CodeGen/X86/commute-cmov.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/commute-cmov.ll?rev=81821&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/commute-cmov.ll (original) +++ llvm/trunk/test/CodeGen/X86/commute-cmov.ll (removed) @@ -1,30 +0,0 @@ -; RUN: llc < %s -march=x86 | FileCheck %s - -define i32 @test1(i32 %x, i32 %n, i32 %w, i32 %v) nounwind readnone { -entry: -; CHECK: test1: -; CHECK: btl -; CHECK-NEXT: movl $12, %eax -; CHECK-NEXT: cmovae 16(%esp), %eax -; CHECK-NEXT: ret - - %0 = lshr i32 %x, %n ; [#uses=1] - %1 = and i32 %0, 1 ; [#uses=1] - %toBool = icmp eq i32 %1, 0 ; [#uses=1] - %.0 = select i1 %toBool, i32 %v, i32 12 ; [#uses=1] - ret i32 %.0 -} -define i32 @test2(i32 %x, i32 %n, i32 %w, i32 %v) nounwind readnone { -entry: -; CHECK: test2: -; CHECK: btl -; CHECK-NEXT: movl $12, %eax -; CHECK-NEXT: cmovb 16(%esp), %eax -; CHECK-NEXT: ret - - %0 = lshr i32 %x, %n ; [#uses=1] - %1 = and i32 %0, 1 ; [#uses=1] - %toBool = icmp eq i32 %1, 0 ; [#uses=1] - %.0 = select i1 %toBool, i32 12, i32 %v ; [#uses=1] - ret i32 %.0 -} From sabre at nondot.org Mon Sep 14 21:25:21 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 15 Sep 2009 02:25:21 -0000 Subject: [llvm-commits] [llvm] r81823 - in /llvm/trunk/test/CodeGen/X86: cmov-i8-eflags.ll cmov.ll select-no-cmov.ll Message-ID: <200909150225.n8F2PMV1008916@zion.cs.uiuc.edu> Author: lattner Date: Mon Sep 14 21:25:21 2009 New Revision: 81823 URL: http://llvm.org/viewvc/llvm-project?rev=81823&view=rev Log: merge some more cmov tests into cmov.ll Removed: llvm/trunk/test/CodeGen/X86/cmov-i8-eflags.ll llvm/trunk/test/CodeGen/X86/select-no-cmov.ll Modified: llvm/trunk/test/CodeGen/X86/cmov.ll Removed: llvm/trunk/test/CodeGen/X86/cmov-i8-eflags.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/cmov-i8-eflags.ll?rev=81822&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/cmov-i8-eflags.ll (original) +++ llvm/trunk/test/CodeGen/X86/cmov-i8-eflags.ll (removed) @@ -1,61 +0,0 @@ -; RUN: llc -march=x86-64 < %s | FileCheck %s -; PR4814 - -; CodeGen shouldn't try to do a setne after an expanded 8-bit conditional -; move without recomputing EFLAGS, because the expansion of the conditional -; move with control flow may clobber EFLAGS (e.g., with xor, to set the -; register to zero). - -; The test is a little awkward; the important part is that there's a test before the -; setne. - -target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128" - - at g_3 = external global i8 ; [#uses=1] - at g_96 = external global i8 ; [#uses=2] - at g_100 = external global i8 ; [#uses=2] - at _2E_str = external constant [15 x i8], align 1 ; <[15 x i8]*> [#uses=1] - -define i32 @main() nounwind { -entry: - %0 = load i8* @g_3, align 1 ; [#uses=2] - %1 = sext i8 %0 to i32 ; [#uses=1] - %.lobit.i = lshr i8 %0, 7 ; [#uses=1] - %tmp.i = zext i8 %.lobit.i to i32 ; [#uses=1] - %tmp.not.i = xor i32 %tmp.i, 1 ; [#uses=1] - %iftmp.17.0.i.i = ashr i32 %1, %tmp.not.i ; [#uses=1] - %retval56.i.i = trunc i32 %iftmp.17.0.i.i to i8 ; [#uses=1] - %2 = icmp eq i8 %retval56.i.i, 0 ; [#uses=2] - %g_96.promoted.i = load i8* @g_96 ; [#uses=3] - %3 = icmp eq i8 %g_96.promoted.i, 0 ; [#uses=2] - br i1 %3, label %func_4.exit.i, label %bb.i.i.i - -bb.i.i.i: ; preds = %entry - %4 = volatile load i8* @g_100, align 1 ; [#uses=0] - br label %func_4.exit.i - -; CHECK: g_100 -; CHECK: testb -; CHECK: testb %al, %al -; CHECK-NEXT: setne %al -; CHECK-NEXT: testb - -func_4.exit.i: ; preds = %bb.i.i.i, %entry - %.not.i = xor i1 %2, true ; [#uses=1] - %brmerge.i = or i1 %3, %.not.i ; [#uses=1] - %.mux.i = select i1 %2, i8 %g_96.promoted.i, i8 0 ; [#uses=1] - br i1 %brmerge.i, label %func_1.exit, label %bb.i.i - -bb.i.i: ; preds = %func_4.exit.i - %5 = volatile load i8* @g_100, align 1 ; [#uses=0] - br label %func_1.exit - -func_1.exit: ; preds = %bb.i.i, %func_4.exit.i - %g_96.tmp.0.i = phi i8 [ %g_96.promoted.i, %bb.i.i ], [ %.mux.i, %func_4.exit.i ] ; [#uses=2] - store i8 %g_96.tmp.0.i, i8* @g_96 - %6 = zext i8 %g_96.tmp.0.i to i32 ; [#uses=1] - %7 = tail call i32 (i8*, ...)* @printf(i8* noalias getelementptr ([15 x i8]* @_2E_str, i64 0, i64 0), i32 %6) nounwind ; [#uses=0] - ret i32 0 -} - -declare i32 @printf(i8* nocapture, ...) nounwind Modified: llvm/trunk/test/CodeGen/X86/cmov.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/cmov.ll?rev=81823&r1=81822&r2=81823&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/cmov.ll (original) +++ llvm/trunk/test/CodeGen/X86/cmov.ll Mon Sep 14 21:25:21 2009 @@ -1,4 +1,5 @@ ; RUN: llc < %s -march=x86-64 | FileCheck %s +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128" define i32 @test1(i32 %x, i32 %n, i32 %w, i32* %vp) nounwind readnone { entry: @@ -46,3 +47,97 @@ call void @bar(i64 %f) ret void } + + + +; CodeGen shouldn't try to do a setne after an expanded 8-bit conditional +; move without recomputing EFLAGS, because the expansion of the conditional +; move with control flow may clobber EFLAGS (e.g., with xor, to set the +; register to zero). + +; The test is a little awkward; the important part is that there's a test before the +; setne. +; PR4814 + + + at g_3 = external global i8 ; [#uses=1] + at g_96 = external global i8 ; [#uses=2] + at g_100 = external global i8 ; [#uses=2] + at _2E_str = external constant [15 x i8], align 1 ; <[15 x i8]*> [#uses=1] + +define i32 @test4() nounwind { +entry: + %0 = load i8* @g_3, align 1 ; [#uses=2] + %1 = sext i8 %0 to i32 ; [#uses=1] + %.lobit.i = lshr i8 %0, 7 ; [#uses=1] + %tmp.i = zext i8 %.lobit.i to i32 ; [#uses=1] + %tmp.not.i = xor i32 %tmp.i, 1 ; [#uses=1] + %iftmp.17.0.i.i = ashr i32 %1, %tmp.not.i ; [#uses=1] + %retval56.i.i = trunc i32 %iftmp.17.0.i.i to i8 ; [#uses=1] + %2 = icmp eq i8 %retval56.i.i, 0 ; [#uses=2] + %g_96.promoted.i = load i8* @g_96 ; [#uses=3] + %3 = icmp eq i8 %g_96.promoted.i, 0 ; [#uses=2] + br i1 %3, label %func_4.exit.i, label %bb.i.i.i + +bb.i.i.i: ; preds = %entry + %4 = volatile load i8* @g_100, align 1 ; [#uses=0] + br label %func_4.exit.i + +; CHECK: test4: +; CHECK: g_100 +; CHECK: testb +; CHECK: testb %al, %al +; CHECK-NEXT: setne %al +; CHECK-NEXT: testb + +func_4.exit.i: ; preds = %bb.i.i.i, %entry + %.not.i = xor i1 %2, true ; [#uses=1] + %brmerge.i = or i1 %3, %.not.i ; [#uses=1] + %.mux.i = select i1 %2, i8 %g_96.promoted.i, i8 0 ; [#uses=1] + br i1 %brmerge.i, label %func_1.exit, label %bb.i.i + +bb.i.i: ; preds = %func_4.exit.i + %5 = volatile load i8* @g_100, align 1 ; [#uses=0] + br label %func_1.exit + +func_1.exit: ; preds = %bb.i.i, %func_4.exit.i + %g_96.tmp.0.i = phi i8 [ %g_96.promoted.i, %bb.i.i ], [ %.mux.i, %func_4.exit.i ] ; [#uses=2] + store i8 %g_96.tmp.0.i, i8* @g_96 + %6 = zext i8 %g_96.tmp.0.i to i32 ; [#uses=1] + %7 = tail call i32 (i8*, ...)* @printf(i8* noalias getelementptr ([15 x i8]* @_2E_str, i64 0, i64 0), i32 %6) nounwind ; [#uses=0] + ret i32 0 +} + +declare i32 @printf(i8* nocapture, ...) nounwind + + +; Should compile to setcc | -2. +; rdar://6668608 +define i32 @test5(i32* nocapture %P) nounwind readonly { +entry: +; CHECK: test5: +; CHECK: setg %al +; CHECK: movzbl %al, %eax +; CHECK: orl $-2, %eax +; CHECK: ret + + %0 = load i32* %P, align 4 ; [#uses=1] + %1 = icmp sgt i32 %0, 41 ; [#uses=1] + %iftmp.0.0 = select i1 %1, i32 -1, i32 -2 ; [#uses=1] + ret i32 %iftmp.0.0 +} + +define i32 @test6(i32* nocapture %P) nounwind readonly { +entry: +; CHECK: test6: +; CHECK: setl %al +; CHECK: movzbl %al, %eax +; CHECK: leal 4(%rax,%rax,8), %eax +; CHECK: ret + %0 = load i32* %P, align 4 ; [#uses=1] + %1 = icmp sgt i32 %0, 41 ; [#uses=1] + %iftmp.0.0 = select i1 %1, i32 4, i32 13 ; [#uses=1] + ret i32 %iftmp.0.0 +} + + Removed: llvm/trunk/test/CodeGen/X86/select-no-cmov.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/select-no-cmov.ll?rev=81822&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/select-no-cmov.ll (original) +++ llvm/trunk/test/CodeGen/X86/select-no-cmov.ll (removed) @@ -1,26 +0,0 @@ -; RUN: llc < %s | not grep cmov - -target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" -target triple = "i386-apple-darwin7" - -; Should compile to setcc | -2. -; rdar://6668608 -define i32 @test(i32* nocapture %P) nounwind readonly { -entry: - %0 = load i32* %P, align 4 ; [#uses=1] - %1 = icmp sgt i32 %0, 41 ; [#uses=1] - %iftmp.0.0 = select i1 %1, i32 -1, i32 -2 ; [#uses=1] - ret i32 %iftmp.0.0 -} - -; setl %al -; movzbl %al, %eax -; leal 4(%eax,%eax,8), %eax -define i32 @test2(i32* nocapture %P) nounwind readonly { -entry: - %0 = load i32* %P, align 4 ; [#uses=1] - %1 = icmp sgt i32 %0, 41 ; [#uses=1] - %iftmp.0.0 = select i1 %1, i32 4, i32 13 ; [#uses=1] - ret i32 %iftmp.0.0 -} - From sabre at nondot.org Mon Sep 14 21:27:23 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 15 Sep 2009 02:27:23 -0000 Subject: [llvm-commits] [llvm] r81824 - in /llvm/trunk/test/CodeGen/X86: cmov.ll select-i8.ll Message-ID: <200909150227.n8F2ROrs009182@zion.cs.uiuc.edu> Author: lattner Date: Mon Sep 14 21:27:23 2009 New Revision: 81824 URL: http://llvm.org/viewvc/llvm-project?rev=81824&view=rev Log: merge one more in. Removed: llvm/trunk/test/CodeGen/X86/select-i8.ll Modified: llvm/trunk/test/CodeGen/X86/cmov.ll Modified: llvm/trunk/test/CodeGen/X86/cmov.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/cmov.ll?rev=81824&r1=81823&r2=81824&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/cmov.ll (original) +++ llvm/trunk/test/CodeGen/X86/cmov.ll Mon Sep 14 21:27:23 2009 @@ -141,3 +141,13 @@ } +; Don't try to use a 16-bit conditional move to do an 8-bit select, +; because it isn't worth it. Just use a branch instead. +define i8 @test7(i1 inreg %c, i8 inreg %a, i8 inreg %b) nounwind { +; CHECK: test7: +; CHECK: testb $1, %dil +; CHECK-NEXT: jne LBB + + %d = select i1 %c, i8 %a, i8 %b + ret i8 %d +} Removed: llvm/trunk/test/CodeGen/X86/select-i8.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/select-i8.ll?rev=81823&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/select-i8.ll (original) +++ llvm/trunk/test/CodeGen/X86/select-i8.ll (removed) @@ -1,12 +0,0 @@ -; RUN: llc < %s -march=x86 > %t -; RUN: not grep movz %t -; RUN: not grep cmov %t -; RUN: grep movb %t | count 2 - -; Don't try to use a 16-bit conditional move to do an 8-bit select, -; because it isn't worth it. Just use a branch instead. - -define i8 @foo(i1 inreg %c, i8 inreg %a, i8 inreg %b) { - %d = select i1 %c, i8 %a, i8 %b - ret i8 %d -} From foldr at codedgers.com Mon Sep 14 22:39:48 2009 From: foldr at codedgers.com (Mikhail Glushenkov) Date: Tue, 15 Sep 2009 03:39:48 -0000 Subject: [llvm-commits] [llvm] r81826 - in /llvm/trunk: include/llvm/System/Program.h lib/System/Unix/Program.inc lib/System/Win32/Program.inc Message-ID: <200909150339.n8F3dn4T018712@zion.cs.uiuc.edu> Author: foldr Date: Mon Sep 14 22:39:45 2009 New Revision: 81826 URL: http://llvm.org/viewvc/llvm-project?rev=81826&view=rev Log: Get rid of GetProcessId in Win32/Program.inc. GetProcessId was introduced only in XP. As a bonus, this change makes Program objects copyable, since Program is now basically a PID. Modified: llvm/trunk/include/llvm/System/Program.h llvm/trunk/lib/System/Unix/Program.inc llvm/trunk/lib/System/Win32/Program.inc Modified: llvm/trunk/include/llvm/System/Program.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/System/Program.h?rev=81826&r1=81825&r2=81826&view=diff ============================================================================== --- llvm/trunk/include/llvm/System/Program.h (original) +++ llvm/trunk/include/llvm/System/Program.h Mon Sep 14 22:39:45 2009 @@ -29,22 +29,18 @@ /// @since 1.4 /// @brief An abstraction for finding and executing programs. class Program { - /// Opaque handle for target specific data. - void *Data_; - // Noncopyable. - Program(const Program& other); - Program& operator=(const Program& other); + unsigned Pid_; /// @name Methods /// @{ public: - Program(); - ~Program(); + Program() : Pid_(0) {} + ~Program() {} /// Return process ID of this program. - unsigned GetPid() const; + unsigned GetPid() const { return Pid_; } /// This function executes the program using the \p arguments provided. The /// invoked program will inherit the stdin, stdout, and stderr file Modified: llvm/trunk/lib/System/Unix/Program.inc URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Unix/Program.inc?rev=81826&r1=81825&r2=81826&view=diff ============================================================================== --- llvm/trunk/lib/System/Unix/Program.inc (original) +++ llvm/trunk/lib/System/Unix/Program.inc Mon Sep 14 22:39:45 2009 @@ -34,15 +34,6 @@ namespace llvm { using namespace sys; -Program::Program() : Data_(0) {} - -Program::~Program() {} - -unsigned Program::GetPid() const { - uint64_t pid = reinterpret_cast(Data_); - return static_cast(pid); -} - // This function just uses the PATH environment variable to find the program. Path Program::FindProgramByName(const std::string& progName) { @@ -214,7 +205,7 @@ break; } - Data_ = reinterpret_cast(child); + Pid_ = child; return true; } @@ -226,7 +217,7 @@ #ifdef HAVE_SYS_WAIT_H struct sigaction Act, Old; - if (Data_ == 0) { + if (Pid_ == 0) { MakeErrMsg(ErrMsg, "Process not started!"); return -1; } @@ -242,8 +233,7 @@ // Parent process: Wait for the child process to terminate. int status; - uint64_t pid = reinterpret_cast(Data_); - pid_t child = static_cast(pid); + pid_t child = Pid_; while (wait(&status) != child) if (secondsToWait && errno == EINTR) { // Kill the child. @@ -291,15 +281,12 @@ bool Program::Kill(std::string* ErrMsg) { - if (Data_ == 0) { + if (Pid_ == 0) { MakeErrMsg(ErrMsg, "Process not started!"); return true; } - uint64_t pid64 = reinterpret_cast(Data_); - pid_t pid = static_cast(pid64); - - if (kill(pid, SIGKILL) != 0) { + if (kill(Pid_, SIGKILL) != 0) { MakeErrMsg(ErrMsg, "The process couldn't be killed!"); return true; } Modified: llvm/trunk/lib/System/Win32/Program.inc URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Win32/Program.inc?rev=81826&r1=81825&r2=81826&view=diff ============================================================================== --- llvm/trunk/lib/System/Win32/Program.inc (original) +++ llvm/trunk/lib/System/Win32/Program.inc Mon Sep 14 22:39:45 2009 @@ -25,21 +25,6 @@ namespace llvm { using namespace sys; -Program::Program() : Data_(0) {} - -Program::~Program() { - if (Data_) { - HANDLE hProcess = reinterpret_cast(Data_); - CloseHandle(hProcess); - Data_ = 0; - } -} - -unsigned Program::GetPid() const { - HANDLE hProcess = reinterpret_cast(Data_); - return GetProcessId(hProcess); -} - // This function just uses the PATH environment variable to find the program. Path Program::FindProgramByName(const std::string& progName) { @@ -137,11 +122,6 @@ const Path** redirects, unsigned memoryLimit, std::string* ErrMsg) { - if (Data_) { - HANDLE hProcess = reinterpret_cast(Data_); - CloseHandle(Data_); - Data_ = 0; - } if (!path.canExecute()) { if (ErrMsg) @@ -269,9 +249,10 @@ path.str() + "'"); return false; } - Data_ = reinterpret_cast(pi.hProcess); + Pid_ = pi.dwProcessId; // Make sure these get closed no matter what. + AutoHandle hProcess(pi.hProcess); AutoHandle hThread(pi.hThread); // Assign the process to a job if a memory limit is defined. @@ -305,12 +286,17 @@ int Program::Wait(unsigned secondsToWait, std::string* ErrMsg) { - if (Data_ == 0) { + if (Pid_ == 0) { MakeErrMsg(ErrMsg, "Process not started!"); return -1; } - HANDLE hProcess = reinterpret_cast(Data_); + HANDLE hOpen = OpenProcess(SYNCHRONIZE, FALSE, Pid_); + if (hOpen == NULL) { + MakeErrMsg(ErrMsg, "OpenProcess failed!"); + return -1; + } + AutoHandle hProcess(hOpen); // Wait for the process to terminate. DWORD millisecondsToWait = INFINITE; @@ -341,12 +327,18 @@ bool Program::Kill(std::string* ErrMsg) { - if (Data_ == 0) { + if (Pid_ == 0) { MakeErrMsg(ErrMsg, "Process not started!"); return true; } - HANDLE hProcess = reinterpret_cast(Data_); + HANDLE hOpen = OpenProcess(PROCESS_TERMINATE, FALSE, Pid_); + if (hOpen == NULL) { + MakeErrMsg(ErrMsg, "OpenProcess failed!"); + return true; + } + AutoHandle hProcess(hOpen); + if (TerminateProcess(hProcess, 1) == 0) { MakeErrMsg(ErrMsg, "The process couldn't be killed!"); return true; From kremenek at apple.com Mon Sep 14 23:06:37 2009 From: kremenek at apple.com (Ted Kremenek) Date: Tue, 15 Sep 2009 04:06:37 -0000 Subject: [llvm-commits] [llvm] r81827 - /llvm/trunk/lib/Target/ARM/AsmParser/CMakeLists.txt Message-ID: <200909150406.n8F46b0d021932@zion.cs.uiuc.edu> Author: kremenek Date: Mon Sep 14 23:06:36 2009 New Revision: 81827 URL: http://llvm.org/viewvc/llvm-project?rev=81827&view=rev Log: Remove invalid add_dependencies line to unbreak the CMake build. Modified: llvm/trunk/lib/Target/ARM/AsmParser/CMakeLists.txt Modified: llvm/trunk/lib/Target/ARM/AsmParser/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmParser/CMakeLists.txt?rev=81827&r1=81826&r2=81827&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/AsmParser/CMakeLists.txt (original) +++ llvm/trunk/lib/Target/ARM/AsmParser/CMakeLists.txt Mon Sep 14 23:06:36 2009 @@ -3,4 +3,4 @@ add_llvm_library(LLVMARMAsmParser ARMAsmParser.cpp ) -add_dependencies(LLVMARMAsmParser) + From kremenek at apple.com Mon Sep 14 23:06:42 2009 From: kremenek at apple.com (Ted Kremenek) Date: Mon, 14 Sep 2009 21:06:42 -0700 Subject: [llvm-commits] [llvm] r81817 - in /llvm/trunk: lib/Target/ARM/AsmParser/ lib/Target/ARM/AsmParser/ARMAsmParser.cpp lib/Target/ARM/AsmParser/CMakeLists.txt lib/Target/ARM/AsmParser/Makefile lib/Target/ARM/Makefile test/MC/AsmParser/arm_word_directive.s test/MC/AsmParser/directive_values.s test/MC/AsmParser/x86_word_directive.s In-Reply-To: <200909150027.n8F0RQUw026432@zion.cs.uiuc.edu> References: <200909150027.n8F0RQUw026432@zion.cs.uiuc.edu> Message-ID: On Sep 14, 2009, at 5:27 PM, Kevin Enderby wrote: > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/ARM/AsmParser/CMakeLists.txt (added) > +++ llvm/trunk/lib/Target/ARM/AsmParser/CMakeLists.txt Mon Sep 14 > 19:27:25 2009 > @@ -0,0 +1,6 @@ > +include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. $ > {CMAKE_CURRENT_SOURCE_DIR}/.. ) > + > +add_llvm_library(LLVMARMAsmParser > + ARMAsmParser.cpp > + ) > +add_dependencies(LLVMARMAsmParser) > Hi Kevin, This last line actually breaks the CMake builds: CMake Error at lib/Target/ARM/AsmParser/CMakeLists.txt:6 (add_dependencies): add_dependencies called with incorrect number of arguments Were you trying to add a specific dependency between the LLVMARMAsmParser and something else? I've gone ahead and removed this last line, but I'm not certain if that is the right thing to do. The CMake build now works, but I'm not certain if a dependency is suppose to be there. Ted -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090914/be180ee6/attachment.html From kremenek at apple.com Mon Sep 14 23:17:35 2009 From: kremenek at apple.com (Ted Kremenek) Date: Tue, 15 Sep 2009 04:17:35 -0000 Subject: [llvm-commits] [llvm] r81828 - /llvm/tags/checker/checker-0.220/ Message-ID: <200909150417.n8F4HZFG023349@zion.cs.uiuc.edu> Author: kremenek Date: Mon Sep 14 23:17:34 2009 New Revision: 81828 URL: http://llvm.org/viewvc/llvm-project?rev=81828&view=rev Log: Removing checker-0.220. Removed: llvm/tags/checker/checker-0.220/ From kremenek at apple.com Mon Sep 14 23:19:24 2009 From: kremenek at apple.com (Ted Kremenek) Date: Tue, 15 Sep 2009 04:19:24 -0000 Subject: [llvm-commits] [llvm] r81831 - /llvm/tags/checker/checker-0.220/ Message-ID: <200909150419.n8F4JOrs023602@zion.cs.uiuc.edu> Author: kremenek Date: Mon Sep 14 23:19:24 2009 New Revision: 81831 URL: http://llvm.org/viewvc/llvm-project?rev=81831&view=rev Log: Tagging checker-0.220. Added: llvm/tags/checker/checker-0.220/ - copied from r81830, llvm/trunk/ From sabre at nondot.org Mon Sep 14 23:27:29 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 15 Sep 2009 04:27:29 -0000 Subject: [llvm-commits] [llvm] r81833 - /llvm/trunk/test/CodeGen/X86/cmov.ll Message-ID: <200909150427.n8F4RTxe024619@zion.cs.uiuc.edu> Author: lattner Date: Mon Sep 14 23:27:29 2009 New Revision: 81833 URL: http://llvm.org/viewvc/llvm-project?rev=81833&view=rev Log: this is failing on linux hosts, force a triple. Modified: llvm/trunk/test/CodeGen/X86/cmov.ll Modified: llvm/trunk/test/CodeGen/X86/cmov.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/cmov.ll?rev=81833&r1=81832&r2=81833&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/cmov.ll (original) +++ llvm/trunk/test/CodeGen/X86/cmov.ll Mon Sep 14 23:27:29 2009 @@ -1,4 +1,4 @@ -; RUN: llc < %s -march=x86-64 | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-apple-darwin10 | FileCheck %s target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128" define i32 @test1(i32 %x, i32 %n, i32 %w, i32* %vp) nounwind readnone { From sabre at nondot.org Mon Sep 14 23:37:49 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 15 Sep 2009 04:37:49 -0000 Subject: [llvm-commits] [llvm] r81834 - /llvm/trunk/include/llvm/ADT/SCCIterator.h Message-ID: <200909150437.n8F4bnf2025925@zion.cs.uiuc.edu> Author: lattner Date: Mon Sep 14 23:37:49 2009 New Revision: 81834 URL: http://llvm.org/viewvc/llvm-project?rev=81834&view=rev Log: switch scciterator to use DenseMap instead of std::map Modified: llvm/trunk/include/llvm/ADT/SCCIterator.h Modified: llvm/trunk/include/llvm/ADT/SCCIterator.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SCCIterator.h?rev=81834&r1=81833&r2=81834&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/SCCIterator.h (original) +++ llvm/trunk/include/llvm/ADT/SCCIterator.h Mon Sep 14 23:37:49 2009 @@ -22,7 +22,7 @@ #define LLVM_ADT_SCCITERATOR_H #include "llvm/ADT/GraphTraits.h" -#include +#include "llvm/ADT/DenseMap.h" #include namespace llvm { @@ -48,7 +48,7 @@ // visitNum is the global counter. // nodeVisitNumbers are per-node visit numbers, also used as DFS flags. unsigned visitNum; - std::map nodeVisitNumbers; + DenseMap nodeVisitNumbers; // SCCNodeStack - Stack holding nodes of the SCC. std::vector SCCNodeStack; From sabre at nondot.org Mon Sep 14 23:45:26 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 15 Sep 2009 04:45:26 -0000 Subject: [llvm-commits] [llvm] r81836 - /llvm/trunk/lib/VMCore/PassManager.cpp Message-ID: <200909150445.n8F4jQn1026893@zion.cs.uiuc.edu> Author: lattner Date: Mon Sep 14 23:45:26 2009 New Revision: 81836 URL: http://llvm.org/viewvc/llvm-project?rev=81836&view=rev Log: add some missing quotes in debug output Modified: llvm/trunk/lib/VMCore/PassManager.cpp Modified: llvm/trunk/lib/VMCore/PassManager.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/PassManager.cpp?rev=81836&r1=81835&r2=81836&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/PassManager.cpp (original) +++ llvm/trunk/lib/VMCore/PassManager.cpp Mon Sep 14 23:45:26 2009 @@ -1041,10 +1041,10 @@ errs() << "' on Module '" << Msg << "'...\n"; break; case ON_LOOP_MSG: - errs() << "' on Loop " << Msg << "'...\n"; + errs() << "' on Loop '" << Msg << "'...\n"; break; case ON_CG_MSG: - errs() << "' on Call Graph " << Msg << "'...\n"; + errs() << "' on Call Graph '" << Msg << "'...\n"; break; default: break; From sabre at nondot.org Tue Sep 15 00:03:04 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 15 Sep 2009 05:03:04 -0000 Subject: [llvm-commits] [llvm] r81838 - in /llvm/trunk: include/llvm/PassManagers.h lib/Analysis/IPA/CallGraphSCCPass.cpp lib/VMCore/PassManager.cpp Message-ID: <200909150503.n8F534eE029077@zion.cs.uiuc.edu> Author: lattner Date: Tue Sep 15 00:03:04 2009 New Revision: 81838 URL: http://llvm.org/viewvc/llvm-project?rev=81838&view=rev Log: make -debug-pass=Executions show information about what call graph nodes are in the SCC for each execution of a CGSCC pass. Modified: llvm/trunk/include/llvm/PassManagers.h llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp llvm/trunk/lib/VMCore/PassManager.cpp Modified: llvm/trunk/include/llvm/PassManagers.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/PassManagers.h?rev=81838&r1=81837&r2=81838&view=diff ============================================================================== --- llvm/trunk/include/llvm/PassManagers.h (original) +++ llvm/trunk/include/llvm/PassManagers.h Tue Sep 15 00:03:04 2009 @@ -380,6 +380,11 @@ // then PMT_Last active pass mangers. std::map *InheritedAnalysis[PMT_Last]; + + /// isPassDebuggingExecutionsOrMore - Return true if -debug-pass=Executions + /// or higher is specified. + bool isPassDebuggingExecutionsOrMore() const; + private: void dumpAnalysisUsage(const StringRef &Msg, const Pass *P, const AnalysisUsage::VectorType &Set) const; Modified: llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp?rev=81838&r1=81837&r2=81838&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp (original) +++ llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp Tue Sep 15 00:03:04 2009 @@ -317,7 +317,20 @@ PassNo != e; ++PassNo) { Pass *P = getContainedPass(PassNo); - dumpPassInfo(P, EXECUTION_MSG, ON_CG_MSG, ""); + // If we're in -debug-pass=Executions mode, construct the SCC node list, + // otherwise avoid constructing this string as it is expensive. + if (isPassDebuggingExecutionsOrMore()) { + std::string Functions; +#ifndef NDEBUG + raw_string_ostream OS(Functions); + for (unsigned i = 0, e = CurSCC.size(); i != e; ++i) { + if (i) OS << ", "; + CurSCC[i]->print(OS); + } + OS.flush(); +#endif + dumpPassInfo(P, EXECUTION_MSG, ON_CG_MSG, Functions); + } dumpRequiredSet(P); initializeAnalysisImpl(P); Modified: llvm/trunk/lib/VMCore/PassManager.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/PassManager.cpp?rev=81838&r1=81837&r2=81838&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/PassManager.cpp (original) +++ llvm/trunk/lib/VMCore/PassManager.cpp Tue Sep 15 00:03:04 2009 @@ -67,6 +67,15 @@ clEnumValEnd)); } // End of llvm namespace +/// isPassDebuggingExecutionsOrMore - Return true if -debug-pass=Executions +/// or higher is specified. +bool PMDataManager::isPassDebuggingExecutionsOrMore() const { + return PassDebugging >= Executions; +} + + + + void PassManagerPrettyStackEntry::print(raw_ostream &OS) const { if (V == 0 && M == 0) OS << "Releasing pass '"; @@ -1044,7 +1053,7 @@ errs() << "' on Loop '" << Msg << "'...\n"; break; case ON_CG_MSG: - errs() << "' on Call Graph '" << Msg << "'...\n"; + errs() << "' on Call Graph Nodes '" << Msg << "'...\n"; break; default: break; @@ -1076,10 +1085,10 @@ return; errs() << (void*)P << std::string(getDepth()*2+3, ' ') << Msg << " Analyses:"; for (unsigned i = 0; i != Set.size(); ++i) { - if (i) errs() << ","; - errs() << " " << Set[i]->getPassName(); + if (i) errs() << ','; + errs() << ' ' << Set[i]->getPassName(); } - errs() << "\n"; + errs() << '\n'; } /// Add RequiredPass into list of lower level passes required by pass P. From sabre at nondot.org Tue Sep 15 00:14:57 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 15 Sep 2009 05:14:57 -0000 Subject: [llvm-commits] [llvm] r81840 - /llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp Message-ID: <200909150514.n8F5EvZv030678@zion.cs.uiuc.edu> Author: lattner Date: Tue Sep 15 00:14:57 2009 New Revision: 81840 URL: http://llvm.org/viewvc/llvm-project?rev=81840&view=rev Log: add newline to debug dump Modified: llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp Modified: llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp?rev=81840&r1=81839&r2=81840&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp Tue Sep 15 00:14:57 2009 @@ -337,7 +337,7 @@ /// predicate, do SROA now. void SROA::DoScalarReplacement(AllocationInst *AI, std::vector &WorkList) { - DEBUG(errs() << "Found inst to SROA: " << *AI); + DEBUG(errs() << "Found inst to SROA: " << *AI << '\n'); SmallVector ElementAllocas; if (const StructType *ST = dyn_cast(AI->getAllocatedType())) { ElementAllocas.reserve(ST->getNumContainedTypes()); From sabre at nondot.org Tue Sep 15 00:40:35 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 15 Sep 2009 05:40:35 -0000 Subject: [llvm-commits] [llvm] r81843 - in /llvm/trunk: include/llvm/Analysis/CallGraph.h lib/Analysis/IPA/CallGraph.cpp lib/Transforms/IPO/ArgumentPromotion.cpp Message-ID: <200909150540.n8F5eZA2001379@zion.cs.uiuc.edu> Author: lattner Date: Tue Sep 15 00:40:35 2009 New Revision: 81843 URL: http://llvm.org/viewvc/llvm-project?rev=81843&view=rev Log: add a new CallGraphNode::replaceCallEdge method and use it from argpromote to avoid invalidating an iterator. This fixes PR4977. All clang tests now pass with expensive checking (on my system at least). Modified: llvm/trunk/include/llvm/Analysis/CallGraph.h llvm/trunk/lib/Analysis/IPA/CallGraph.cpp llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp Modified: llvm/trunk/include/llvm/Analysis/CallGraph.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/CallGraph.h?rev=81843&r1=81842&r2=81843&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/CallGraph.h (original) +++ llvm/trunk/include/llvm/Analysis/CallGraph.h Tue Sep 15 00:40:35 2009 @@ -270,6 +270,12 @@ /// removeOneAbstractEdgeTo - Remove one edge associated with a null callsite /// from this node to the specified callee function. void removeOneAbstractEdgeTo(CallGraphNode *Callee); + + /// replaceCallEdge - This method replaces the edge in the node for the + /// specified call site with a new one. Note that this method takes linear + /// time, so it should be used sparingly. + void replaceCallEdge(CallSite CS, CallSite NewCS, CallGraphNode *NewNode); + }; //===----------------------------------------------------------------------===// Modified: llvm/trunk/lib/Analysis/IPA/CallGraph.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IPA/CallGraph.cpp?rev=81843&r1=81842&r2=81843&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/IPA/CallGraph.cpp (original) +++ llvm/trunk/lib/Analysis/IPA/CallGraph.cpp Tue Sep 15 00:40:35 2009 @@ -279,5 +279,22 @@ } } +/// replaceCallEdge - This method replaces the edge in the node for the +/// specified call site with a new one. Note that this method takes linear +/// time, so it should be used sparingly. +void CallGraphNode::replaceCallEdge(CallSite CS, + CallSite NewCS, CallGraphNode *NewNode){ + for (CalledFunctionsVector::iterator I = CalledFunctions.begin(); ; ++I) { + assert(I != CalledFunctions.end() && "Cannot find callsite to remove!"); + if (I->first == CS.getInstruction()) { + I->second->DropRef(); + I->first = NewCS.getInstruction(); + I->second = NewNode; + NewNode->AddRef(); + return; + } + } +} + // Enuse that users of CallGraph.h also link with this file DEFINING_FILE_FOR(CallGraph) Modified: llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp?rev=81843&r1=81842&r2=81843&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp Tue Sep 15 00:40:35 2009 @@ -589,7 +589,7 @@ // Construct the new function type using the new arguments. FunctionType *NFTy = FunctionType::get(RetTy, Params, FTy->isVarArg()); - // Create the new function body and insert it into the module... + // Create the new function body and insert it into the module. Function *NF = Function::Create(NFTy, F->getLinkage(), F->getName()); NF->copyAttributesFrom(F); @@ -599,7 +599,8 @@ // Recompute the parameter attributes list based on the new arguments for // the function. - NF->setAttributes(AttrListPtr::get(AttributesVec.begin(), AttributesVec.end())); + NF->setAttributes(AttrListPtr::get(AttributesVec.begin(), + AttributesVec.end())); AttributesVec.clear(); F->getParent()->getFunctionList().insert(F, NF); @@ -729,8 +730,7 @@ // Update the callgraph to know that the callsite has been transformed. CallGraphNode *CalleeNode = CG[Call->getParent()->getParent()]; - CalleeNode->removeCallEdgeFor(Call); - CalleeNode->addCalledFunction(New, NF_CGN); + CalleeNode->replaceCallEdge(Call, New, NF_CGN); if (!Call->use_empty()) { Call->replaceAllUsesWith(New); From sabre at nondot.org Tue Sep 15 01:28:12 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 15 Sep 2009 06:28:12 -0000 Subject: [llvm-commits] [llvm] r81845 - in /llvm/trunk: lib/VMCore/ConstantFold.cpp test/Assembler/insertextractvalue.ll Message-ID: <200909150628.n8F6SDib007558@zion.cs.uiuc.edu> Author: lattner Date: Tue Sep 15 01:28:12 2009 New Revision: 81845 URL: http://llvm.org/viewvc/llvm-project?rev=81845&view=rev Log: fix PR4963: folding insertvalue would sometimes turn a packed struct into an unpacked one. Modified: llvm/trunk/lib/VMCore/ConstantFold.cpp llvm/trunk/test/Assembler/insertextractvalue.ll Modified: llvm/trunk/lib/VMCore/ConstantFold.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/ConstantFold.cpp?rev=81845&r1=81844&r2=81845&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/ConstantFold.cpp (original) +++ llvm/trunk/lib/VMCore/ConstantFold.cpp Tue Sep 15 01:28:12 2009 @@ -499,17 +499,19 @@ if (isa(Agg)) { // Insertion of constant into aggregate undef - // Optimize away insertion of undef + // Optimize away insertion of undef. if (isa(Val)) return const_cast(Agg); + // Otherwise break the aggregate undef into multiple undefs and do - // the insertion + // the insertion. const CompositeType *AggTy = cast(Agg->getType()); unsigned numOps; if (const ArrayType *AR = dyn_cast(AggTy)) numOps = AR->getNumElements(); else numOps = cast(AggTy)->getNumElements(); + std::vector Ops(numOps); for (unsigned i = 0; i < numOps; ++i) { const Type *MemberTy = AggTy->getTypeAtIndex(i); @@ -520,24 +522,27 @@ UndefValue::get(MemberTy); Ops[i] = const_cast(Op); } - if (isa(AggTy)) - return ConstantStruct::get(Context, Ops); - else - return ConstantArray::get(cast(AggTy), Ops); + + if (const StructType* ST = dyn_cast(AggTy)) + return ConstantStruct::get(Context, Ops, ST->isPacked()); + return ConstantArray::get(cast(AggTy), Ops); } + if (isa(Agg)) { // Insertion of constant into aggregate zero - // Optimize away insertion of zero + // Optimize away insertion of zero. if (Val->isNullValue()) return const_cast(Agg); + // Otherwise break the aggregate zero into multiple zeros and do - // the insertion + // the insertion. const CompositeType *AggTy = cast(Agg->getType()); unsigned numOps; if (const ArrayType *AR = dyn_cast(AggTy)) numOps = AR->getNumElements(); else numOps = cast(AggTy)->getNumElements(); + std::vector Ops(numOps); for (unsigned i = 0; i < numOps; ++i) { const Type *MemberTy = AggTy->getTypeAtIndex(i); @@ -549,13 +554,14 @@ Constant::getNullValue(MemberTy); Ops[i] = const_cast(Op); } - if (isa(AggTy)) - return ConstantStruct::get(Context, Ops); - else - return ConstantArray::get(cast(AggTy), Ops); + + if (const StructType* ST = dyn_cast(AggTy)) + return ConstantStruct::get(Context, Ops, ST->isPacked()); + return ConstantArray::get(cast(AggTy), Ops); } + if (isa(Agg) || isa(Agg)) { - // Insertion of constant into aggregate constant + // Insertion of constant into aggregate constant. std::vector Ops(Agg->getNumOperands()); for (unsigned i = 0; i < Agg->getNumOperands(); ++i) { const Constant *Op = @@ -565,12 +571,10 @@ Agg->getOperand(i); Ops[i] = const_cast(Op); } - Constant *C; - if (isa(Agg->getType())) - C = ConstantStruct::get(Context, Ops); - else - C = ConstantArray::get(cast(Agg->getType()), Ops); - return C; + + if (const StructType* ST = dyn_cast(Agg->getType())) + return ConstantStruct::get(Context, Ops, ST->isPacked()); + return ConstantArray::get(cast(Agg->getType()), Ops); } return 0; @@ -585,7 +589,7 @@ if (C1->getType() == Type::getPPC_FP128Ty(Context)) return 0; - // Handle UndefValue up front + // Handle UndefValue up front. if (isa(C1) || isa(C2)) { switch (Opcode) { case Instruction::Xor: Modified: llvm/trunk/test/Assembler/insertextractvalue.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/insertextractvalue.ll?rev=81845&r1=81844&r2=81845&view=diff ============================================================================== --- llvm/trunk/test/Assembler/insertextractvalue.ll (original) +++ llvm/trunk/test/Assembler/insertextractvalue.ll Tue Sep 15 01:28:12 2009 @@ -21,3 +21,9 @@ store {{i32},{float, double}} insertvalue ({{i32},{float, double}} zeroinitializer, double 20.0, 1, 1), {{i32},{float, double}}* %p ret float extractvalue ({{i32},{float, double}} zeroinitializer, 1, 0) } + + +; PR4963 +define <{ i32, i32 }> @test57() { + ret <{ i32, i32 }> insertvalue (<{ i32, i32 }> zeroinitializer, i32 4, 1) +} From nicholas at mxc.ca Tue Sep 15 01:28:26 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Tue, 15 Sep 2009 06:28:26 -0000 Subject: [llvm-commits] [llvm] r81846 - in /llvm/trunk: lib/VMCore/Type.cpp test/Other/2009-09-14-function-elements.ll Message-ID: <200909150628.n8F6SQQ4007601@zion.cs.uiuc.edu> Author: nicholas Date: Tue Sep 15 01:28:26 2009 New Revision: 81846 URL: http://llvm.org/viewvc/llvm-project?rev=81846&view=rev Log: Forbid arrays of function-type and structures with function-typed fields. While I'm there, change code that does: SomeTy == Type::getFooType(Context) into: SomeTy->getTypeID() == FooTyID to decrease the amount of useless type creation which may involve locking, etc. Added: llvm/trunk/test/Other/2009-09-14-function-elements.ll Modified: llvm/trunk/lib/VMCore/Type.cpp Modified: llvm/trunk/lib/VMCore/Type.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Type.cpp?rev=81846&r1=81845&r2=81846&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Type.cpp (original) +++ llvm/trunk/lib/VMCore/Type.cpp Tue Sep 15 01:28:26 2009 @@ -364,11 +364,10 @@ bool FunctionType::isValidReturnType(const Type *RetTy) { if (RetTy->isFirstClassType()) { if (const PointerType *PTy = dyn_cast(RetTy)) - return PTy->getElementType() != Type::getMetadataTy(RetTy->getContext()); + return PTy->getElementType()->getTypeID() != MetadataTyID; return true; } - if (RetTy == Type::getVoidTy(RetTy->getContext()) || - RetTy == Type::getMetadataTy(RetTy->getContext()) || + if (RetTy->getTypeID() == VoidTyID || RetTy->getTypeID() == MetadataTyID || isa(RetTy)) return true; @@ -389,8 +388,7 @@ bool FunctionType::isValidArgumentType(const Type *ArgTy) { if ((!ArgTy->isFirstClassType() && !isa(ArgTy)) || (isa(ArgTy) && - cast(ArgTy)->getElementType() == - Type::getMetadataTy(ArgTy->getContext()))) + cast(ArgTy)->getElementType()->getTypeID() == MetadataTyID)) return false; return true; @@ -829,13 +827,12 @@ } bool ArrayType::isValidElementType(const Type *ElemTy) { - if (ElemTy == Type::getVoidTy(ElemTy->getContext()) || - ElemTy == Type::getLabelTy(ElemTy->getContext()) || - ElemTy == Type::getMetadataTy(ElemTy->getContext())) + if (ElemTy->getTypeID() == VoidTyID || ElemTy->getTypeID() == LabelTyID || + ElemTy->getTypeID() == MetadataTyID || isa(ElemTy)) return false; if (const PointerType *PTy = dyn_cast(ElemTy)) - if (PTy->getElementType() == Type::getMetadataTy(ElemTy->getContext())) + if (PTy->getElementType()->getTypeID() == MetadataTyID) return false; return true; @@ -909,13 +906,12 @@ } bool StructType::isValidElementType(const Type *ElemTy) { - if (ElemTy == Type::getVoidTy(ElemTy->getContext()) || - ElemTy == Type::getLabelTy(ElemTy->getContext()) || - ElemTy == Type::getMetadataTy(ElemTy->getContext())) + if (ElemTy->getTypeID() == VoidTyID || ElemTy->getTypeID() == LabelTyID || + ElemTy->getTypeID() == MetadataTyID || isa(ElemTy)) return false; if (const PointerType *PTy = dyn_cast(ElemTy)) - if (PTy->getElementType() == Type::getMetadataTy(ElemTy->getContext())) + if (PTy->getElementType()->getTypeID() == MetadataTyID) return false; return true; @@ -928,7 +924,7 @@ PointerType *PointerType::get(const Type *ValueType, unsigned AddressSpace) { assert(ValueType && "Can't get a pointer to type!"); - assert(ValueType != Type::getVoidTy(ValueType->getContext()) && + assert(ValueType->getTypeID() != VoidTyID && "Pointer to void is not valid, use i8* instead!"); assert(isValidElementType(ValueType) && "Invalid type for pointer element!"); PointerValType PVT(ValueType, AddressSpace); @@ -955,12 +951,12 @@ } bool PointerType::isValidElementType(const Type *ElemTy) { - if (ElemTy == Type::getVoidTy(ElemTy->getContext()) || - ElemTy == Type::getLabelTy(ElemTy->getContext())) + if (ElemTy->getTypeID() == VoidTyID || + ElemTy->getTypeID() == LabelTyID) return false; if (const PointerType *PTy = dyn_cast(ElemTy)) - if (PTy->getElementType() == Type::getMetadataTy(ElemTy->getContext())) + if (PTy->getElementType()->getTypeID() == MetadataTyID) return false; return true; Added: llvm/trunk/test/Other/2009-09-14-function-elements.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Other/2009-09-14-function-elements.ll?rev=81846&view=auto ============================================================================== --- llvm/trunk/test/Other/2009-09-14-function-elements.ll (added) +++ llvm/trunk/test/Other/2009-09-14-function-elements.ll Tue Sep 15 01:28:26 2009 @@ -0,0 +1,6 @@ +; RUN: not llvm-as %s -disable-output 2>/dev/null + +; Arrays and structures with function types (not function pointers) are illegal. + + at foo = external global [4 x i32 (i32)] + at bar = external global { i32 (i32) } From clattner at apple.com Tue Sep 15 01:29:42 2009 From: clattner at apple.com (Chris Lattner) Date: Mon, 14 Sep 2009 23:29:42 -0700 Subject: [llvm-commits] [llvm] r81845 - in /llvm/trunk: lib/VMCore/ConstantFold.cpp test/Assembler/insertextractvalue.ll In-Reply-To: <200909150628.n8F6SDib007558@zion.cs.uiuc.edu> References: <200909150628.n8F6SDib007558@zion.cs.uiuc.edu> Message-ID: <74A7C8B1-614C-44CA-A454-3ECF822D13A4@apple.com> On Sep 14, 2009, at 11:28 PM, Chris Lattner wrote: > Author: lattner > Date: Tue Sep 15 01:28:12 2009 > New Revision: 81845 > > URL: http://llvm.org/viewvc/llvm-project?rev=81845&view=rev > Log: > fix PR4963: folding insertvalue would sometimes turn a packed struct > into > an unpacked one. I forgot to mention that the patch was by written by Tomas Lindquist Olsen! -Chris From sabre at nondot.org Tue Sep 15 01:34:29 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 15 Sep 2009 06:34:29 -0000 Subject: [llvm-commits] [llvm] r81848 - /llvm/trunk/test/Transforms/ConstProp/basictest.ll Message-ID: <200909150634.n8F6YTKP008432@zion.cs.uiuc.edu> Author: lattner Date: Tue Sep 15 01:34:29 2009 New Revision: 81848 URL: http://llvm.org/viewvc/llvm-project?rev=81848&view=rev Log: convert to filecheck Modified: llvm/trunk/test/Transforms/ConstProp/basictest.ll Modified: llvm/trunk/test/Transforms/ConstProp/basictest.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/ConstProp/basictest.ll?rev=81848&r1=81847&r2=81848&view=diff ============================================================================== --- llvm/trunk/test/Transforms/ConstProp/basictest.ll (original) +++ llvm/trunk/test/Transforms/ConstProp/basictest.ll Tue Sep 15 01:34:29 2009 @@ -1,20 +1,21 @@ +; RUN: opt < %s -constprop -die -S | FileCheck %s + ; This is a basic sanity check for constant propogation. The add instruction ; should be eliminated. - -; RUN: opt < %s -constprop -die -S | not grep add - -define i32 @test(i1 %B) { +define i32 @test1(i1 %B) { br i1 %B, label %BB1, label %BB2 -BB1: ; preds = %0 - %Val = add i32 0, 0 ; [#uses=1] +BB1: + %Val = add i32 0, 0 br label %BB3 -BB2: ; preds = %0 +BB2: br label %BB3 -BB3: ; preds = %BB2, %BB1 - %Ret = phi i32 [ %Val, %BB1 ], [ 1, %BB2 ] ; [#uses=1] +BB3: +; CHECK: @test1 +; CHECK: %Ret = phi i32 [ 0, %BB1 ], [ 1, %BB2 ] + %Ret = phi i32 [ %Val, %BB1 ], [ 1, %BB2 ] ret i32 %Ret } From clattner at apple.com Tue Sep 15 01:41:26 2009 From: clattner at apple.com (Chris Lattner) Date: Mon, 14 Sep 2009 23:41:26 -0700 Subject: [llvm-commits] [llvm] r81813 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAG.h include/llvm/CodeGen/SelectionDAGNodes.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp In-Reply-To: <200909150013.n8F0DCbX024473@zion.cs.uiuc.edu> References: <200909150013.n8F0DCbX024473@zion.cs.uiuc.edu> Message-ID: On Sep 14, 2009, at 5:13 PM, Nate Begeman wrote: > Author: sampo > Date: Mon Sep 14 19:13:12 2009 > New Revision: 81813 > > URL: http://llvm.org/viewvc/llvm-project?rev=81813&view=rev > Log: > Add an "original alignment" field to load and store nodes. This > enables the > DAG Combiner to disambiguate chains for loads and stores of types > which are > broken up by the Legalizer into smaller pieces. Hi Nate, > + //! OrigAlign - The original alignment of this MemSDNode in the > case where > + // this node was created by legalize from a MemSDNode with known > alignment. > + unsigned OrigAlign; I don't understand what this means. Is this saying that the load/ store is always an access to [ptr_with_some_alignment]+SVOffset? If so, it seems that the ultimate alignment of the access is actually: MinAlign(OrigAlign, SVOffset) (from MathExtras.h). If this is true, then you can make the comment much more strong, and fix MemSDNode to never actually store the alignment of the access (store OrigAlign instead and compute the access alignment when needed). If we do need to keep both alignments around, is there any way to encode this in SubclassData like the alignment field itself is to avoid growing MemSDNode (the biggest sdnode)? -Chris From evan.cheng at apple.com Tue Sep 15 01:45:17 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 15 Sep 2009 06:45:17 -0000 Subject: [llvm-commits] [llvm] r81849 - /llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Message-ID: <200909150645.n8F6jHVo009922@zion.cs.uiuc.edu> Author: evancheng Date: Tue Sep 15 01:45:16 2009 New Revision: 81849 URL: http://llvm.org/viewvc/llvm-project?rev=81849&view=rev Log: Another try at early partial coalescing. Identity phi source copies (their sources are defined by phi join def) are coalesced. And the phi join copy is backward copy propagated into the other copies. Still miscompiling some tests. :-( Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=81849&r1=81848&r2=81849&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original) +++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Tue Sep 15 01:45:16 2009 @@ -1052,23 +1052,19 @@ bool LiveIntervals::isProfitableToCoalesce(LiveInterval &DstInt, LiveInterval &SrcInt, SmallVector &IdentCopies, - SmallVector &OtherCopies, - bool &HaveConflict) { - HaveConflict = false; - + SmallVector &OtherCopies) { + bool HaveConflict = false; unsigned NumIdent = 0; - unsigned NumSources = 0; for (MachineRegisterInfo::reg_iterator ri = mri_->reg_begin(SrcInt.reg), re = mri_->reg_end(); ri != re; ++ri) { MachineOperand &O = ri.getOperand(); if (!O.isDef()) continue; - ++NumSources; MachineInstr *MI = &*ri; unsigned SrcReg, DstReg, SrcSubReg, DstSubReg; if (!tii_->isMoveInstr(*MI, SrcReg, DstReg, SrcSubReg, DstSubReg)) - continue; + return false; if (SrcReg != DstInt.reg) { OtherCopies.push_back(MI); HaveConflict |= DstInt.liveAt(getInstructionIndex(MI)); @@ -1078,7 +1074,9 @@ } } - return NumSources >= 5 && (((float)NumIdent) / NumSources) > 0.20F; + if (!HaveConflict) + return false; // Let coalescer handle it + return IdentCopies.size() > OtherCopies.size(); } void LiveIntervals::performEarlyCoalescing() { @@ -1104,78 +1102,78 @@ LiveInterval &SrcInt = getInterval(PHISrc); SmallVector IdentCopies; SmallVector OtherCopies; - bool HaveConflict; - if (!isProfitableToCoalesce(DstInt, SrcInt, IdentCopies, OtherCopies, - HaveConflict)) + if (!isProfitableToCoalesce(DstInt, SrcInt, IdentCopies, OtherCopies)) continue; DEBUG(errs() << "PHI Join: " << *Join); assert(DstInt.containsOneValue() && "PHI join should have just one val#!"); VNInfo *VNI = DstInt.getValNumInfo(0); - VNInfo *NewVNI = HaveConflict - ? 0 : SrcInt.getNextValue(VNI->def, 0, false, VNInfoAllocator); + + // Change the non-identity copies to directly target the phi destination. + for (unsigned i = 0, e = OtherCopies.size(); i != e; ++i) { + MachineInstr *PHICopy = OtherCopies[i]; + DEBUG(errs() << "Moving: " << *PHICopy); + + MachineInstrIndex MIIndex = getInstructionIndex(PHICopy); + MachineInstrIndex DefIndex = getDefIndex(MIIndex); + LiveRange *SLR = SrcInt.getLiveRangeContaining(DefIndex); + MachineInstrIndex StartIndex = SLR->start; + MachineInstrIndex EndIndex = SLR->end; + + // Delete val# defined by the now identity copy and add the range from + // beginning of the mbb to the end of the range. + SrcInt.removeValNo(SLR->valno); + DEBUG(errs() << " added range [" << StartIndex << ',' + << EndIndex << "] to reg" << DstInt.reg << '\n'); + if (DstInt.liveAt(StartIndex)) + DstInt.removeRange(StartIndex, EndIndex); + VNInfo *NewVNI = DstInt.getNextValue(DefIndex, PHICopy, true, + VNInfoAllocator); + NewVNI->setHasPHIKill(true); + DstInt.addRange(LiveRange(StartIndex, EndIndex, NewVNI)); + for (unsigned j = 0, ee = PHICopy->getNumOperands(); j != ee; ++j) { + MachineOperand &MO = PHICopy->getOperand(j); + if (!MO.isReg() || MO.getReg() != PHISrc) + continue; + MO.setReg(PHIDst); + } + } + // Now let's eliminate all the would-be identity copies. for (unsigned i = 0, e = IdentCopies.size(); i != e; ++i) { MachineInstr *PHICopy = IdentCopies[i]; DEBUG(errs() << "Coalescing: " << *PHICopy); - MachineBasicBlock *PHIMBB = PHICopy->getParent(); MachineInstrIndex MIIndex = getInstructionIndex(PHICopy); MachineInstrIndex DefIndex = getDefIndex(MIIndex); LiveRange *SLR = SrcInt.getLiveRangeContaining(DefIndex); - MachineInstrIndex StartIndex = HaveConflict - ? SLR->start : getMBBStartIdx(PHIMBB); + MachineInstrIndex StartIndex = SLR->start; MachineInstrIndex EndIndex = SLR->end; // Delete val# defined by the now identity copy and add the range from // beginning of the mbb to the end of the range. SrcInt.removeValNo(SLR->valno); - if (HaveConflict) { - DEBUG(errs() << " added range [" << StartIndex << ',' - << EndIndex << "] to reg" << DstInt.reg << '\n'); - DstInt.addRange(LiveRange(StartIndex, EndIndex, VNI)); - // FIXME: Update uses of src to dst in this range? - } else { - DEBUG(errs() << " added range [" << StartIndex << ',' - << SLR->start << "] to reg" << SrcInt.reg << '\n'); - SrcInt.addRange(LiveRange(StartIndex, EndIndex, NewVNI)); - if (PHICopy->killsRegister(PHIDst)) - EndIndex = DefIndex; - DstInt.removeRange(StartIndex, EndIndex); - } RemoveMachineInstrFromMaps(PHICopy); PHICopy->eraseFromParent(); - } - if (HaveConflict) { - // First unset the kill. - for (unsigned i = 0, e = Join->getNumOperands(); i != e; ++i) { - MachineOperand &O = Join->getOperand(i); - if (!O.isReg() || O.getReg() != PHISrc) - continue; - if (O.isKill()) - O.setIsKill(false); - } - MachineInstrIndex MIIndex = getInstructionIndex(Join); - MachineInstrIndex UseIndex = getUseIndex(MIIndex); - MachineInstrIndex DefIndex = getDefIndex(MIIndex); - LiveRange *SLR = SrcInt.getLiveRangeContaining(UseIndex); - LiveRange *DLR = DstInt.getLiveRangeContaining(DefIndex); - SrcInt.addRange(LiveRange(DLR->start, DLR->end, SLR->valno)); - } else { - SrcInt.MergeValueInAsValue(DstInt, VNI, NewVNI); - - // Change all references of phi source to destination. - for (MachineRegisterInfo::reg_iterator ri = mri_->reg_begin(PHIDst), - re = mri_->reg_end(); ri != re; ) { - MachineOperand &O = ri.getOperand(); - ++ri; - O.setReg(PHISrc); - } - removeInterval(DstInt.reg); - - RemoveMachineInstrFromMaps(Join); - Join->eraseFromParent(); - } + DEBUG(errs() << " added range [" << StartIndex << ',' + << EndIndex << "] to reg" << DstInt.reg << '\n'); + DstInt.addRange(LiveRange(StartIndex, EndIndex, VNI)); + } + + // Remove the phi join and update the phi block liveness. + MachineInstrIndex MIIndex = getInstructionIndex(Join); + MachineInstrIndex UseIndex = getUseIndex(MIIndex); + MachineInstrIndex DefIndex = getDefIndex(MIIndex); + LiveRange *SLR = SrcInt.getLiveRangeContaining(UseIndex); + LiveRange *DLR = DstInt.getLiveRangeContaining(DefIndex); + DLR->valno->setCopy(0); + DLR->valno->setIsDefAccurate(false); + DstInt.addRange(LiveRange(SLR->start, SLR->end, DLR->valno)); + SrcInt.removeRange(SLR->start, SLR->end); + assert(SrcInt.empty()); + removeInterval(PHISrc); + RemoveMachineInstrFromMaps(Join); + Join->eraseFromParent(); ++numCoalescing; } From evan.cheng at apple.com Tue Sep 15 02:05:13 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 15 Sep 2009 07:05:13 -0000 Subject: [llvm-commits] [llvm] r81850 - /llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h Message-ID: <200909150705.n8F75DYH012710@zion.cs.uiuc.edu> Author: evancheng Date: Tue Sep 15 02:05:12 2009 New Revision: 81850 URL: http://llvm.org/viewvc/llvm-project?rev=81850&view=rev Log: Forgot this. Modified: llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h Modified: llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h?rev=81850&r1=81849&r2=81850&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h (original) +++ llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h Tue Sep 15 02:05:12 2009 @@ -435,8 +435,7 @@ bool isProfitableToCoalesce(LiveInterval &DstInt, LiveInterval &SrcInt, SmallVector &IdentCopies, - SmallVector &OtherCopies, - bool &HaveConflict); + SmallVector &OtherCopies); void performEarlyCoalescing(); From nicholas at mxc.ca Tue Sep 15 02:08:26 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Tue, 15 Sep 2009 07:08:26 -0000 Subject: [llvm-commits] [llvm] r81851 - /llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp Message-ID: <200909150708.n8F78Q63013103@zion.cs.uiuc.edu> Author: nicholas Date: Tue Sep 15 02:08:25 2009 New Revision: 81851 URL: http://llvm.org/viewvc/llvm-project?rev=81851&view=rev Log: Add more newlines to make up for the ones removed from the end of instructions. Modified: llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp Modified: llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp?rev=81851&r1=81850&r2=81851&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp Tue Sep 15 02:08:25 2009 @@ -244,8 +244,8 @@ // constructs like "void foo() { int A[] = {1,2,3,4,5,6,7,8,9...}; }" if 'A' // is only subsequently read. if (Instruction *TheCopy = isOnlyCopiedFromConstantGlobal(AI)) { - DEBUG(errs() << "Found alloca equal to global: " << *AI); - DEBUG(errs() << " memcpy = " << *TheCopy); + DEBUG(errs() << "Found alloca equal to global: " << *AI << '\n'); + DEBUG(errs() << " memcpy = " << *TheCopy << '\n'); Constant *TheSrc = cast(TheCopy->getOperand(2)); AI->replaceAllUsesWith(ConstantExpr::getBitCast(TheSrc, AI->getType())); TheCopy->eraseFromParent(); // Don't mutate the global. @@ -306,7 +306,7 @@ // we just get a lot of insert/extracts. If at least one vector is // involved, then we probably really do have a union of vector/array. if (VectorTy && isa(VectorTy) && HadAVector) { - DEBUG(errs() << "CONVERT TO VECTOR: " << *AI << " TYPE = " + DEBUG(errs() << "CONVERT TO VECTOR: " << *AI << "\n TYPE = " << *VectorTy << '\n'); // Create and insert the vector alloca. @@ -488,7 +488,7 @@ if (Info.isUnsafe) return; break; } - DEBUG(errs() << " Transformation preventing inst: " << *User); + DEBUG(errs() << " Transformation preventing inst: " << *User << '\n'); return MarkUnsafe(Info); case Instruction::Call: if (MemIntrinsic *MI = dyn_cast(User)) { @@ -498,10 +498,10 @@ break; } } - DEBUG(errs() << " Transformation preventing inst: " << *User); + DEBUG(errs() << " Transformation preventing inst: " << *User << '\n'); return MarkUnsafe(Info); default: - DEBUG(errs() << " Transformation preventing inst: " << *User); + DEBUG(errs() << " Transformation preventing inst: " << *User << '\n'); return MarkUnsafe(Info); } } @@ -926,7 +926,8 @@ IntegerType::get(SI->getContext(), AllocaSizeBits), "", SI); - DEBUG(errs() << "PROMOTING STORE TO WHOLE ALLOCA: " << *AI << *SI); + DEBUG(errs() << "PROMOTING STORE TO WHOLE ALLOCA: " << *AI << '\n' << *SI + << '\n'); // There are two forms here: AI could be an array or struct. Both cases // have different ways to compute the element offset. @@ -1042,7 +1043,8 @@ TD->getTypeAllocSizeInBits(LI->getType()) != AllocaSizeBits) return; - DEBUG(errs() << "PROMOTING LOAD OF WHOLE ALLOCA: " << *AI << *LI); + DEBUG(errs() << "PROMOTING LOAD OF WHOLE ALLOCA: " << *AI << '\n' << *LI + << '\n'); // There are two forms here: AI could be an array or struct. Both cases // have different ways to compute the element offset. @@ -1169,7 +1171,8 @@ I != E; ++I) { isSafeUseOfAllocation(cast(*I), AI, Info); if (Info.isUnsafe) { - DEBUG(errs() << "Cannot transform: " << *AI << " due to user: " << **I); + DEBUG(errs() << "Cannot transform: " << *AI << "\n due to user: " + << **I << '\n'); return 0; } } From asl at math.spbu.ru Tue Sep 15 02:12:03 2009 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Tue, 15 Sep 2009 11:12:03 +0400 Subject: [llvm-commits] [llvm] r81657 - in /llvm/trunk: lib/Target/ARM/ARMRegisterInfo.td test/CodeGen/ARM/2009-09-13-InvalidSubreg.ll In-Reply-To: References: <200909130059.n8D0xhIF024496@zion.cs.uiuc.edu> Message-ID: Hello, Evan > Could you explain why this is needed? ARM 'high' D / Q registers don't have 32-bit subregs. Previously we incorrectly claimed that all Q / D registers do have them. This confuses the codegen while computing superregs - it was allowed to have e.g. Q8 as a superreg of 32-bit subreg, which is definitely incorrect. We discussed the PR in question with Bob and decided that proper solution will be to model subregs properly. All other solutions turned out to be pretty fragile. The dummy subclass is needed since we want to have same subreg indices for both QPR and QPR_VFP2 reglcass. -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University From baldrick at free.fr Tue Sep 15 02:40:38 2009 From: baldrick at free.fr (Duncan Sands) Date: Tue, 15 Sep 2009 09:40:38 +0200 Subject: [llvm-commits] [llvm] r80930 - in /llvm/trunk/lib/Target/X86: X86ISelLowering.cpp X86Instr64bit.td X86InstrInfo.td In-Reply-To: <3AC8C10E-B832-4870-A80F-97C1B3524C7F@apple.com> References: <200909031718.n83HIqqR031599@zion.cs.uiuc.edu> <4AA00AB1.8080304@free.fr> <3AC8C10E-B832-4870-A80F-97C1B3524C7F@apple.com> Message-ID: <4AAF44F6.7050700@free.fr> >> not sure why you mention trampoline code here? > > All I know is that one of test failures happened to be in the vicinity > of a trampoline setup, and there was nothing else suspicious around. > If -disable-16bit is worth pursuing, I'll do more testing and figure > out what's really going on there. OK, thanks. Ciao, Duncan. From baldrick at free.fr Tue Sep 15 03:36:42 2009 From: baldrick at free.fr (Duncan Sands) Date: Tue, 15 Sep 2009 08:36:42 -0000 Subject: [llvm-commits] [gcc-plugin] r81853 - in /gcc-plugin/trunk: llvm-backend.cpp llvm-convert.cpp llvm-internal.h Message-ID: <200909150836.n8F8agb0004778@zion.cs.uiuc.edu> Author: baldrick Date: Tue Sep 15 03:36:41 2009 New Revision: 81853 URL: http://llvm.org/viewvc/llvm-project?rev=81853&view=rev Log: GCC adds a star '*' at the front of user specified assembler names. LLVM has a similar scheme, only it uses '\1'. Make sure '*' is turned into '\1' in assembler names. With this change sqlite3 links. Modified: gcc-plugin/trunk/llvm-backend.cpp gcc-plugin/trunk/llvm-convert.cpp gcc-plugin/trunk/llvm-internal.h Modified: gcc-plugin/trunk/llvm-backend.cpp URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-backend.cpp?rev=81853&r1=81852&r2=81853&view=diff ============================================================================== --- gcc-plugin/trunk/llvm-backend.cpp (original) +++ gcc-plugin/trunk/llvm-backend.cpp Tue Sep 15 03:36:41 2009 @@ -1375,14 +1375,11 @@ //TODO timevar_push(TV_LLVM_GLOBALS); - const char *Name = ""; - if (DECL_NAME(decl)) - if (tree AssemblerName = DECL_ASSEMBLER_NAME(decl)) - Name = IDENTIFIER_POINTER(AssemblerName); - + std::string Name = getLLVMAssemblerName(decl).str(); + // Now handle ordinary static variables and functions (in memory). // Also handle vars declared register invalidly. - if (Name[0] == 1) { + if (!Name.empty() && Name[0] == 1) { #ifdef REGISTER_PREFIX if (strlen (REGISTER_PREFIX) != 0) { int reg_number = decode_reg_name(Name); @@ -1407,7 +1404,7 @@ // object. Note that this is quite possibly a forward reference to the // object, so its type may change later. if (TREE_CODE(decl) == FUNCTION_DECL) { - assert(Name[0] && "Function with empty name!"); + assert(!Name.empty() && "Function with empty name!"); // If this function has already been created, reuse the decl. This happens // when we have something like __builtin_memset and memset in the same file. Function *FnEntry = TheModule->getFunction(Name); @@ -1464,7 +1461,7 @@ if (Ty == Type::getVoidTy(Context)) Ty = StructType::get(Context); - if (Name[0] == 0) { // Global has no name. + if (Name.empty()) { // Global has no name. GV = new GlobalVariable(*TheModule, Ty, false, GlobalValue::ExternalLinkage, 0, ""); @@ -1553,15 +1550,6 @@ //TODO timevar_pop(TV_LLVM_GLOBALS); } -/// llvm_get_decl_name - Used by varasm.c, returns the specified declaration's -/// name. -const char *llvm_get_decl_name(void *LLVM) { - if (LLVM) - if (const ValueName *VN = ((Value*)LLVM)->getValueName()) - return VN->getKeyData(); - return ""; -} - /// llvm_mark_decl_weak - Used by varasm.c, called when a decl is found to be /// weak, but it already had an llvm object created for it. This marks the LLVM /// object weak as well. @@ -1641,10 +1629,24 @@ /// extractRegisterName - Get a register name given its decl. In 4.2 unlike 4.0 /// these names have been run through set_user_assembler_name which means they -/// may have a leading \1 at this point; compensate. +/// may have a leading star at this point; compensate. const char* extractRegisterName(tree decl) { const char* Name = IDENTIFIER_POINTER(DECL_ASSEMBLER_NAME(decl)); - return (*Name == 1) ? Name + 1 : Name; + return (*Name == '*') ? Name + 1 : Name; +} + +/// getLLVMAssemblerName - Get the assembler name (DECL_ASSEMBLER_NAME) for the +/// declaration, with any leading star replaced by '\1'. +Twine getLLVMAssemblerName(union tree_node *decl) { + tree Ident = DECL_ASSEMBLER_NAME(decl); + if (!Ident) + return ""; + + const char *Name = IDENTIFIER_POINTER(Ident); + if (*Name != '*') + return Name; + + return "\1" + Twine(Name + 1); } /// FinalizePlugin - Shutdown the plugin. Modified: gcc-plugin/trunk/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-convert.cpp?rev=81853&r1=81852&r2=81853&view=diff ============================================================================== --- gcc-plugin/trunk/llvm-convert.cpp (original) +++ gcc-plugin/trunk/llvm-convert.cpp Tue Sep 15 03:36:41 2009 @@ -396,10 +396,10 @@ } void TreeToLLVM::StartFunctionBody() { - const char *Name = ""; - // Get the name of the function. - if (tree ID = DECL_ASSEMBLER_NAME(FnDecl)) - Name = IDENTIFIER_POINTER(ID); + std::string Name = getLLVMAssemblerName(FnDecl).str(); + // TODO: Add support for dropping the leading '\1' in order to support + // unsigned bswap(unsigned) __asm__("llvm.bswap"); + // This would also require adjustments in make_decl_llvm. // Determine the FunctionType and calling convention for this function. tree static_chain = cfun->static_chain_decl; Modified: gcc-plugin/trunk/llvm-internal.h URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-internal.h?rev=81853&r1=81852&r2=81853&view=diff ============================================================================== --- gcc-plugin/trunk/llvm-internal.h (original) +++ gcc-plugin/trunk/llvm-internal.h Tue Sep 15 03:36:41 2009 @@ -127,6 +127,7 @@ void clearTargetBuiltinCache(); const char* extractRegisterName(union tree_node*); void handleVisibility(union tree_node* decl, GlobalValue *GV); +Twine getLLVMAssemblerName(union tree_node *); struct StructTypeConversionInfo; From edwintorok at gmail.com Tue Sep 15 03:41:56 2009 From: edwintorok at gmail.com (=?ISO-8859-1?Q?T=F6r=F6k_Edwin?=) Date: Tue, 15 Sep 2009 11:41:56 +0300 Subject: [llvm-commits] [gcc-plugin] r81762 - in /gcc-plugin/trunk: ./ gt-llvm-cache.h In-Reply-To: <200909141354.n8EDsYnw006148@zion.cs.uiuc.edu> References: <200909141354.n8EDsYnw006148@zion.cs.uiuc.edu> Message-ID: <4AAF5354.9070909@gmail.com> On 2009-09-14 16:54, Duncan Sands wrote: > Author: baldrick > Date: Mon Sep 14 08:54:33 2009 > New Revision: 81762 > > URL: http://llvm.org/viewvc/llvm-project?rev=81762&view=rev > Log: > The generated header containing garbage collector information > is actually not host or target specific as far as I can see. > Add it to the repository so everyone doesn't have to generate > it (which requires a big gcc patch). > > Added: > gcc-plugin/trunk/gt-llvm-cache.h > Modified: > gcc-plugin/trunk/ (props changed) > > Propchange: gcc-plugin/trunk/ > > ------------------------------------------------------------------------------ > --- svn:ignore (original) > +++ svn:ignore (removed) > @@ -1 +0,0 @@ > -gt-llvm-cache.h > > Added: gcc-plugin/trunk/gt-llvm-cache.h > URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/gt-llvm-cache.h?rev=81762&view=auto > > ============================================================================== > --- gcc-plugin/trunk/gt-llvm-cache.h (added) > +++ gcc-plugin/trunk/gt-llvm-cache.h Mon Sep 14 08:54:33 2009 > @@ -0,0 +1,1962 @@ > +/* Type information for GCC. > + Copyright (C) 2004, 2007, 2009 Free Software Foundation, Inc. > + > +This file is part of GCC. > + > +GCC is free software; you can redistribute it and/or modify it under > +the terms of the GNU General Public License as published by the Free > +Software Foundation; either version 3, or (at your option) any later > +version. > Why is this GPLv3? Best regards, --Edwin From anton at korobeynikov.info Tue Sep 15 03:48:28 2009 From: anton at korobeynikov.info (Anton Korobeynikov) Date: Tue, 15 Sep 2009 12:48:28 +0400 Subject: [llvm-commits] [gcc-plugin] r81762 - in /gcc-plugin/trunk: ./ gt-llvm-cache.h In-Reply-To: <4AAF5354.9070909@gmail.com> References: <200909141354.n8EDsYnw006148@zion.cs.uiuc.edu> <4AAF5354.9070909@gmail.com> Message-ID: > Why is this GPLv3? Because the whole gcc plugin is GPLv3 ? -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University From baldrick at free.fr Tue Sep 15 03:59:19 2009 From: baldrick at free.fr (Duncan Sands) Date: Tue, 15 Sep 2009 10:59:19 +0200 Subject: [llvm-commits] [gcc-plugin] r81762 - in /gcc-plugin/trunk: ./ gt-llvm-cache.h In-Reply-To: <4AAF5354.9070909@gmail.com> References: <200909141354.n8EDsYnw006148@zion.cs.uiuc.edu> <4AAF5354.9070909@gmail.com> Message-ID: <4AAF5767.7080303@free.fr> Hi T?r?k, > Why is this GPLv3? it is autogenerated by gcc (which is GPLv3), and unsurprisingly the gcc developers decided it should be GPLv3 too. This doesn't matter since the plugin is also GPLv3: it is licensed as GPLv2 or later, and makes use of and links with gcc which is GPLv3. I'm pretty sure this makes the plugin GPLv3. Ciao, Duncan. From baldrick at free.fr Tue Sep 15 08:03:26 2009 From: baldrick at free.fr (Duncan Sands) Date: Tue, 15 Sep 2009 13:03:26 -0000 Subject: [llvm-commits] [gcc-plugin] r81854 - /gcc-plugin/trunk/llvm-convert.cpp Message-ID: <200909151303.n8FD3QUJ006682@zion.cs.uiuc.edu> Author: baldrick Date: Tue Sep 15 08:03:25 2009 New Revision: 81854 URL: http://llvm.org/viewvc/llvm-project?rev=81854&view=rev Log: It turns out that POINTER_PLUS_EXPR means to add a byte offset to the pointer, and not compute ptr+offset (i.e. in units of the pointee) as you might think. With this fix, sqlite3 not only compiles and links, it actually works! Modified: gcc-plugin/trunk/llvm-convert.cpp Modified: gcc-plugin/trunk/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-convert.cpp?rev=81854&r1=81853&r2=81854&view=diff ============================================================================== --- gcc-plugin/trunk/llvm-convert.cpp (original) +++ gcc-plugin/trunk/llvm-convert.cpp Tue Sep 15 08:03:25 2009 @@ -3758,22 +3758,15 @@ } Value *TreeToLLVM::EmitPOINTER_PLUS_EXPR(tree exp) { - tree ptr_type = TREE_TYPE(TREE_OPERAND(exp, 0)); - Value *Ptr = Emit(TREE_OPERAND(exp, 0), 0); - Value *Idx = Emit(TREE_OPERAND(exp, 1), 0); - - // If we are indexing over a variable sized type, do raw pointer arithmetic. - if (!isSequentialCompatible(ptr_type) && !VOID_TYPE_P(TREE_TYPE(ptr_type))) { - // Compute the offset in bytes. - Value *Size = Emit(TYPE_SIZE(TREE_TYPE(ptr_type)), 0); - Idx = Builder.CreateMul(Idx, CastToUIntType(Size, Idx->getType())); - - // Convert the pointer into an i8* and add the offset to it. - Ptr = Builder.CreateBitCast(Ptr, Type::getInt8Ty(Context)->getPointerTo()); - } + Value *Ptr = Emit(TREE_OPERAND(exp, 0), 0); // The pointer. + Value *Idx = Emit(TREE_OPERAND(exp, 1), 0); // The offset in bytes. + // Convert the pointer into an i8* and add the offset to it. + Ptr = Builder.CreateBitCast(Ptr, Type::getInt8Ty(Context)->getPointerTo()); Value *GEP = POINTER_TYPE_OVERFLOW_UNDEFINED ? Builder.CreateInBoundsGEP(Ptr, Idx) : Builder.CreateGEP(Ptr, Idx); + + // The result may be of a different pointer type. return Builder.CreateBitCast(GEP, ConvertType(TREE_TYPE(exp))); } From baldrick at free.fr Tue Sep 15 09:27:11 2009 From: baldrick at free.fr (Duncan Sands) Date: Tue, 15 Sep 2009 14:27:11 -0000 Subject: [llvm-commits] [gcc-plugin] r81855 - /gcc-plugin/trunk/llvm-convert.cpp Message-ID: <200909151427.n8FERBuW017901@zion.cs.uiuc.edu> Author: baldrick Date: Tue Sep 15 09:27:11 2009 New Revision: 81855 URL: http://llvm.org/viewvc/llvm-project?rev=81855&view=rev Log: In mainline GCC, the filter value is an "int". Modified: gcc-plugin/trunk/llvm-convert.cpp Modified: gcc-plugin/trunk/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-convert.cpp?rev=81855&r1=81854&r2=81855&view=diff ============================================================================== --- gcc-plugin/trunk/llvm-convert.cpp (original) +++ gcc-plugin/trunk/llvm-convert.cpp Tue Sep 15 09:27:11 2009 @@ -1916,22 +1916,22 @@ // Check to see if the exception values have been constructed. if (ExceptionValue) return; - const Type *IntPtr = TD.getIntPtrType(Context); + const Type *IntTy = ConvertType(integer_type_node); ExceptionValue = CreateTemporary(PointerType::getUnqual(Type::getInt8Ty(Context))); ExceptionValue->setName("eh_exception"); - ExceptionSelectorValue = CreateTemporary(IntPtr); + ExceptionSelectorValue = CreateTemporary(IntTy); ExceptionSelectorValue->setName("eh_selector"); FuncEHException = Intrinsic::getDeclaration(TheModule, Intrinsic::eh_exception); FuncEHSelector = Intrinsic::getDeclaration(TheModule, - (IntPtr == Type::getInt32Ty(Context) ? + (IntTy == Type::getInt32Ty(Context) ? Intrinsic::eh_selector_i32 : Intrinsic::eh_selector_i64)); FuncEHGetTypeID = Intrinsic::getDeclaration(TheModule, - (IntPtr == Type::getInt32Ty(Context) ? + (IntTy == Type::getInt32Ty(Context) ? Intrinsic::eh_typeid_for_i32 : Intrinsic::eh_typeid_for_i64)); } From gohman at apple.com Tue Sep 15 10:08:33 2009 From: gohman at apple.com (Dan Gohman) Date: Tue, 15 Sep 2009 15:08:33 -0000 Subject: [llvm-commits] [llvm] r81856 - in /llvm/trunk/include/llvm: ADT/SmallSet.h AbstractTypeUser.h Analysis/LoopInfo.h Analysis/ScalarEvolutionExpressions.h CodeGen/LiveVariables.h Support/Timer.h Target/TargetSchedule.td Message-ID: <200909151508.n8FF8YGg023250@zion.cs.uiuc.edu> Author: djg Date: Tue Sep 15 10:08:33 2009 New Revision: 81856 URL: http://llvm.org/viewvc/llvm-project?rev=81856&view=rev Log: Fix apostrophos. Modified: llvm/trunk/include/llvm/ADT/SmallSet.h llvm/trunk/include/llvm/AbstractTypeUser.h llvm/trunk/include/llvm/Analysis/LoopInfo.h llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h llvm/trunk/include/llvm/CodeGen/LiveVariables.h llvm/trunk/include/llvm/Support/Timer.h llvm/trunk/include/llvm/Target/TargetSchedule.td Modified: llvm/trunk/include/llvm/ADT/SmallSet.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SmallSet.h?rev=81856&r1=81855&r2=81856&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/SmallSet.h (original) +++ llvm/trunk/include/llvm/ADT/SmallSet.h Tue Sep 15 10:08:33 2009 @@ -30,7 +30,7 @@ template class SmallSet { /// Use a SmallVector to hold the elements here (even though it will never - /// reach it's 'large' stage) to avoid calling the default ctors of elements + /// reach its 'large' stage) to avoid calling the default ctors of elements /// we will never use. SmallVector Vector; std::set Set; Modified: llvm/trunk/include/llvm/AbstractTypeUser.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/AbstractTypeUser.h?rev=81856&r1=81855&r2=81856&view=diff ============================================================================== --- llvm/trunk/include/llvm/AbstractTypeUser.h (original) +++ llvm/trunk/include/llvm/AbstractTypeUser.h Tue Sep 15 10:08:33 2009 @@ -65,7 +65,7 @@ const Type *NewTy) = 0; /// The other case which AbstractTypeUsers must be aware of is when a type - /// makes the transition from being abstract (where it has clients on it's + /// makes the transition from being abstract (where it has clients on its /// AbstractTypeUsers list) to concrete (where it does not). This method /// notifies ATU's when this occurs for a type. /// Modified: llvm/trunk/include/llvm/Analysis/LoopInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/LoopInfo.h?rev=81856&r1=81855&r2=81856&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/LoopInfo.h (original) +++ llvm/trunk/include/llvm/Analysis/LoopInfo.h Tue Sep 15 10:08:33 2009 @@ -732,7 +732,7 @@ for (typename InvBlockTraits::ChildIteratorType I = InvBlockTraits::child_begin(BB), E = InvBlockTraits::child_end(BB); I != E; ++I) - if (DT.dominates(BB, *I)) // If BB dominates it's predecessor... + if (DT.dominates(BB, *I)) // If BB dominates its predecessor... TodoStack.push_back(*I); if (TodoStack.empty()) return 0; // No backedges to this block... @@ -758,7 +758,7 @@ if (LoopT *SubLoop = const_cast(getLoopFor(X))) if (SubLoop->getHeader() == X && isNotAlreadyContainedIn(SubLoop, L)){ - // Remove the subloop from it's current parent... + // Remove the subloop from its current parent... assert(SubLoop->ParentLoop && SubLoop->ParentLoop != L); LoopT *SLP = SubLoop->ParentLoop; // SubLoopParent typename std::vector::iterator I = Modified: llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h?rev=81856&r1=81855&r2=81856&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h (original) +++ llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h Tue Sep 15 10:08:33 2009 @@ -575,7 +575,7 @@ //===--------------------------------------------------------------------===// /// SCEVUnknown - This means that we are dealing with an entirely unknown SCEV - /// value, and only represent it as it's LLVM Value. This is the "bottom" + /// value, and only represent it as its LLVM Value. This is the "bottom" /// value for the analysis. /// class SCEVUnknown : public SCEV { Modified: llvm/trunk/include/llvm/CodeGen/LiveVariables.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveVariables.h?rev=81856&r1=81855&r2=81856&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/LiveVariables.h (original) +++ llvm/trunk/include/llvm/CodeGen/LiveVariables.h Tue Sep 15 10:08:33 2009 @@ -155,7 +155,7 @@ MachineInstr *FindLastPartialDef(unsigned Reg, unsigned &PartDefReg); /// hasRegisterUseBelow - Return true if the specified register is used after - /// the current instruction and before it's next definition. + /// the current instruction and before its next definition. bool hasRegisterUseBelow(unsigned Reg, MachineBasicBlock::iterator I, MachineBasicBlock *MBB); Modified: llvm/trunk/include/llvm/Support/Timer.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Timer.h?rev=81856&r1=81855&r2=81856&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/Timer.h (original) +++ llvm/trunk/include/llvm/Support/Timer.h Tue Sep 15 10:08:33 2009 @@ -27,7 +27,7 @@ class raw_ostream; /// Timer - This class is used to track the amount of time spent between -/// invocations of it's startTimer()/stopTimer() methods. Given appropriate OS +/// invocations of its startTimer()/stopTimer() methods. Given appropriate OS /// support it can also keep track of the RSS of the program at various points. /// By default, the Timer will print the amount of time it has captured to /// standard error when the laster timer is destroyed, otherwise it is printed Modified: llvm/trunk/include/llvm/Target/TargetSchedule.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetSchedule.td?rev=81856&r1=81855&r2=81856&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetSchedule.td (original) +++ llvm/trunk/include/llvm/Target/TargetSchedule.td Tue Sep 15 10:08:33 2009 @@ -60,7 +60,7 @@ //===----------------------------------------------------------------------===// // Instruction itinerary data - These values provide a runtime map of an -// instruction itinerary class (name) to it's itinerary data. +// instruction itinerary class (name) to its itinerary data. // class InstrItinData stages, list operandcycles = []> { From gohman at apple.com Tue Sep 15 10:09:54 2009 From: gohman at apple.com (Dan Gohman) Date: Tue, 15 Sep 2009 15:09:54 -0000 Subject: [llvm-commits] [llvm] r81857 - /llvm/trunk/test/CodeGen/X86/cmov.ll Message-ID: <200909151509.n8FF9sdj023434@zion.cs.uiuc.edu> Author: djg Date: Tue Sep 15 10:09:54 2009 New Revision: 81857 URL: http://llvm.org/viewvc/llvm-project?rev=81857&view=rev Log: Restore a comment that was lost in the merge. Modified: llvm/trunk/test/CodeGen/X86/cmov.ll Modified: llvm/trunk/test/CodeGen/X86/cmov.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/cmov.ll?rev=81857&r1=81856&r2=81857&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/cmov.ll (original) +++ llvm/trunk/test/CodeGen/X86/cmov.ll Tue Sep 15 10:09:54 2009 @@ -33,6 +33,10 @@ } +; x86's 32-bit cmov doesn't clobber the high 32 bits of the destination +; if the condition is false. An explicit zero-extend (movl) is needed +; after the cmov. + declare void @bar(i64) nounwind define void @test3(i64 %a, i64 %b, i1 %p) nounwind { From gohman at apple.com Tue Sep 15 10:33:42 2009 From: gohman at apple.com (Dan Gohman) Date: Tue, 15 Sep 2009 15:33:42 -0000 Subject: [llvm-commits] [llvm] r81858 - /llvm/trunk/tools/llvm-dis/llvm-dis.cpp Message-ID: <200909151533.n8FFXg5C026578@zion.cs.uiuc.edu> Author: djg Date: Tue Sep 15 10:33:42 2009 New Revision: 81858 URL: http://llvm.org/viewvc/llvm-project?rev=81858&view=rev Log: Don't bother using a PassManager just to print a Module. Modified: llvm/trunk/tools/llvm-dis/llvm-dis.cpp Modified: llvm/trunk/tools/llvm-dis/llvm-dis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-dis/llvm-dis.cpp?rev=81858&r1=81857&r2=81858&view=diff ============================================================================== --- llvm/trunk/tools/llvm-dis/llvm-dis.cpp (original) +++ llvm/trunk/tools/llvm-dis/llvm-dis.cpp Tue Sep 15 10:33:42 2009 @@ -18,9 +18,7 @@ #include "llvm/LLVMContext.h" #include "llvm/Module.h" -#include "llvm/PassManager.h" #include "llvm/Bitcode/ReaderWriter.h" -#include "llvm/Assembly/PrintModulePass.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/ManagedStatic.h" #include "llvm/Support/MemoryBuffer.h" @@ -105,11 +103,8 @@ } // All that llvm-dis does is write the assembly to a file. - if (!DontPrint) { - PassManager Passes; - Passes.add(createPrintModulePass(Out.get())); - Passes.run(*M.get()); - } + if (!DontPrint) + *Out << *M; return 0; } From gohman at apple.com Tue Sep 15 10:35:08 2009 From: gohman at apple.com (Dan Gohman) Date: Tue, 15 Sep 2009 15:35:08 -0000 Subject: [llvm-commits] [llvm] r81859 - in /llvm/trunk: docs/CommandGuide/llvm-link.pod tools/llvm-link/llvm-link.cpp Message-ID: <200909151535.n8FFZ82t026776@zion.cs.uiuc.edu> Author: djg Date: Tue Sep 15 10:35:07 2009 New Revision: 81859 URL: http://llvm.org/viewvc/llvm-project?rev=81859&view=rev Log: Give llvm-link a -S option. Modified: llvm/trunk/docs/CommandGuide/llvm-link.pod llvm/trunk/tools/llvm-link/llvm-link.cpp Modified: llvm/trunk/docs/CommandGuide/llvm-link.pod URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/CommandGuide/llvm-link.pod?rev=81859&r1=81858&r2=81859&view=diff ============================================================================== --- llvm/trunk/docs/CommandGuide/llvm-link.pod (original) +++ llvm/trunk/docs/CommandGuide/llvm-link.pod Tue Sep 15 10:35:07 2009 @@ -42,6 +42,10 @@ Specify the output file name. If F is C<->, then B will write its output to standard output. +=item B<-S> + +Write output in LLVM intermediate language (instead of bitcode). + =item B<-d> If specified, B prints a human-readable version of the output Modified: llvm/trunk/tools/llvm-link/llvm-link.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-link/llvm-link.cpp?rev=81859&r1=81858&r2=81859&view=diff ============================================================================== --- llvm/trunk/tools/llvm-link/llvm-link.cpp (original) +++ llvm/trunk/tools/llvm-link/llvm-link.cpp Tue Sep 15 10:35:07 2009 @@ -41,6 +41,10 @@ Force("f", cl::desc("Enable binary output on terminals")); static cl::opt +OutputAssembly("S", + cl::desc("Write output as LLVM assembly"), cl::Hidden); + +static cl::opt Verbose("v", cl::desc("Print information about actions taken")); static cl::opt @@ -116,7 +120,7 @@ // TODO: Iterate over the -l list and link in any modules containing // global symbols that have not been resolved so far. - if (DumpAsm) errs() << "Here's the assembly:\n" << *Composite.get(); + if (DumpAsm) errs() << "Here's the assembly:\n" << *Composite; std::string ErrorInfo; std::auto_ptr @@ -132,13 +136,15 @@ if (OutputFilename != "-") sys::RemoveFileOnSignal(sys::Path(OutputFilename)); - if (verifyModule(*Composite.get())) { + if (verifyModule(*Composite)) { errs() << argv[0] << ": linked module is broken!\n"; return 1; } if (Verbose) errs() << "Writing bitcode...\n"; - if (Force || !CheckBitcodeOutputToConsole(*Out, true)) + if (OutputAssembly) { + *Out << *Composite; + } else if (Force || !CheckBitcodeOutputToConsole(*Out, true)) WriteBitcodeToFile(Composite.get(), *Out); return 0; From gohman at apple.com Tue Sep 15 10:38:31 2009 From: gohman at apple.com (Dan Gohman) Date: Tue, 15 Sep 2009 15:38:31 -0000 Subject: [llvm-commits] [llvm] r81860 - /llvm/trunk/test/Linker/ Message-ID: <200909151538.n8FFcWv2027257@zion.cs.uiuc.edu> Author: djg Date: Tue Sep 15 10:38:31 2009 New Revision: 81860 URL: http://llvm.org/viewvc/llvm-project?rev=81860&view=rev Log: Use llvm-link -S instead of using llvm-dis. Modified: llvm/trunk/test/Linker/2003-01-30-LinkerRename.ll llvm/trunk/test/Linker/2003-01-30-LinkerTypeRename.ll llvm/trunk/test/Linker/2003-04-23-LinkOnceLost.ll llvm/trunk/test/Linker/2003-05-31-LinkerRename.ll llvm/trunk/test/Linker/2003-08-23-GlobalVarLinking.ll llvm/trunk/test/Linker/2003-10-21-ConflictingTypesTolerance.ll llvm/trunk/test/Linker/2004-12-03-DisagreeingType.ll llvm/trunk/test/Linker/2005-02-12-ConstantGlobals-2.ll llvm/trunk/test/Linker/2005-02-12-ConstantGlobals.ll llvm/trunk/test/Linker/2005-12-06-AppendingZeroLengthArrays.ll llvm/trunk/test/Linker/2006-06-15-GlobalVarAlignment.ll llvm/trunk/test/Linker/2008-06-13-LinkOnceRedefinition.ll llvm/trunk/test/Linker/2008-06-26-AddressSpace.ll llvm/trunk/test/Linker/AppendingLinkage.ll llvm/trunk/test/Linker/AppendingLinkage2.ll llvm/trunk/test/Linker/ConstantGlobals1.ll llvm/trunk/test/Linker/ConstantGlobals2.ll llvm/trunk/test/Linker/ConstantGlobals3.ll llvm/trunk/test/Linker/LinkOnce.ll llvm/trunk/test/Linker/link-global-to-func.ll llvm/trunk/test/Linker/linknamedmdnode.ll Modified: llvm/trunk/test/Linker/2003-01-30-LinkerRename.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/2003-01-30-LinkerRename.ll?rev=81860&r1=81859&r2=81860&view=diff ============================================================================== --- llvm/trunk/test/Linker/2003-01-30-LinkerRename.ll (original) +++ llvm/trunk/test/Linker/2003-01-30-LinkerRename.ll Tue Sep 15 10:38:31 2009 @@ -3,7 +3,7 @@ ; RUN: echo {define internal i32 @foo() \{ ret i32 7 \} } | llvm-as > %t.1.bc ; RUN: llvm-as %s -o %t.2.bc -; RUN: llvm-link %t.1.bc %t.2.bc | llvm-dis | grep @foo() | grep -v internal +; RUN: llvm-link %t.1.bc %t.2.bc -S | grep @foo() | grep -v internal define i32 @foo() { ret i32 0 } Modified: llvm/trunk/test/Linker/2003-01-30-LinkerTypeRename.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/2003-01-30-LinkerTypeRename.ll?rev=81860&r1=81859&r2=81860&view=diff ============================================================================== --- llvm/trunk/test/Linker/2003-01-30-LinkerTypeRename.ll (original) +++ llvm/trunk/test/Linker/2003-01-30-LinkerTypeRename.ll Tue Sep 15 10:38:31 2009 @@ -3,7 +3,7 @@ ; RUN: echo {%Ty = type opaque @GV = external global %Ty*} | llvm-as > %t.1.bc ; RUN: llvm-as < %s > %t.2.bc -; RUN: llvm-link %t.1.bc %t.2.bc | llvm-dis | grep {%Ty } | not grep opaque +; RUN: llvm-link %t.1.bc %t.2.bc -S | grep {%Ty } | not grep opaque %Ty = type i32 Modified: llvm/trunk/test/Linker/2003-04-23-LinkOnceLost.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/2003-04-23-LinkOnceLost.ll?rev=81860&r1=81859&r2=81860&view=diff ============================================================================== --- llvm/trunk/test/Linker/2003-04-23-LinkOnceLost.ll (original) +++ llvm/trunk/test/Linker/2003-04-23-LinkOnceLost.ll Tue Sep 15 10:38:31 2009 @@ -4,7 +4,7 @@ ; RUN: echo { define linkonce void @foo() \{ ret void \} } | \ ; RUN: llvm-as -o %t.2.bc ; RUN: llvm-as %s -o %t.1.bc -; RUN: llvm-link %t.1.bc %t.2.bc | llvm-dis | grep foo | grep linkonce +; RUN: llvm-link %t.1.bc %t.2.bc -S | grep foo | grep linkonce declare void @foo() Modified: llvm/trunk/test/Linker/2003-05-31-LinkerRename.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/2003-05-31-LinkerRename.ll?rev=81860&r1=81859&r2=81860&view=diff ============================================================================== --- llvm/trunk/test/Linker/2003-05-31-LinkerRename.ll (original) +++ llvm/trunk/test/Linker/2003-05-31-LinkerRename.ll Tue Sep 15 10:38:31 2009 @@ -6,7 +6,7 @@ ; RUN: echo { define internal i32 @foo() \{ ret i32 7 \} } | llvm-as > %t.1.bc ; RUN: llvm-as < %s > %t.2.bc -; RUN: llvm-link %t.1.bc %t.2.bc | llvm-dis | grep internal | not grep @foo( +; RUN: llvm-link %t.1.bc %t.2.bc -S | grep internal | not grep @foo( declare i32 @foo() Modified: llvm/trunk/test/Linker/2003-08-23-GlobalVarLinking.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/2003-08-23-GlobalVarLinking.ll?rev=81860&r1=81859&r2=81860&view=diff ============================================================================== --- llvm/trunk/test/Linker/2003-08-23-GlobalVarLinking.ll (original) +++ llvm/trunk/test/Linker/2003-08-23-GlobalVarLinking.ll Tue Sep 15 10:38:31 2009 @@ -1,7 +1,7 @@ ; RUN: llvm-as < %s > %t.out1.bc ; RUN: echo {@S = external global \{ i32, opaque* \} declare void @F(opaque*)}\ ; RUN: | llvm-as > %t.out2.bc -; RUN: llvm-link %t.out1.bc %t.out2.bc | llvm-dis | not grep opaque +; RUN: llvm-link %t.out1.bc %t.out2.bc -S | not grep opaque ; After linking this testcase, there should be no opaque types left. The two ; S's should cause the opaque type to be resolved to 'int'. Modified: llvm/trunk/test/Linker/2003-10-21-ConflictingTypesTolerance.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/2003-10-21-ConflictingTypesTolerance.ll?rev=81860&r1=81859&r2=81860&view=diff ============================================================================== --- llvm/trunk/test/Linker/2003-10-21-ConflictingTypesTolerance.ll (original) +++ llvm/trunk/test/Linker/2003-10-21-ConflictingTypesTolerance.ll Tue Sep 15 10:38:31 2009 @@ -1,6 +1,6 @@ ; RUN: llvm-as < %s > %t.out1.bc ; RUN: echo { %M = type \[8 x i32\] external global %M } | llvm-as > %t.out2.bc -; RUN: llvm-link %t.out1.bc %t.out2.bc | llvm-dis | grep %M | grep \\{ +; RUN: llvm-link %t.out1.bc %t.out2.bc -S | grep %M | grep \\{ %M = type { i32 } Modified: llvm/trunk/test/Linker/2004-12-03-DisagreeingType.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/2004-12-03-DisagreeingType.ll?rev=81860&r1=81859&r2=81860&view=diff ============================================================================== --- llvm/trunk/test/Linker/2004-12-03-DisagreeingType.ll (original) +++ llvm/trunk/test/Linker/2004-12-03-DisagreeingType.ll Tue Sep 15 10:38:31 2009 @@ -1,7 +1,7 @@ ; RUN: echo {@G = weak global \{\{\{\{double\}\}\}\} zeroinitializer } | \ ; RUN: llvm-as > %t.out2.bc ; RUN: llvm-as < %s > %t.out1.bc -; RUN: llvm-link %t.out1.bc %t.out2.bc | llvm-dis | not grep {\\}} +; RUN: llvm-link %t.out1.bc %t.out2.bc -S | not grep {\\}} ; When linked, the global above should be eliminated, being merged with the ; global below. Modified: llvm/trunk/test/Linker/2005-02-12-ConstantGlobals-2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/2005-02-12-ConstantGlobals-2.ll?rev=81860&r1=81859&r2=81860&view=diff ============================================================================== --- llvm/trunk/test/Linker/2005-02-12-ConstantGlobals-2.ll (original) +++ llvm/trunk/test/Linker/2005-02-12-ConstantGlobals-2.ll Tue Sep 15 10:38:31 2009 @@ -3,6 +3,6 @@ ; RUN: echo {@X = external constant i32} | llvm-as > %t.2.bc ; RUN: llvm-as < %s > %t.1.bc -; RUN: llvm-link %t.1.bc %t.2.bc | llvm-dis | grep {global i32 7} +; RUN: llvm-link %t.1.bc %t.2.bc -S | grep {global i32 7} @X = global i32 7 Modified: llvm/trunk/test/Linker/2005-02-12-ConstantGlobals.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/2005-02-12-ConstantGlobals.ll?rev=81860&r1=81859&r2=81860&view=diff ============================================================================== --- llvm/trunk/test/Linker/2005-02-12-ConstantGlobals.ll (original) +++ llvm/trunk/test/Linker/2005-02-12-ConstantGlobals.ll Tue Sep 15 10:38:31 2009 @@ -3,6 +3,6 @@ ; RUN: echo {@X = global i32 7} | llvm-as > %t.2.bc ; RUN: llvm-as < %s > %t.1.bc -; RUN: llvm-link %t.1.bc %t.2.bc | llvm-dis | grep {global i32 7} +; RUN: llvm-link %t.1.bc %t.2.bc -S | grep {global i32 7} @X = external constant i32 ; [#uses=0] Modified: llvm/trunk/test/Linker/2005-12-06-AppendingZeroLengthArrays.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/2005-12-06-AppendingZeroLengthArrays.ll?rev=81860&r1=81859&r2=81860&view=diff ============================================================================== --- llvm/trunk/test/Linker/2005-12-06-AppendingZeroLengthArrays.ll (original) +++ llvm/trunk/test/Linker/2005-12-06-AppendingZeroLengthArrays.ll Tue Sep 15 10:38:31 2009 @@ -1,7 +1,7 @@ ; RUN: echo { @G = appending global \[0 x i32\] zeroinitializer } | \ ; RUN: llvm-as > %t.out2.bc ; RUN: llvm-as < %s > %t.out1.bc -; RUN: llvm-link %t.out1.bc %t.out2.bc | llvm-dis | grep {@G =} +; RUN: llvm-link %t.out1.bc %t.out2.bc -S | grep {@G =} ; When linked, the globals should be merged, and the result should still ; be named '@G'. Modified: llvm/trunk/test/Linker/2006-06-15-GlobalVarAlignment.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/2006-06-15-GlobalVarAlignment.ll?rev=81860&r1=81859&r2=81860&view=diff ============================================================================== --- llvm/trunk/test/Linker/2006-06-15-GlobalVarAlignment.ll (original) +++ llvm/trunk/test/Linker/2006-06-15-GlobalVarAlignment.ll Tue Sep 15 10:38:31 2009 @@ -2,6 +2,6 @@ ; RUN: echo {@X = global i32 7, align 8} | llvm-as > %t.2.bc ; RUN: llvm-as < %s > %t.1.bc -; RUN: llvm-link %t.1.bc %t.2.bc | llvm-dis | grep {align 8} +; RUN: llvm-link %t.1.bc %t.2.bc -S | grep {align 8} @X = weak global i32 7, align 4 Modified: llvm/trunk/test/Linker/2008-06-13-LinkOnceRedefinition.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/2008-06-13-LinkOnceRedefinition.ll?rev=81860&r1=81859&r2=81860&view=diff ============================================================================== --- llvm/trunk/test/Linker/2008-06-13-LinkOnceRedefinition.ll (original) +++ llvm/trunk/test/Linker/2008-06-13-LinkOnceRedefinition.ll Tue Sep 15 10:38:31 2009 @@ -3,6 +3,6 @@ ; RUN: llvm-as %s -o %t.foo1.bc ; RUN: llvm-as %s -o %t.foo2.bc ; RUN: echo {define linkonce void @foo(i32 %x) { ret void }} | llvm-as -o %t.foo3.bc -; RUN: llvm-link %t.foo1.bc %t.foo2.bc | llvm-dis -; RUN: llvm-link %t.foo1.bc %t.foo3.bc | llvm-dis +; RUN: llvm-link %t.foo1.bc %t.foo2.bc -S +; RUN: llvm-link %t.foo1.bc %t.foo3.bc -S define linkonce void @foo() { ret void } Modified: llvm/trunk/test/Linker/2008-06-26-AddressSpace.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/2008-06-26-AddressSpace.ll?rev=81860&r1=81859&r2=81860&view=diff ============================================================================== --- llvm/trunk/test/Linker/2008-06-26-AddressSpace.ll (original) +++ llvm/trunk/test/Linker/2008-06-26-AddressSpace.ll Tue Sep 15 10:38:31 2009 @@ -2,8 +2,8 @@ ; in different modules. ; RUN: llvm-as %s -o %t.foo1.bc ; RUN: echo | llvm-as -o %t.foo2.bc -; RUN: llvm-link %t.foo2.bc %t.foo1.bc | llvm-dis | grep {addrspace(2)} -; RUN: llvm-link %t.foo1.bc %t.foo2.bc | llvm-dis | grep {addrspace(2)} +; RUN: llvm-link %t.foo2.bc %t.foo1.bc -S | grep {addrspace(2)} +; RUN: llvm-link %t.foo1.bc %t.foo2.bc -S | grep {addrspace(2)} ; rdar://6038021 @G = addrspace(2) global i32 256 Modified: llvm/trunk/test/Linker/AppendingLinkage.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/AppendingLinkage.ll?rev=81860&r1=81859&r2=81860&view=diff ============================================================================== --- llvm/trunk/test/Linker/AppendingLinkage.ll (original) +++ llvm/trunk/test/Linker/AppendingLinkage.ll Tue Sep 15 10:38:31 2009 @@ -3,7 +3,7 @@ ; RUN: echo {@X = appending global \[1 x i32\] \[i32 8\] } | \ ; RUN: llvm-as > %t.2.bc ; RUN: llvm-as < %s > %t.1.bc -; RUN: llvm-link %t.1.bc %t.2.bc | llvm-dis | grep 7 | grep 4 | grep 8 +; RUN: llvm-link %t.1.bc %t.2.bc -S | grep 7 | grep 4 | grep 8 @X = appending global [2 x i32] [ i32 7, i32 4 ] ; <[2 x i32]*> [#uses=2] @Y = global i32* getelementptr ([2 x i32]* @X, i64 0, i64 0) ; [#uses=0] Modified: llvm/trunk/test/Linker/AppendingLinkage2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/AppendingLinkage2.ll?rev=81860&r1=81859&r2=81860&view=diff ============================================================================== --- llvm/trunk/test/Linker/AppendingLinkage2.ll (original) +++ llvm/trunk/test/Linker/AppendingLinkage2.ll Tue Sep 15 10:38:31 2009 @@ -3,6 +3,6 @@ ; RUN: echo {@X = appending global \[1 x i32\] \[i32 8\] } | \ ; RUN: llvm-as > %t.2.bc ; RUN: llvm-as < %s > %t.1.bc -; RUN: llvm-link %t.1.bc %t.2.bc | llvm-dis | grep 7 | grep 8 +; RUN: llvm-link %t.1.bc %t.2.bc -S | grep 7 | grep 8 @X = appending global [1 x i32] [ i32 7 ] ; <[1 x i32]*> [#uses=0] Modified: llvm/trunk/test/Linker/ConstantGlobals1.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/ConstantGlobals1.ll?rev=81860&r1=81859&r2=81860&view=diff ============================================================================== --- llvm/trunk/test/Linker/ConstantGlobals1.ll (original) +++ llvm/trunk/test/Linker/ConstantGlobals1.ll Tue Sep 15 10:38:31 2009 @@ -3,7 +3,7 @@ ; RUN: echo {@X = constant \[1 x i32\] \[i32 8\] } | \ ; RUN: llvm-as > %t.2.bc ; RUN: llvm-as < %s > %t.1.bc -; RUN: llvm-link %t.1.bc %t.2.bc | llvm-dis | grep constant +; RUN: llvm-link %t.1.bc %t.2.bc -S | grep constant @X = external global [1 x i32] ; <[1 x i32]*> [#uses=0] Modified: llvm/trunk/test/Linker/ConstantGlobals2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/ConstantGlobals2.ll?rev=81860&r1=81859&r2=81860&view=diff ============================================================================== --- llvm/trunk/test/Linker/ConstantGlobals2.ll (original) +++ llvm/trunk/test/Linker/ConstantGlobals2.ll Tue Sep 15 10:38:31 2009 @@ -3,7 +3,7 @@ ; RUN: echo {@X = external global \[1 x i32\] } | \ ; RUN: llvm-as > %t.2.bc ; RUN: llvm-as < %s > %t.1.bc -; RUN: llvm-link %t.1.bc %t.2.bc | llvm-dis | grep constant +; RUN: llvm-link %t.1.bc %t.2.bc -S | grep constant @X = constant [1 x i32] [ i32 12 ] ; <[1 x i32]*> [#uses=0] Modified: llvm/trunk/test/Linker/ConstantGlobals3.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/ConstantGlobals3.ll?rev=81860&r1=81859&r2=81860&view=diff ============================================================================== --- llvm/trunk/test/Linker/ConstantGlobals3.ll (original) +++ llvm/trunk/test/Linker/ConstantGlobals3.ll Tue Sep 15 10:38:31 2009 @@ -3,6 +3,6 @@ ; RUN: echo {@X = external constant \[1 x i32\] } | \ ; RUN: llvm-as > %t.2.bc ; RUN: llvm-as < %s > %t.1.bc -; RUN: llvm-link %t.1.bc %t.2.bc | llvm-dis | grep constant +; RUN: llvm-link %t.1.bc %t.2.bc -S | grep constant @X = external global [1 x i32] ; <[1 x i32]*> [#uses=0] Modified: llvm/trunk/test/Linker/LinkOnce.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/LinkOnce.ll?rev=81860&r1=81859&r2=81860&view=diff ============================================================================== --- llvm/trunk/test/Linker/LinkOnce.ll (original) +++ llvm/trunk/test/Linker/LinkOnce.ll Tue Sep 15 10:38:31 2009 @@ -3,6 +3,6 @@ ; RUN: echo "@X = linkonce global i32 8" | llvm-as > %t.2.bc ; RUN: llvm-as < %s > %t.1.bc -; RUN: llvm-link %t.1.bc %t.2.bc | llvm-dis +; RUN: llvm-link %t.1.bc %t.2.bc -S @X = linkonce global i32 7 ; [#uses=0] Modified: llvm/trunk/test/Linker/link-global-to-func.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/link-global-to-func.ll?rev=81860&r1=81859&r2=81860&view=diff ============================================================================== --- llvm/trunk/test/Linker/link-global-to-func.ll (original) +++ llvm/trunk/test/Linker/link-global-to-func.ll Tue Sep 15 10:38:31 2009 @@ -1,7 +1,7 @@ ; RUN: llvm-as %s -o %t1.bc ; RUN: echo {declare void @__eprintf(i8*, i8*, i32, i8*) noreturn define void @foo() { tail call void @__eprintf( i8* undef, i8* undef, i32 4, i8* null ) noreturn nounwind unreachable }} | llvm-as -o %t2.bc -; RUN: llvm-link %t2.bc %t1.bc -o - | llvm-dis | grep __eprintf -; RUN: llvm-link %t1.bc %t2.bc -o - | llvm-dis | grep __eprintf +; RUN: llvm-link %t2.bc %t1.bc -S | grep __eprintf +; RUN: llvm-link %t1.bc %t2.bc -S | grep __eprintf ; rdar://6072702 Modified: llvm/trunk/test/Linker/linknamedmdnode.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/linknamedmdnode.ll?rev=81860&r1=81859&r2=81860&view=diff ============================================================================== --- llvm/trunk/test/Linker/linknamedmdnode.ll (original) +++ llvm/trunk/test/Linker/linknamedmdnode.ll Tue Sep 15 10:38:31 2009 @@ -1,6 +1,6 @@ ; RUN: llvm-as < %s > %t.bc ; RUN: llvm-as < %p/linknamedmdnode2.ll > %t2.bc -; RUN: llvm-link %t.bc %t2.bc | llvm-dis | grep "!llvm.stuff = !{!0, !1}" +; RUN: llvm-link %t.bc %t2.bc -S | grep "!llvm.stuff = !{!0, !1}" !0 = metadata !{i32 42} !llvm.stuff = !{!0} From gohman at apple.com Tue Sep 15 10:58:07 2009 From: gohman at apple.com (Dan Gohman) Date: Tue, 15 Sep 2009 15:58:07 -0000 Subject: [llvm-commits] [llvm] r81861 - in /llvm/trunk: include/llvm/AbstractTypeUser.h include/llvm/Value.h lib/VMCore/Constants.cpp lib/VMCore/ConstantsContext.h lib/VMCore/Type.cpp test/Linker/partial-type-refinement-link.ll test/Linker/partial-type-refinement.ll Message-ID: <200909151558.n8FFw8AN030172@zion.cs.uiuc.edu> Author: djg Date: Tue Sep 15 10:58:07 2009 New Revision: 81861 URL: http://llvm.org/viewvc/llvm-project?rev=81861&view=rev Log: When a constant's type is refined, update the constant in place instead of cloning and RAUWing it. - Make AbstractTypeUser a friend of Value so that it can offer its subclasses a way to update a Value's type in place. This is better than a universally visible setType method on Value, and it's sufficient for the immediate need. - Eliminate the constant "convert" functions. This eliminates a lot of logic duplication, and fixes a complicated bug where a constant can't actually be cloned during the type refinement process because some of the types that its folder needs are half-destroyed, being in the middle of refinement themselves. - Move the getValType functions from being static overloaded functions in Constants.cpp to be members of class template specializations in ConstantsContext.h. This means that the code ends up getting instantiated twice, however it also makes it possible to eliminate all "convert" functions, so it's not a big net code size increase. And if desired, the duplicate instantiations could be eliminated with some reorganization. Added: llvm/trunk/test/Linker/partial-type-refinement-link.ll llvm/trunk/test/Linker/partial-type-refinement.ll Modified: llvm/trunk/include/llvm/AbstractTypeUser.h llvm/trunk/include/llvm/Value.h llvm/trunk/lib/VMCore/Constants.cpp llvm/trunk/lib/VMCore/ConstantsContext.h llvm/trunk/lib/VMCore/Type.cpp Modified: llvm/trunk/include/llvm/AbstractTypeUser.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/AbstractTypeUser.h?rev=81861&r1=81860&r2=81861&view=diff ============================================================================== --- llvm/trunk/include/llvm/AbstractTypeUser.h (original) +++ llvm/trunk/include/llvm/AbstractTypeUser.h Tue Sep 15 10:58:07 2009 @@ -31,6 +31,7 @@ namespace llvm { +class Value; class Type; class DerivedType; template struct simplify_type; @@ -55,6 +56,12 @@ class AbstractTypeUser { protected: virtual ~AbstractTypeUser(); // Derive from me + + /// setType - It's normally not possible to change a Value's type in place, + /// but an AbstractTypeUser subclass that knows what its doing can be + /// permitted to do so with care. + void setType(Value *V, const Type *NewTy); + public: /// refineAbstractType - The callback method invoked when an abstract type is Modified: llvm/trunk/include/llvm/Value.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Value.h?rev=81861&r1=81860&r2=81861&view=diff ============================================================================== --- llvm/trunk/include/llvm/Value.h (original) +++ llvm/trunk/include/llvm/Value.h Tue Sep 15 10:58:07 2009 @@ -81,6 +81,7 @@ friend class ValueSymbolTable; // Allow ValueSymbolTable to directly mod Name. friend class SymbolTable; // Allow SymbolTable to directly poke Name. friend class ValueHandleBase; + friend class AbstractTypeUser; ValueName *Name; void operator=(const Value &); // Do not implement Modified: llvm/trunk/lib/VMCore/Constants.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Constants.cpp?rev=81861&r1=81860&r2=81861&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Constants.cpp (original) +++ llvm/trunk/lib/VMCore/Constants.cpp Tue Sep 15 10:58:07 2009 @@ -878,8 +878,6 @@ //===----------------------------------------------------------------------===// // Factory Function Implementation -static char getValType(ConstantAggregateZero *CPZ) { return 0; } - ConstantAggregateZero* ConstantAggregateZero::get(const Type* Ty) { assert((isa(Ty) || isa(Ty) || isa(Ty)) && "Cannot create an aggregate zero of non-aggregate type!"); @@ -1008,11 +1006,6 @@ //---- ConstantPointerNull::get() implementation... // -static char getValType(ConstantPointerNull *) { - return 0; -} - - ConstantPointerNull *ConstantPointerNull::get(const PointerType *Ty) { // Implicitly locked. return Ty->getContext().pImpl->NullPtrConstants.getOrCreate(Ty, 0); @@ -1030,10 +1023,6 @@ //---- UndefValue::get() implementation... // -static char getValType(UndefValue *) { - return 0; -} - UndefValue *UndefValue::get(const Type *Ty) { // Implicitly locked. return Ty->getContext().pImpl->UndefValueConstants.getOrCreate(Ty, 0); @@ -1050,18 +1039,6 @@ //---- ConstantExpr::get() implementations... // -static ExprMapKeyType getValType(ConstantExpr *CE) { - std::vector Operands; - Operands.reserve(CE->getNumOperands()); - for (unsigned i = 0, e = CE->getNumOperands(); i != e; ++i) - Operands.push_back(cast(CE->getOperand(i))); - return ExprMapKeyType(CE->getOpcode(), Operands, - CE->isCompare() ? CE->getPredicate() : 0, - CE->getRawSubclassOptionalData(), - CE->hasIndices() ? - CE->getIndices() : SmallVector()); -} - /// This is a utility function to handle folding of casts and lookup of the /// cast in the ExprConstants map. It is used by the various get* methods below. static inline Constant *getFoldedCast( @@ -1878,15 +1855,6 @@ /// work, but would be really slow because it would have to unique each updated /// array instance. -static std::vector getValType(ConstantArray *CA) { - std::vector Elements; - Elements.reserve(CA->getNumOperands()); - for (unsigned i = 0, e = CA->getNumOperands(); i != e; ++i) - Elements.push_back(cast(CA->getOperand(i))); - return Elements; -} - - void ConstantArray::replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U) { assert(isa(To) && "Cannot make Constant refer to non-constant!"); @@ -1895,7 +1863,7 @@ LLVMContext &Context = getType()->getContext(); LLVMContextImpl *pImpl = Context.pImpl; - std::pair Lookup; + std::pair Lookup; Lookup.first.first = getType(); Lookup.second = this; @@ -1973,14 +1941,6 @@ destroyConstant(); } -static std::vector getValType(ConstantStruct *CS) { - std::vector Elements; - Elements.reserve(CS->getNumOperands()); - for (unsigned i = 0, e = CS->getNumOperands(); i != e; ++i) - Elements.push_back(cast(CS->getOperand(i))); - return Elements; -} - void ConstantStruct::replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U) { assert(isa(To) && "Cannot make Constant refer to non-constant!"); @@ -1989,7 +1949,7 @@ unsigned OperandToUpdate = U-OperandList; assert(getOperand(OperandToUpdate) == From && "ReplaceAllUsesWith broken!"); - std::pair Lookup; + std::pair Lookup; Lookup.first.first = getType(); Lookup.second = this; std::vector &Values = Lookup.first.second; @@ -2049,14 +2009,6 @@ destroyConstant(); } -static std::vector getValType(ConstantVector *CP) { - std::vector Elements; - Elements.reserve(CP->getNumOperands()); - for (unsigned i = 0, e = CP->getNumOperands(); i != e; ++i) - Elements.push_back(CP->getOperand(i)); - return Elements; -} - void ConstantVector::replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U) { assert(isa(To) && "Cannot make Constant refer to non-constant!"); Modified: llvm/trunk/lib/VMCore/ConstantsContext.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/ConstantsContext.h?rev=81861&r1=81860&r2=81861&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/ConstantsContext.h (original) +++ llvm/trunk/lib/VMCore/ConstantsContext.h Tue Sep 15 10:58:07 2009 @@ -350,10 +350,11 @@ } }; -template -struct ConvertConstantType { - static void convert(ConstantClass *OldC, const TypeClass *NewTy) { - llvm_unreachable("This type cannot be converted!"); +template +struct ConstantKeyData { + typedef void ValType; + static ValType getValType(ConstantClass *C) { + llvm_unreachable("Unknown Constant type!"); } }; @@ -404,50 +405,18 @@ }; template<> -struct ConvertConstantType { - static void convert(ConstantExpr *OldC, const Type *NewTy) { - Constant *New; - switch (OldC->getOpcode()) { - case Instruction::Trunc: - case Instruction::ZExt: - case Instruction::SExt: - case Instruction::FPTrunc: - case Instruction::FPExt: - case Instruction::UIToFP: - case Instruction::SIToFP: - case Instruction::FPToUI: - case Instruction::FPToSI: - case Instruction::PtrToInt: - case Instruction::IntToPtr: - case Instruction::BitCast: - New = ConstantExpr::getCast(OldC->getOpcode(), OldC->getOperand(0), - NewTy); - break; - case Instruction::Select: - New = ConstantExpr::getSelectTy(NewTy, OldC->getOperand(0), - OldC->getOperand(1), - OldC->getOperand(2)); - break; - default: - assert(OldC->getOpcode() >= Instruction::BinaryOpsBegin && - OldC->getOpcode() < Instruction::BinaryOpsEnd); - New = ConstantExpr::getTy(NewTy, OldC->getOpcode(), OldC->getOperand(0), - OldC->getOperand(1)); - break; - case Instruction::GetElementPtr: - // Make everyone now use a constant of the new type... - std::vector Idx(OldC->op_begin()+1, OldC->op_end()); - New = cast(OldC)->isInBounds() ? - ConstantExpr::getInBoundsGetElementPtrTy(NewTy, OldC->getOperand(0), - &Idx[0], Idx.size()) : - ConstantExpr::getGetElementPtrTy(NewTy, OldC->getOperand(0), - &Idx[0], Idx.size()); - break; - } - - assert(New != OldC && "Didn't replace constant??"); - OldC->uncheckedReplaceAllUsesWith(New); - OldC->destroyConstant(); // This constant is now dead, destroy it. +struct ConstantKeyData { + typedef ExprMapKeyType ValType; + static ValType getValType(ConstantExpr *CE) { + std::vector Operands; + Operands.reserve(CE->getNumOperands()); + for (unsigned i = 0, e = CE->getNumOperands(); i != e; ++i) + Operands.push_back(cast(CE->getOperand(i))); + return ExprMapKeyType(CE->getOpcode(), Operands, + CE->isCompare() ? CE->getPredicate() : 0, + CE->getRawSubclassOptionalData(), + CE->hasIndices() ? + CE->getIndices() : SmallVector()); } }; @@ -460,56 +429,46 @@ }; template<> -struct ConvertConstantType { - static void convert(ConstantVector *OldC, const VectorType *NewTy) { - // Make everyone now use a constant of the new type... - std::vector C; - for (unsigned i = 0, e = OldC->getNumOperands(); i != e; ++i) - C.push_back(cast(OldC->getOperand(i))); - Constant *New = ConstantVector::get(NewTy, C); - assert(New != OldC && "Didn't replace constant??"); - OldC->uncheckedReplaceAllUsesWith(New); - OldC->destroyConstant(); // This constant is now dead, destroy it. +struct ConstantKeyData { + typedef std::vector ValType; + static ValType getValType(ConstantVector *CP) { + std::vector Elements; + Elements.reserve(CP->getNumOperands()); + for (unsigned i = 0, e = CP->getNumOperands(); i != e; ++i) + Elements.push_back(CP->getOperand(i)); + return Elements; } }; template<> -struct ConvertConstantType { - static void convert(ConstantAggregateZero *OldC, const Type *NewTy) { - // Make everyone now use a constant of the new type... - Constant *New = ConstantAggregateZero::get(NewTy); - assert(New != OldC && "Didn't replace constant??"); - OldC->uncheckedReplaceAllUsesWith(New); - OldC->destroyConstant(); // This constant is now dead, destroy it. +struct ConstantKeyData { + typedef char ValType; + static ValType getValType(ConstantAggregateZero *C) { + return 0; } }; template<> -struct ConvertConstantType { - static void convert(ConstantArray *OldC, const ArrayType *NewTy) { - // Make everyone now use a constant of the new type... - std::vector C; - for (unsigned i = 0, e = OldC->getNumOperands(); i != e; ++i) - C.push_back(cast(OldC->getOperand(i))); - Constant *New = ConstantArray::get(NewTy, C); - assert(New != OldC && "Didn't replace constant??"); - OldC->uncheckedReplaceAllUsesWith(New); - OldC->destroyConstant(); // This constant is now dead, destroy it. +struct ConstantKeyData { + typedef std::vector ValType; + static ValType getValType(ConstantArray *CA) { + std::vector Elements; + Elements.reserve(CA->getNumOperands()); + for (unsigned i = 0, e = CA->getNumOperands(); i != e; ++i) + Elements.push_back(cast(CA->getOperand(i))); + return Elements; } }; template<> -struct ConvertConstantType { - static void convert(ConstantStruct *OldC, const StructType *NewTy) { - // Make everyone now use a constant of the new type... - std::vector C; - for (unsigned i = 0, e = OldC->getNumOperands(); i != e; ++i) - C.push_back(cast(OldC->getOperand(i))); - Constant *New = ConstantStruct::get(NewTy, C); - assert(New != OldC && "Didn't replace constant??"); - - OldC->uncheckedReplaceAllUsesWith(New); - OldC->destroyConstant(); // This constant is now dead, destroy it. +struct ConstantKeyData { + typedef std::vector ValType; + static ValType getValType(ConstantStruct *CS) { + std::vector Elements; + Elements.reserve(CS->getNumOperands()); + for (unsigned i = 0, e = CS->getNumOperands(); i != e; ++i) + Elements.push_back(cast(CS->getOperand(i))); + return Elements; } }; @@ -522,13 +481,10 @@ }; template<> -struct ConvertConstantType { - static void convert(ConstantPointerNull *OldC, const PointerType *NewTy) { - // Make everyone now use a constant of the new type... - Constant *New = ConstantPointerNull::get(NewTy); - assert(New != OldC && "Didn't replace constant??"); - OldC->uncheckedReplaceAllUsesWith(New); - OldC->destroyConstant(); // This constant is now dead, destroy it. +struct ConstantKeyData { + typedef char ValType; + static ValType getValType(ConstantPointerNull *C) { + return 0; } }; @@ -541,13 +497,10 @@ }; template<> -struct ConvertConstantType { - static void convert(UndefValue *OldC, const Type *NewTy) { - // Make everyone now use a constant of the new type. - Constant *New = UndefValue::get(NewTy); - assert(New != OldC && "Didn't replace constant??"); - OldC->uncheckedReplaceAllUsesWith(New); - OldC->destroyConstant(); // This constant is now dead, destroy it. +struct ConstantKeyData { + typedef char ValType; + static ValType getValType(UndefValue *C) { + return 0; } }; @@ -555,10 +508,11 @@ bool HasLargeKey = false /*true for arrays and structs*/ > class ValueMap : public AbstractTypeUser { public: - typedef std::pair MapKey; - typedef std::map MapTy; - typedef std::map InverseMapTy; - typedef std::map AbstractTypeMapTy; + typedef std::pair MapKey; + typedef std::map MapTy; + typedef std::map InverseMapTy; + typedef std::map + AbstractTypeMapTy; private: /// Map - This is the main map from the element descriptor to the Constants. /// This is the primary way we avoid creating two of the same shape @@ -599,7 +553,7 @@ /// I->second == 0, and should be filled in. /// NOTE: This function is not locked. It is the caller's responsibility // to enforce proper synchronization. - typename MapTy::iterator InsertOrGetItem(std::pair + typename MapTy::iterator InsertOrGetItem(std::pair &InsertVal, bool &Exists) { std::pair IP = Map.insert(InsertVal); @@ -619,7 +573,7 @@ typename MapTy::iterator I = Map.find(MapKey(static_cast(CP->getRawType()), - getValType(CP))); + ConstantKeyData::getValType(CP))); if (I == Map.end() || I->second != CP) { // FIXME: This should not use a linear scan. If this gets to be a // performance problem, someone should look at this. @@ -629,6 +583,22 @@ return I; } + void AddAbstractTypeUser(const Type *Ty, typename MapTy::iterator I) { + // If the type of the constant is abstract, make sure that an entry + // exists for it in the AbstractTypeMap. + if (Ty->isAbstract()) { + const DerivedType *DTy = static_cast(Ty); + typename AbstractTypeMapTy::iterator TI = AbstractTypeMap.find(DTy); + + if (TI == AbstractTypeMap.end()) { + // Add ourselves to the ATU list of the type. + cast(DTy)->addAbstractTypeUser(this); + + AbstractTypeMap.insert(TI, std::make_pair(DTy, I)); + } + } + } + ConstantClass* Create(const TypeClass *Ty, const ValType &V, typename MapTy::iterator I) { ConstantClass* Result = @@ -640,19 +610,7 @@ if (HasLargeKey) // Remember the reverse mapping if needed. InverseMap.insert(std::make_pair(Result, I)); - // If the type of the constant is abstract, make sure that an entry - // exists for it in the AbstractTypeMap. - if (Ty->isAbstract()) { - typename AbstractTypeMapTy::iterator TI = - AbstractTypeMap.find(Ty); - - if (TI == AbstractTypeMap.end()) { - // Add ourselves to the ATU list of the type. - cast(Ty)->addAbstractTypeUser(this); - - AbstractTypeMap.insert(TI, std::make_pair(Ty, I)); - } - } + AddAbstractTypeUser(Ty, I); return Result; } @@ -668,7 +626,7 @@ typename MapTy::iterator I = Map.find(Lookup); // Is it in the map? if (I != Map.end()) - Result = static_cast(I->second); + Result = I->second; if (!Result) { // If no preexisting value, create one now... @@ -678,6 +636,43 @@ return Result; } + void UpdateAbstractTypeMap(const DerivedType *Ty, + typename MapTy::iterator I) { + assert(AbstractTypeMap.count(Ty) && + "Abstract type not in AbstractTypeMap?"); + typename MapTy::iterator &ATMEntryIt = AbstractTypeMap[Ty]; + if (ATMEntryIt == I) { + // Yes, we are removing the representative entry for this type. + // See if there are any other entries of the same type. + typename MapTy::iterator TmpIt = ATMEntryIt; + + // First check the entry before this one... + if (TmpIt != Map.begin()) { + --TmpIt; + if (TmpIt->first.first != Ty) // Not the same type, move back... + ++TmpIt; + } + + // If we didn't find the same type, try to move forward... + if (TmpIt == ATMEntryIt) { + ++TmpIt; + if (TmpIt == Map.end() || TmpIt->first.first != Ty) + --TmpIt; // No entry afterwards with the same type + } + + // If there is another entry in the map of the same abstract type, + // update the AbstractTypeMap entry now. + if (TmpIt != ATMEntryIt) { + ATMEntryIt = TmpIt; + } else { + // Otherwise, we are removing the last instance of this type + // from the table. Remove from the ATM, and from user list. + cast(Ty)->removeAbstractTypeUser(this); + AbstractTypeMap.erase(Ty); + } + } + } + void remove(ConstantClass *CP) { sys::SmartScopedLock Lock(ValueMapLock); typename MapTy::iterator I = FindExistingElement(CP); @@ -689,47 +684,13 @@ // Now that we found the entry, make sure this isn't the entry that // the AbstractTypeMap points to. - const TypeClass *Ty = static_cast(I->first.first); - if (Ty->isAbstract()) { - assert(AbstractTypeMap.count(Ty) && - "Abstract type not in AbstractTypeMap?"); - typename MapTy::iterator &ATMEntryIt = AbstractTypeMap[Ty]; - if (ATMEntryIt == I) { - // Yes, we are removing the representative entry for this type. - // See if there are any other entries of the same type. - typename MapTy::iterator TmpIt = ATMEntryIt; - - // First check the entry before this one... - if (TmpIt != Map.begin()) { - --TmpIt; - if (TmpIt->first.first != Ty) // Not the same type, move back... - ++TmpIt; - } - - // If we didn't find the same type, try to move forward... - if (TmpIt == ATMEntryIt) { - ++TmpIt; - if (TmpIt == Map.end() || TmpIt->first.first != Ty) - --TmpIt; // No entry afterwards with the same type - } - - // If there is another entry in the map of the same abstract type, - // update the AbstractTypeMap entry now. - if (TmpIt != ATMEntryIt) { - ATMEntryIt = TmpIt; - } else { - // Otherwise, we are removing the last instance of this type - // from the table. Remove from the ATM, and from user list. - cast(Ty)->removeAbstractTypeUser(this); - AbstractTypeMap.erase(Ty); - } - } - } + const TypeClass *Ty = I->first.first; + if (Ty->isAbstract()) + UpdateAbstractTypeMap(static_cast(Ty), I); Map.erase(I); } - /// MoveConstantToNewSlot - If we are about to change C to be the element /// specified by I, update our internal data structures to reflect this /// fact. @@ -765,8 +726,7 @@ void refineAbstractType(const DerivedType *OldTy, const Type *NewTy) { sys::SmartScopedLock Lock(ValueMapLock); - typename AbstractTypeMapTy::iterator I = - AbstractTypeMap.find(cast(OldTy)); + typename AbstractTypeMapTy::iterator I = AbstractTypeMap.find(OldTy); assert(I != AbstractTypeMap.end() && "Abstract type not in AbstractTypeMap?"); @@ -775,12 +735,39 @@ // leaving will remove() itself, causing the AbstractTypeMapEntry to be // eliminated eventually. do { - ConvertConstantType::convert( - static_cast(I->second->second), - cast(NewTy)); - - I = AbstractTypeMap.find(cast(OldTy)); + ConstantClass *C = I->second->second; + MapKey Key(cast(NewTy), + ConstantKeyData::getValType(C)); + + std::pair IP = + Map.insert(std::make_pair(Key, C)); + if (IP.second) { + // The map didn't previously have an appropriate constant in the + // new type. + + // Remove the old entry. + typename MapTy::iterator OldI = + Map.find(MapKey(cast(OldTy), IP.first->first.second)); + assert(OldI != Map.end() && "Constant not in map!"); + UpdateAbstractTypeMap(OldTy, OldI); + Map.erase(OldI); + + // Set the constant's type. This is done in place! + setType(C, NewTy); + + // Update the inverse map so that we know that this constant is now + // located at descriptor I. + if (HasLargeKey) + InverseMap[C] = IP.first; + + AddAbstractTypeUser(NewTy, IP.first); + } else { + // The map already had an appropriate constant in the new type, so + // there's no longer a need for the old constant. + C->uncheckedReplaceAllUsesWith(IP.first->second); + C->destroyConstant(); // This constant is now dead, destroy it. + } + I = AbstractTypeMap.find(OldTy); } while (I != AbstractTypeMap.end()); } Modified: llvm/trunk/lib/VMCore/Type.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Type.cpp?rev=81861&r1=81860&r2=81861&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Type.cpp (original) +++ llvm/trunk/lib/VMCore/Type.cpp Tue Sep 15 10:58:07 2009 @@ -42,6 +42,9 @@ AbstractTypeUser::~AbstractTypeUser() {} +void AbstractTypeUser::setType(Value *V, const Type *NewTy) { + V->VTy = NewTy; +} //===----------------------------------------------------------------------===// // Type Class Implementation Added: llvm/trunk/test/Linker/partial-type-refinement-link.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/partial-type-refinement-link.ll?rev=81861&view=auto ============================================================================== --- llvm/trunk/test/Linker/partial-type-refinement-link.ll (added) +++ llvm/trunk/test/Linker/partial-type-refinement-link.ll Tue Sep 15 10:58:07 2009 @@ -0,0 +1,20 @@ +; This file is used by first.ll, so it doesn't actually do anything itself +; RUN: true + +%AnalysisResolver = type { i8, %PMDataManager* } +%"DenseMap" = type { i64, %"pair"*, i64, i64 } +%PMDataManager = type { i8, %PMTopLevelManager*, i8, i8, i8, i8, i8, i64, i8 } +%PMTopLevelManager = type { i8, i8, i8, i8, i8, i8, i8, i8, %"DenseMap" } +%P = type { i8, %AnalysisResolver*, i64 } +%PI = type { i8, i8, i8, i8, i8, i8, %"vector", %P* } +%"SmallVImpl" = type { i8, %PI* } +%"_V_base" = type { %"_V_base::_V_impl" } +%"_V_base::_V_impl" = type { %PI*, i8, i8 } +%"pair" = type opaque +%"vector" = type { %"_V_base" } + +define void @f(%"SmallVImpl"* %this) { +entry: + %x = getelementptr inbounds %"SmallVImpl"* %this, i64 0, i32 1 + ret void +} Added: llvm/trunk/test/Linker/partial-type-refinement.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/partial-type-refinement.ll?rev=81861&view=auto ============================================================================== --- llvm/trunk/test/Linker/partial-type-refinement.ll (added) +++ llvm/trunk/test/Linker/partial-type-refinement.ll Tue Sep 15 10:58:07 2009 @@ -0,0 +1,24 @@ +; RUN: llvm-link %s %p/partial-type-refinement-link.ll -S | FileCheck %s +; PR4954 + +; CHECK: load %PI** getelementptr inbounds (%"RegisterP"* @_ZN3mvmL1XE, i64 0, i32 0, i32 6, i32 0, i32 0, i32 0), align 16 + +%AnalysisResolver = type { i8, %PMDataManager* } +%"DenseMap" = type { i64, %"pair"*, i64, i64 } +%PMDataManager = type { i8, %PMTopLevelManager*, i8, i8, i8, i8, i8, i64, i8 } +%PMTopLevelManager = type { i8, i8, i8, i8, i8, i8, i8, i8, %"DenseMap" } +%P = type { i8, %AnalysisResolver*, i64 } +%PI = type { i8, i8, i8, i8, i8, i8, %"vector", %P* } +%"RegisterP" = type { %PI } +%"_V_base" = type { %"_V_base::_V_impl" } +%"_V_base::_V_impl" = type { %PI*, i8, i8 } +%"pair" = type opaque +%"vector" = type { %"_V_base" } + + at _ZN3mvmL1XE = external global %"RegisterP" + +define void @__tcf_0() nounwind { +entry: + %0 = load %PI** getelementptr inbounds (%"RegisterP"* @_ZN3mvmL1XE, i64 0, i32 0, i32 6, i32 0, i32 0, i32 0), align 16 + ret void +} From gohman at apple.com Tue Sep 15 11:00:30 2009 From: gohman at apple.com (Dan Gohman) Date: Tue, 15 Sep 2009 16:00:30 -0000 Subject: [llvm-commits] [llvm] r81862 - /llvm/trunk/lib/VMCore/ConstantFold.cpp Message-ID: <200909151600.n8FG0UCv030475@zion.cs.uiuc.edu> Author: djg Date: Tue Sep 15 11:00:30 2009 New Revision: 81862 URL: http://llvm.org/viewvc/llvm-project?rev=81862&view=rev Log: Fix an accidental inversion of the inbounds flag. Modified: llvm/trunk/lib/VMCore/ConstantFold.cpp Modified: llvm/trunk/lib/VMCore/ConstantFold.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/ConstantFold.cpp?rev=81862&r1=81861&r2=81862&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/ConstantFold.cpp (original) +++ llvm/trunk/lib/VMCore/ConstantFold.cpp Tue Sep 15 11:00:30 2009 @@ -1873,10 +1873,10 @@ for (unsigned i = 0; i != NumIdx; ++i) if (!NewIdxs[i]) NewIdxs[i] = Idxs[i]; return inBounds ? - ConstantExpr::getGetElementPtr(const_cast(C), - NewIdxs.data(), NewIdxs.size()) : ConstantExpr::getInBoundsGetElementPtr(const_cast(C), - NewIdxs.data(), NewIdxs.size()); + NewIdxs.data(), NewIdxs.size()) : + ConstantExpr::getGetElementPtr(const_cast(C), + NewIdxs.data(), NewIdxs.size()); } // If all indices are known integers and normalized, we can do a simple From gohman at apple.com Tue Sep 15 11:14:44 2009 From: gohman at apple.com (Dan Gohman) Date: Tue, 15 Sep 2009 16:14:44 -0000 Subject: [llvm-commits] [llvm] r81864 - /llvm/trunk/lib/Analysis/ValueTracking.cpp Message-ID: <200909151614.n8FGEjLF032266@zion.cs.uiuc.edu> Author: djg Date: Tue Sep 15 11:14:44 2009 New Revision: 81864 URL: http://llvm.org/viewvc/llvm-project?rev=81864&view=rev Log: Teach ValueTracking how to look through GlobalAliases. GlobalAliases are not folded in the constant folder because the constant folder doesn't simplify ConstantExpr operands. Modified: llvm/trunk/lib/Analysis/ValueTracking.cpp Modified: llvm/trunk/lib/Analysis/ValueTracking.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ValueTracking.cpp?rev=81864&r1=81863&r2=81864&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ValueTracking.cpp (original) +++ llvm/trunk/lib/Analysis/ValueTracking.cpp Tue Sep 15 11:14:44 2009 @@ -16,6 +16,7 @@ #include "llvm/Constants.h" #include "llvm/Instructions.h" #include "llvm/GlobalVariable.h" +#include "llvm/GlobalAlias.h" #include "llvm/IntrinsicInst.h" #include "llvm/LLVMContext.h" #include "llvm/Operator.h" @@ -105,6 +106,17 @@ KnownOne.clear(); return; } + // A weak GlobalAlias is totally unknown. A non-weak GlobalAlias has + // the bits of its aliasee. + if (GlobalAlias *GA = dyn_cast(V)) { + if (GA->mayBeOverridden()) { + KnownZero.clear(); KnownOne.clear(); + } else { + ComputeMaskedBits(GA->getAliasee(), Mask, KnownZero, KnownOne, + TD, Depth+1); + } + return; + } KnownZero.clear(); KnownOne.clear(); // Start out not knowing anything. From enderby at apple.com Tue Sep 15 11:29:53 2009 From: enderby at apple.com (Kevin Enderby) Date: Tue, 15 Sep 2009 09:29:53 -0700 Subject: [llvm-commits] [llvm] r81817 - in /llvm/trunk: lib/Target/ARM/AsmParser/ lib/Target/ARM/AsmParser/ARMAsmParser.cpp lib/Target/ARM/AsmParser/CMakeLists.txt lib/Target/ARM/AsmParser/Makefile lib/Target/ARM/Makefile test/MC/AsmParser/arm_word_directive.s test/MC/AsmParser/directive_values.s test/MC/AsmParser/x86_word_directive.s In-Reply-To: References: <200909150027.n8F0RQUw026432@zion.cs.uiuc.edu> Message-ID: Hi Ted, Thanks for fixing that. I was trying to clean out my hacks of my wild copy and pastes and missed that one. For now it shouldn't be there. Kev On Sep 14, 2009, at 9:06 PM, Ted Kremenek wrote: > > On Sep 14, 2009, at 5:27 PM, Kevin Enderby wrote: > >> ===================================================================== >> ========= >> --- llvm/trunk/lib/Target/ARM/AsmParser/CMakeLists.txt (added) >> +++ llvm/trunk/lib/Target/ARM/AsmParser/CMakeLists.txt Mon Sep 14 >> 19:27:25 2009 >> @@ -0,0 +1,6 @@ >> +include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. $ >> {CMAKE_CURRENT_SOURCE_DIR}/.. ) >> + >> +add_llvm_library(LLVMARMAsmParser >> + ARMAsmParser.cpp >> + ) >> +add_dependencies(LLVMARMAsmParser) >> > > Hi Kevin, > > This last line actually breaks the CMake builds: > > CMake Error at lib/Target/ARM/AsmParser/CMakeLists.txt:6 > (add_dependencies): > add_dependencies called with incorrect number of arguments > > Were you trying to add a specific dependency between the > LLVMARMAsmParser and something else? > > I've gone ahead and removed this last line, but I'm not certain if > that is the right thing to do. The CMake build now works, but I'm > not certain if a dependency is suppose to be there. > > Ted > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090915/b1b057c5/attachment.html From kremenek at apple.com Tue Sep 15 12:36:12 2009 From: kremenek at apple.com (Ted Kremenek) Date: Tue, 15 Sep 2009 17:36:12 -0000 Subject: [llvm-commits] [llvm] r81872 - /llvm/tags/checker/checker-0.220/ Message-ID: <200909151736.n8FHaCSl011500@zion.cs.uiuc.edu> Author: kremenek Date: Tue Sep 15 12:36:12 2009 New Revision: 81872 URL: http://llvm.org/viewvc/llvm-project?rev=81872&view=rev Log: Removing checker-0.220. Removed: llvm/tags/checker/checker-0.220/ From natebegeman at mac.com Tue Sep 15 12:36:28 2009 From: natebegeman at mac.com (Nate Begeman) Date: Tue, 15 Sep 2009 10:36:28 -0700 Subject: [llvm-commits] [llvm] r81813 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAG.h include/llvm/CodeGen/SelectionDAGNodes.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp In-Reply-To: References: <200909150013.n8F0DCbX024473@zion.cs.uiuc.edu> Message-ID: <53514D84-13CE-464A-A97B-348514BB9325@mac.com> On Sep 14, 2009, at 11:41 PM, Chris Lattner wrote: > > On Sep 14, 2009, at 5:13 PM, Nate Begeman wrote: > >> Author: sampo >> Date: Mon Sep 14 19:13:12 2009 >> New Revision: 81813 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=81813&view=rev >> Log: >> Add an "original alignment" field to load and store nodes. This >> enables the >> DAG Combiner to disambiguate chains for loads and stores of types >> which are >> broken up by the Legalizer into smaller pieces. > > Hi Nate, > >> + //! OrigAlign - The original alignment of this MemSDNode in the >> case where >> + // this node was created by legalize from a MemSDNode with known >> alignment. >> + unsigned OrigAlign; > > I don't understand what this means. Is this saying that the load/ > store is always an access to [ptr_with_some_alignment]+SVOffset? > > If so, it seems that the ultimate alignment of the access is actually: > MinAlign(OrigAlign, SVOffset) > (from MathExtras.h). > > If this is true, then you can make the comment much more strong, and > fix MemSDNode to never actually store the alignment of the access > (store OrigAlign instead and compute the access alignment when > needed). > > If we do need to keep both alignments around, is there any way to > encode this in SubclassData like the alignment field itself is to > avoid growing MemSDNode (the biggest sdnode)? Thanks for the feedback, I'm working on it. Cheers, Nate -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090915/1612af60/attachment.html From kremenek at apple.com Tue Sep 15 12:44:14 2009 From: kremenek at apple.com (Ted Kremenek) Date: Tue, 15 Sep 2009 17:44:14 -0000 Subject: [llvm-commits] [llvm] r81875 - /llvm/tags/checker/checker-0.220/ Message-ID: <200909151744.n8FHiEU9012571@zion.cs.uiuc.edu> Author: kremenek Date: Tue Sep 15 12:44:14 2009 New Revision: 81875 URL: http://llvm.org/viewvc/llvm-project?rev=81875&view=rev Log: Tagging checker-0.220. Added: llvm/tags/checker/checker-0.220/ - copied from r81874, llvm/trunk/ From sabre at nondot.org Tue Sep 15 12:46:24 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 15 Sep 2009 17:46:24 -0000 Subject: [llvm-commits] [llvm] r81877 - in /llvm/trunk: lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp lib/Target/Sparc/SparcISelDAGToDAG.cpp lib/Target/Sparc/SparcISelLowering.cpp lib/Target/Sparc/SparcISelLowering.h lib/Target/Sparc/SparcInstrInfo.cpp lib/Target/Sparc/SparcInstrInfo.h lib/Target/Sparc/SparcInstrInfo.td lib/Target/Sparc/SparcRegisterInfo.td test/CodeGen/SPARC/2009-08-28-PIC.ll test/CodeGen/SPARC/2009-08-28-WeakLinkage.ll Message-ID: <200909151746.n8FHkOcd012915@zion.cs.uiuc.edu> Author: lattner Date: Tue Sep 15 12:46:24 2009 New Revision: 81877 URL: http://llvm.org/viewvc/llvm-project?rev=81877&view=rev Log: several major improvements to the sparc backend: support for weak linkage and PIC codegen. Patch by Venkatraman Govindaraju! Added: llvm/trunk/test/CodeGen/SPARC/2009-08-28-PIC.ll llvm/trunk/test/CodeGen/SPARC/2009-08-28-WeakLinkage.ll Modified: llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp llvm/trunk/lib/Target/Sparc/SparcISelDAGToDAG.cpp llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp llvm/trunk/lib/Target/Sparc/SparcISelLowering.h llvm/trunk/lib/Target/Sparc/SparcInstrInfo.cpp llvm/trunk/lib/Target/Sparc/SparcInstrInfo.h llvm/trunk/lib/Target/Sparc/SparcInstrInfo.td llvm/trunk/lib/Target/Sparc/SparcRegisterInfo.td Modified: llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp?rev=81877&r1=81876&r2=81877&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp Tue Sep 15 12:46:24 2009 @@ -75,12 +75,14 @@ unsigned AsmVariant, const char *ExtraCode); bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo, unsigned AsmVariant, const char *ExtraCode); + + void emitFunctionHeader(const MachineFunction &MF); + bool printGetPCX(const MachineInstr *MI, unsigned OpNo); }; } // end of anonymous namespace #include "SparcGenAsmWriter.inc" - /// runOnMachineFunction - This uses the printInstruction() /// method to print assembly for each instruction. /// @@ -96,17 +98,9 @@ // BBs the same name. (If you have a better way, please let me know!) O << "\n\n"; - - // Print out the label for the function. - const Function *F = MF.getFunction(); - OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(F, Mang, TM)); - EmitAlignment(MF.getAlignment(), F); - O << "\t.globl\t" << CurrentFnName << '\n'; - - printVisibility(CurrentFnName, F->getVisibility()); - - O << "\t.type\t" << CurrentFnName << ", #function\n"; - O << CurrentFnName << ":\n"; + emitFunctionHeader(MF); + + // Emit pre-function debug information. DW->BeginFunction(&MF); @@ -145,9 +139,43 @@ DW->EndFunction(&MF); // We didn't modify anything. + O << "\t.size\t" << CurrentFnName << ", .-" << CurrentFnName << '\n'; return false; } +void SparcAsmPrinter::emitFunctionHeader(const MachineFunction &MF) { + const Function *F = MF.getFunction(); + OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(F, Mang, TM)); + EmitAlignment(MF.getAlignment(), F); + + switch (F->getLinkage()) { + default: llvm_unreachable("Unknown linkage type"); + case Function::PrivateLinkage: + case Function::InternalLinkage: + // Function is internal. + break; + case Function::DLLExportLinkage: + case Function::ExternalLinkage: + // Function is externally visible + O << "\t.global\t" << CurrentFnName << '\n'; + break; + case Function::LinkerPrivateLinkage: + case Function::LinkOnceAnyLinkage: + case Function::LinkOnceODRLinkage: + case Function::WeakAnyLinkage: + case Function::WeakODRLinkage: + // Function is weak + O << "\t.weak\t" << CurrentFnName << '\n' ; + break; + } + + printVisibility(CurrentFnName, F->getVisibility()); + + O << "\t.type\t" << CurrentFnName << ", #function\n"; + O << CurrentFnName << ":\n"; +} + + void SparcAsmPrinter::printOperand(const MachineInstr *MI, int opNum) { const MachineOperand &MO = MI->getOperand (opNum); bool CloseParen = false; @@ -215,6 +243,36 @@ } } +bool SparcAsmPrinter::printGetPCX(const MachineInstr *MI, unsigned opNum) { + std::string operand = ""; + const MachineOperand &MO = MI->getOperand(opNum); + switch (MO.getType()) { + default: assert(0 && "Operand is not a register "); + case MachineOperand::MO_Register: + assert(TargetRegisterInfo::isPhysicalRegister(MO.getReg()) && + "Operand is not a physical register "); + operand = "%" + LowercaseString(getRegisterName(MO.getReg())); + break; + } + + unsigned bbNum = NumberForBB[MI->getParent()->getBasicBlock()]; + + O << '\n' << ".LLGETPCH" << bbNum << ":\n"; + O << "\tcall\t.LLGETPC" << bbNum << '\n' ; + + O << "\t sethi\t" + << "%hi(_GLOBAL_OFFSET_TABLE_+(.-.LLGETPCH" << bbNum << ")), " + << operand << '\n' ; + + O << ".LLGETPC" << bbNum << ":\n" ; + O << "\tor\t" << operand + << ", %lo(_GLOBAL_OFFSET_TABLE_+(.-.LLGETPCH" << bbNum << ")), " + << operand << '\n'; + O << "\tadd\t" << operand << ", %o7, " << operand << '\n'; + + return true; +} + void SparcAsmPrinter::printCCOperand(const MachineInstr *MI, int opNum) { int CC = (int)MI->getOperand(opNum).getImm(); O << SPARCCondCodeToString((SPCC::CondCodes)CC); Modified: llvm/trunk/lib/Target/Sparc/SparcISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcISelDAGToDAG.cpp?rev=81877&r1=81876&r2=81877&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/SparcISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/Sparc/SparcISelDAGToDAG.cpp Tue Sep 15 12:46:24 2009 @@ -34,10 +34,13 @@ /// Subtarget - Keep a pointer to the Sparc Subtarget around so that we can /// make the right decision when generating code for different targets. const SparcSubtarget &Subtarget; + SparcTargetMachine& TM; + MachineBasicBlock *CurBB; public: - explicit SparcDAGToDAGISel(SparcTargetMachine &TM) - : SelectionDAGISel(TM), - Subtarget(TM.getSubtarget()) { + explicit SparcDAGToDAGISel(SparcTargetMachine &tm) + : SelectionDAGISel(tm), + Subtarget(tm.getSubtarget()), + TM(tm) { } SDNode *Select(SDValue Op); @@ -63,6 +66,9 @@ // Include the pieces autogenerated from the target description. #include "SparcGenDAGISel.inc" + +private: + SDNode* getGlobalBaseReg(); }; } // end anonymous namespace @@ -70,12 +76,18 @@ /// SelectionDAGISel when it has created a SelectionDAG for us to codegen. void SparcDAGToDAGISel::InstructionSelect() { DEBUG(BB->dump()); - + CurBB = BB; // Select target instructions for the DAG. SelectRoot(*CurDAG); CurDAG->RemoveDeadNodes(); } +SDNode* SparcDAGToDAGISel::getGlobalBaseReg() { + MachineFunction *MF = CurBB->getParent(); + unsigned GlobalBaseReg = TM.getInstrInfo()->getGlobalBaseReg(MF); + return CurDAG->getRegister(GlobalBaseReg, TLI.getPointerTy()).getNode(); +} + bool SparcDAGToDAGISel::SelectADDRri(SDValue Op, SDValue Addr, SDValue &Base, SDValue &Offset) { if (FrameIndexSDNode *FIN = dyn_cast(Addr)) { @@ -149,6 +161,9 @@ switch (N->getOpcode()) { default: break; + case SPISD::GLOBAL_BASE_REG: + return getGlobalBaseReg(); + case ISD::SDIV: case ISD::UDIV: { // FIXME: should use a custom expander to expose the SRA to the dag. Modified: llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp?rev=81877&r1=81876&r2=81877&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp (original) +++ llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp Tue Sep 15 12:46:24 2009 @@ -740,17 +740,29 @@ } } -static SDValue LowerGLOBALADDRESS(SDValue Op, SelectionDAG &DAG) { +SDValue SparcTargetLowering::LowerGlobalAddress(SDValue Op, + SelectionDAG &DAG) { GlobalValue *GV = cast(Op)->getGlobal(); // FIXME there isn't really any debug info here DebugLoc dl = Op.getDebugLoc(); SDValue GA = DAG.getTargetGlobalAddress(GV, MVT::i32); SDValue Hi = DAG.getNode(SPISD::Hi, dl, MVT::i32, GA); SDValue Lo = DAG.getNode(SPISD::Lo, dl, MVT::i32, GA); - return DAG.getNode(ISD::ADD, dl, MVT::i32, Lo, Hi); + + if (getTargetMachine().getRelocationModel() != Reloc::PIC_) + return DAG.getNode(ISD::ADD, dl, MVT::i32, Lo, Hi); + + SDValue GlobalBase = DAG.getNode(SPISD::GLOBAL_BASE_REG, dl, + getPointerTy()); + SDValue RelAddr = DAG.getNode(ISD::ADD, dl, MVT::i32, Lo, Hi); + SDValue AbsAddr = DAG.getNode(ISD::ADD, dl, MVT::i32, + GlobalBase, RelAddr); + return DAG.getLoad(getPointerTy(), dl, DAG.getEntryNode(), + AbsAddr, NULL, 0); } -static SDValue LowerCONSTANTPOOL(SDValue Op, SelectionDAG &DAG) { +SDValue SparcTargetLowering::LowerConstantPool(SDValue Op, + SelectionDAG &DAG) { ConstantPoolSDNode *N = cast(Op); // FIXME there isn't really any debug info here DebugLoc dl = Op.getDebugLoc(); @@ -758,7 +770,16 @@ SDValue CP = DAG.getTargetConstantPool(C, MVT::i32, N->getAlignment()); SDValue Hi = DAG.getNode(SPISD::Hi, dl, MVT::i32, CP); SDValue Lo = DAG.getNode(SPISD::Lo, dl, MVT::i32, CP); - return DAG.getNode(ISD::ADD, dl, MVT::i32, Lo, Hi); + if (getTargetMachine().getRelocationModel() != Reloc::PIC_) + return DAG.getNode(ISD::ADD, dl, MVT::i32, Lo, Hi); + + SDValue GlobalBase = DAG.getNode(SPISD::GLOBAL_BASE_REG, dl, + getPointerTy()); + SDValue RelAddr = DAG.getNode(ISD::ADD, dl, MVT::i32, Lo, Hi); + SDValue AbsAddr = DAG.getNode(ISD::ADD, dl, MVT::i32, + GlobalBase, RelAddr); + return DAG.getLoad(getPointerTy(), dl, DAG.getEntryNode(), + AbsAddr, NULL, 0); } static SDValue LowerFP_TO_SINT(SDValue Op, SelectionDAG &DAG) { @@ -912,8 +933,8 @@ case ISD::FRAMEADDR: return SDValue(); case ISD::GlobalTLSAddress: llvm_unreachable("TLS not implemented for Sparc."); - case ISD::GlobalAddress: return LowerGLOBALADDRESS(Op, DAG); - case ISD::ConstantPool: return LowerCONSTANTPOOL(Op, DAG); + case ISD::GlobalAddress: return LowerGlobalAddress(Op, DAG); + case ISD::ConstantPool: return LowerConstantPool(Op, DAG); case ISD::FP_TO_SINT: return LowerFP_TO_SINT(Op, DAG); case ISD::SINT_TO_FP: return LowerSINT_TO_FP(Op, DAG); case ISD::BR_CC: return LowerBR_CC(Op, DAG); @@ -1054,5 +1075,5 @@ /// getFunctionAlignment - Return the Log2 alignment of this function. unsigned SparcTargetLowering::getFunctionAlignment(const Function *) const { - return 4; + return 2; } Modified: llvm/trunk/lib/Target/Sparc/SparcISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcISelLowering.h?rev=81877&r1=81876&r2=81877&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/SparcISelLowering.h (original) +++ llvm/trunk/lib/Target/Sparc/SparcISelLowering.h Tue Sep 15 12:46:24 2009 @@ -35,7 +35,8 @@ ITOF, // Int to FP within a FP register. CALL, // A call instruction. - RET_FLAG // Return with a flag operand. + RET_FLAG, // Return with a flag operand. + GLOBAL_BASE_REG // Global base reg for PIC }; } @@ -96,6 +97,9 @@ CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Outs, DebugLoc dl, SelectionDAG &DAG); + + SDValue LowerGlobalAddress(SDValue Op, SelectionDAG &DAG); + SDValue LowerConstantPool(SDValue Op, SelectionDAG &DAG); }; } // end namespace llvm Modified: llvm/trunk/lib/Target/Sparc/SparcInstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcInstrInfo.cpp?rev=81877&r1=81876&r2=81877&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/SparcInstrInfo.cpp (original) +++ llvm/trunk/lib/Target/Sparc/SparcInstrInfo.cpp Tue Sep 15 12:46:24 2009 @@ -17,8 +17,10 @@ #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SmallVector.h" #include "llvm/CodeGen/MachineInstrBuilder.h" +#include "llvm/CodeGen/MachineRegisterInfo.h" #include "llvm/Support/ErrorHandling.h" #include "SparcGenInstrInfo.inc" +#include "SparcMachineFunctionInfo.h" using namespace llvm; SparcInstrInfo::SparcInstrInfo(SparcSubtarget &ST) @@ -235,3 +237,25 @@ return NewMI; } + +unsigned SparcInstrInfo::getGlobalBaseReg(MachineFunction *MF) const +{ + SparcMachineFunctionInfo *SparcFI = MF->getInfo(); + unsigned GlobalBaseReg = SparcFI->getGlobalBaseReg(); + if (GlobalBaseReg != 0) + return GlobalBaseReg; + + // Insert the set of GlobalBaseReg into the first MBB of the function + MachineBasicBlock &FirstMBB = MF->front(); + MachineBasicBlock::iterator MBBI = FirstMBB.begin(); + MachineRegisterInfo &RegInfo = MF->getRegInfo(); + + GlobalBaseReg = RegInfo.createVirtualRegister(&SP::IntRegsRegClass); + + + DebugLoc dl = DebugLoc::getUnknownLoc(); + + BuildMI(FirstMBB, MBBI, dl, get(SP::GETPCX), GlobalBaseReg); + SparcFI->setGlobalBaseReg(GlobalBaseReg); + return GlobalBaseReg; +} Modified: llvm/trunk/lib/Target/Sparc/SparcInstrInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcInstrInfo.h?rev=81877&r1=81876&r2=81877&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/SparcInstrInfo.h (original) +++ llvm/trunk/lib/Target/Sparc/SparcInstrInfo.h Tue Sep 15 12:46:24 2009 @@ -97,6 +97,8 @@ MachineInstr* LoadMI) const { return 0; } + + unsigned getGlobalBaseReg(MachineFunction *MF) const; }; } Modified: llvm/trunk/lib/Target/Sparc/SparcInstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcInstrInfo.td?rev=81877&r1=81876&r2=81877&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/SparcInstrInfo.td (original) +++ llvm/trunk/lib/Target/Sparc/SparcInstrInfo.td Tue Sep 15 12:46:24 2009 @@ -134,6 +134,10 @@ def retflag : SDNode<"SPISD::RET_FLAG", SDTNone, [SDNPHasChain, SDNPOptInFlag]>; +def getPCX : Operand { + let PrintMethod = "printGetPCX"; +} + //===----------------------------------------------------------------------===// // SPARC Flag Conditions //===----------------------------------------------------------------------===// @@ -207,6 +211,11 @@ class Pseudo pattern> : InstSP; +// GETPCX for PIC +let Defs = [O7], Uses = [O7] in { + def GETPCX : Pseudo<(outs getPCX:$getpcseq), (ins), "$getpcseq", [] >; +} + let Defs = [O6], Uses = [O6] in { def ADJCALLSTACKDOWN : Pseudo<(outs), (ins i32imm:$amt), "!ADJCALLSTACKDOWN $amt", @@ -431,18 +440,23 @@ (outs IntRegs:$dst), (ins MEMri:$addr), "add ${addr:arith}, $dst", [(set IntRegs:$dst, ADDRri:$addr)]>; - -defm ADDCC : F3_12<"addcc", 0b010000, addc>; + +let Defs = [ICC] in + defm ADDCC : F3_12<"addcc", 0b010000, addc>; + defm ADDX : F3_12<"addx", 0b001000, adde>; // Section B.15 - Subtract Instructions, p. 110 defm SUB : F3_12 <"sub" , 0b000100, sub>; defm SUBX : F3_12 <"subx" , 0b001100, sube>; -defm SUBCC : F3_12 <"subcc", 0b010100, SPcmpicc>; -def SUBXCCrr: F3_1<2, 0b011100, - (outs IntRegs:$dst), (ins IntRegs:$b, IntRegs:$c), - "subxcc $b, $c, $dst", []>; +let Defs = [ICC] in { + defm SUBCC : F3_12 <"subcc", 0b010100, SPcmpicc>; + + def SUBXCCrr: F3_1<2, 0b011100, + (outs IntRegs:$dst), (ins IntRegs:$b, IntRegs:$c), + "subxcc $b, $c, $dst", []>; +} // Section B.18 - Multiply Instructions, p. 113 defm UMUL : F3_12np<"umul", 0b001010>; @@ -471,11 +485,12 @@ def BA : BranchSP<0b1000, (ins brtarget:$dst), "ba $dst", [(br bb:$dst)]>; - + // FIXME: the encoding for the JIT should look at the condition field. -def BCOND : BranchSP<0, (ins brtarget:$dst, CCOp:$cc), - "b$cc $dst", - [(SPbricc bb:$dst, imm:$cc)]>; +let Uses = [ICC] in + def BCOND : BranchSP<0, (ins brtarget:$dst, CCOp:$cc), + "b$cc $dst", + [(SPbricc bb:$dst, imm:$cc)]>; // Section B.22 - Branch on Floating-point Condition Codes Instructions, p. 121 @@ -489,9 +504,10 @@ } // FIXME: the encoding for the JIT should look at the condition field. -def FBCOND : FPBranchSP<0, (ins brtarget:$dst, CCOp:$cc), - "fb$cc $dst", - [(SPbrfcc bb:$dst, imm:$cc)]>; +let Uses = [FCC] in + def FBCOND : FPBranchSP<0, (ins brtarget:$dst, CCOp:$cc), + "fb$cc $dst", + [(SPbrfcc bb:$dst, imm:$cc)]>; // Section B.24 - Call and Link Instruction, p. 125 @@ -633,15 +649,16 @@ // Note 2: the result of a FCMP is not available until the 2nd cycle // after the instr is retired, but there is no interlock. This behavior // is modelled with a forced noop after the instruction. -def FCMPS : F3_3<2, 0b110101, 0b001010001, - (outs), (ins FPRegs:$src1, FPRegs:$src2), - "fcmps $src1, $src2\n\tnop", - [(SPcmpfcc FPRegs:$src1, FPRegs:$src2)]>; -def FCMPD : F3_3<2, 0b110101, 0b001010010, - (outs), (ins DFPRegs:$src1, DFPRegs:$src2), - "fcmpd $src1, $src2\n\tnop", - [(SPcmpfcc DFPRegs:$src1, DFPRegs:$src2)]>; - +let Defs = [FCC] in { + def FCMPS : F3_3<2, 0b110101, 0b001010001, + (outs), (ins FPRegs:$src1, FPRegs:$src2), + "fcmps $src1, $src2\n\tnop", + [(SPcmpfcc FPRegs:$src1, FPRegs:$src2)]>; + def FCMPD : F3_3<2, 0b110101, 0b001010010, + (outs), (ins DFPRegs:$src1, DFPRegs:$src2), + "fcmpd $src1, $src2\n\tnop", + [(SPcmpfcc DFPRegs:$src1, DFPRegs:$src2)]>; +} //===----------------------------------------------------------------------===// // V9 Instructions Modified: llvm/trunk/lib/Target/Sparc/SparcRegisterInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcRegisterInfo.td?rev=81877&r1=81876&r2=81877&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/SparcRegisterInfo.td (original) +++ llvm/trunk/lib/Target/Sparc/SparcRegisterInfo.td Tue Sep 15 12:46:24 2009 @@ -16,6 +16,10 @@ let Namespace = "SP"; } +class SparcCtrlReg: Register { + let Namespace = "SP"; +} + // Registers are identified with 5-bit ID numbers. // Ri - 32-bit integer registers class Ri num, string n> : SparcReg { @@ -31,6 +35,10 @@ let SubRegs = subregs; } +// Control Registers +def ICC : SparcCtrlReg<"ICC">; +def FCC : SparcCtrlReg<"FCC">; + // Integer registers def G0 : Ri< 0, "G0">, DwarfRegNum<[0]>; def G1 : Ri< 1, "G1">, DwarfRegNum<[1]>; @@ -46,7 +54,7 @@ def O3 : Ri<11, "O3">, DwarfRegNum<[11]>; def O4 : Ri<12, "O4">, DwarfRegNum<[12]>; def O5 : Ri<13, "O5">, DwarfRegNum<[13]>; -def O6 : Ri<14, "O6">, DwarfRegNum<[14]>; +def O6 : Ri<14, "SP">, DwarfRegNum<[14]>; def O7 : Ri<15, "O7">, DwarfRegNum<[15]>; def L0 : Ri<16, "L0">, DwarfRegNum<[16]>; def L1 : Ri<17, "L1">, DwarfRegNum<[17]>; @@ -62,7 +70,7 @@ def I3 : Ri<27, "I3">, DwarfRegNum<[27]>; def I4 : Ri<28, "I4">, DwarfRegNum<[28]>; def I5 : Ri<29, "I5">, DwarfRegNum<[29]>; -def I6 : Ri<30, "I6">, DwarfRegNum<[30]>; +def I6 : Ri<30, "FP">, DwarfRegNum<[30]>; def I7 : Ri<31, "I7">, DwarfRegNum<[31]>; // Floating-point registers Added: llvm/trunk/test/CodeGen/SPARC/2009-08-28-PIC.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/SPARC/2009-08-28-PIC.ll?rev=81877&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/SPARC/2009-08-28-PIC.ll (added) +++ llvm/trunk/test/CodeGen/SPARC/2009-08-28-PIC.ll Tue Sep 15 12:46:24 2009 @@ -0,0 +1,9 @@ +; RUN: llvm-as < %s | llc -march=sparc --relocation-model=pic | grep _GLOBAL_OFFSET_TABLE_ + + at foo = global i32 0 ; [#uses=1] + +define i32 @func() nounwind readonly { +entry: + %0 = load i32* @foo, align 4 ; [#uses=1] + ret i32 %0 +} Added: llvm/trunk/test/CodeGen/SPARC/2009-08-28-WeakLinkage.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/SPARC/2009-08-28-WeakLinkage.ll?rev=81877&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/SPARC/2009-08-28-WeakLinkage.ll (added) +++ llvm/trunk/test/CodeGen/SPARC/2009-08-28-WeakLinkage.ll Tue Sep 15 12:46:24 2009 @@ -0,0 +1,6 @@ +; RUN: llvm-as < %s | llc -march=sparc | grep weak + +define weak i32 @func() nounwind { +entry: + ret i32 0 +} From clattner at apple.com Tue Sep 15 12:47:14 2009 From: clattner at apple.com (Chris Lattner) Date: Tue, 15 Sep 2009 10:47:14 -0700 Subject: [llvm-commits] PATCH: SPARC codegen fixes In-Reply-To: References: Message-ID: <979F2A58-EEFE-4782-AA4A-97A6807565EF@apple.com> Hi Venkatraman, I'm sorry for the delay, your patch looks great. I resolved various merge conflicts and committed it as r81877, thanks again! -Chris On Aug 28, 2009, at 8:50 PM, Venkatraman Govindaraju wrote: > On Fri, Aug 28, 2009 at 12:00 AM, Chris Lattner > wrote: >> >> >> Whoa, nice! Some minor stylistic comments: >> >> +let Defs = [ICC] in { >> + defm SUBCC : F3_12 <"subcc", 0b010100, SPcmpicc>; >> >> Please indent by 2. >> > > Done. > >> + case MachineOperand::MO_Register: >> + if (TargetRegisterInfo::isPhysicalRegister(MO.getReg())) >> + operand = "%" + LowercaseString (RI.get(MO.getReg()).AsmName); >> + else >> >> No space before arguments of a function call >> > > Deleted > >> + if (LabelForBaseReg.find(operand) == LabelForBaseReg.end()) { >> + LabelForBaseReg[operand] = LabelForBaseReg.size(); >> + } >> >> Please use: >> if (!LabelForBaseReg.count(operand)) >> LabelForBaseReg[operand] = LabelForBaseReg.size(); >> >> It would be even more efficient to just use >> LabelForBaseReg.insert(std::make_pair(operand, ..size)) >> > > See below. I don't need LabelForBaseReg anymore. > >> >> + // Print out PIC Base computation helpers >> >> Please properly punctuate the sentence (end with .) >> >> >> Please don't use tabs in the code. >> > > Removed tabs that I found. > >> >> + case MachineOperand::MO_Register: >> + if (TargetRegisterInfo::isPhysicalRegister(MO.getReg())) >> + operand = "%" + LowercaseString (RI.get(MO.getReg()).AsmName); >> + else >> + operand = "%reg" + MO.getReg(); >> + break; >> >> Virtregs can never get to the asmprinter, please turn the "if" into >> an >> assert. >> > > Done. > >> >> >> >> + if (getTargetMachine().getRelocationModel() == Reloc::PIC_) { >> + SDValue GlobalBase = DAG.getNode(SPISD::GLOBAL_BASE_REG, dl, >> + getPointerTy()); >> + SDValue RelAddr = DAG.getNode(ISD::ADD, dl, MVT::i32, Lo, Hi); >> + SDValue AbsAddr = DAG.getNode(ISD::ADD, dl, MVT::i32, >> + GlobalBase, RelAddr); >> + return DAG.getLoad(getPointerTy(), dl, DAG.getEntryNode(), >> + AbsAddr, NULL, 0); >> + } else { >> + return DAG.getNode(ISD::ADD, dl, MVT::i32, Lo, Hi); >> + } >> >> This code would be less nested if you wrote it as: >> >> + if (getTargetMachine().getRelocationModel() != Reloc::PIC_) >> + return DAG.getNode(ISD::ADD, dl, MVT::i32, Lo, Hi); >> >> + SDValue GlobalBase = DAG.getNode(SPISD::GLOBAL_BASE_REG, dl, >> + getPointerTy()); >> + SDValue RelAddr = DAG.getNode(ISD::ADD, dl, MVT::i32, Lo, Hi); >> + SDValue AbsAddr = DAG.getNode(ISD::ADD, dl, MVT::i32, >> + GlobalBase, RelAddr); >> + return DAG.getLoad(getPointerTy(), dl, DAG.getEntryNode(), >> + AbsAddr, NULL, 0); >> > > Done. > >> >> >> >> >> Some more important issues: >> >> We need testcases for this :) >> > > I added two testcases. First is to test whether function linkage is > correctly set. Second is to test the PIC code generates code to get > _GLOBAL_OFFSET_TABLE_. > Please let me know how to make them better or need more testcases. > >> >> + O << "\t.section\t\".text\"\n" >> >> Please don't switch sections textually, use >> OutStreamer.SwitchSection. >> >> << "\t.align 4\n" >> >> Likewise, use the streamer to emit the alignment. >> >> >> More generally, I don't understand why LabelForBaseReg needs to be >> a map >> from strings to unsigned. Can't you make it a map from MO.getReg() >> or >> something? Can you give an example of the sort of code you're >> generating >> (I'm not familiar with sparc pic codegen). >> > > I modified the code so that I don't need LabelForBaseReg any more. I > also don't need to change the sections manually. > I am generating the following code for PIC. This example assumes that > register %l7 is allocated to be the base register > > foo: > // > Function Prolog > // > .LLGETPCH0: > // Call sets PC to %o7 > call .LLGETPC0 > // This sequence computes _GLOBAL_OFFSET_TABLE_ offset from call > instruction's PC > sethi %hi(_GLOBAL_OFFSET_TABLE_+(.-.LLGETPC0), %l7 > or %l7, %lo(_GLOBAL_OFFSET_TABLE_+(.-.LLGETPC0), %l7 > .LLGETPC0: > // Finally add the PC to get absolute address of > _GLOBAL_OFFSET_TABLE_ in %l7 > add %l7, %o7, %l7 > > // Loading a global value to scratch register %g1 > // Load the glob ptr's offset > sethi %hi(global), %g1 > add %g1, %lo(global), %g1 > // Load the glob ptr from _GLOBAL_OFFSET_TABLE_ > ld [%g1+%l7], %g1 > // Finally load the value itself. > ld [%g1], %g1 > >> Thanks, >> >> -Chris >> >> > From deeppatel1987 at gmail.com Tue Sep 15 12:53:11 2009 From: deeppatel1987 at gmail.com (Sandeep Patel) Date: Tue, 15 Sep 2009 17:53:11 -0000 Subject: [llvm-commits] [llvm] r81878 - in /llvm/trunk: lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp test/CodeGen/ARM/2009-09-13-InvalidSuperReg.ll Message-ID: <200909151753.n8FHrBAn013809@zion.cs.uiuc.edu> Author: sandeep Date: Tue Sep 15 12:53:11 2009 New Revision: 81878 URL: http://llvm.org/viewvc/llvm-project?rev=81878&view=rev Log: Fix superreg use in ARMAsmPrinter. Approved by Anton Korobeynikov. Added: llvm/trunk/test/CodeGen/ARM/2009-09-13-InvalidSuperReg.ll Modified: llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Modified: llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp?rev=81878&r1=81877&r2=81878&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Tue Sep 15 12:53:11 2009 @@ -318,8 +318,8 @@ << '}'; } else if (Modifier && strcmp(Modifier, "lane") == 0) { unsigned RegNum = ARMRegisterInfo::getRegisterNumbering(Reg); - unsigned DReg = TRI->getMatchingSuperReg(Reg, RegNum & 1 ? 0 : 1, - &ARM::DPRRegClass); + unsigned DReg = TRI->getMatchingSuperReg(Reg, RegNum & 1 ? 2 : 1, + &ARM::DPR_VFP2RegClass); O << getRegisterName(DReg) << '[' << (RegNum & 1) << ']'; } else { O << getRegisterName(Reg); Added: llvm/trunk/test/CodeGen/ARM/2009-09-13-InvalidSuperReg.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2009-09-13-InvalidSuperReg.ll?rev=81878&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/ARM/2009-09-13-InvalidSuperReg.ll (added) +++ llvm/trunk/test/CodeGen/ARM/2009-09-13-InvalidSuperReg.ll Tue Sep 15 12:53:11 2009 @@ -0,0 +1,41 @@ +; RUN: llc < %s -march=arm -mattr=+neon -mcpu=cortex-a9 + +define arm_aapcs_vfpcc <4 x float> @foo(i8* nocapture %pBuffer, i32 %numItems) nounwind { + %1 = ptrtoint i8* %pBuffer to i32 + + %lsr.iv2641 = inttoptr i32 %1 to float* + %tmp29 = add i32 %1, 4 + %tmp2930 = inttoptr i32 %tmp29 to float* + %tmp31 = add i32 %1, 8 + %tmp3132 = inttoptr i32 %tmp31 to float* + %tmp33 = add i32 %1, 12 + %tmp3334 = inttoptr i32 %tmp33 to float* + %tmp35 = add i32 %1, 16 + %tmp3536 = inttoptr i32 %tmp35 to float* + %tmp37 = add i32 %1, 20 + %tmp3738 = inttoptr i32 %tmp37 to float* + %tmp39 = add i32 %1, 24 + %tmp3940 = inttoptr i32 %tmp39 to float* + %2 = load float* %lsr.iv2641, align 4 + %3 = load float* %tmp2930, align 4 + %4 = load float* %tmp3132, align 4 + %5 = load float* %tmp3334, align 4 + %6 = load float* %tmp3536, align 4 + %7 = load float* %tmp3738, align 4 + %8 = load float* %tmp3940, align 4 + %9 = insertelement <4 x float> undef, float %6, i32 0 + %10 = shufflevector <4 x float> %9, <4 x float> undef, <4 x i32> zeroinitializer + %11 = insertelement <4 x float> %10, float %7, i32 1 + %12 = insertelement <4 x float> %11, float %8, i32 2 + %13 = insertelement <4 x float> undef, float %2, i32 0 + %14 = shufflevector <4 x float> %13, <4 x float> undef, <4 x i32> zeroinitializer + %15 = insertelement <4 x float> %14, float %3, i32 1 + %16 = insertelement <4 x float> %15, float %4, i32 2 + %17 = insertelement <4 x float> %16, float %5, i32 3 + %18 = fsub <4 x float> zeroinitializer, %12 + %19 = shufflevector <4 x float> %18, <4 x float> undef, <4 x i32> zeroinitializer + %20 = shufflevector <4 x float> %17, <4 x float> undef, <2 x i32> + %21 = shufflevector <2 x float> %20, <2 x float> undef, <4 x i32> + + ret <4 x float> %21 +} From bob.wilson at apple.com Tue Sep 15 12:56:18 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Tue, 15 Sep 2009 17:56:18 -0000 Subject: [llvm-commits] [llvm] r81879 - /llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp Message-ID: <200909151756.n8FHuIP2014196@zion.cs.uiuc.edu> Author: bwilson Date: Tue Sep 15 12:56:18 2009 New Revision: 81879 URL: http://llvm.org/viewvc/llvm-project?rev=81879&view=rev Log: Handle AddrMode4 for Thumb2 in rewriteT2FrameIndex. This occurs for VLDM/VSTM instructions, and without this check, the code assumes that an offset is allowed, as it would be with VLDR/VSTR. The asm printer, however, silently drops the offset, producing incorrect code. Since the address register in this case is either the stack or frame pointer, the spill location ends up conflicting with some other stack slot or with outgoing arguments on the stack. Modified: llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp Modified: llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp?rev=81879&r1=81878&r2=81879&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp Tue Sep 15 12:56:18 2009 @@ -383,6 +383,11 @@ "Bit extraction didn't work?"); MI.getOperand(FrameRegIdx+1).ChangeToImmediate(ThisImmVal); } else { + + // AddrMode4 cannot handle any offset. + if (AddrMode == ARMII::AddrMode4) + return false; + // AddrModeT2_so cannot handle any offset. If there is no offset // register then we change to an immediate version. unsigned NewOpc = Opcode; From sabre at nondot.org Tue Sep 15 13:03:13 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 15 Sep 2009 18:03:13 -0000 Subject: [llvm-commits] [llvm] r81881 - /llvm/trunk/lib/Target/Sparc/SparcMachineFunctionInfo.h Message-ID: <200909151803.n8FI3D0d015052@zion.cs.uiuc.edu> Author: lattner Date: Tue Sep 15 13:03:13 2009 New Revision: 81881 URL: http://llvm.org/viewvc/llvm-project?rev=81881&view=rev Log: add missing file Added: llvm/trunk/lib/Target/Sparc/SparcMachineFunctionInfo.h Added: llvm/trunk/lib/Target/Sparc/SparcMachineFunctionInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcMachineFunctionInfo.h?rev=81881&view=auto ============================================================================== --- llvm/trunk/lib/Target/Sparc/SparcMachineFunctionInfo.h (added) +++ llvm/trunk/lib/Target/Sparc/SparcMachineFunctionInfo.h Tue Sep 15 13:03:13 2009 @@ -0,0 +1,32 @@ +//===- SparcMachineFunctionInfo.h - Sparc Machine Function Info -*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file declares Sparc specific per-machine-function information. +// +//===----------------------------------------------------------------------===// +#ifndef SPARCMACHINEFUNCTIONINFO_H +#define SPARCMACHINEFUNCTIONINFO_H + +#include "llvm/CodeGen/MachineFunction.h" + +namespace llvm { + + class SparcMachineFunctionInfo : public MachineFunctionInfo { + private: + unsigned GlobalBaseReg; + public: + SparcMachineFunctionInfo() : GlobalBaseReg(0) {} + SparcMachineFunctionInfo(MachineFunction &MF) : GlobalBaseReg(0) {} + + unsigned getGlobalBaseReg() const { return GlobalBaseReg; } + void setGlobalBaseReg(unsigned Reg) { GlobalBaseReg = Reg; } + }; +} + +#endif From clattner at apple.com Tue Sep 15 13:05:18 2009 From: clattner at apple.com (Chris Lattner) Date: Tue, 15 Sep 2009 11:05:18 -0700 Subject: [llvm-commits] [llvm] r81878 - in /llvm/trunk: lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp test/CodeGen/ARM/2009-09-13-InvalidSuperReg.ll In-Reply-To: <200909151753.n8FHrBAn013809@zion.cs.uiuc.edu> References: <200909151753.n8FHrBAn013809@zion.cs.uiuc.edu> Message-ID: <91563F0B-3607-41A1-AEFD-B2A9FD62EDEE@apple.com> On Sep 15, 2009, at 10:53 AM, Sandeep Patel wrote: > Author: sandeep > Date: Tue Sep 15 12:53:11 2009 > New Revision: 81878 > > URL: http://llvm.org/viewvc/llvm-project?rev=81878&view=rev > Log: > Fix superreg use in ARMAsmPrinter. Approved by Anton Korobeynikov. Hi Sandeep, Please make the test check for some expected output. I will be hacking on the ARM asmprinter (to make it work like the new X86 asmprinter) real-soon-now and don't want to regress anything. -Chris > > Added: > llvm/trunk/test/CodeGen/ARM/2009-09-13-InvalidSuperReg.ll > Modified: > llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp > > Modified: llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp?rev=81878&r1=81877&r2=81878&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp (original) > +++ llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Tue Sep > 15 12:53:11 2009 > @@ -318,8 +318,8 @@ > << '}'; > } else if (Modifier && strcmp(Modifier, "lane") == 0) { > unsigned RegNum = ARMRegisterInfo::getRegisterNumbering(Reg); > - unsigned DReg = TRI->getMatchingSuperReg(Reg, RegNum & 1 ? > 0 : 1, > - &ARM::DPRRegClass); > + unsigned DReg = TRI->getMatchingSuperReg(Reg, RegNum & 1 ? > 2 : 1, > + > &ARM::DPR_VFP2RegClass); > O << getRegisterName(DReg) << '[' << (RegNum & 1) << ']'; > } else { > O << getRegisterName(Reg); > > Added: llvm/trunk/test/CodeGen/ARM/2009-09-13-InvalidSuperReg.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2009-09-13-InvalidSuperReg.ll?rev=81878&view=auto > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/CodeGen/ARM/2009-09-13-InvalidSuperReg.ll (added) > +++ llvm/trunk/test/CodeGen/ARM/2009-09-13-InvalidSuperReg.ll Tue > Sep 15 12:53:11 2009 > @@ -0,0 +1,41 @@ > +; RUN: llc < %s -march=arm -mattr=+neon -mcpu=cortex-a9 > + > +define arm_aapcs_vfpcc <4 x float> @foo(i8* nocapture %pBuffer, i32 > %numItems) nounwind { > + %1 = ptrtoint i8* %pBuffer to i32 > + > + %lsr.iv2641 = inttoptr i32 %1 to float* > + %tmp29 = add i32 %1, 4 > + %tmp2930 = inttoptr i32 %tmp29 to float* > + %tmp31 = add i32 %1, 8 > + %tmp3132 = inttoptr i32 %tmp31 to float* > + %tmp33 = add i32 %1, 12 > + %tmp3334 = inttoptr i32 %tmp33 to float* > + %tmp35 = add i32 %1, 16 > + %tmp3536 = inttoptr i32 %tmp35 to float* > + %tmp37 = add i32 %1, 20 > + %tmp3738 = inttoptr i32 %tmp37 to float* > + %tmp39 = add i32 %1, 24 > + %tmp3940 = inttoptr i32 %tmp39 to float* > + %2 = load float* %lsr.iv2641, align 4 > + %3 = load float* %tmp2930, align 4 > + %4 = load float* %tmp3132, align 4 > + %5 = load float* %tmp3334, align 4 > + %6 = load float* %tmp3536, align 4 > + %7 = load float* %tmp3738, align 4 > + %8 = load float* %tmp3940, align 4 > + %9 = insertelement <4 x float> undef, float %6, i32 0 > + %10 = shufflevector <4 x float> %9, <4 x float> undef, <4 x i32> > zeroinitializer > + %11 = insertelement <4 x float> %10, float %7, i32 1 > + %12 = insertelement <4 x float> %11, float %8, i32 2 > + %13 = insertelement <4 x float> undef, float %2, i32 0 > + %14 = shufflevector <4 x float> %13, <4 x float> undef, <4 x i32> > zeroinitializer > + %15 = insertelement <4 x float> %14, float %3, i32 1 > + %16 = insertelement <4 x float> %15, float %4, i32 2 > + %17 = insertelement <4 x float> %16, float %5, i32 3 > + %18 = fsub <4 x float> zeroinitializer, %12 > + %19 = shufflevector <4 x float> %18, <4 x float> undef, <4 x i32> > zeroinitializer > + %20 = shufflevector <4 x float> %17, <4 x float> undef, <2 x i32> > > + %21 = shufflevector <2 x float> %20, <2 x float> undef, <4 x i32> > > + > + ret <4 x float> %21 > +} > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From deeppatel1987 at gmail.com Tue Sep 15 13:09:38 2009 From: deeppatel1987 at gmail.com (Sandeep Patel) Date: Tue, 15 Sep 2009 18:09:38 +0000 Subject: [llvm-commits] [llvm] r81878 - in /llvm/trunk: lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp test/CodeGen/ARM/2009-09-13-InvalidSuperReg.ll In-Reply-To: <91563F0B-3607-41A1-AEFD-B2A9FD62EDEE@apple.com> References: <200909151753.n8FHrBAn013809@zion.cs.uiuc.edu> <91563F0B-3607-41A1-AEFD-B2A9FD62EDEE@apple.com> Message-ID: <305d6f60909151109g73bbe53akd79f523771d78ad0@mail.gmail.com> On Tue, Sep 15, 2009 at 6:05 PM, Chris Lattner wrote: > > On Sep 15, 2009, at 10:53 AM, Sandeep Patel wrote: > >> Author: sandeep >> Date: Tue Sep 15 12:53:11 2009 >> New Revision: 81878 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=81878&view=rev >> Log: >> Fix superreg use in ARMAsmPrinter. Approved by Anton Korobeynikov. > > Hi Sandeep, > > Please make the test check for some expected output. ?I will be hacking on > the ARM asmprinter (to make it work like the new X86 asmprinter) > real-soon-now and don't want to regress anything. The expected output is not asserting. There are a ton of tests that are like this. To pick two randomly for ARM: 2007-03-26-RegScavengerAssert.ll and 2009-09-13-InvalidSubreg.ll. deep From clattner at apple.com Tue Sep 15 13:16:01 2009 From: clattner at apple.com (Chris Lattner) Date: Tue, 15 Sep 2009 11:16:01 -0700 Subject: [llvm-commits] [llvm] r81878 - in /llvm/trunk: lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp test/CodeGen/ARM/2009-09-13-InvalidSuperReg.ll In-Reply-To: <305d6f60909151109g73bbe53akd79f523771d78ad0@mail.gmail.com> References: <200909151753.n8FHrBAn013809@zion.cs.uiuc.edu> <91563F0B-3607-41A1-AEFD-B2A9FD62EDEE@apple.com> <305d6f60909151109g73bbe53akd79f523771d78ad0@mail.gmail.com> Message-ID: <99A8D0DF-EB2F-4D57-8A60-D9DC5BCAAFC1@apple.com> On Sep 15, 2009, at 11:09 AM, Sandeep Patel wrote: > On Tue, Sep 15, 2009 at 6:05 PM, Chris Lattner > wrote: >> >> On Sep 15, 2009, at 10:53 AM, Sandeep Patel wrote: >> >>> Author: sandeep >>> Date: Tue Sep 15 12:53:11 2009 >>> New Revision: 81878 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=81878&view=rev >>> Log: >>> Fix superreg use in ARMAsmPrinter. Approved by Anton Korobeynikov. >> >> Hi Sandeep, >> >> Please make the test check for some expected output. I will be >> hacking on >> the ARM asmprinter (to make it work like the new X86 asmprinter) >> real-soon-now and don't want to regress anything. > > The expected output is not asserting. There are a ton of tests that > are like this. To pick two randomly for ARM: > 2007-03-26-RegScavengerAssert.ll and 2009-09-13-InvalidSubreg.ll. Aha, ok, thanks! -Chris From sabre at nondot.org Tue Sep 15 13:23:24 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 15 Sep 2009 18:23:24 -0000 Subject: [llvm-commits] [llvm] r81882 - /llvm/trunk/test/CodeGen/X86/fast-isel-gep-sext.ll Message-ID: <200909151823.n8FINOcg017887@zion.cs.uiuc.edu> Author: lattner Date: Tue Sep 15 13:23:23 2009 New Revision: 81882 URL: http://llvm.org/viewvc/llvm-project?rev=81882&view=rev Log: convert to filecheck Modified: llvm/trunk/test/CodeGen/X86/fast-isel-gep-sext.ll Modified: llvm/trunk/test/CodeGen/X86/fast-isel-gep-sext.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/fast-isel-gep-sext.ll?rev=81882&r1=81881&r2=81882&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/fast-isel-gep-sext.ll (original) +++ llvm/trunk/test/CodeGen/X86/fast-isel-gep-sext.ll Tue Sep 15 13:23:23 2009 @@ -1,17 +1,33 @@ -; RUN: llc < %s -march=x86-64 -O0 | grep movslq -; RUN: llc < %s -march=x86 -O0 +; RUN: llc < %s -march=x86-64 -O0 | FileCheck %s --check-prefix=X64 +; RUN: llc < %s -march=x86 -O0 | FileCheck %s --check-prefix=X32 ; PR3181 ; GEP indices are interpreted as signed integers, so they ; should be sign-extended to 64 bits on 64-bit targets. -define i32 @foo(i32 %t3, i32* %t1) nounwind { +define i32 @test1(i32 %t3, i32* %t1) nounwind { %t9 = getelementptr i32* %t1, i32 %t3 ; [#uses=1] %t15 = load i32* %t9 ; [#uses=1] ret i32 %t15 +; X32: test1: +; X32: movl (%ecx,%eax,4), %eax +; X32: ret + +; X64: test1: +; X64: movslq %edi, %rax +; X64: movl (%rsi,%rax,4), %eax +; X64: ret + } -define i32 @bar(i64 %t3, i32* %t1) nounwind { +define i32 @test2(i64 %t3, i32* %t1) nounwind { %t9 = getelementptr i32* %t1, i64 %t3 ; [#uses=1] %t15 = load i32* %t9 ; [#uses=1] ret i32 %t15 +; X32: test2: +; X32: movl (%eax,%ecx,4), %eax +; X32: ret + +; X64: test2: +; X64: movl (%rsi,%rdi,4), %eax +; X64: ret } From baldrick at free.fr Tue Sep 15 13:23:36 2009 From: baldrick at free.fr (Duncan Sands) Date: Tue, 15 Sep 2009 18:23:36 -0000 Subject: [llvm-commits] [gcc-plugin] r81883 - /gcc-plugin/trunk/llvm-convert.cpp Message-ID: <200909151823.n8FINa79017921@zion.cs.uiuc.edu> Author: baldrick Date: Tue Sep 15 13:23:36 2009 New Revision: 81883 URL: http://llvm.org/viewvc/llvm-project?rev=81883&view=rev Log: Support ASM expressions that define ssa names. Modified: gcc-plugin/trunk/llvm-convert.cpp Modified: gcc-plugin/trunk/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-convert.cpp?rev=81883&r1=81882&r2=81883&view=diff ============================================================================== --- gcc-plugin/trunk/llvm-convert.cpp (original) +++ gcc-plugin/trunk/llvm-convert.cpp Tue Sep 15 13:23:36 2009 @@ -4329,6 +4329,8 @@ SmallVector StoreCallResultAddrs; SmallVector CallResultTypes; SmallVector CallResultIsSigned; + SmallVector CallResultSSANames; + SmallVector CallResultSSATemps; // Process outputs. ValNum = 0; @@ -4384,9 +4386,19 @@ SimplifiedConstraint = CanonicalizeConstraint(Constraint+1); } - LValue Dest = EmitLV(Operand); - const Type *DestValTy = - cast(Dest.Ptr->getType())->getElementType(); + LValue Dest; + const Type *DestValTy; + if (TREE_CODE(Operand) == SSA_NAME) { + // The ASM is defining an ssa name. Store the output to a temporary, then + // load it out again later as the ssa name. + DestValTy = ConvertType(TREE_TYPE(Operand)); + Dest.Ptr = CreateTemporary(DestValTy); + CallResultSSANames.push_back(Operand); + CallResultSSATemps.push_back(Dest.Ptr); + } else { + Dest = EmitLV(Operand); + DestValTy = cast(Dest.Ptr->getType())->getElementType(); + } assert(!Dest.isBitfield() && "Cannot assign into a bitfield!"); if (!AllowsMem && DestValTy->isSingleValueType()) {// Reg dest -> asm return @@ -4613,6 +4625,10 @@ } } + // If the call defined any ssa names, associate them with their value. + for (unsigned i = 0, e = CallResultSSANames.size(); i != e; ++i) + SSANames[CallResultSSANames[i]] = Builder.CreateLoad(CallResultSSATemps[i]); + // Give the backend a chance to upgrade the inline asm to LLVM code. This // handles some common cases that LLVM has intrinsics for, e.g. x86 bswap -> // llvm.bswap. From sabre at nondot.org Tue Sep 15 13:23:37 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 15 Sep 2009 18:23:37 -0000 Subject: [llvm-commits] [llvm] r81884 - in /llvm/trunk/test/CodeGen/X86: fast-isel-gep-sext.ll fast-isel-gep.ll Message-ID: <200909151823.n8FINba4017937@zion.cs.uiuc.edu> Author: lattner Date: Tue Sep 15 13:23:37 2009 New Revision: 81884 URL: http://llvm.org/viewvc/llvm-project?rev=81884&view=rev Log: rename test Added: llvm/trunk/test/CodeGen/X86/fast-isel-gep.ll - copied unchanged from r81882, llvm/trunk/test/CodeGen/X86/fast-isel-gep-sext.ll Removed: llvm/trunk/test/CodeGen/X86/fast-isel-gep-sext.ll Removed: llvm/trunk/test/CodeGen/X86/fast-isel-gep-sext.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/fast-isel-gep-sext.ll?rev=81883&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/fast-isel-gep-sext.ll (original) +++ llvm/trunk/test/CodeGen/X86/fast-isel-gep-sext.ll (removed) @@ -1,33 +0,0 @@ -; RUN: llc < %s -march=x86-64 -O0 | FileCheck %s --check-prefix=X64 -; RUN: llc < %s -march=x86 -O0 | FileCheck %s --check-prefix=X32 -; PR3181 - -; GEP indices are interpreted as signed integers, so they -; should be sign-extended to 64 bits on 64-bit targets. - -define i32 @test1(i32 %t3, i32* %t1) nounwind { - %t9 = getelementptr i32* %t1, i32 %t3 ; [#uses=1] - %t15 = load i32* %t9 ; [#uses=1] - ret i32 %t15 -; X32: test1: -; X32: movl (%ecx,%eax,4), %eax -; X32: ret - -; X64: test1: -; X64: movslq %edi, %rax -; X64: movl (%rsi,%rax,4), %eax -; X64: ret - -} -define i32 @test2(i64 %t3, i32* %t1) nounwind { - %t9 = getelementptr i32* %t1, i64 %t3 ; [#uses=1] - %t15 = load i32* %t9 ; [#uses=1] - ret i32 %t15 -; X32: test2: -; X32: movl (%eax,%ecx,4), %eax -; X32: ret - -; X64: test2: -; X64: movl (%rsi,%rdi,4), %eax -; X64: ret -} From sabre at nondot.org Tue Sep 15 13:27:02 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 15 Sep 2009 18:27:02 -0000 Subject: [llvm-commits] [llvm] r81886 - in /llvm/trunk: lib/Target/X86/X86InstrBuilder.h test/CodeGen/X86/fast-isel-gep.ll Message-ID: <200909151827.n8FIR2T5018389@zion.cs.uiuc.edu> Author: lattner Date: Tue Sep 15 13:27:02 2009 New Revision: 81886 URL: http://llvm.org/viewvc/llvm-project?rev=81886&view=rev Log: fix PR4984 by ensuring that fastisel adds properly sign extended GEP displacement values to machineinstrs. Modified: llvm/trunk/lib/Target/X86/X86InstrBuilder.h llvm/trunk/test/CodeGen/X86/fast-isel-gep.ll Modified: llvm/trunk/lib/Target/X86/X86InstrBuilder.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrBuilder.h?rev=81886&r1=81885&r2=81886&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrBuilder.h (original) +++ llvm/trunk/lib/Target/X86/X86InstrBuilder.h Tue Sep 15 13:27:02 2009 @@ -47,7 +47,7 @@ unsigned Scale; unsigned IndexReg; - unsigned Disp; + int Disp; GlobalValue *GV; unsigned GVOpFlags; Modified: llvm/trunk/test/CodeGen/X86/fast-isel-gep.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/fast-isel-gep.ll?rev=81886&r1=81885&r2=81886&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/fast-isel-gep.ll (original) +++ llvm/trunk/test/CodeGen/X86/fast-isel-gep.ll Tue Sep 15 13:27:02 2009 @@ -1,10 +1,9 @@ ; RUN: llc < %s -march=x86-64 -O0 | FileCheck %s --check-prefix=X64 ; RUN: llc < %s -march=x86 -O0 | FileCheck %s --check-prefix=X32 -; PR3181 ; GEP indices are interpreted as signed integers, so they ; should be sign-extended to 64 bits on 64-bit targets. - +; PR3181 define i32 @test1(i32 %t3, i32* %t1) nounwind { %t9 = getelementptr i32* %t1, i32 %t3 ; [#uses=1] %t15 = load i32* %t9 ; [#uses=1] @@ -31,3 +30,24 @@ ; X64: movl (%rsi,%rdi,4), %eax ; X64: ret } + + + +; PR4984 +define i8 @test3(i8* %start) nounwind { +entry: + %A = getelementptr i8* %start, i64 -2 ; [#uses=1] + %B = load i8* %A, align 1 ; [#uses=1] + ret i8 %B + + +; X32: test3: +; X32: movl 4(%esp), %eax +; X32: movb -2(%eax), %al +; X32: ret + +; X64: test3: +; X64: movb -2(%rdi), %al +; X64: ret + +} From dalej at apple.com Tue Sep 15 13:32:15 2009 From: dalej at apple.com (Dale Johannesen) Date: Tue, 15 Sep 2009 18:32:15 -0000 Subject: [llvm-commits] [llvm] r81888 - /llvm/trunk/lib/Target/X86/X86JITInfo.cpp Message-ID: <200909151832.n8FIWFHp019100@zion.cs.uiuc.edu> Author: johannes Date: Tue Sep 15 13:32:14 2009 New Revision: 81888 URL: http://llvm.org/viewvc/llvm-project?rev=81888&view=rev Log: Change the marker byte for stubs from 0xcd to 0xce (another form of interrupt instruction, which shouldn't arise any other way). 0xcd is also used by JITMemoryManager to initialize the buffer to garbage, which means it could appear following a noreturn call even when that is not a stub, confusing X86CompilationCallback2. PR 4929. Modified: llvm/trunk/lib/Target/X86/X86JITInfo.cpp Modified: llvm/trunk/lib/Target/X86/X86JITInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86JITInfo.cpp?rev=81888&r1=81887&r2=81888&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86JITInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86JITInfo.cpp Tue Sep 15 13:32:14 2009 @@ -338,7 +338,7 @@ "Could not find return address on the stack!"); // It's a stub if there is an interrupt marker after the call. - bool isStub = ((unsigned char*)RetAddr)[0] == 0xCD; + bool isStub = ((unsigned char*)RetAddr)[0] == 0xCE; // The call instruction should have pushed the return value onto the stack... #if defined (X86_64_JIT) @@ -377,7 +377,7 @@ // If this is a stub, rewrite the call into an unconditional branch // instruction so that two return addresses are not pushed onto the stack // when the requested function finally gets called. This also makes the - // 0xCD byte (interrupt) dead, so the marker doesn't effect anything. + // 0xCE byte (interrupt) dead, so the marker doesn't effect anything. #if defined (X86_64_JIT) // If the target address is within 32-bit range of the stub, use a // PC-relative branch instead of loading the actual address. (This is @@ -480,7 +480,10 @@ JCE.emitWordLE((intptr_t)Fn-JCE.getCurrentPCValue()-4); #endif - JCE.emitByte(0xCD); // Interrupt - Just a marker identifying the stub! + // This used to use 0xCD, but that value is used by JITMemoryManager to + // initialize the buffer with garbage, which means it may follow a + // noreturn function call, confusing X86CompilationCallback2. PR 4929. + JCE.emitByte(0xCE); // Interrupt - Just a marker identifying the stub! return JCE.finishGVStub(F); } From isanbard at gmail.com Tue Sep 15 13:35:14 2009 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 15 Sep 2009 18:35:14 -0000 Subject: [llvm-commits] [llvm] r81891 - in /llvm/tags/Apple: llvmCore-2207-Eric/ llvmCore-2207/ Message-ID: <200909151835.n8FIZEiZ019615@zion.cs.uiuc.edu> Author: void Date: Tue Sep 15 13:35:14 2009 New Revision: 81891 URL: http://llvm.org/viewvc/llvm-project?rev=81891&view=rev Log: Move tag with Eric's patch out to recreate 2207. Added: llvm/tags/Apple/llvmCore-2207-Eric/ - copied from r81890, llvm/tags/Apple/llvmCore-2207/ Removed: llvm/tags/Apple/llvmCore-2207/ From isanbard at gmail.com Tue Sep 15 13:35:36 2009 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 15 Sep 2009 18:35:36 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r81892 - in /llvm-gcc-4.2/tags/Apple: llvmgcc42-2207-Eric/ llvmgcc42-2207/ Message-ID: <200909151835.n8FIZaDs019698@zion.cs.uiuc.edu> Author: void Date: Tue Sep 15 13:35:35 2009 New Revision: 81892 URL: http://llvm.org/viewvc/llvm-project?rev=81892&view=rev Log: Move tag with Eric's patch out to recreate 2207. Added: llvm-gcc-4.2/tags/Apple/llvmgcc42-2207-Eric/ - copied from r81891, llvm-gcc-4.2/tags/Apple/llvmgcc42-2207/ Removed: llvm-gcc-4.2/tags/Apple/llvmgcc42-2207/ From isanbard at gmail.com Tue Sep 15 13:36:02 2009 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 15 Sep 2009 18:36:02 -0000 Subject: [llvm-commits] [llvm] r81893 - /llvm/tags/Apple/llvmCore-2207/ Message-ID: <200909151836.n8FIa3M3019765@zion.cs.uiuc.edu> Author: void Date: Tue Sep 15 13:36:02 2009 New Revision: 81893 URL: http://llvm.org/viewvc/llvm-project?rev=81893&view=rev Log: Creating llvmCore-2207 from Bender-SWB. Added: llvm/tags/Apple/llvmCore-2207/ - copied from r81892, llvm/branches/Apple/Bender-SWB/ From isanbard at gmail.com Tue Sep 15 13:36:10 2009 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 15 Sep 2009 18:36:10 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r81894 - /llvm-gcc-4.2/tags/Apple/llvmgcc42-2207/ Message-ID: <200909151836.n8FIaB7g019799@zion.cs.uiuc.edu> Author: void Date: Tue Sep 15 13:36:10 2009 New Revision: 81894 URL: http://llvm.org/viewvc/llvm-project?rev=81894&view=rev Log: Creating llvmgcc42-2207 from Bender-SWB. Added: llvm-gcc-4.2/tags/Apple/llvmgcc42-2207/ - copied from r81893, llvm-gcc-4.2/branches/Apple/Bender-SWB/ From scallanan at apple.com Tue Sep 15 13:47:29 2009 From: scallanan at apple.com (Sean Callanan) Date: Tue, 15 Sep 2009 18:47:29 -0000 Subject: [llvm-commits] [llvm] r81895 - in /llvm/trunk/lib/Target/X86: X86Instr64bit.td X86InstrInfo.td X86RegisterInfo.td Message-ID: <200909151847.n8FIlUxl021361@zion.cs.uiuc.edu> Author: spyffe Date: Tue Sep 15 13:47:29 2009 New Revision: 81895 URL: http://llvm.org/viewvc/llvm-project?rev=81895&view=rev Log: Added a new register class for segment registers to the Intel register table. Added 16- and 64-bit MOVs to and from the segment registers to the Intel instruction tables. Modified: llvm/trunk/lib/Target/X86/X86Instr64bit.td llvm/trunk/lib/Target/X86/X86InstrInfo.td llvm/trunk/lib/Target/X86/X86RegisterInfo.td Modified: llvm/trunk/lib/Target/X86/X86Instr64bit.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Instr64bit.td?rev=81895&r1=81894&r2=81895&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86Instr64bit.td (original) +++ llvm/trunk/lib/Target/X86/X86Instr64bit.td Tue Sep 15 13:47:29 2009 @@ -330,6 +330,16 @@ def MOV64ao32 : RIi32<0xA3, RawFrm, (outs i32imm:$dst), (ins), "mov{q}\t{%rax, $dst|$dst, %rax}", []>; +// Moves to and from segment registers +def MOV64rs : RI<0x8C, MRMDestReg, (outs GR64:$dst), (ins SEGMENT_REG:$src), + "mov{w}\t{$src, $dst|$dst, $src}", []>; +def MOV64ms : RI<0x8C, MRMDestMem, (outs i64mem:$dst), (ins SEGMENT_REG:$src), + "mov{w}\t{$src, $dst|$dst, $src}", []>; +def MOV64sr : RI<0x8E, MRMSrcReg, (outs SEGMENT_REG:$dst), (ins GR64:$src), + "mov{w}\t{$src, $dst|$dst, $src}", []>; +def MOV64sm : RI<0x8E, MRMSrcMem, (outs SEGMENT_REG:$dst), (ins i64mem:$src), + "mov{w}\t{$src, $dst|$dst, $src}", []>; + // Sign/Zero extenders // MOVSX64rr8 always has a REX prefix and it has an 8-bit register Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=81895&r1=81894&r2=81895&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Tue Sep 15 13:47:29 2009 @@ -946,6 +946,16 @@ def MOV32ao32 : Ii32 <0xA3, RawFrm, (outs i32imm:$dst), (ins), "mov{l}\t{%eax, $dst|$dst, %eax}", []>; +// Moves to and from segment registers +def MOV16rs : I<0x8C, MRMDestReg, (outs GR16:$dst), (ins SEGMENT_REG:$src), + "mov{w}\t{$src, $dst|$dst, $src}", []>; +def MOV16ms : I<0x8C, MRMDestMem, (outs i16mem:$dst), (ins SEGMENT_REG:$src), + "mov{w}\t{$src, $dst|$dst, $src}", []>; +def MOV16sr : I<0x8E, MRMSrcReg, (outs SEGMENT_REG:$dst), (ins GR16:$src), + "mov{w}\t{$src, $dst|$dst, $src}", []>; +def MOV16sm : I<0x8E, MRMSrcMem, (outs SEGMENT_REG:$dst), (ins i16mem:$src), + "mov{w}\t{$src, $dst|$dst, $src}", []>; + let canFoldAsLoad = 1, isReMaterializable = 1, mayHaveSideEffects = 1 in { def MOV8rm : I<0x8A, MRMSrcMem, (outs GR8 :$dst), (ins i8mem :$src), "mov{b}\t{$src, $dst|$dst, $src}", Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.td?rev=81895&r1=81894&r2=81895&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86RegisterInfo.td (original) +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.td Tue Sep 15 13:47:29 2009 @@ -440,6 +440,11 @@ }]; } +// Segment registers for use by MOV instructions (and others) that have a +// segment register as one operand. Always contain a 16-bit segment +// descriptor. +def SEGMENT_REG : RegisterClass<"X86", [i16], 16, [CS, DS, SS, ES, FS, GS]> { +} // GR8_ABCD_L, GR8_ABCD_H, GR16_ABCD, GR32_ABCD, GR64_ABCD - Subclasses of // GR8, GR16, GR32, and GR64 which contain just the "a" "b", "c", and "d" From grosbach at apple.com Tue Sep 15 13:56:13 2009 From: grosbach at apple.com (Jim Grosbach) Date: Tue, 15 Sep 2009 18:56:13 -0000 Subject: [llvm-commits] [llvm] r81896 - /llvm/trunk/include/llvm/CodeGen/RegisterScavenging.h Message-ID: <200909151856.n8FIuEPv022517@zion.cs.uiuc.edu> Author: grosbach Date: Tue Sep 15 13:56:13 2009 New Revision: 81896 URL: http://llvm.org/viewvc/llvm-project?rev=81896&view=rev Log: Correct comment pasto Modified: llvm/trunk/include/llvm/CodeGen/RegisterScavenging.h Modified: llvm/trunk/include/llvm/CodeGen/RegisterScavenging.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/RegisterScavenging.h?rev=81896&r1=81895&r2=81896&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/RegisterScavenging.h (original) +++ llvm/trunk/include/llvm/CodeGen/RegisterScavenging.h Tue Sep 15 13:56:13 2009 @@ -121,7 +121,7 @@ /// isReserved - Returns true if a register is reserved. It is never "unused". bool isReserved(unsigned Reg) const { return ReservedRegs.test(Reg); } - /// isUsed / isUsed - Test if a register is currently being used. + /// isUsed / isUnused - Test if a register is currently being used. /// bool isUsed(unsigned Reg) const { return !RegsAvailable.test(Reg); } bool isUnused(unsigned Reg) const { return RegsAvailable.test(Reg); } From natebegeman at mac.com Tue Sep 15 14:05:41 2009 From: natebegeman at mac.com (Nate Begeman) Date: Tue, 15 Sep 2009 19:05:41 -0000 Subject: [llvm-commits] [llvm] r81897 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAG.h include/llvm/CodeGen/SelectionDAGNodes.h lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Message-ID: <200909151905.n8FJ5fS8023724@zion.cs.uiuc.edu> Author: sampo Date: Tue Sep 15 14:05:41 2009 New Revision: 81897 URL: http://llvm.org/viewvc/llvm-project?rev=81897&view=rev Log: Better solution for tracking both the original alignment of the access, and the current alignment based on the source value offset. This avoids increasing the size of mem nodes. Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAG.h?rev=81897&r1=81896&r2=81897&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAG.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Tue Sep 15 14:05:41 2009 @@ -544,7 +544,7 @@ /// SDValue getLoad(EVT VT, DebugLoc dl, SDValue Chain, SDValue Ptr, const Value *SV, int SVOffset, bool isVolatile=false, - unsigned Alignment=0, unsigned OrigAlignment=0); + unsigned Alignment=0); SDValue getExtLoad(ISD::LoadExtType ExtType, DebugLoc dl, EVT VT, SDValue Chain, SDValue Ptr, const Value *SV, int SVOffset, EVT EVT, bool isVolatile=false, @@ -554,14 +554,13 @@ SDValue getLoad(ISD::MemIndexedMode AM, DebugLoc dl, ISD::LoadExtType ExtType, EVT VT, SDValue Chain, SDValue Ptr, SDValue Offset, const Value *SV, int SVOffset, EVT EVT, - bool isVolatile=false, unsigned Alignment=0, - unsigned OrigAlignment=0); + bool isVolatile=false, unsigned Alignment=0); /// getStore - Helper function to build ISD::STORE nodes. /// SDValue getStore(SDValue Chain, DebugLoc dl, SDValue Val, SDValue Ptr, const Value *SV, int SVOffset, bool isVolatile=false, - unsigned Alignment=0, unsigned OrigAlignment=0); + unsigned Alignment=0); SDValue getTruncStore(SDValue Chain, DebugLoc dl, SDValue Val, SDValue Ptr, const Value *SV, int SVOffset, EVT TVT, bool isVolatile=false, unsigned Alignment=0); Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h?rev=81897&r1=81896&r2=81897&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h Tue Sep 15 14:05:41 2009 @@ -28,6 +28,7 @@ #include "llvm/CodeGen/ValueTypes.h" #include "llvm/CodeGen/MachineMemOperand.h" #include "llvm/Support/Allocator.h" +#include "llvm/Support/MathExtras.h" #include "llvm/Support/RecyclingAllocator.h" #include "llvm/Support/DataTypes.h" #include "llvm/Support/DebugLoc.h" @@ -1518,23 +1519,22 @@ //! SVOffset - Memory location offset. Note that base is defined in MemSDNode int SVOffset; - - //! OrigAlign - The original alignment of this MemSDNode in the case where - // this node was created by legalize from a MemSDNode with known alignment. - unsigned OrigAlign; - public: MemSDNode(unsigned Opc, DebugLoc dl, SDVTList VTs, EVT MemoryVT, - const Value *srcValue, int SVOff, - unsigned alignment, bool isvolatile, unsigned oalign); + const Value *srcValue, int SVOff, unsigned alignment, + bool isvolatile); MemSDNode(unsigned Opc, DebugLoc dl, SDVTList VTs, const SDValue *Ops, unsigned NumOps, EVT MemoryVT, const Value *srcValue, int SVOff, - unsigned alignment, bool isvolatile, unsigned oalign); + unsigned alignment, bool isvolatile); /// Returns alignment and volatility of the memory access - unsigned getAlignment() const { return (1u << (SubclassData >> 6)) >> 1; } - unsigned getOriginalAlignment() const { return OrigAlign; } + unsigned getOriginalAlignment() const { + return (1u << (SubclassData >> 6)) >> 1; + } + unsigned getAlignment() const { + return MinAlign(getOriginalAlignment(), SVOffset); + } bool isVolatile() const { return (SubclassData >> 5) & 1; } /// getRawSubclassData - Return the SubclassData value, which contains an @@ -1605,14 +1605,14 @@ SDValue Cmp, SDValue Swp, const Value* SrcVal, unsigned Align=0) : MemSDNode(Opc, dl, VTL, MemVT, SrcVal, /*SVOffset=*/0, - Align, /*isVolatile=*/true, /* OrigAlign=*/0) { + Align, /*isVolatile=*/true) { InitOperands(Ops, Chain, Ptr, Cmp, Swp); } AtomicSDNode(unsigned Opc, DebugLoc dl, SDVTList VTL, EVT MemVT, SDValue Chain, SDValue Ptr, SDValue Val, const Value* SrcVal, unsigned Align=0) : MemSDNode(Opc, dl, VTL, MemVT, SrcVal, /*SVOffset=*/0, - Align, /*isVolatile=*/true, /* OrigAlign=*/0) { + Align, /*isVolatile=*/true) { InitOperands(Ops, Chain, Ptr, Val); } @@ -1653,8 +1653,7 @@ const SDValue *Ops, unsigned NumOps, EVT MemoryVT, const Value *srcValue, int SVO, unsigned Align, bool Vol, bool ReadMem, bool WriteMem) - : MemSDNode(Opc, dl, VTs, Ops, NumOps, MemoryVT, srcValue, SVO, Align, Vol, - /* OrigAlign=*/0), + : MemSDNode(Opc, dl, VTs, Ops, NumOps, MemoryVT, srcValue, SVO, Align, Vol), ReadMem(ReadMem), WriteMem(WriteMem) { } @@ -2269,9 +2268,8 @@ public: LSBaseSDNode(ISD::NodeType NodeTy, DebugLoc dl, SDValue *Operands, unsigned numOperands, SDVTList VTs, ISD::MemIndexedMode AM, - EVT VT, const Value *SV, int SVO, unsigned Align, bool Vol, - unsigned OAlign) - : MemSDNode(NodeTy, dl, VTs, VT, SV, SVO, Align, Vol, OAlign) { + EVT VT, const Value *SV, int SVO, unsigned Align, bool Vol) + : MemSDNode(NodeTy, dl, VTs, VT, SV, SVO, Align, Vol) { assert(Align != 0 && "Loads and stores should have non-zero aligment"); SubclassData |= AM << 2; assert(getAddressingMode() == AM && "MemIndexedMode encoding error!"); @@ -2309,10 +2307,9 @@ friend class SelectionDAG; LoadSDNode(SDValue *ChainPtrOff, DebugLoc dl, SDVTList VTs, ISD::MemIndexedMode AM, ISD::LoadExtType ETy, EVT LVT, - const Value *SV, int O=0, unsigned Align=0, bool Vol=false, - unsigned OAlign=0) + const Value *SV, int O=0, unsigned Align=0, bool Vol=false) : LSBaseSDNode(ISD::LOAD, dl, ChainPtrOff, 3, - VTs, AM, LVT, SV, O, Align, Vol, OAlign) { + VTs, AM, LVT, SV, O, Align, Vol) { SubclassData |= (unsigned short)ETy; assert(getExtensionType() == ETy && "LoadExtType encoding error!"); } @@ -2339,10 +2336,9 @@ friend class SelectionDAG; StoreSDNode(SDValue *ChainValuePtrOff, DebugLoc dl, SDVTList VTs, ISD::MemIndexedMode AM, bool isTrunc, EVT SVT, - const Value *SV, int O=0, unsigned Align=0, bool Vol=false, - unsigned OAlign=0) + const Value *SV, int O=0, unsigned Align=0, bool Vol=false) : LSBaseSDNode(ISD::STORE, dl, ChainValuePtrOff, 4, - VTs, AM, SVT, SV, O, Align, Vol, OAlign) { + VTs, AM, SVT, SV, O, Align, Vol) { SubclassData |= (unsigned short)isTrunc; assert(isTruncatingStore() == isTrunc && "isTrunc encoding error!"); } Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp?rev=81897&r1=81896&r2=81897&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp Tue Sep 15 14:05:41 2009 @@ -170,8 +170,7 @@ DAG.getUNDEF(N->getBasePtr().getValueType()), N->getSrcValue(), N->getSrcValueOffset(), N->getMemoryVT().getVectorElementType(), - N->isVolatile(), N->getAlignment(), - N->getOriginalAlignment()); + N->isVolatile(), N->getOriginalAlignment()); // Legalized the chain result - switch anything that used the old chain to // use the new one. @@ -361,8 +360,7 @@ return DAG.getStore(N->getChain(), dl, GetScalarizedVector(N->getOperand(1)), N->getBasePtr(), N->getSrcValue(), N->getSrcValueOffset(), - N->isVolatile(), N->getAlignment(), - N->getOriginalAlignment()); + N->isVolatile(), N->getOriginalAlignment()); } @@ -716,23 +714,21 @@ const Value *SV = LD->getSrcValue(); int SVOffset = LD->getSrcValueOffset(); EVT MemoryVT = LD->getMemoryVT(); - unsigned Alignment = LD->getAlignment(); - unsigned OrigAlignment = LD->getOriginalAlignment(); + unsigned Alignment = LD->getOriginalAlignment(); bool isVolatile = LD->isVolatile(); EVT LoMemVT, HiMemVT; GetSplitDestVTs(MemoryVT, LoMemVT, HiMemVT); Lo = DAG.getLoad(ISD::UNINDEXED, dl, ExtType, LoVT, Ch, Ptr, Offset, - SV, SVOffset, LoMemVT, isVolatile, Alignment, OrigAlignment); + SV, SVOffset, LoMemVT, isVolatile, Alignment); unsigned IncrementSize = LoMemVT.getSizeInBits()/8; Ptr = DAG.getNode(ISD::ADD, dl, Ptr.getValueType(), Ptr, DAG.getIntPtrConstant(IncrementSize)); SVOffset += IncrementSize; - Alignment = MinAlign(Alignment, IncrementSize); Hi = DAG.getLoad(ISD::UNINDEXED, dl, ExtType, HiVT, Ch, Ptr, Offset, - SV, SVOffset, HiMemVT, isVolatile, Alignment, OrigAlignment); + SV, SVOffset, HiMemVT, isVolatile, Alignment); // Build a factor node to remember that this load is independent of the // other one. @@ -1081,8 +1077,7 @@ SDValue Ptr = N->getBasePtr(); int SVOffset = N->getSrcValueOffset(); EVT MemoryVT = N->getMemoryVT(); - unsigned Alignment = N->getAlignment(); - unsigned OrigAlignment = N->getOriginalAlignment(); + unsigned Alignment = N->getOriginalAlignment(); bool isVol = N->isVolatile(); SDValue Lo, Hi; GetSplitVector(N->getOperand(1), Lo, Hi); @@ -1097,21 +1092,19 @@ LoMemVT, isVol, Alignment); else Lo = DAG.getStore(Ch, dl, Lo, Ptr, N->getSrcValue(), SVOffset, - isVol, Alignment, OrigAlignment); + isVol, Alignment); // Increment the pointer to the other half. Ptr = DAG.getNode(ISD::ADD, dl, Ptr.getValueType(), Ptr, DAG.getIntPtrConstant(IncrementSize)); + SVOffset += IncrementSize; if (isTruncating) - Hi = DAG.getTruncStore(Ch, dl, Hi, Ptr, - N->getSrcValue(), SVOffset+IncrementSize, - HiMemVT, - isVol, MinAlign(Alignment, IncrementSize)); + Hi = DAG.getTruncStore(Ch, dl, Hi, Ptr, N->getSrcValue(), SVOffset, + HiMemVT, isVol, Alignment); else - Hi = DAG.getStore(Ch, dl, Hi, Ptr, N->getSrcValue(), SVOffset+IncrementSize, - isVol, MinAlign(Alignment, IncrementSize), - OrigAlignment); + Hi = DAG.getStore(Ch, dl, Hi, Ptr, N->getSrcValue(), SVOffset, + isVol, Alignment); return DAG.getNode(ISD::TokenFactor, dl, MVT::Other, Lo, Hi); } Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=81897&r1=81896&r2=81897&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Tue Sep 15 14:05:41 2009 @@ -432,12 +432,14 @@ const LoadSDNode *LD = cast(N); ID.AddInteger(LD->getMemoryVT().getRawBits()); ID.AddInteger(LD->getRawSubclassData()); + ID.AddInteger(LD->getSrcValueOffset()); break; } case ISD::STORE: { const StoreSDNode *ST = cast(N); ID.AddInteger(ST->getMemoryVT().getRawBits()); ID.AddInteger(ST->getRawSubclassData()); + ID.AddInteger(ST->getSrcValueOffset()); break; } case ISD::ATOMIC_CMP_SWAP: @@ -3646,12 +3648,9 @@ ISD::LoadExtType ExtType, EVT VT, SDValue Chain, SDValue Ptr, SDValue Offset, const Value *SV, int SVOffset, EVT EVT, - bool isVolatile, unsigned Alignment, - unsigned OrigAlignment) { + bool isVolatile, unsigned Alignment) { if (Alignment == 0) // Ensure that codegen never sees alignment 0 Alignment = getEVTAlignment(VT); - if (OrigAlignment == 0) - OrigAlignment = Alignment; if (VT == EVT) { ExtType = ISD::NON_EXTLOAD; @@ -3682,12 +3681,13 @@ AddNodeIDNode(ID, ISD::LOAD, VTs, Ops, 3); ID.AddInteger(EVT.getRawBits()); ID.AddInteger(encodeMemSDNodeFlags(ExtType, AM, isVolatile, Alignment)); + ID.AddInteger(SVOffset); void *IP = 0; if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) return SDValue(E, 0); SDNode *N = NodeAllocator.Allocate(); new (N) LoadSDNode(Ops, dl, VTs, AM, ExtType, EVT, SV, SVOffset, - Alignment, isVolatile, OrigAlignment); + Alignment, isVolatile); CSEMap.InsertNode(N, IP); AllNodes.push_back(N); return SDValue(N, 0); @@ -3696,11 +3696,10 @@ SDValue SelectionDAG::getLoad(EVT VT, DebugLoc dl, SDValue Chain, SDValue Ptr, const Value *SV, int SVOffset, - bool isVolatile, unsigned Alignment, - unsigned OrigAlignment) { + bool isVolatile, unsigned Alignment) { SDValue Undef = getUNDEF(Ptr.getValueType()); return getLoad(ISD::UNINDEXED, dl, ISD::NON_EXTLOAD, VT, Chain, Ptr, Undef, - SV, SVOffset, VT, isVolatile, Alignment, OrigAlignment); + SV, SVOffset, VT, isVolatile, Alignment); } SDValue SelectionDAG::getExtLoad(ISD::LoadExtType ExtType, DebugLoc dl, EVT VT, @@ -3727,14 +3726,11 @@ SDValue SelectionDAG::getStore(SDValue Chain, DebugLoc dl, SDValue Val, SDValue Ptr, const Value *SV, int SVOffset, - bool isVolatile, unsigned Alignment, - unsigned OrigAlignment) { + bool isVolatile, unsigned Alignment) { EVT VT = Val.getValueType(); if (Alignment == 0) // Ensure that codegen never sees alignment 0 Alignment = getEVTAlignment(VT); - if (OrigAlignment == 0) - OrigAlignment = Alignment; SDVTList VTs = getVTList(MVT::Other); SDValue Undef = getUNDEF(Ptr.getValueType()); @@ -3744,12 +3740,13 @@ ID.AddInteger(VT.getRawBits()); ID.AddInteger(encodeMemSDNodeFlags(false, ISD::UNINDEXED, isVolatile, Alignment)); + ID.AddInteger(SVOffset); void *IP = 0; if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) return SDValue(E, 0); SDNode *N = NodeAllocator.Allocate(); new (N) StoreSDNode(Ops, dl, VTs, ISD::UNINDEXED, false, - VT, SV, SVOffset, Alignment, isVolatile, OrigAlignment); + VT, SV, SVOffset, Alignment, isVolatile); CSEMap.InsertNode(N, IP); AllNodes.push_back(N); return SDValue(N, 0); @@ -3779,6 +3776,7 @@ ID.AddInteger(SVT.getRawBits()); ID.AddInteger(encodeMemSDNodeFlags(true, ISD::UNINDEXED, isVolatile, Alignment)); + ID.AddInteger(SVOffset); void *IP = 0; if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) return SDValue(E, 0); @@ -4976,25 +4974,24 @@ MemSDNode::MemSDNode(unsigned Opc, DebugLoc dl, SDVTList VTs, EVT memvt, const Value *srcValue, int SVO, unsigned alignment, - bool vol, unsigned origAlign) - : SDNode(Opc, dl, VTs), MemoryVT(memvt), SrcValue(srcValue), SVOffset(SVO), - OrigAlign(origAlign) { + bool vol) + : SDNode(Opc, dl, VTs), MemoryVT(memvt), SrcValue(srcValue), SVOffset(SVO) { SubclassData = encodeMemSDNodeFlags(0, ISD::UNINDEXED, vol, alignment); assert(isPowerOf2_32(alignment) && "Alignment is not a power of 2!"); - assert(getAlignment() == alignment && "Alignment representation error!"); - assert(isVolatile() == vol && "Volatile representation error!"); + assert(getOriginalAlignment() == alignment && "Alignment encoding error!"); + assert(isVolatile() == vol && "Volatile encoding error!"); } MemSDNode::MemSDNode(unsigned Opc, DebugLoc dl, SDVTList VTs, const SDValue *Ops, unsigned NumOps, EVT memvt, const Value *srcValue, int SVO, unsigned alignment, - bool vol, unsigned origAlign) + bool vol) : SDNode(Opc, dl, VTs, Ops, NumOps), - MemoryVT(memvt), SrcValue(srcValue), SVOffset(SVO), OrigAlign(origAlign) { + MemoryVT(memvt), SrcValue(srcValue), SVOffset(SVO) { SubclassData = encodeMemSDNodeFlags(0, ISD::UNINDEXED, vol, alignment); assert(isPowerOf2_32(alignment) && "Alignment is not a power of 2!"); - assert(getAlignment() == alignment && "Alignment representation error!"); - assert(isVolatile() == vol && "Volatile representation error!"); + assert(getOriginalAlignment() == alignment && "Alignment encoding error!"); + assert(isVolatile() == vol && "Volatile encoding error!"); } /// getMemOperand - Return a MachineMemOperand object describing the memory Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp?rev=81897&r1=81896&r2=81897&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Tue Sep 15 14:05:41 2009 @@ -2815,7 +2815,7 @@ DAG.getNode(ISD::ADD, getCurDebugLoc(), PtrVT, Ptr, DAG.getConstant(Offsets[i], PtrVT)), - SV, Offsets[i], isVolatile, Alignment, Alignment); + SV, Offsets[i], isVolatile, Alignment); Values[i] = L; Chains[i] = L.getValue(1); } @@ -2864,8 +2864,7 @@ DAG.getNode(ISD::ADD, getCurDebugLoc(), PtrVT, Ptr, DAG.getConstant(Offsets[i], PtrVT)), - PtrV, Offsets[i], - isVolatile, Alignment, Alignment); + PtrV, Offsets[i], isVolatile, Alignment); DAG.setRoot(DAG.getNode(ISD::TokenFactor, getCurDebugLoc(), MVT::Other, &Chains[0], NumValues)); From daniel at zuster.org Tue Sep 15 15:08:23 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 15 Sep 2009 13:08:23 -0700 Subject: [llvm-commits] [llvm] r81897 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAG.h include/llvm/CodeGen/SelectionDAGNodes.h lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/CodeGen/SelectionDAG/Select Message-ID: <6a8523d60909151308k6d94a4a7y82806b0ef3acbcf4@mail.gmail.com> Hi Nate, This causes CodeGen/X86/fold-sext-trunc.ll to fail, at least on x86_64-apple-darwin10. Can you take a look? - Daniel On Tue, Sep 15, 2009 at 12:05 PM, Nate Begeman wrote: > Author: sampo > Date: Tue Sep 15 14:05:41 2009 > New Revision: 81897 > > URL: http://llvm.org/viewvc/llvm-project?rev=81897&view=rev > Log: > Better solution for tracking both the original alignment of the access, and the current alignment based > on the source value offset. ?This avoids increasing the size of mem nodes. > > Modified: > ? ?llvm/trunk/include/llvm/CodeGen/SelectionDAG.h > ? ?llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h > ? ?llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp > ? ?llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp > ? ?llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp > > Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAG.h?rev=81897&r1=81896&r2=81897&view=diff > > ============================================================================== > --- llvm/trunk/include/llvm/CodeGen/SelectionDAG.h (original) > +++ llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Tue Sep 15 14:05:41 2009 > @@ -544,7 +544,7 @@ > ? /// > ? SDValue getLoad(EVT VT, DebugLoc dl, SDValue Chain, SDValue Ptr, > ? ? ? ? ? ? ? ? ? ? const Value *SV, int SVOffset, bool isVolatile=false, > - ? ? ? ? ? ? ? ? ? ?unsigned Alignment=0, unsigned OrigAlignment=0); > + ? ? ? ? ? ? ? ? ? ?unsigned Alignment=0); > ? SDValue getExtLoad(ISD::LoadExtType ExtType, DebugLoc dl, EVT VT, > ? ? ? ? ? ? ? ? ? ? ? ?SDValue Chain, SDValue Ptr, const Value *SV, > ? ? ? ? ? ? ? ? ? ? ? ?int SVOffset, EVT EVT, bool isVolatile=false, > @@ -554,14 +554,13 @@ > ? SDValue getLoad(ISD::MemIndexedMode AM, DebugLoc dl, ISD::LoadExtType ExtType, > ? ? ? ? ? ? ? ? ? EVT VT, SDValue Chain, SDValue Ptr, SDValue Offset, > ? ? ? ? ? ? ? ? ? const Value *SV, int SVOffset, EVT EVT, > - ? ? ? ? ? ? ? ? ?bool isVolatile=false, unsigned Alignment=0, > - ? ? ? ? ? ? ? ? ?unsigned OrigAlignment=0); > + ? ? ? ? ? ? ? ? ?bool isVolatile=false, unsigned Alignment=0); > > ? /// getStore - Helper function to build ISD::STORE nodes. > ? /// > ? SDValue getStore(SDValue Chain, DebugLoc dl, SDValue Val, SDValue Ptr, > ? ? ? ? ? ? ? ? ? ? ?const Value *SV, int SVOffset, bool isVolatile=false, > - ? ? ? ? ? ? ? ? ? ? unsigned Alignment=0, unsigned OrigAlignment=0); > + ? ? ? ? ? ? ? ? ? ? unsigned Alignment=0); > ? SDValue getTruncStore(SDValue Chain, DebugLoc dl, SDValue Val, SDValue Ptr, > ? ? ? ? ? ? ? ? ? ? ? ? ? const Value *SV, int SVOffset, EVT TVT, > ? ? ? ? ? ? ? ? ? ? ? ? ? bool isVolatile=false, unsigned Alignment=0); > > Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h?rev=81897&r1=81896&r2=81897&view=diff > > ============================================================================== > --- llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h (original) > +++ llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h Tue Sep 15 14:05:41 2009 > @@ -28,6 +28,7 @@ > ?#include "llvm/CodeGen/ValueTypes.h" > ?#include "llvm/CodeGen/MachineMemOperand.h" > ?#include "llvm/Support/Allocator.h" > +#include "llvm/Support/MathExtras.h" > ?#include "llvm/Support/RecyclingAllocator.h" > ?#include "llvm/Support/DataTypes.h" > ?#include "llvm/Support/DebugLoc.h" > @@ -1518,23 +1519,22 @@ > > ? //! SVOffset - Memory location offset. Note that base is defined in MemSDNode > ? int SVOffset; > - > - ?//! OrigAlign - The original alignment of this MemSDNode in the case where > - ?// this node was created by legalize from a MemSDNode with known alignment. > - ?unsigned OrigAlign; > - > ?public: > ? MemSDNode(unsigned Opc, DebugLoc dl, SDVTList VTs, EVT MemoryVT, > - ? ? ? ? ? ?const Value *srcValue, int SVOff, > - ? ? ? ? ? ?unsigned alignment, bool isvolatile, unsigned oalign); > + ? ? ? ? ? ?const Value *srcValue, int SVOff, unsigned alignment, > + ? ? ? ? ? ?bool isvolatile); > > ? MemSDNode(unsigned Opc, DebugLoc dl, SDVTList VTs, const SDValue *Ops, > ? ? ? ? ? ? unsigned NumOps, EVT MemoryVT, const Value *srcValue, int SVOff, > - ? ? ? ? ? ?unsigned alignment, bool isvolatile, unsigned oalign); > + ? ? ? ? ? ?unsigned alignment, bool isvolatile); > > ? /// Returns alignment and volatility of the memory access > - ?unsigned getAlignment() const { return (1u << (SubclassData >> 6)) >> 1; } > - ?unsigned getOriginalAlignment() const { return OrigAlign; } > + ?unsigned getOriginalAlignment() const { > + ? ?return (1u << (SubclassData >> 6)) >> 1; > + ?} > + ?unsigned getAlignment() const { > + ? ?return MinAlign(getOriginalAlignment(), SVOffset); > + ?} > ? bool isVolatile() const { return (SubclassData >> 5) & 1; } > > ? /// getRawSubclassData - Return the SubclassData value, which contains an > @@ -1605,14 +1605,14 @@ > ? ? ? ? ? ? ? ?SDValue Cmp, SDValue Swp, const Value* SrcVal, > ? ? ? ? ? ? ? ?unsigned Align=0) > ? ? : MemSDNode(Opc, dl, VTL, MemVT, SrcVal, /*SVOffset=*/0, > - ? ? ? ? ? ? ? ?Align, /*isVolatile=*/true, /* OrigAlign=*/0) { > + ? ? ? ? ? ? ? ?Align, /*isVolatile=*/true) { > ? ? InitOperands(Ops, Chain, Ptr, Cmp, Swp); > ? } > ? AtomicSDNode(unsigned Opc, DebugLoc dl, SDVTList VTL, EVT MemVT, > ? ? ? ? ? ? ? ?SDValue Chain, SDValue Ptr, > ? ? ? ? ? ? ? ?SDValue Val, const Value* SrcVal, unsigned Align=0) > ? ? : MemSDNode(Opc, dl, VTL, MemVT, SrcVal, /*SVOffset=*/0, > - ? ? ? ? ? ? ? ?Align, /*isVolatile=*/true, /* OrigAlign=*/0) { > + ? ? ? ? ? ? ? ?Align, /*isVolatile=*/true) { > ? ? InitOperands(Ops, Chain, Ptr, Val); > ? } > > @@ -1653,8 +1653,7 @@ > ? ? ? ? ? ? ? ? ? ? ?const SDValue *Ops, unsigned NumOps, > ? ? ? ? ? ? ? ? ? ? ?EVT MemoryVT, const Value *srcValue, int SVO, > ? ? ? ? ? ? ? ? ? ? ?unsigned Align, bool Vol, bool ReadMem, bool WriteMem) > - ? ?: MemSDNode(Opc, dl, VTs, Ops, NumOps, MemoryVT, srcValue, SVO, Align, Vol, > - ? ? ? ? ? ? ? ?/* OrigAlign=*/0), > + ? ?: MemSDNode(Opc, dl, VTs, Ops, NumOps, MemoryVT, srcValue, SVO, Align, Vol), > ? ? ? ReadMem(ReadMem), WriteMem(WriteMem) { > ? } > > @@ -2269,9 +2268,8 @@ > ?public: > ? LSBaseSDNode(ISD::NodeType NodeTy, DebugLoc dl, SDValue *Operands, > ? ? ? ? ? ? ? ?unsigned numOperands, SDVTList VTs, ISD::MemIndexedMode AM, > - ? ? ? ? ? ? ? EVT VT, const Value *SV, int SVO, unsigned Align, bool Vol, > - ? ? ? ? ? ? ? unsigned OAlign) > - ? ?: MemSDNode(NodeTy, dl, VTs, VT, SV, SVO, Align, Vol, OAlign) { > + ? ? ? ? ? ? ? EVT VT, const Value *SV, int SVO, unsigned Align, bool Vol) > + ? ?: MemSDNode(NodeTy, dl, VTs, VT, SV, SVO, Align, Vol) { > ? ? assert(Align != 0 && "Loads and stores should have non-zero aligment"); > ? ? SubclassData |= AM << 2; > ? ? assert(getAddressingMode() == AM && "MemIndexedMode encoding error!"); > @@ -2309,10 +2307,9 @@ > ? friend class SelectionDAG; > ? LoadSDNode(SDValue *ChainPtrOff, DebugLoc dl, SDVTList VTs, > ? ? ? ? ? ? ?ISD::MemIndexedMode AM, ISD::LoadExtType ETy, EVT LVT, > - ? ? ? ? ? ? const Value *SV, int O=0, unsigned Align=0, bool Vol=false, > - ? ? ? ? ? ? unsigned OAlign=0) > + ? ? ? ? ? ? const Value *SV, int O=0, unsigned Align=0, bool Vol=false) > ? ? : LSBaseSDNode(ISD::LOAD, dl, ChainPtrOff, 3, > - ? ? ? ? ? ? ? ? ? VTs, AM, LVT, SV, O, Align, Vol, OAlign) { > + ? ? ? ? ? ? ? ? ? VTs, AM, LVT, SV, O, Align, Vol) { > ? ? SubclassData |= (unsigned short)ETy; > ? ? assert(getExtensionType() == ETy && "LoadExtType encoding error!"); > ? } > @@ -2339,10 +2336,9 @@ > ? friend class SelectionDAG; > ? StoreSDNode(SDValue *ChainValuePtrOff, DebugLoc dl, SDVTList VTs, > ? ? ? ? ? ? ? ISD::MemIndexedMode AM, bool isTrunc, EVT SVT, > - ? ? ? ? ? ? ?const Value *SV, int O=0, unsigned Align=0, bool Vol=false, > - ? ? ? ? ? ? ?unsigned OAlign=0) > + ? ? ? ? ? ? ?const Value *SV, int O=0, unsigned Align=0, bool Vol=false) > ? ? : LSBaseSDNode(ISD::STORE, dl, ChainValuePtrOff, 4, > - ? ? ? ? ? ? ? ? ? VTs, AM, SVT, SV, O, Align, Vol, OAlign) { > + ? ? ? ? ? ? ? ? ? VTs, AM, SVT, SV, O, Align, Vol) { > ? ? SubclassData |= (unsigned short)isTrunc; > ? ? assert(isTruncatingStore() == isTrunc && "isTrunc encoding error!"); > ? } > > Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp?rev=81897&r1=81896&r2=81897&view=diff > > ============================================================================== > --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp (original) > +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp Tue Sep 15 14:05:41 2009 > @@ -170,8 +170,7 @@ > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?DAG.getUNDEF(N->getBasePtr().getValueType()), > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?N->getSrcValue(), N->getSrcValueOffset(), > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?N->getMemoryVT().getVectorElementType(), > - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? N->isVolatile(), N->getAlignment(), > - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? N->getOriginalAlignment()); > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? N->isVolatile(), N->getOriginalAlignment()); > > ? // Legalized the chain result - switch anything that used the old chain to > ? // use the new one. > @@ -361,8 +360,7 @@ > > ? return DAG.getStore(N->getChain(), dl, GetScalarizedVector(N->getOperand(1)), > ? ? ? ? ? ? ? ? ? ? ? N->getBasePtr(), N->getSrcValue(), N->getSrcValueOffset(), > - ? ? ? ? ? ? ? ? ? ? ?N->isVolatile(), N->getAlignment(), > - ? ? ? ? ? ? ? ? ? ? ?N->getOriginalAlignment()); > + ? ? ? ? ? ? ? ? ? ? ?N->isVolatile(), N->getOriginalAlignment()); > ?} > > > @@ -716,23 +714,21 @@ > ? const Value *SV = LD->getSrcValue(); > ? int SVOffset = LD->getSrcValueOffset(); > ? EVT MemoryVT = LD->getMemoryVT(); > - ?unsigned Alignment = LD->getAlignment(); > - ?unsigned OrigAlignment = LD->getOriginalAlignment(); > + ?unsigned Alignment = LD->getOriginalAlignment(); > ? bool isVolatile = LD->isVolatile(); > > ? EVT LoMemVT, HiMemVT; > ? GetSplitDestVTs(MemoryVT, LoMemVT, HiMemVT); > > ? Lo = DAG.getLoad(ISD::UNINDEXED, dl, ExtType, LoVT, Ch, Ptr, Offset, > - ? ? ? ? ? ? ? ? ? SV, SVOffset, LoMemVT, isVolatile, Alignment, OrigAlignment); > + ? ? ? ? ? ? ? ? ? SV, SVOffset, LoMemVT, isVolatile, Alignment); > > ? unsigned IncrementSize = LoMemVT.getSizeInBits()/8; > ? Ptr = DAG.getNode(ISD::ADD, dl, Ptr.getValueType(), Ptr, > ? ? ? ? ? ? ? ? ? ? DAG.getIntPtrConstant(IncrementSize)); > ? SVOffset += IncrementSize; > - ?Alignment = MinAlign(Alignment, IncrementSize); > ? Hi = DAG.getLoad(ISD::UNINDEXED, dl, ExtType, HiVT, Ch, Ptr, Offset, > - ? ? ? ? ? ? ? ? ? SV, SVOffset, HiMemVT, isVolatile, Alignment, OrigAlignment); > + ? ? ? ? ? ? ? ? ? SV, SVOffset, HiMemVT, isVolatile, Alignment); > > ? // Build a factor node to remember that this load is independent of the > ? // other one. > @@ -1081,8 +1077,7 @@ > ? SDValue Ptr = N->getBasePtr(); > ? int SVOffset = N->getSrcValueOffset(); > ? EVT MemoryVT = N->getMemoryVT(); > - ?unsigned Alignment = N->getAlignment(); > - ?unsigned OrigAlignment = N->getOriginalAlignment(); > + ?unsigned Alignment = N->getOriginalAlignment(); > ? bool isVol = N->isVolatile(); > ? SDValue Lo, Hi; > ? GetSplitVector(N->getOperand(1), Lo, Hi); > @@ -1097,21 +1092,19 @@ > ? ? ? ? ? ? ? ? ? ? ? ? ? ?LoMemVT, isVol, Alignment); > ? else > ? ? Lo = DAG.getStore(Ch, dl, Lo, Ptr, N->getSrcValue(), SVOffset, > - ? ? ? ? ? ? ? ? ? ? ?isVol, Alignment, OrigAlignment); > + ? ? ? ? ? ? ? ? ? ? ?isVol, Alignment); > > ? // Increment the pointer to the other half. > ? Ptr = DAG.getNode(ISD::ADD, dl, Ptr.getValueType(), Ptr, > ? ? ? ? ? ? ? ? ? ? DAG.getIntPtrConstant(IncrementSize)); > + ?SVOffset += IncrementSize; > > ? if (isTruncating) > - ? ?Hi = DAG.getTruncStore(Ch, dl, Hi, Ptr, > - ? ? ? ? ? ? ? ? ? ? ? ? ? N->getSrcValue(), SVOffset+IncrementSize, > - ? ? ? ? ? ? ? ? ? ? ? ? ? HiMemVT, > - ? ? ? ? ? ? ? ? ? ? ? ? ? isVol, MinAlign(Alignment, IncrementSize)); > + ? ?Hi = DAG.getTruncStore(Ch, dl, Hi, Ptr, N->getSrcValue(), SVOffset, > + ? ? ? ? ? ? ? ? ? ? ? ? ? HiMemVT, isVol, Alignment); > ? else > - ? ?Hi = DAG.getStore(Ch, dl, Hi, Ptr, N->getSrcValue(), SVOffset+IncrementSize, > - ? ? ? ? ? ? ? ? ? ? ?isVol, MinAlign(Alignment, IncrementSize), > - ? ? ? ? ? ? ? ? ? ? ?OrigAlignment); > + ? ?Hi = DAG.getStore(Ch, dl, Hi, Ptr, N->getSrcValue(), SVOffset, > + ? ? ? ? ? ? ? ? ? ? ?isVol, Alignment); > > ? return DAG.getNode(ISD::TokenFactor, dl, MVT::Other, Lo, Hi); > ?} > > Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=81897&r1=81896&r2=81897&view=diff > > ============================================================================== > --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) > +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Tue Sep 15 14:05:41 2009 > @@ -432,12 +432,14 @@ > ? ? const LoadSDNode *LD = cast(N); > ? ? ID.AddInteger(LD->getMemoryVT().getRawBits()); > ? ? ID.AddInteger(LD->getRawSubclassData()); > + ? ?ID.AddInteger(LD->getSrcValueOffset()); > ? ? break; > ? } > ? case ISD::STORE: { > ? ? const StoreSDNode *ST = cast(N); > ? ? ID.AddInteger(ST->getMemoryVT().getRawBits()); > ? ? ID.AddInteger(ST->getRawSubclassData()); > + ? ?ID.AddInteger(ST->getSrcValueOffset()); > ? ? break; > ? } > ? case ISD::ATOMIC_CMP_SWAP: > @@ -3646,12 +3648,9 @@ > ? ? ? ? ? ? ? ? ? ? ? ISD::LoadExtType ExtType, EVT VT, SDValue Chain, > ? ? ? ? ? ? ? ? ? ? ? SDValue Ptr, SDValue Offset, > ? ? ? ? ? ? ? ? ? ? ? const Value *SV, int SVOffset, EVT EVT, > - ? ? ? ? ? ? ? ? ? ? ?bool isVolatile, unsigned Alignment, > - ? ? ? ? ? ? ? ? ? ? ?unsigned OrigAlignment) { > + ? ? ? ? ? ? ? ? ? ? ?bool isVolatile, unsigned Alignment) { > ? if (Alignment == 0) ?// Ensure that codegen never sees alignment 0 > ? ? Alignment = getEVTAlignment(VT); > - ?if (OrigAlignment == 0) > - ? ?OrigAlignment = Alignment; > > ? if (VT == EVT) { > ? ? ExtType = ISD::NON_EXTLOAD; > @@ -3682,12 +3681,13 @@ > ? AddNodeIDNode(ID, ISD::LOAD, VTs, Ops, 3); > ? ID.AddInteger(EVT.getRawBits()); > ? ID.AddInteger(encodeMemSDNodeFlags(ExtType, AM, isVolatile, Alignment)); > + ?ID.AddInteger(SVOffset); > ? void *IP = 0; > ? if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) > ? ? return SDValue(E, 0); > ? SDNode *N = NodeAllocator.Allocate(); > ? new (N) LoadSDNode(Ops, dl, VTs, AM, ExtType, EVT, SV, SVOffset, > - ? ? ? ? ? ? ? ? ? ? Alignment, isVolatile, OrigAlignment); > + ? ? ? ? ? ? ? ? ? ? Alignment, isVolatile); > ? CSEMap.InsertNode(N, IP); > ? AllNodes.push_back(N); > ? return SDValue(N, 0); > @@ -3696,11 +3696,10 @@ > ?SDValue SelectionDAG::getLoad(EVT VT, DebugLoc dl, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? SDValue Chain, SDValue Ptr, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? const Value *SV, int SVOffset, > - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?bool isVolatile, unsigned Alignment, > - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?unsigned OrigAlignment) { > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?bool isVolatile, unsigned Alignment) { > ? SDValue Undef = getUNDEF(Ptr.getValueType()); > ? return getLoad(ISD::UNINDEXED, dl, ISD::NON_EXTLOAD, VT, Chain, Ptr, Undef, > - ? ? ? ? ? ? ? ? SV, SVOffset, VT, isVolatile, Alignment, OrigAlignment); > + ? ? ? ? ? ? ? ? SV, SVOffset, VT, isVolatile, Alignment); > ?} > > ?SDValue SelectionDAG::getExtLoad(ISD::LoadExtType ExtType, DebugLoc dl, EVT VT, > @@ -3727,14 +3726,11 @@ > > ?SDValue SelectionDAG::getStore(SDValue Chain, DebugLoc dl, SDValue Val, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?SDValue Ptr, const Value *SV, int SVOffset, > - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? bool isVolatile, unsigned Alignment, > - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? unsigned OrigAlignment) { > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? bool isVolatile, unsigned Alignment) { > ? EVT VT = Val.getValueType(); > > ? if (Alignment == 0) ?// Ensure that codegen never sees alignment 0 > ? ? Alignment = getEVTAlignment(VT); > - ?if (OrigAlignment == 0) > - ? ?OrigAlignment = Alignment; > > ? SDVTList VTs = getVTList(MVT::Other); > ? SDValue Undef = getUNDEF(Ptr.getValueType()); > @@ -3744,12 +3740,13 @@ > ? ID.AddInteger(VT.getRawBits()); > ? ID.AddInteger(encodeMemSDNodeFlags(false, ISD::UNINDEXED, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?isVolatile, Alignment)); > + ?ID.AddInteger(SVOffset); > ? void *IP = 0; > ? if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) > ? ? return SDValue(E, 0); > ? SDNode *N = NodeAllocator.Allocate(); > ? new (N) StoreSDNode(Ops, dl, VTs, ISD::UNINDEXED, false, > - ? ? ? ? ? ? ? ? ? ? ?VT, SV, SVOffset, Alignment, isVolatile, OrigAlignment); > + ? ? ? ? ? ? ? ? ? ? ?VT, SV, SVOffset, Alignment, isVolatile); > ? CSEMap.InsertNode(N, IP); > ? AllNodes.push_back(N); > ? return SDValue(N, 0); > @@ -3779,6 +3776,7 @@ > ? ID.AddInteger(SVT.getRawBits()); > ? ID.AddInteger(encodeMemSDNodeFlags(true, ISD::UNINDEXED, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?isVolatile, Alignment)); > + ?ID.AddInteger(SVOffset); > ? void *IP = 0; > ? if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) > ? ? return SDValue(E, 0); > @@ -4976,25 +4974,24 @@ > > ?MemSDNode::MemSDNode(unsigned Opc, DebugLoc dl, SDVTList VTs, EVT memvt, > ? ? ? ? ? ? ? ? ? ? ?const Value *srcValue, int SVO, unsigned alignment, > - ? ? ? ? ? ? ? ? ? ? bool vol, unsigned origAlign) > - : SDNode(Opc, dl, VTs), MemoryVT(memvt), SrcValue(srcValue), SVOffset(SVO), > - ? OrigAlign(origAlign) { > + ? ? ? ? ? ? ? ? ? ? bool vol) > + : SDNode(Opc, dl, VTs), MemoryVT(memvt), SrcValue(srcValue), SVOffset(SVO) { > ? SubclassData = encodeMemSDNodeFlags(0, ISD::UNINDEXED, vol, alignment); > ? assert(isPowerOf2_32(alignment) && "Alignment is not a power of 2!"); > - ?assert(getAlignment() == alignment && "Alignment representation error!"); > - ?assert(isVolatile() == vol && "Volatile representation error!"); > + ?assert(getOriginalAlignment() == alignment && "Alignment encoding error!"); > + ?assert(isVolatile() == vol && "Volatile encoding error!"); > ?} > > ?MemSDNode::MemSDNode(unsigned Opc, DebugLoc dl, SDVTList VTs, > ? ? ? ? ? ? ? ? ? ? ?const SDValue *Ops, unsigned NumOps, EVT memvt, > ? ? ? ? ? ? ? ? ? ? ?const Value *srcValue, int SVO, unsigned alignment, > - ? ? ? ? ? ? ? ? ? ? bool vol, unsigned origAlign) > + ? ? ? ? ? ? ? ? ? ? bool vol) > ? ?: SDNode(Opc, dl, VTs, Ops, NumOps), > - ? ? MemoryVT(memvt), SrcValue(srcValue), SVOffset(SVO), OrigAlign(origAlign) { > + ? ? MemoryVT(memvt), SrcValue(srcValue), SVOffset(SVO) { > ? SubclassData = encodeMemSDNodeFlags(0, ISD::UNINDEXED, vol, alignment); > ? assert(isPowerOf2_32(alignment) && "Alignment is not a power of 2!"); > - ?assert(getAlignment() == alignment && "Alignment representation error!"); > - ?assert(isVolatile() == vol && "Volatile representation error!"); > + ?assert(getOriginalAlignment() == alignment && "Alignment encoding error!"); > + ?assert(isVolatile() == vol && "Volatile encoding error!"); > ?} > > ?/// getMemOperand - Return a MachineMemOperand object describing the memory > > Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp?rev=81897&r1=81896&r2=81897&view=diff > > ============================================================================== > --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp (original) > +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Tue Sep 15 14:05:41 2009 > @@ -2815,7 +2815,7 @@ > ? ? ? ? ? ? ? ? ? ? ? ? ? ? DAG.getNode(ISD::ADD, getCurDebugLoc(), > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? PtrVT, Ptr, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? DAG.getConstant(Offsets[i], PtrVT)), > - ? ? ? ? ? ? ? ? ? ? ? ? ? ?SV, Offsets[i], isVolatile, Alignment, Alignment); > + ? ? ? ? ? ? ? ? ? ? ? ? ? ?SV, Offsets[i], isVolatile, Alignment); > ? ? Values[i] = L; > ? ? Chains[i] = L.getValue(1); > ? } > @@ -2864,8 +2864,7 @@ > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?DAG.getNode(ISD::ADD, getCurDebugLoc(), > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?PtrVT, Ptr, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?DAG.getConstant(Offsets[i], PtrVT)), > - ? ? ? ? ? ? ? ? ? ? ? ? ? ? PtrV, Offsets[i], > - ? ? ? ? ? ? ? ? ? ? ? ? ? ? isVolatile, Alignment, Alignment); > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? PtrV, Offsets[i], isVolatile, Alignment); > > ? DAG.setRoot(DAG.getNode(ISD::TokenFactor, getCurDebugLoc(), > ? ? ? ? ? ? ? ? ? ? ? ? ? MVT::Other, &Chains[0], NumValues)); > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From daniel at zuster.org Tue Sep 15 15:09:18 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 15 Sep 2009 20:09:18 -0000 Subject: [llvm-commits] [llvm] r81902 - /llvm/trunk/utils/lit/lit.py Message-ID: <200909152009.n8FK9I9H032198@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Sep 15 15:09:17 2009 New Revision: 81902 URL: http://llvm.org/viewvc/llvm-project?rev=81902&view=rev Log: lit: When finding nested test suites, check first in the execpath in case there is a site configuration. Modified: llvm/trunk/utils/lit/lit.py Modified: llvm/trunk/utils/lit/lit.py URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit.py?rev=81902&r1=81901&r2=81902&view=diff ============================================================================== --- llvm/trunk/utils/lit/lit.py (original) +++ llvm/trunk/utils/lit/lit.py Tue Sep 15 15:09:17 2009 @@ -264,19 +264,28 @@ if filename == 'Output' or filename in lc.excludes: continue - filepath = os.path.join(source_path, filename) - if os.path.isdir(filepath): - # If this directory contains a test suite, reload it. - if dirContainsTestSuite(filepath): - for res in getTests(filepath, litConfig, - testSuiteCache, localConfigCache): - yield res - else: - # Otherwise, continue loading from inside this test suite. - for res in getTestsInSuite(ts, path_in_suite + (filename,), - litConfig, testSuiteCache, - localConfigCache): - yield res + # Ignore non-directories. + file_sourcepath = os.path.join(source_path, filename) + if not os.path.isdir(file_sourcepath): + continue + + # Check for nested test suites, first in the execpath in case there is a + # site configuration and then in the source path. + file_execpath = ts.getExecPath(path_in_suite + (filename,)) + if dirContainsTestSuite(file_execpath): + subiter = getTests(file_execpath, litConfig, + testSuiteCache, localConfigCache) + elif dirContainsTestSuite(file_sourcepath): + subiter = getTests(file_sourcepath, litConfig, + testSuiteCache, localConfigCache) + else: + # Otherwise, continue loading from inside this test suite. + subiter = getTestsInSuite(ts, path_in_suite + (filename,), + litConfig, testSuiteCache, + localConfigCache) + + for res in subiter: + yield res def runTests(numThreads, litConfig, provider, display): # If only using one testing thread, don't use threads at all; this lets us From daniel at zuster.org Tue Sep 15 15:31:13 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 15 Sep 2009 20:31:13 -0000 Subject: [llvm-commits] [llvm] r81909 - /llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Message-ID: <200909152031.n8FKVDtV002653@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Sep 15 15:31:12 2009 New Revision: 81909 URL: http://llvm.org/viewvc/llvm-project?rev=81909&view=rev Log: Fix -Asserts warning. Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=81909&r1=81908&r2=81909&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original) +++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Tue Sep 15 15:31:12 2009 @@ -637,13 +637,14 @@ return false; } - +#ifndef NDEBUG static void printRegName(unsigned reg, const TargetRegisterInfo* tri_) { if (TargetRegisterInfo::isPhysicalRegister(reg)) errs() << tri_->getName(reg); else errs() << "%reg" << reg; } +#endif void LiveIntervals::handleVirtualRegisterDef(MachineBasicBlock *mbb, MachineBasicBlock::iterator mi, From daniel at zuster.org Tue Sep 15 15:31:28 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 15 Sep 2009 20:31:28 -0000 Subject: [llvm-commits] [llvm] r81910 - in /llvm/trunk/docs/CommandGuide: llc.pod opt.pod Message-ID: <200909152031.n8FKVSjH002696@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Sep 15 15:31:28 2009 New Revision: 81910 URL: http://llvm.org/viewvc/llvm-project?rev=81910&view=rev Log: Update llc/opt PODs to clarify they support .ll input. Modified: llvm/trunk/docs/CommandGuide/llc.pod llvm/trunk/docs/CommandGuide/opt.pod Modified: llvm/trunk/docs/CommandGuide/llc.pod URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/CommandGuide/llc.pod?rev=81910&r1=81909&r2=81910&view=diff ============================================================================== --- llvm/trunk/docs/CommandGuide/llc.pod (original) +++ llvm/trunk/docs/CommandGuide/llc.pod Tue Sep 15 15:31:28 2009 @@ -10,18 +10,19 @@ =head1 DESCRIPTION -The B command compiles LLVM bitcode into assembly language for a +The B command compiles LLVM source inputs into assembly language for a specified architecture. The assembly language output can then be passed through a native assembler and linker to generate a native executable. The choice of architecture for the output assembly code is automatically -determined from the input bitcode file, unless the B<-march> option is used to -override the default. +determined from the input file, unless the B<-march> option is used to override +the default. =head1 OPTIONS -If I is - or omitted, B reads LLVM bitcode from standard input. -Otherwise, it will read LLVM bitcode from I. +If I is - or omitted, B reads from standard input. Otherwise, it +will from I. Inputs can be in either the LLVM assembly language +format (.ll) or the LLVM bitcode format (.bc). If the B<-o> option is omitted, then B will send its output to standard output if the input is from standard input. If the B<-o> option specifies -, @@ -55,13 +56,13 @@ =item B<-mtriple>=I -Override the target triple specified in the input bitcode file with the -specified string. +Override the target triple specified in the input file with the specified +string. =item B<-march>=I Specify the architecture for which to generate assembly, overriding the target -encoded in the bitcode file. See the output of B for a list of +encoded in the input file. See the output of B for a list of valid architectures. By default this is inferred from the target triple or autodetected to the current architecture. Modified: llvm/trunk/docs/CommandGuide/opt.pod URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/CommandGuide/opt.pod?rev=81910&r1=81909&r2=81910&view=diff ============================================================================== --- llvm/trunk/docs/CommandGuide/opt.pod (original) +++ llvm/trunk/docs/CommandGuide/opt.pod Tue Sep 15 15:31:28 2009 @@ -11,24 +11,25 @@ =head1 DESCRIPTION The B command is the modular LLVM optimizer and analyzer. It takes LLVM -bitcode as input, runs the specified optimizations or analyses on it, and then -outputs the optimized LLVM bitcode or the analysis results. The function of +source files as input, runs the specified optimizations or analyses on it, and then +outputs the optimized file or the analysis results. The function of B depends on whether the B<-analyze> option is given. -When B<-analyze> is specified, B performs various analyses of LLVM -bitcode. It will usually print the results on standard output, but in a few -cases, it will print output to standard error or generate a file with the -analysis output, which is usually done when the output is meant for another -program. +When B<-analyze> is specified, B performs various analyses of the input +source. It will usually print the results on standard output, but in a few +cases, it will print output to standard error or generate a file with the +analysis output, which is usually done when the output is meant for another +program. While B<-analyze> is I given, B attempts to produce an optimized -bitcode file. The optimizations available via B depend upon what +output file. The optimizations available via B depend upon what libraries were linked into it as well as any additional libraries that have been loaded with the B<-load> option. Use the B<-help> option to determine what optimizations you can use. If I is omitted from the command line or is I<->, B reads its -input from standard input. The input must be an LLVM bitcode file. +input from standard input. Inputs can be in either the LLVM assembly language +format (.ll) or the LLVM bitcode format (.bc). If an output filename is not specified with the B<-o> option, B writes its output to the standard output. From daniel at zuster.org Tue Sep 15 15:31:35 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 15 Sep 2009 20:31:35 -0000 Subject: [llvm-commits] [llvm] r81911 - in /llvm/trunk/docs/CommandGuide: llc.pod opt.pod Message-ID: <200909152031.n8FKVZ4C002735@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Sep 15 15:31:35 2009 New Revision: 81911 URL: http://llvm.org/viewvc/llvm-project?rev=81911&view=rev Log: Remove references to obsolete -f option. Modified: llvm/trunk/docs/CommandGuide/llc.pod llvm/trunk/docs/CommandGuide/opt.pod Modified: llvm/trunk/docs/CommandGuide/llc.pod URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/CommandGuide/llc.pod?rev=81911&r1=81910&r2=81911&view=diff ============================================================================== --- llvm/trunk/docs/CommandGuide/llc.pod (original) +++ llvm/trunk/docs/CommandGuide/llc.pod Tue Sep 15 15:31:35 2009 @@ -48,12 +48,6 @@ I<-O1>, I<-O2>, I<-O3>, and I<-O4> optimization levels used by B and B. -=item B<-f> - -Enable binary output on terminals. Normally, B will refuse to -write raw bitcode output if the output stream is a terminal. With this option, -B will write raw bitcode regardless of the output device. - =item B<-mtriple>=I Override the target triple specified in the input file with the specified Modified: llvm/trunk/docs/CommandGuide/opt.pod URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/CommandGuide/opt.pod?rev=81911&r1=81910&r2=81911&view=diff ============================================================================== --- llvm/trunk/docs/CommandGuide/opt.pod (original) +++ llvm/trunk/docs/CommandGuide/opt.pod Tue Sep 15 15:31:35 2009 @@ -38,12 +38,6 @@ =over -=item B<-f> - -Enable binary output on terminals. Normally, B will refuse to -write raw bitcode output if the output stream is a terminal. With this option, -B will write raw bitcode regardless of the output device. - =item B<-help> Print a summary of command line options. From daniel at zuster.org Tue Sep 15 15:31:46 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 15 Sep 2009 20:31:46 -0000 Subject: [llvm-commits] [llvm] r81912 - in /llvm/trunk: include/llvm/Support/raw_ostream.h lib/Support/raw_ostream.cpp unittests/Support/raw_ostream_test.cpp Message-ID: <200909152031.n8FKVkYL002778@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Sep 15 15:31:46 2009 New Revision: 81912 URL: http://llvm.org/viewvc/llvm-project?rev=81912&view=rev Log: Drop the raw_ostream required buffer size to 1. - As best I can tell, we have eliminated all the code which used to require a larger buffer size. Modified: llvm/trunk/include/llvm/Support/raw_ostream.h llvm/trunk/lib/Support/raw_ostream.cpp llvm/trunk/unittests/Support/raw_ostream_test.cpp Modified: llvm/trunk/include/llvm/Support/raw_ostream.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/raw_ostream.h?rev=81912&r1=81911&r2=81912&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/raw_ostream.h (original) +++ llvm/trunk/include/llvm/Support/raw_ostream.h Tue Sep 15 15:31:46 2009 @@ -41,7 +41,7 @@ /// 1. Unbuffered (BufferMode == Unbuffered) /// 1. Uninitialized (BufferMode != Unbuffered && OutBufStart == 0). /// 2. Buffered (BufferMode != Unbuffered && OutBufStart != 0 && - /// OutBufEnd - OutBufStart >= 64). + /// OutBufEnd - OutBufStart >= 1). /// /// If buffered, then the raw_ostream owns the buffer if (BufferMode == /// InternalBuffer); otherwise the buffer has been set via SetBuffer and is Modified: llvm/trunk/lib/Support/raw_ostream.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/raw_ostream.cpp?rev=81912&r1=81911&r2=81912&view=diff ============================================================================== --- llvm/trunk/lib/Support/raw_ostream.cpp (original) +++ llvm/trunk/lib/Support/raw_ostream.cpp Tue Sep 15 15:31:46 2009 @@ -84,8 +84,8 @@ void raw_ostream::SetBufferAndMode(char *BufferStart, size_t Size, BufferKind Mode) { assert(((Mode == Unbuffered && BufferStart == 0 && Size == 0) || - (Mode != Unbuffered && BufferStart && Size >= 64)) && - "stream must be unbuffered, or have >= 64 bytes of buffer"); + (Mode != Unbuffered && BufferStart && Size)) && + "stream must be unbuffered or have at least one byte"); // Make sure the current buffer is free of content (we can't flush here; the // child buffer management logic will be in write_impl). assert(GetNumBytesInBuffer() == 0 && "Current buffer is non-empty!"); Modified: llvm/trunk/unittests/Support/raw_ostream_test.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/raw_ostream_test.cpp?rev=81912&r1=81911&r2=81912&view=diff ============================================================================== --- llvm/trunk/unittests/Support/raw_ostream_test.cpp (original) +++ llvm/trunk/unittests/Support/raw_ostream_test.cpp Tue Sep 15 15:31:46 2009 @@ -117,4 +117,14 @@ EXPECT_EQ("1.20", printToString(format("%.2f", 1.2), 10)); } +TEST(raw_ostreamTest, TinyBuffer) { + std::string Str; + raw_string_ostream OS(Str); + OS.SetBufferSize(1); + OS << "hello"; + OS << 1; + OS << 'w' << 'o' << 'r' << 'l' << 'd'; + EXPECT_EQ("hello1world", OS.str()); +} + } From vhernandez at apple.com Tue Sep 15 15:38:04 2009 From: vhernandez at apple.com (Victor Hernandez) Date: Tue, 15 Sep 2009 13:38:04 -0700 Subject: [llvm-commits] [PATCH] get all MallocInst transforms/analysis to operate on malloc calls instead (patch #1) Message-ID: <0DCE4E98-5D92-4748-A804-B1EBBA14A240@apple.com> This is the first of 4 patches that will result in malloc calls having the same transforms/analysis applied to them as are currently done to MallocInst. This first patch includes changes to the malloc call creation code (AllocTy is now the element type of the malloc, not the resulting pointer type) and a bug fix to getMallocArraySize (the case where the array size is a product of 2 constants was broken). Also included are changes isSafeToSpeculativelyExecute() and Verifier to treat malloc calls the same as MallocInst. -------------- next part -------------- A non-text attachment was scrubbed... Name: MallocCalls.diff Type: application/octet-stream Size: 12938 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090915/cd11305f/attachment.obj -------------- next part -------------- Victor From gohman at apple.com Tue Sep 15 15:40:52 2009 From: gohman at apple.com (Dan Gohman) Date: Tue, 15 Sep 2009 13:40:52 -0700 Subject: [llvm-commits] [llvm] r81911 - in /llvm/trunk/docs/CommandGuide: llc.pod opt.pod In-Reply-To: <200909152031.n8FKVZ4C002735@zion.cs.uiuc.edu> References: <200909152031.n8FKVZ4C002735@zion.cs.uiuc.edu> Message-ID: <7BED6F84-135F-4226-87D8-B326C8005233@apple.com> On Sep 15, 2009, at 1:31 PM, Daniel Dunbar wrote: > Author: ddunbar > Date: Tue Sep 15 15:31:35 2009 > New Revision: 81911 > > URL: http://llvm.org/viewvc/llvm-project?rev=81911&view=rev > Log: > Remove references to obsolete -f option. Hi Danial, the -f option isn't completely obsolete. It's been reduced to meaning "don't suppress binary output to a tty", which is a small part of its original meaning, but at the moment it still does mean that. Dan From vhernandez at apple.com Tue Sep 15 15:44:08 2009 From: vhernandez at apple.com (Victor Hernandez) Date: Tue, 15 Sep 2009 13:44:08 -0700 Subject: [llvm-commits] [PATCH] extend transform passes to treat malloc calls the same as MallocInst (patch #3) Message-ID: <099A54D1-9659-4DB1-B64C-6AF8AB805D84@apple.com> These are the changes to make all the transform passes apply the same analysis to malloc calls as to MallocInst. -------------- next part -------------- A non-text attachment was scrubbed... Name: MallocTransforms.diff Type: application/octet-stream Size: 35205 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090915/31b0b38f/attachment.obj -------------- next part -------------- Victor From vhernandez at apple.com Tue Sep 15 15:44:11 2009 From: vhernandez at apple.com (Victor Hernandez) Date: Tue, 15 Sep 2009 13:44:11 -0700 Subject: [llvm-commits] [PATCH] extend SelectionDAGBuild to treat malloc calls the same as MallocInst (patch #4) Message-ID: <05892D6F-5D3B-45FD-8FA0-82EB6A686B63@apple.com> SelectionDAGBuild is the only pass in CodeGen that handles MallocInst specially. This patch extends that code to handle malloc calls also. -------------- next part -------------- A non-text attachment was scrubbed... Name: MallocCodeGen.diff Type: application/octet-stream Size: 3506 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090915/4846380b/attachment.obj -------------- next part -------------- Victor From vhernandez at apple.com Tue Sep 15 15:44:04 2009 From: vhernandez at apple.com (Victor Hernandez) Date: Tue, 15 Sep 2009 13:44:04 -0700 Subject: [llvm-commits] [PATCH] extend analysis passes to treat malloc calls the same as MallocInst (patch #2) Message-ID: <13429790-6CCE-4644-A1EE-A554440F22E7@apple.com> These are the changes to make all the analysis passes apply the same analysis to malloc calls as to MallocInst. -------------- next part -------------- A non-text attachment was scrubbed... Name: MallocAnalysis.diff Type: application/octet-stream Size: 10518 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090915/0f2fc301/attachment.obj -------------- next part -------------- Victor From scallanan at apple.com Tue Sep 15 15:53:57 2009 From: scallanan at apple.com (Sean Callanan) Date: Tue, 15 Sep 2009 20:53:57 -0000 Subject: [llvm-commits] [llvm] r81914 - in /llvm/trunk/lib/Target/X86: X86Instr64bit.td X86InstrInfo.td Message-ID: <200909152053.n8FKrvNT005736@zion.cs.uiuc.edu> Author: spyffe Date: Tue Sep 15 15:53:57 2009 New Revision: 81914 URL: http://llvm.org/viewvc/llvm-project?rev=81914&view=rev Log: Added register-to-register ADD instructions to the Intel tables, where the source operand is specified by the R/M field and the destination operand by the Reg field. Modified: llvm/trunk/lib/Target/X86/X86Instr64bit.td llvm/trunk/lib/Target/X86/X86InstrInfo.td Modified: llvm/trunk/lib/Target/X86/X86Instr64bit.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Instr64bit.td?rev=81914&r1=81913&r2=81914&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86Instr64bit.td (original) +++ llvm/trunk/lib/Target/X86/X86Instr64bit.td Tue Sep 15 15:53:57 2009 @@ -457,6 +457,11 @@ "add{q}\t{$src2, $dst|$dst, $src2}", [(set GR64:$dst, (add GR64:$src1, (load addr:$src2))), (implicit EFLAGS)]>; + +// Register-Register Addition +def ADD64mrmrr : RI<0x03, MRMSrcReg, (outs GR64:$dst), (ins GR64:$src1, GR64:$src2), + "add{l}\t{$src2, $dst|$dst, $src2}", []>; + } // isTwoAddress // Memory-Register Addition Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=81914&r1=81913&r2=81914&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Tue Sep 15 15:53:57 2009 @@ -2427,6 +2427,14 @@ "add{l}\t{$src2, $dst|$dst, $src2}", [(set GR32:$dst, (add GR32:$src1, (load addr:$src2))), (implicit EFLAGS)]>; + +// Register-Register Addition +def ADD8mrmrr: I<0x02, MRMSrcReg, (outs GR8:$dst), (ins GR8:$src1, GR8:$src2), + "add{b}\t{$src2, $dst|$dst, $src2}", []>; +def ADD16mrmrr: I<0x03, MRMSrcReg,(outs GR16:$dst),(ins GR16:$src1, GR16:$src2), + "add{w}\t{$src2, $dst|$dst, $src2}", []>, OpSize; +def ADD32mrmrr: I<0x03, MRMSrcReg,(outs GR16:$dst),(ins GR16:$src1, GR16:$src2), + "add{l}\t{$src2, $dst|$dst, $src2}", []>; // Register-Integer Addition def ADD8ri : Ii8<0x80, MRM0r, (outs GR8:$dst), (ins GR8:$src1, i8imm:$src2), From bob.wilson at apple.com Tue Sep 15 15:58:03 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Tue, 15 Sep 2009 20:58:03 -0000 Subject: [llvm-commits] [llvm] r81915 - in /llvm/trunk/test/CodeGen/ARM: veor.ll vfcmp.ll vfp.ll vget_lane.ll vhadd.ll vhsub.ll Message-ID: <200909152058.n8FKw3SG006287@zion.cs.uiuc.edu> Author: bwilson Date: Tue Sep 15 15:58:02 2009 New Revision: 81915 URL: http://llvm.org/viewvc/llvm-project?rev=81915&view=rev Log: Convert more tests to FileCheck. Modified: llvm/trunk/test/CodeGen/ARM/veor.ll llvm/trunk/test/CodeGen/ARM/vfcmp.ll llvm/trunk/test/CodeGen/ARM/vfp.ll llvm/trunk/test/CodeGen/ARM/vget_lane.ll llvm/trunk/test/CodeGen/ARM/vhadd.ll llvm/trunk/test/CodeGen/ARM/vhsub.ll Modified: llvm/trunk/test/CodeGen/ARM/veor.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/veor.ll?rev=81915&r1=81914&r2=81915&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/ARM/veor.ll (original) +++ llvm/trunk/test/CodeGen/ARM/veor.ll Tue Sep 15 15:58:02 2009 @@ -1,8 +1,8 @@ -; RUN: llc < %s -march=arm -mattr=+neon > %t -; RUN: grep veor %t | count 8 -; Note: function names do not include "veor" to allow simple grep for opcodes +; RUN: llc < %s -march=arm -mattr=+neon | FileCheck %s define <8 x i8> @v_eori8(<8 x i8>* %A, <8 x i8>* %B) nounwind { +;CHECK: v_eori8: +;CHECK: veor %tmp1 = load <8 x i8>* %A %tmp2 = load <8 x i8>* %B %tmp3 = xor <8 x i8> %tmp1, %tmp2 @@ -10,6 +10,8 @@ } define <4 x i16> @v_eori16(<4 x i16>* %A, <4 x i16>* %B) nounwind { +;CHECK: v_eori16: +;CHECK: veor %tmp1 = load <4 x i16>* %A %tmp2 = load <4 x i16>* %B %tmp3 = xor <4 x i16> %tmp1, %tmp2 @@ -17,6 +19,8 @@ } define <2 x i32> @v_eori32(<2 x i32>* %A, <2 x i32>* %B) nounwind { +;CHECK: v_eori32: +;CHECK: veor %tmp1 = load <2 x i32>* %A %tmp2 = load <2 x i32>* %B %tmp3 = xor <2 x i32> %tmp1, %tmp2 @@ -24,6 +28,8 @@ } define <1 x i64> @v_eori64(<1 x i64>* %A, <1 x i64>* %B) nounwind { +;CHECK: v_eori64: +;CHECK: veor %tmp1 = load <1 x i64>* %A %tmp2 = load <1 x i64>* %B %tmp3 = xor <1 x i64> %tmp1, %tmp2 @@ -31,6 +37,8 @@ } define <16 x i8> @v_eorQi8(<16 x i8>* %A, <16 x i8>* %B) nounwind { +;CHECK: v_eorQi8: +;CHECK: veor %tmp1 = load <16 x i8>* %A %tmp2 = load <16 x i8>* %B %tmp3 = xor <16 x i8> %tmp1, %tmp2 @@ -38,6 +46,8 @@ } define <8 x i16> @v_eorQi16(<8 x i16>* %A, <8 x i16>* %B) nounwind { +;CHECK: v_eorQi16: +;CHECK: veor %tmp1 = load <8 x i16>* %A %tmp2 = load <8 x i16>* %B %tmp3 = xor <8 x i16> %tmp1, %tmp2 @@ -45,6 +55,8 @@ } define <4 x i32> @v_eorQi32(<4 x i32>* %A, <4 x i32>* %B) nounwind { +;CHECK: v_eorQi32: +;CHECK: veor %tmp1 = load <4 x i32>* %A %tmp2 = load <4 x i32>* %B %tmp3 = xor <4 x i32> %tmp1, %tmp2 @@ -52,6 +64,8 @@ } define <2 x i64> @v_eorQi64(<2 x i64>* %A, <2 x i64>* %B) nounwind { +;CHECK: v_eorQi64: +;CHECK: veor %tmp1 = load <2 x i64>* %A %tmp2 = load <2 x i64>* %B %tmp3 = xor <2 x i64> %tmp1, %tmp2 Modified: llvm/trunk/test/CodeGen/ARM/vfcmp.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/vfcmp.ll?rev=81915&r1=81914&r2=81915&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/ARM/vfcmp.ll (original) +++ llvm/trunk/test/CodeGen/ARM/vfcmp.ll Tue Sep 15 15:58:02 2009 @@ -1,14 +1,12 @@ -; RUN: llc < %s -march=arm -mattr=+neon > %t -; RUN: grep {vceq\\.f32} %t | count 1 -; RUN: grep {vcgt\\.f32} %t | count 9 -; RUN: grep {vcge\\.f32} %t | count 5 -; RUN: grep vorr %t | count 4 -; RUN: grep vmvn %t | count 7 +; RUN: llc < %s -march=arm -mattr=+neon | FileCheck %s ; This tests fcmp operations that do not map directly to NEON instructions. ; une is implemented with VCEQ/VMVN define <2 x i32> @vcunef32(<2 x float>* %A, <2 x float>* %B) nounwind { +;CHECK: vcunef32: +;CHECK: vceq.f32 +;CHECK-NEXT: vmvn %tmp1 = load <2 x float>* %A %tmp2 = load <2 x float>* %B %tmp3 = fcmp une <2 x float> %tmp1, %tmp2 @@ -18,6 +16,8 @@ ; olt is implemented with VCGT define <2 x i32> @vcoltf32(<2 x float>* %A, <2 x float>* %B) nounwind { +;CHECK: vcoltf32: +;CHECK: vcgt.f32 %tmp1 = load <2 x float>* %A %tmp2 = load <2 x float>* %B %tmp3 = fcmp olt <2 x float> %tmp1, %tmp2 @@ -27,6 +27,8 @@ ; ole is implemented with VCGE define <2 x i32> @vcolef32(<2 x float>* %A, <2 x float>* %B) nounwind { +;CHECK: vcolef32: +;CHECK: vcge.f32 %tmp1 = load <2 x float>* %A %tmp2 = load <2 x float>* %B %tmp3 = fcmp ole <2 x float> %tmp1, %tmp2 @@ -36,6 +38,9 @@ ; uge is implemented with VCGT/VMVN define <2 x i32> @vcugef32(<2 x float>* %A, <2 x float>* %B) nounwind { +;CHECK: vcugef32: +;CHECK: vcgt.f32 +;CHECK-NEXT: vmvn %tmp1 = load <2 x float>* %A %tmp2 = load <2 x float>* %B %tmp3 = fcmp uge <2 x float> %tmp1, %tmp2 @@ -45,6 +50,9 @@ ; ule is implemented with VCGT/VMVN define <2 x i32> @vculef32(<2 x float>* %A, <2 x float>* %B) nounwind { +;CHECK: vculef32: +;CHECK: vcgt.f32 +;CHECK-NEXT: vmvn %tmp1 = load <2 x float>* %A %tmp2 = load <2 x float>* %B %tmp3 = fcmp ule <2 x float> %tmp1, %tmp2 @@ -54,6 +62,9 @@ ; ugt is implemented with VCGE/VMVN define <2 x i32> @vcugtf32(<2 x float>* %A, <2 x float>* %B) nounwind { +;CHECK: vcugtf32: +;CHECK: vcge.f32 +;CHECK-NEXT: vmvn %tmp1 = load <2 x float>* %A %tmp2 = load <2 x float>* %B %tmp3 = fcmp ugt <2 x float> %tmp1, %tmp2 @@ -63,6 +74,9 @@ ; ult is implemented with VCGE/VMVN define <2 x i32> @vcultf32(<2 x float>* %A, <2 x float>* %B) nounwind { +;CHECK: vcultf32: +;CHECK: vcge.f32 +;CHECK-NEXT: vmvn %tmp1 = load <2 x float>* %A %tmp2 = load <2 x float>* %B %tmp3 = fcmp ult <2 x float> %tmp1, %tmp2 @@ -72,6 +86,11 @@ ; ueq is implemented with VCGT/VCGT/VORR/VMVN define <2 x i32> @vcueqf32(<2 x float>* %A, <2 x float>* %B) nounwind { +;CHECK: vcueqf32: +;CHECK: vcgt.f32 +;CHECK-NEXT: vcgt.f32 +;CHECK-NEXT: vorr +;CHECK-NEXT: vmvn %tmp1 = load <2 x float>* %A %tmp2 = load <2 x float>* %B %tmp3 = fcmp ueq <2 x float> %tmp1, %tmp2 @@ -81,6 +100,10 @@ ; one is implemented with VCGT/VCGT/VORR define <2 x i32> @vconef32(<2 x float>* %A, <2 x float>* %B) nounwind { +;CHECK: vconef32: +;CHECK: vcgt.f32 +;CHECK-NEXT: vcgt.f32 +;CHECK-NEXT: vorr %tmp1 = load <2 x float>* %A %tmp2 = load <2 x float>* %B %tmp3 = fcmp one <2 x float> %tmp1, %tmp2 @@ -90,6 +113,11 @@ ; uno is implemented with VCGT/VCGE/VORR/VMVN define <2 x i32> @vcunof32(<2 x float>* %A, <2 x float>* %B) nounwind { +;CHECK: vcunof32: +;CHECK: vcge.f32 +;CHECK-NEXT: vcgt.f32 +;CHECK-NEXT: vorr +;CHECK-NEXT: vmvn %tmp1 = load <2 x float>* %A %tmp2 = load <2 x float>* %B %tmp3 = fcmp uno <2 x float> %tmp1, %tmp2 @@ -99,6 +127,10 @@ ; ord is implemented with VCGT/VCGE/VORR define <2 x i32> @vcordf32(<2 x float>* %A, <2 x float>* %B) nounwind { +;CHECK: vcordf32: +;CHECK: vcge.f32 +;CHECK-NEXT: vcgt.f32 +;CHECK-NEXT: vorr %tmp1 = load <2 x float>* %A %tmp2 = load <2 x float>* %B %tmp3 = fcmp ord <2 x float> %tmp1, %tmp2 Modified: llvm/trunk/test/CodeGen/ARM/vfp.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/vfp.ll?rev=81915&r1=81914&r2=81915&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/ARM/vfp.ll (original) +++ llvm/trunk/test/CodeGen/ARM/vfp.ll Tue Sep 15 15:58:02 2009 @@ -1,19 +1,4 @@ -; RUN: llc < %s -march=arm -mattr=+vfp2 | \ -; RUN: grep fabs | count 2 -; RUN: llc < %s -march=arm -mattr=+vfp2 | \ -; RUN: grep fmscs | count 1 -; RUN: llc < %s -march=arm -mattr=+vfp2 | \ -; RUN: grep fcvt | count 2 -; RUN: llc < %s -march=arm -mattr=+vfp2 | \ -; RUN: grep fuito | count 2 -; RUN: llc < %s -march=arm -mattr=+vfp2 | \ -; RUN: grep fto.i | count 4 -; RUN: llc < %s -march=arm -mattr=+vfp2 | \ -; RUN: grep bmi | count 1 -; RUN: llc < %s -march=arm -mattr=+vfp2 | \ -; RUN: grep bgt | count 1 -; RUN: llc < %s -march=arm -mattr=+vfp2 | \ -; RUN: grep fcmpezs | count 1 +; RUN: llc < %s -march=arm -mattr=+vfp2 | FileCheck %s define void @test(float* %P, double* %D) { %A = load float* %P ; [#uses=1] @@ -28,16 +13,20 @@ declare double @fabs(double) define void @test_abs(float* %P, double* %D) { +;CHECK: test_abs: %a = load float* %P ; [#uses=1] +;CHECK: fabss %b = call float @fabsf( float %a ) ; [#uses=1] store float %b, float* %P %A = load double* %D ; [#uses=1] +;CHECK: fabsd %B = call double @fabs( double %A ) ; [#uses=1] store double %B, double* %D ret void } define void @test_add(float* %P, double* %D) { +;CHECK: test_add: %a = load float* %P ; [#uses=2] %b = fadd float %a, %a ; [#uses=1] store float %b, float* %P @@ -48,9 +37,12 @@ } define void @test_ext_round(float* %P, double* %D) { +;CHECK: test_ext_round: %a = load float* %P ; [#uses=1] +;CHECK: fcvtds %b = fpext float %a to double ; [#uses=1] %A = load double* %D ; [#uses=1] +;CHECK: fcvtsd %B = fptrunc double %A to float ; [#uses=1] store double %b, double* %D store float %B, float* %P @@ -58,9 +50,11 @@ } define void @test_fma(float* %P1, float* %P2, float* %P3) { +;CHECK: test_fma: %a1 = load float* %P1 ; [#uses=1] %a2 = load float* %P2 ; [#uses=1] %a3 = load float* %P3 ; [#uses=1] +;CHECK: fmscs %X = fmul float %a1, %a2 ; [#uses=1] %Y = fsub float %X, %a3 ; [#uses=1] store float %Y, float* %P1 @@ -68,42 +62,55 @@ } define i32 @test_ftoi(float* %P1) { +;CHECK: test_ftoi: %a1 = load float* %P1 ; [#uses=1] +;CHECK: ftosizs %b1 = fptosi float %a1 to i32 ; [#uses=1] ret i32 %b1 } define i32 @test_ftou(float* %P1) { +;CHECK: test_ftou: %a1 = load float* %P1 ; [#uses=1] +;CHECK: ftouizs %b1 = fptoui float %a1 to i32 ; [#uses=1] ret i32 %b1 } define i32 @test_dtoi(double* %P1) { +;CHECK: test_dtoi: %a1 = load double* %P1 ; [#uses=1] +;CHECK: ftosizd %b1 = fptosi double %a1 to i32 ; [#uses=1] ret i32 %b1 } define i32 @test_dtou(double* %P1) { +;CHECK: test_dtou: %a1 = load double* %P1 ; [#uses=1] +;CHECK: ftouizd %b1 = fptoui double %a1 to i32 ; [#uses=1] ret i32 %b1 } define void @test_utod(double* %P1, i32 %X) { +;CHECK: test_utod: +;CHECK: fuitod %b1 = uitofp i32 %X to double ; [#uses=1] store double %b1, double* %P1 ret void } define void @test_utod2(double* %P1, i8 %X) { +;CHECK: test_utod2: +;CHECK: fuitod %b1 = uitofp i8 %X to double ; [#uses=1] store double %b1, double* %P1 ret void } define void @test_cmp(float* %glob, i32 %X) { +;CHECK: test_cmp: entry: %tmp = load float* %glob ; [#uses=2] %tmp3 = getelementptr float* %glob, i32 2 ; [#uses=1] @@ -111,6 +118,8 @@ %tmp.upgrd.1 = fcmp oeq float %tmp, %tmp4 ; [#uses=1] %tmp5 = fcmp uno float %tmp, %tmp4 ; [#uses=1] %tmp6 = or i1 %tmp.upgrd.1, %tmp5 ; [#uses=1] +;CHECK: bmi +;CHECK-NEXT: bgt br i1 %tmp6, label %cond_true, label %cond_false cond_true: ; preds = %entry @@ -129,8 +138,10 @@ declare i32 @baz(...) define void @test_cmpfp0(float* %glob, i32 %X) { +;CHECK: test_cmpfp0: entry: %tmp = load float* %glob ; [#uses=1] +;CHECK: fcmpezs %tmp.upgrd.3 = fcmp ogt float %tmp, 0.000000e+00 ; [#uses=1] br i1 %tmp.upgrd.3, label %cond_true, label %cond_false Modified: llvm/trunk/test/CodeGen/ARM/vget_lane.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/vget_lane.ll?rev=81915&r1=81914&r2=81915&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/ARM/vget_lane.ll (original) +++ llvm/trunk/test/CodeGen/ARM/vget_lane.ll Tue Sep 15 15:58:02 2009 @@ -1,11 +1,8 @@ -; RUN: llc < %s -march=arm -mattr=+neon > %t -; RUN: grep {vmov\\.s8} %t | count 2 -; RUN: grep {vmov\\.s16} %t | count 2 -; RUN: grep {vmov\\.u8} %t | count 2 -; RUN: grep {vmov\\.u16} %t | count 2 -; RUN: grep {vmov\\.32} %t | count 2 +; RUN: llc < %s -march=arm -mattr=+neon | FileCheck %s define i32 @vget_lanes8(<8 x i8>* %A) nounwind { +;CHECK: vget_lanes8: +;CHECK: vmov.s8 %tmp1 = load <8 x i8>* %A %tmp2 = extractelement <8 x i8> %tmp1, i32 1 %tmp3 = sext i8 %tmp2 to i32 @@ -13,6 +10,8 @@ } define i32 @vget_lanes16(<4 x i16>* %A) nounwind { +;CHECK: vget_lanes16: +;CHECK: vmov.s16 %tmp1 = load <4 x i16>* %A %tmp2 = extractelement <4 x i16> %tmp1, i32 1 %tmp3 = sext i16 %tmp2 to i32 @@ -20,6 +19,8 @@ } define i32 @vget_laneu8(<8 x i8>* %A) nounwind { +;CHECK: vget_laneu8: +;CHECK: vmov.u8 %tmp1 = load <8 x i8>* %A %tmp2 = extractelement <8 x i8> %tmp1, i32 1 %tmp3 = zext i8 %tmp2 to i32 @@ -27,6 +28,8 @@ } define i32 @vget_laneu16(<4 x i16>* %A) nounwind { +;CHECK: vget_laneu16: +;CHECK: vmov.u16 %tmp1 = load <4 x i16>* %A %tmp2 = extractelement <4 x i16> %tmp1, i32 1 %tmp3 = zext i16 %tmp2 to i32 @@ -35,6 +38,8 @@ ; Do a vector add to keep the extraction from being done directly from memory. define i32 @vget_lanei32(<2 x i32>* %A) nounwind { +;CHECK: vget_lanei32: +;CHECK: vmov.32 %tmp1 = load <2 x i32>* %A %tmp2 = add <2 x i32> %tmp1, %tmp1 %tmp3 = extractelement <2 x i32> %tmp2, i32 1 @@ -42,6 +47,8 @@ } define i32 @vgetQ_lanes8(<16 x i8>* %A) nounwind { +;CHECK: vgetQ_lanes8: +;CHECK: vmov.s8 %tmp1 = load <16 x i8>* %A %tmp2 = extractelement <16 x i8> %tmp1, i32 1 %tmp3 = sext i8 %tmp2 to i32 @@ -49,6 +56,8 @@ } define i32 @vgetQ_lanes16(<8 x i16>* %A) nounwind { +;CHECK: vgetQ_lanes16: +;CHECK: vmov.s16 %tmp1 = load <8 x i16>* %A %tmp2 = extractelement <8 x i16> %tmp1, i32 1 %tmp3 = sext i16 %tmp2 to i32 @@ -56,6 +65,8 @@ } define i32 @vgetQ_laneu8(<16 x i8>* %A) nounwind { +;CHECK: vgetQ_laneu8: +;CHECK: vmov.u8 %tmp1 = load <16 x i8>* %A %tmp2 = extractelement <16 x i8> %tmp1, i32 1 %tmp3 = zext i8 %tmp2 to i32 @@ -63,6 +74,8 @@ } define i32 @vgetQ_laneu16(<8 x i16>* %A) nounwind { +;CHECK: vgetQ_laneu16: +;CHECK: vmov.u16 %tmp1 = load <8 x i16>* %A %tmp2 = extractelement <8 x i16> %tmp1, i32 1 %tmp3 = zext i16 %tmp2 to i32 @@ -71,6 +84,8 @@ ; Do a vector add to keep the extraction from being done directly from memory. define i32 @vgetQ_lanei32(<4 x i32>* %A) nounwind { +;CHECK: vgetQ_lanei32: +;CHECK: vmov.32 %tmp1 = load <4 x i32>* %A %tmp2 = add <4 x i32> %tmp1, %tmp1 %tmp3 = extractelement <4 x i32> %tmp2, i32 1 Modified: llvm/trunk/test/CodeGen/ARM/vhadd.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/vhadd.ll?rev=81915&r1=81914&r2=81915&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/ARM/vhadd.ll (original) +++ llvm/trunk/test/CodeGen/ARM/vhadd.ll Tue Sep 15 15:58:02 2009 @@ -1,12 +1,8 @@ -; RUN: llc < %s -march=arm -mattr=+neon > %t -; RUN: grep {vhadd\\.s8} %t | count 2 -; RUN: grep {vhadd\\.s16} %t | count 2 -; RUN: grep {vhadd\\.s32} %t | count 2 -; RUN: grep {vhadd\\.u8} %t | count 2 -; RUN: grep {vhadd\\.u16} %t | count 2 -; RUN: grep {vhadd\\.u32} %t | count 2 +; RUN: llc < %s -march=arm -mattr=+neon | FileCheck %s define <8 x i8> @vhadds8(<8 x i8>* %A, <8 x i8>* %B) nounwind { +;CHECK: vhadds8: +;CHECK: vhadd.s8 %tmp1 = load <8 x i8>* %A %tmp2 = load <8 x i8>* %B %tmp3 = call <8 x i8> @llvm.arm.neon.vhadds.v8i8(<8 x i8> %tmp1, <8 x i8> %tmp2) @@ -14,6 +10,8 @@ } define <4 x i16> @vhadds16(<4 x i16>* %A, <4 x i16>* %B) nounwind { +;CHECK: vhadds16: +;CHECK: vhadd.s16 %tmp1 = load <4 x i16>* %A %tmp2 = load <4 x i16>* %B %tmp3 = call <4 x i16> @llvm.arm.neon.vhadds.v4i16(<4 x i16> %tmp1, <4 x i16> %tmp2) @@ -21,6 +19,8 @@ } define <2 x i32> @vhadds32(<2 x i32>* %A, <2 x i32>* %B) nounwind { +;CHECK: vhadds32: +;CHECK: vhadd.s32 %tmp1 = load <2 x i32>* %A %tmp2 = load <2 x i32>* %B %tmp3 = call <2 x i32> @llvm.arm.neon.vhadds.v2i32(<2 x i32> %tmp1, <2 x i32> %tmp2) @@ -28,6 +28,8 @@ } define <8 x i8> @vhaddu8(<8 x i8>* %A, <8 x i8>* %B) nounwind { +;CHECK: vhaddu8: +;CHECK: vhadd.u8 %tmp1 = load <8 x i8>* %A %tmp2 = load <8 x i8>* %B %tmp3 = call <8 x i8> @llvm.arm.neon.vhaddu.v8i8(<8 x i8> %tmp1, <8 x i8> %tmp2) @@ -35,6 +37,8 @@ } define <4 x i16> @vhaddu16(<4 x i16>* %A, <4 x i16>* %B) nounwind { +;CHECK: vhaddu16: +;CHECK: vhadd.u16 %tmp1 = load <4 x i16>* %A %tmp2 = load <4 x i16>* %B %tmp3 = call <4 x i16> @llvm.arm.neon.vhaddu.v4i16(<4 x i16> %tmp1, <4 x i16> %tmp2) @@ -42,6 +46,8 @@ } define <2 x i32> @vhaddu32(<2 x i32>* %A, <2 x i32>* %B) nounwind { +;CHECK: vhaddu32: +;CHECK: vhadd.u32 %tmp1 = load <2 x i32>* %A %tmp2 = load <2 x i32>* %B %tmp3 = call <2 x i32> @llvm.arm.neon.vhaddu.v2i32(<2 x i32> %tmp1, <2 x i32> %tmp2) @@ -49,6 +55,8 @@ } define <16 x i8> @vhaddQs8(<16 x i8>* %A, <16 x i8>* %B) nounwind { +;CHECK: vhaddQs8: +;CHECK: vhadd.s8 %tmp1 = load <16 x i8>* %A %tmp2 = load <16 x i8>* %B %tmp3 = call <16 x i8> @llvm.arm.neon.vhadds.v16i8(<16 x i8> %tmp1, <16 x i8> %tmp2) @@ -56,6 +64,8 @@ } define <8 x i16> @vhaddQs16(<8 x i16>* %A, <8 x i16>* %B) nounwind { +;CHECK: vhaddQs16: +;CHECK: vhadd.s16 %tmp1 = load <8 x i16>* %A %tmp2 = load <8 x i16>* %B %tmp3 = call <8 x i16> @llvm.arm.neon.vhadds.v8i16(<8 x i16> %tmp1, <8 x i16> %tmp2) @@ -63,6 +73,8 @@ } define <4 x i32> @vhaddQs32(<4 x i32>* %A, <4 x i32>* %B) nounwind { +;CHECK: vhaddQs32: +;CHECK: vhadd.s32 %tmp1 = load <4 x i32>* %A %tmp2 = load <4 x i32>* %B %tmp3 = call <4 x i32> @llvm.arm.neon.vhadds.v4i32(<4 x i32> %tmp1, <4 x i32> %tmp2) @@ -70,6 +82,8 @@ } define <16 x i8> @vhaddQu8(<16 x i8>* %A, <16 x i8>* %B) nounwind { +;CHECK: vhaddQu8: +;CHECK: vhadd.u8 %tmp1 = load <16 x i8>* %A %tmp2 = load <16 x i8>* %B %tmp3 = call <16 x i8> @llvm.arm.neon.vhaddu.v16i8(<16 x i8> %tmp1, <16 x i8> %tmp2) @@ -77,6 +91,8 @@ } define <8 x i16> @vhaddQu16(<8 x i16>* %A, <8 x i16>* %B) nounwind { +;CHECK: vhaddQu16: +;CHECK: vhadd.u16 %tmp1 = load <8 x i16>* %A %tmp2 = load <8 x i16>* %B %tmp3 = call <8 x i16> @llvm.arm.neon.vhaddu.v8i16(<8 x i16> %tmp1, <8 x i16> %tmp2) @@ -84,6 +100,8 @@ } define <4 x i32> @vhaddQu32(<4 x i32>* %A, <4 x i32>* %B) nounwind { +;CHECK: vhaddQu32: +;CHECK: vhadd.u32 %tmp1 = load <4 x i32>* %A %tmp2 = load <4 x i32>* %B %tmp3 = call <4 x i32> @llvm.arm.neon.vhaddu.v4i32(<4 x i32> %tmp1, <4 x i32> %tmp2) Modified: llvm/trunk/test/CodeGen/ARM/vhsub.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/vhsub.ll?rev=81915&r1=81914&r2=81915&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/ARM/vhsub.ll (original) +++ llvm/trunk/test/CodeGen/ARM/vhsub.ll Tue Sep 15 15:58:02 2009 @@ -1,12 +1,8 @@ -; RUN: llc < %s -march=arm -mattr=+neon > %t -; RUN: grep {vhsub\\.s8} %t | count 2 -; RUN: grep {vhsub\\.s16} %t | count 2 -; RUN: grep {vhsub\\.s32} %t | count 2 -; RUN: grep {vhsub\\.u8} %t | count 2 -; RUN: grep {vhsub\\.u16} %t | count 2 -; RUN: grep {vhsub\\.u32} %t | count 2 +; RUN: llc < %s -march=arm -mattr=+neon | FileCheck %s define <8 x i8> @vhsubs8(<8 x i8>* %A, <8 x i8>* %B) nounwind { +;CHECK: vhsubs8: +;CHECK: vhsub.s8 %tmp1 = load <8 x i8>* %A %tmp2 = load <8 x i8>* %B %tmp3 = call <8 x i8> @llvm.arm.neon.vhsubs.v8i8(<8 x i8> %tmp1, <8 x i8> %tmp2) @@ -14,6 +10,8 @@ } define <4 x i16> @vhsubs16(<4 x i16>* %A, <4 x i16>* %B) nounwind { +;CHECK: vhsubs16: +;CHECK: vhsub.s16 %tmp1 = load <4 x i16>* %A %tmp2 = load <4 x i16>* %B %tmp3 = call <4 x i16> @llvm.arm.neon.vhsubs.v4i16(<4 x i16> %tmp1, <4 x i16> %tmp2) @@ -21,6 +19,8 @@ } define <2 x i32> @vhsubs32(<2 x i32>* %A, <2 x i32>* %B) nounwind { +;CHECK: vhsubs32: +;CHECK: vhsub.s32 %tmp1 = load <2 x i32>* %A %tmp2 = load <2 x i32>* %B %tmp3 = call <2 x i32> @llvm.arm.neon.vhsubs.v2i32(<2 x i32> %tmp1, <2 x i32> %tmp2) @@ -28,6 +28,8 @@ } define <8 x i8> @vhsubu8(<8 x i8>* %A, <8 x i8>* %B) nounwind { +;CHECK: vhsubu8: +;CHECK: vhsub.u8 %tmp1 = load <8 x i8>* %A %tmp2 = load <8 x i8>* %B %tmp3 = call <8 x i8> @llvm.arm.neon.vhsubu.v8i8(<8 x i8> %tmp1, <8 x i8> %tmp2) @@ -35,6 +37,8 @@ } define <4 x i16> @vhsubu16(<4 x i16>* %A, <4 x i16>* %B) nounwind { +;CHECK: vhsubu16: +;CHECK: vhsub.u16 %tmp1 = load <4 x i16>* %A %tmp2 = load <4 x i16>* %B %tmp3 = call <4 x i16> @llvm.arm.neon.vhsubu.v4i16(<4 x i16> %tmp1, <4 x i16> %tmp2) @@ -42,6 +46,8 @@ } define <2 x i32> @vhsubu32(<2 x i32>* %A, <2 x i32>* %B) nounwind { +;CHECK: vhsubu32: +;CHECK: vhsub.u32 %tmp1 = load <2 x i32>* %A %tmp2 = load <2 x i32>* %B %tmp3 = call <2 x i32> @llvm.arm.neon.vhsubu.v2i32(<2 x i32> %tmp1, <2 x i32> %tmp2) @@ -49,6 +55,8 @@ } define <16 x i8> @vhsubQs8(<16 x i8>* %A, <16 x i8>* %B) nounwind { +;CHECK: vhsubQs8: +;CHECK: vhsub.s8 %tmp1 = load <16 x i8>* %A %tmp2 = load <16 x i8>* %B %tmp3 = call <16 x i8> @llvm.arm.neon.vhsubs.v16i8(<16 x i8> %tmp1, <16 x i8> %tmp2) @@ -56,6 +64,8 @@ } define <8 x i16> @vhsubQs16(<8 x i16>* %A, <8 x i16>* %B) nounwind { +;CHECK: vhsubQs16: +;CHECK: vhsub.s16 %tmp1 = load <8 x i16>* %A %tmp2 = load <8 x i16>* %B %tmp3 = call <8 x i16> @llvm.arm.neon.vhsubs.v8i16(<8 x i16> %tmp1, <8 x i16> %tmp2) @@ -63,6 +73,8 @@ } define <4 x i32> @vhsubQs32(<4 x i32>* %A, <4 x i32>* %B) nounwind { +;CHECK: vhsubQs32: +;CHECK: vhsub.s32 %tmp1 = load <4 x i32>* %A %tmp2 = load <4 x i32>* %B %tmp3 = call <4 x i32> @llvm.arm.neon.vhsubs.v4i32(<4 x i32> %tmp1, <4 x i32> %tmp2) @@ -70,6 +82,8 @@ } define <16 x i8> @vhsubQu8(<16 x i8>* %A, <16 x i8>* %B) nounwind { +;CHECK: vhsubQu8: +;CHECK: vhsub.u8 %tmp1 = load <16 x i8>* %A %tmp2 = load <16 x i8>* %B %tmp3 = call <16 x i8> @llvm.arm.neon.vhsubu.v16i8(<16 x i8> %tmp1, <16 x i8> %tmp2) @@ -77,6 +91,8 @@ } define <8 x i16> @vhsubQu16(<8 x i16>* %A, <8 x i16>* %B) nounwind { +;CHECK: vhsubQu16: +;CHECK: vhsub.u16 %tmp1 = load <8 x i16>* %A %tmp2 = load <8 x i16>* %B %tmp3 = call <8 x i16> @llvm.arm.neon.vhsubu.v8i16(<8 x i16> %tmp1, <8 x i16> %tmp2) @@ -84,6 +100,8 @@ } define <4 x i32> @vhsubQu32(<4 x i32>* %A, <4 x i32>* %B) nounwind { +;CHECK: vhsubQu32: +;CHECK: vhsub.u32 %tmp1 = load <4 x i32>* %A %tmp2 = load <4 x i32>* %B %tmp3 = call <4 x i32> @llvm.arm.neon.vhsubu.v4i32(<4 x i32> %tmp1, <4 x i32> %tmp2) From baldrick at free.fr Tue Sep 15 16:24:15 2009 From: baldrick at free.fr (Duncan Sands) Date: Tue, 15 Sep 2009 21:24:15 -0000 Subject: [llvm-commits] [gcc-plugin] r81918 - in /gcc-plugin/trunk: llvm-convert.cpp llvm-internal.h Message-ID: <200909152124.n8FLOF7Q009812@zion.cs.uiuc.edu> Author: baldrick Date: Tue Sep 15 16:24:15 2009 New Revision: 81918 URL: http://llvm.org/viewvc/llvm-project?rev=81918&view=rev Log: Add support for constant POINTER_PLUS_EXPR. Modified: gcc-plugin/trunk/llvm-convert.cpp gcc-plugin/trunk/llvm-internal.h Modified: gcc-plugin/trunk/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-convert.cpp?rev=81918&r1=81917&r2=81918&view=diff ============================================================================== --- gcc-plugin/trunk/llvm-convert.cpp (original) +++ gcc-plugin/trunk/llvm-convert.cpp Tue Sep 15 16:24:15 2009 @@ -6941,6 +6941,7 @@ case MINUS_EXPR: return ConvertBinOp_CST(exp); case CONSTRUCTOR: return ConvertCONSTRUCTOR(exp); case VIEW_CONVERT_EXPR: return Convert(TREE_OPERAND(exp, 0)); + case POINTER_PLUS_EXPR: return ConvertPOINTER_PLUS_EXPR(exp); case ADDR_EXPR: return TheFolder->CreateBitCast(EmitLV(TREE_OPERAND(exp, 0)), ConvertType(TREE_TYPE(exp))); @@ -7152,6 +7153,20 @@ return TheFolder->CreateCast(opcode, Elt, Ty); } +Constant *TreeConstantToLLVM::ConvertPOINTER_PLUS_EXPR(tree exp) { + Constant *Ptr = Convert(TREE_OPERAND(exp, 0)); // The pointer. + Constant *Idx = Convert(TREE_OPERAND(exp, 1)); // The offset in bytes. + + // Convert the pointer into an i8* and add the offset to it. + Ptr = TheFolder->CreateBitCast(Ptr, Type::getInt8Ty(Context)->getPointerTo()); + Constant *GEP = POINTER_TYPE_OVERFLOW_UNDEFINED ? + TheFolder->CreateInBoundsGetElementPtr(Ptr, &Idx, 1) : + TheFolder->CreateGetElementPtr(Ptr, &Idx, 1); + + // The result may be of a different pointer type. + return TheFolder->CreateBitCast(GEP, ConvertType(TREE_TYPE(exp))); +} + Constant *TreeConstantToLLVM::ConvertBinOp_CST(tree exp) { Constant *LHS = Convert(TREE_OPERAND(exp, 0)); bool LHSIsSigned = !TYPE_UNSIGNED(TREE_TYPE(TREE_OPERAND(exp,0))); Modified: gcc-plugin/trunk/llvm-internal.h URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-internal.h?rev=81918&r1=81917&r2=81918&view=diff ============================================================================== --- gcc-plugin/trunk/llvm-internal.h (original) +++ gcc-plugin/trunk/llvm-internal.h Tue Sep 15 16:24:15 2009 @@ -683,7 +683,8 @@ static Constant *ConvertArrayCONSTRUCTOR(tree_node *exp); static Constant *ConvertRecordCONSTRUCTOR(tree_node *exp); static Constant *ConvertUnionCONSTRUCTOR(tree_node *exp); - + static Constant *ConvertPOINTER_PLUS_EXPR(tree_node *exp); + // Constant Expression l-values. static Constant *EmitLV(tree_node *exp); static Constant *EmitLV_Decl(tree_node *exp); From eli.friedman at gmail.com Tue Sep 15 16:37:41 2009 From: eli.friedman at gmail.com (Eli Friedman) Date: Tue, 15 Sep 2009 14:37:41 -0700 Subject: [llvm-commits] [llvm] r81914 - in /llvm/trunk/lib/Target/X86: X86Instr64bit.td X86InstrInfo.td In-Reply-To: <200909152053.n8FKrvNT005736@zion.cs.uiuc.edu> References: <200909152053.n8FKrvNT005736@zion.cs.uiuc.edu> Message-ID: On Tue, Sep 15, 2009 at 1:53 PM, Sean Callanan wrote: ============================================================================== > --- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original) > +++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Tue Sep 15 15:53:57 2009 > @@ -2427,6 +2427,14 @@ > ? ? ? ? ? ? ? ? ?"add{l}\t{$src2, $dst|$dst, $src2}", > ? ? ? ? ? ? ? ? ?[(set GR32:$dst, (add GR32:$src1, (load addr:$src2))), > ? ? ? ? ? ? ? ? ? (implicit EFLAGS)]>; > + > +// Register-Register Addition > +def ADD8mrmrr: I<0x02, MRMSrcReg, (outs GR8:$dst), (ins GR8:$src1, GR8:$src2), > + ? ? ? ? ? ? ? ? "add{b}\t{$src2, $dst|$dst, $src2}", []>; > +def ADD16mrmrr: I<0x03, MRMSrcReg,(outs GR16:$dst),(ins GR16:$src1, GR16:$src2), > + ? ? ? ? ? ? ? ? ?"add{w}\t{$src2, $dst|$dst, $src2}", []>, OpSize; > +def ADD32mrmrr: I<0x03, MRMSrcReg,(outs GR16:$dst),(ins GR16:$src1, GR16:$src2), > + ? ? ? ? ? ? ? ? ?"add{l}\t{$src2, $dst|$dst, $src2}", []>; > > ?// Register-Integer Addition > ?def ADD8ri ? ?: Ii8<0x80, MRM0r, (outs GR8:$dst), (ins GR8:$src1, i8imm:$src2), It might be worth adding a comment explaining that these are equivalent to ADD32rr and friends. -Eli From eli.friedman at gmail.com Tue Sep 15 16:39:06 2009 From: eli.friedman at gmail.com (Eli Friedman) Date: Tue, 15 Sep 2009 14:39:06 -0700 Subject: [llvm-commits] [PATCH] extend SelectionDAGBuild to treat malloc calls the same as MallocInst (patch #4) In-Reply-To: <05892D6F-5D3B-45FD-8FA0-82EB6A686B63@apple.com> References: <05892D6F-5D3B-45FD-8FA0-82EB6A686B63@apple.com> Message-ID: On Tue, Sep 15, 2009 at 1:44 PM, Victor Hernandez wrote: > SelectionDAGBuild is the only pass in CodeGen that handles MallocInst > specially. ?This patch extends that code to handle malloc calls also. This part is both wrong and not necessary. -Eli From scallanan at apple.com Tue Sep 15 16:43:27 2009 From: scallanan at apple.com (Sean Callanan) Date: Tue, 15 Sep 2009 21:43:27 -0000 Subject: [llvm-commits] [llvm] r81923 - in /llvm/trunk/lib/Target/X86: X86Instr64bit.td X86InstrInfo.td Message-ID: <200909152143.n8FLhRLg012395@zion.cs.uiuc.edu> Author: spyffe Date: Tue Sep 15 16:43:27 2009 New Revision: 81923 URL: http://llvm.org/viewvc/llvm-project?rev=81923&view=rev Log: Updated comments per Eli's suggestion. Modified: llvm/trunk/lib/Target/X86/X86Instr64bit.td llvm/trunk/lib/Target/X86/X86InstrInfo.td Modified: llvm/trunk/lib/Target/X86/X86Instr64bit.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Instr64bit.td?rev=81923&r1=81922&r2=81923&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86Instr64bit.td (original) +++ llvm/trunk/lib/Target/X86/X86Instr64bit.td Tue Sep 15 16:43:27 2009 @@ -458,7 +458,8 @@ [(set GR64:$dst, (add GR64:$src1, (load addr:$src2))), (implicit EFLAGS)]>; -// Register-Register Addition +// Register-Register Addition - Equivalent to the normal rr form (ADD64rr), but +// differently encoded. def ADD64mrmrr : RI<0x03, MRMSrcReg, (outs GR64:$dst), (ins GR64:$src1, GR64:$src2), "add{l}\t{$src2, $dst|$dst, $src2}", []>; Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=81923&r1=81922&r2=81923&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Tue Sep 15 16:43:27 2009 @@ -2428,7 +2428,8 @@ [(set GR32:$dst, (add GR32:$src1, (load addr:$src2))), (implicit EFLAGS)]>; -// Register-Register Addition +// Register-Register Addition - Equivalent to the normal rr forms (ADD8rr, +// ADD16rr, and ADD32rr), but differently encoded. def ADD8mrmrr: I<0x02, MRMSrcReg, (outs GR8:$dst), (ins GR8:$src1, GR8:$src2), "add{b}\t{$src2, $dst|$dst, $src2}", []>; def ADD16mrmrr: I<0x03, MRMSrcReg,(outs GR16:$dst),(ins GR16:$src1, GR16:$src2), From jonz at apple.com Tue Sep 15 16:55:59 2009 From: jonz at apple.com (Jon Ziegler) Date: Tue, 15 Sep 2009 21:55:59 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r81926 - /llvm-gcc-4.2/tags/Apple/llvmgcc42-2309/ Message-ID: <200909152155.n8FLtx6w014039@zion.cs.uiuc.edu> Author: jonz Date: Tue Sep 15 16:55:59 2009 New Revision: 81926 URL: http://llvm.org/viewvc/llvm-project?rev=81926&view=rev Log: Creating llvmgcc42-2309 from Leela. Added: llvm-gcc-4.2/tags/Apple/llvmgcc42-2309/ - copied from r81925, llvm-gcc-4.2/branches/Apple/Leela/ From jonz at apple.com Tue Sep 15 16:56:19 2009 From: jonz at apple.com (Jon Ziegler) Date: Tue, 15 Sep 2009 21:56:19 -0000 Subject: [llvm-commits] [llvm] r81927 - /llvm/tags/Apple/llvmCore-2309/ Message-ID: <200909152156.n8FLuJe7014090@zion.cs.uiuc.edu> Author: jonz Date: Tue Sep 15 16:56:18 2009 New Revision: 81927 URL: http://llvm.org/viewvc/llvm-project?rev=81927&view=rev Log: Creating llvmCore-2309 from Leela. Added: llvm/tags/Apple/llvmCore-2309/ - copied from r81926, llvm/branches/Apple/Leela/ From echristo at apple.com Tue Sep 15 16:56:46 2009 From: echristo at apple.com (Eric Christopher) Date: Tue, 15 Sep 2009 21:56:46 -0000 Subject: [llvm-commits] [llvm] r81928 - /llvm/trunk/lib/CodeGen/DwarfEHPrepare.cpp Message-ID: <200909152156.n8FLukm5014157@zion.cs.uiuc.edu> Author: echristo Date: Tue Sep 15 16:56:46 2009 New Revision: 81928 URL: http://llvm.org/viewvc/llvm-project?rev=81928&view=rev Log: Expand on comment. Modified: llvm/trunk/lib/CodeGen/DwarfEHPrepare.cpp Modified: llvm/trunk/lib/CodeGen/DwarfEHPrepare.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/DwarfEHPrepare.cpp?rev=81928&r1=81927&r2=81928&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/DwarfEHPrepare.cpp (original) +++ llvm/trunk/lib/CodeGen/DwarfEHPrepare.cpp Tue Sep 15 16:56:46 2009 @@ -107,7 +107,9 @@ /// NormalizeLandingPads - Normalize and discover landing pads, noting them /// in the LandingPads set. A landing pad is normal if the only CFG edges -/// that end at it are unwind edges from invoke instructions. +/// that end at it are unwind edges from invoke instructions. If we inlined +/// through an invoke we could have a normal branch from the previous +/// unwind block through to the landing pad for the original invoke. /// Abnormal landing pads are fixed up by redirecting all unwind edges to /// a new basic block which falls through to the original. bool DwarfEHPrepare::NormalizeLandingPads() { @@ -132,6 +134,7 @@ break; } } + if (OnlyUnwoundTo) { // Only unwind edges lead to the landing pad. Remember the landing pad. LandingPads.insert(LPad); From isanbard at gmail.com Tue Sep 15 17:18:46 2009 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 15 Sep 2009 22:18:46 -0000 Subject: [llvm-commits] [llvm] r81932 - /llvm/tags/Apple/llvmCore-2207/ Message-ID: <200909152218.n8FMIkVa017042@zion.cs.uiuc.edu> Author: void Date: Tue Sep 15 17:18:46 2009 New Revision: 81932 URL: http://llvm.org/viewvc/llvm-project?rev=81932&view=rev Log: Retagging 2207. Removed: llvm/tags/Apple/llvmCore-2207/ From isanbard at gmail.com Tue Sep 15 17:18:56 2009 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 15 Sep 2009 22:18:56 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r81933 - /llvm-gcc-4.2/tags/Apple/llvmgcc42-2207/ Message-ID: <200909152218.n8FMIuKp017074@zion.cs.uiuc.edu> Author: void Date: Tue Sep 15 17:18:56 2009 New Revision: 81933 URL: http://llvm.org/viewvc/llvm-project?rev=81933&view=rev Log: Retagging 2207. Removed: llvm-gcc-4.2/tags/Apple/llvmgcc42-2207/ From isanbard at gmail.com Tue Sep 15 17:19:15 2009 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 15 Sep 2009 22:19:15 -0000 Subject: [llvm-commits] [llvm] r81934 - /llvm/tags/Apple/llvmCore-2207/ Message-ID: <200909152219.n8FMJFk1017124@zion.cs.uiuc.edu> Author: void Date: Tue Sep 15 17:19:15 2009 New Revision: 81934 URL: http://llvm.org/viewvc/llvm-project?rev=81934&view=rev Log: Creating llvmCore-2207 from Bender-SWB. Added: llvm/tags/Apple/llvmCore-2207/ - copied from r81933, llvm/branches/Apple/Bender-SWB/ From isanbard at gmail.com Tue Sep 15 17:19:24 2009 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 15 Sep 2009 22:19:24 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r81935 - /llvm-gcc-4.2/tags/Apple/llvmgcc42-2207/ Message-ID: <200909152219.n8FMJOhs017155@zion.cs.uiuc.edu> Author: void Date: Tue Sep 15 17:19:23 2009 New Revision: 81935 URL: http://llvm.org/viewvc/llvm-project?rev=81935&view=rev Log: Creating llvmgcc42-2207 from Bender-SWB. Added: llvm-gcc-4.2/tags/Apple/llvmgcc42-2207/ - copied from r81934, llvm-gcc-4.2/branches/Apple/Bender-SWB/ From natebegeman at mac.com Tue Sep 15 17:30:11 2009 From: natebegeman at mac.com (Nate Begeman) Date: Tue, 15 Sep 2009 22:30:11 -0000 Subject: [llvm-commits] [llvm] r81937 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Message-ID: <200909152230.n8FMUC61018527@zion.cs.uiuc.edu> Author: sampo Date: Tue Sep 15 17:30:11 2009 New Revision: 81937 URL: http://llvm.org/viewvc/llvm-project?rev=81937&view=rev Log: Do not add the SVOffset to the Node CSE ID. The same pointer argument cannot have different SVOffsets. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=81937&r1=81936&r2=81937&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Tue Sep 15 17:30:11 2009 @@ -432,14 +432,12 @@ const LoadSDNode *LD = cast(N); ID.AddInteger(LD->getMemoryVT().getRawBits()); ID.AddInteger(LD->getRawSubclassData()); - ID.AddInteger(LD->getSrcValueOffset()); break; } case ISD::STORE: { const StoreSDNode *ST = cast(N); ID.AddInteger(ST->getMemoryVT().getRawBits()); ID.AddInteger(ST->getRawSubclassData()); - ID.AddInteger(ST->getSrcValueOffset()); break; } case ISD::ATOMIC_CMP_SWAP: @@ -3681,7 +3679,6 @@ AddNodeIDNode(ID, ISD::LOAD, VTs, Ops, 3); ID.AddInteger(EVT.getRawBits()); ID.AddInteger(encodeMemSDNodeFlags(ExtType, AM, isVolatile, Alignment)); - ID.AddInteger(SVOffset); void *IP = 0; if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) return SDValue(E, 0); @@ -3740,7 +3737,6 @@ ID.AddInteger(VT.getRawBits()); ID.AddInteger(encodeMemSDNodeFlags(false, ISD::UNINDEXED, isVolatile, Alignment)); - ID.AddInteger(SVOffset); void *IP = 0; if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) return SDValue(E, 0); @@ -3776,7 +3772,6 @@ ID.AddInteger(SVT.getRawBits()); ID.AddInteger(encodeMemSDNodeFlags(true, ISD::UNINDEXED, isVolatile, Alignment)); - ID.AddInteger(SVOffset); void *IP = 0; if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) return SDValue(E, 0); From sabre at nondot.org Tue Sep 15 17:44:26 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 15 Sep 2009 22:44:26 -0000 Subject: [llvm-commits] [llvm] r81940 - in /llvm/trunk: include/llvm/CodeGen/MachineFunction.h include/llvm/CodeGen/MachineModuleInfo.h lib/CodeGen/MachineFunction.cpp lib/CodeGen/MachineModuleInfo.cpp Message-ID: <200909152244.n8FMiQ80020396@zion.cs.uiuc.edu> Author: lattner Date: Tue Sep 15 17:44:26 2009 New Revision: 81940 URL: http://llvm.org/viewvc/llvm-project?rev=81940&view=rev Log: add hooks to hang target-specific goop off MachineModuleInfo, move MachineFunctionInfo virtual method out of line to give it a home. Modified: llvm/trunk/include/llvm/CodeGen/MachineFunction.h llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h llvm/trunk/lib/CodeGen/MachineFunction.cpp llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp Modified: llvm/trunk/include/llvm/CodeGen/MachineFunction.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineFunction.h?rev=81940&r1=81939&r2=81940&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineFunction.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineFunction.h Tue Sep 15 17:44:26 2009 @@ -63,7 +63,7 @@ /// of type are accessed/created with MF::getInfo and destroyed when the /// MachineFunction is destroyed. struct MachineFunctionInfo { - virtual ~MachineFunctionInfo() {} + virtual ~MachineFunctionInfo(); }; class MachineFunction { @@ -159,8 +159,8 @@ /// void setAlignment(unsigned A) { Alignment = A; } - /// MachineFunctionInfo - Keep track of various per-function pieces of - /// information for backends that would like to do so. + /// getInfo - Keep track of various per-function pieces of information for + /// backends that would like to do so. /// template Ty *getInfo() { Modified: llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h?rev=81940&r1=81939&r2=81940&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h Tue Sep 15 17:44:26 2009 @@ -54,6 +54,17 @@ class Module; class PointerType; class StructType; + + +/// MachineModuleInfoImpl - This class can be derived from and used by targets +/// to hold private target-specific information for each Module. Objects of +/// type are accessed/created with MMI::getInfo and destroyed when the +/// MachineModuleInfo is destroyed. +struct MachineModuleInfoImpl { + virtual ~MachineModuleInfoImpl(); +}; + + //===----------------------------------------------------------------------===// /// LandingPadInfo - This structure is used to retain landing pad info for @@ -80,7 +91,10 @@ /// schemes and reformated for specific use. /// class MachineModuleInfo : public ImmutablePass { -private: + /// TargetMMI - This is the target-specific implementation of + /// MachineModuleInfoImpl, which lets them accumulate whatever info they want. + MachineModuleInfoImpl *TargetMMI; + // LabelIDList - One entry per assigned label. Normally the entry is equal to // the list index(+1). If the entry is zero then the label has been deleted. // Any other value indicates the label has been deleted by is mapped to @@ -132,14 +146,9 @@ MachineModuleInfo(); ~MachineModuleInfo(); - /// doInitialization - Initialize the state for a new module. - /// bool doInitialization(); - - /// doFinalization - Tear down the state after completion of a module. - /// bool doFinalization(); - + /// BeginFunction - Begin gathering function meta information. /// void BeginFunction(MachineFunction *MF); @@ -148,6 +157,24 @@ /// void EndFunction(); + /// getInfo - Keep track of various per-function pieces of information for + /// backends that would like to do so. + /// + template + Ty *getInfo() { + if (TargetMMI == 0) + TargetMMI = new Ty(*this); + + assert((void*)dynamic_cast(TargetMMI) == (void*)TargetMMI && + "Invalid concrete type or multiple inheritence for getInfo"); + return static_cast(TargetMMI); + } + + template + const Ty *getInfo() const { + return const_cast(this)->getInfo(); + } + /// AnalyzeModule - Scan the module for global debug information. /// void AnalyzeModule(Module &M); Modified: llvm/trunk/lib/CodeGen/MachineFunction.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineFunction.cpp?rev=81940&r1=81939&r2=81940&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineFunction.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineFunction.cpp Tue Sep 15 17:44:26 2009 @@ -73,6 +73,9 @@ // MachineFunction implementation //===---------------------------------------------------------------------===// +// Out of line virtual method. +MachineFunctionInfo::~MachineFunctionInfo() {} + void ilist_traits::deleteNode(MachineBasicBlock *MBB) { MBB->getParent()->DeleteMachineBasicBlock(MBB); } Modified: llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp?rev=81940&r1=81939&r2=81940&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp Tue Sep 15 17:44:26 2009 @@ -32,23 +32,23 @@ X("machinemoduleinfo", "Module Information"); char MachineModuleInfo::ID = 0; +// Out of line virtual method. +MachineModuleInfoImpl::~MachineModuleInfoImpl() {} + //===----------------------------------------------------------------------===// MachineModuleInfo::MachineModuleInfo() : ImmutablePass(&ID) -, LabelIDList() -, FrameMoves() -, LandingPads() -, Personalities() +, TargetMMI(0) , CallsEHReturn(0) , CallsUnwindInit(0) -, DbgInfoAvailable(false) -{ +, DbgInfoAvailable(false) { // Always emit some info, by default "no personality" info. Personalities.push_back(NULL); } -MachineModuleInfo::~MachineModuleInfo() { +MachineModuleInfo::~MachineModuleInfo() { + delete TargetMMI; } /// doInitialization - Initialize the state for a new module. From sabre at nondot.org Tue Sep 15 17:58:36 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 15 Sep 2009 22:58:36 -0000 Subject: [llvm-commits] [llvm] r81942 - /llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Message-ID: <200909152258.n8FMwaUF022299@zion.cs.uiuc.edu> Author: lattner Date: Tue Sep 15 17:58:35 2009 New Revision: 81942 URL: http://llvm.org/viewvc/llvm-project?rev=81942&view=rev Log: strength reduce a call to PrintRelDirective(true). Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp?rev=81942&r1=81941&r2=81942&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Tue Sep 15 17:58:35 2009 @@ -160,10 +160,12 @@ // If there is a personality, we need to indicate the function's location. if (Personality) { - PrintRelDirective(true); + O << MAI->getData32bitsDirective(); + O << MAI->getPersonalityPrefix(); Asm->EmitExternalGlobal((const GlobalVariable *)(Personality)); O << MAI->getPersonalitySuffix(); + if (strcmp(MAI->getPersonalitySuffix(), "+4 at GOTPCREL")) O << "-" << MAI->getPCSymbol(); Asm->EOL("Personality"); From sabre at nondot.org Tue Sep 15 18:11:32 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 15 Sep 2009 23:11:32 -0000 Subject: [llvm-commits] [llvm] r81946 - in /llvm/trunk: include/llvm/MC/MCAsmInfo.h lib/CodeGen/AsmPrinter/AsmPrinter.cpp lib/MC/MCAsmInfo.cpp Message-ID: <200909152311.n8FNBWw7024056@zion.cs.uiuc.edu> Author: lattner Date: Tue Sep 15 18:11:32 2009 New Revision: 81946 URL: http://llvm.org/viewvc/llvm-project?rev=81946&view=rev Log: remove some horrible MAI hooks which fortunately turn out to be always empty. Modified: llvm/trunk/include/llvm/MC/MCAsmInfo.h llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp llvm/trunk/lib/MC/MCAsmInfo.cpp Modified: llvm/trunk/include/llvm/MC/MCAsmInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCAsmInfo.h?rev=81946&r1=81945&r2=81946&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCAsmInfo.h (original) +++ llvm/trunk/include/llvm/MC/MCAsmInfo.h Tue Sep 15 18:11:32 2009 @@ -84,18 +84,6 @@ /// is "l" on Darwin, currently used for some ObjC metadata. const char *LinkerPrivateGlobalPrefix; // Defaults to "" - /// GlobalVarAddrPrefix/Suffix - If these are nonempty, these strings - /// will enclose any GlobalVariable (that isn't a function) - /// - const char *GlobalVarAddrPrefix; // Defaults to "" - const char *GlobalVarAddrSuffix; // Defaults to "" - - /// FunctionAddrPrefix/Suffix - If these are nonempty, these strings - /// will enclose any GlobalVariable that points to a function. - /// - const char *FunctionAddrPrefix; // Defaults to "" - const char *FunctionAddrSuffix; // Defaults to "" - /// PersonalityPrefix/Suffix - If these are nonempty, these strings will /// enclose any personality function in the common frame section. /// @@ -365,18 +353,6 @@ const char *getLinkerPrivateGlobalPrefix() const { return LinkerPrivateGlobalPrefix; } - const char *getGlobalVarAddrPrefix() const { - return GlobalVarAddrPrefix; - } - const char *getGlobalVarAddrSuffix() const { - return GlobalVarAddrSuffix; - } - const char *getFunctionAddrPrefix() const { - return FunctionAddrPrefix; - } - const char *getFunctionAddrSuffix() const { - return FunctionAddrSuffix; - } const char *getPersonalityPrefix() const { return PersonalityPrefix; } Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=81946&r1=81945&r2=81946&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Tue Sep 15 18:11:32 2009 @@ -514,16 +514,7 @@ /// generate the appropriate value. const std::string &AsmPrinter::getGlobalLinkName(const GlobalVariable *GV, std::string &LinkName) const { - if (isa(GV)) { - LinkName += MAI->getFunctionAddrPrefix(); - LinkName += Mang->getMangledName(GV); - LinkName += MAI->getFunctionAddrSuffix(); - } else { - LinkName += MAI->getGlobalVarAddrPrefix(); - LinkName += Mang->getMangledName(GV); - LinkName += MAI->getGlobalVarAddrSuffix(); - } - + LinkName += Mang->getMangledName(GV); return LinkName; } @@ -838,18 +829,8 @@ O << CI->getZExtValue(); } else if (const GlobalValue *GV = dyn_cast(CV)) { // This is a constant address for a global variable or function. Use the - // name of the variable or function as the address value, possibly - // decorating it with GlobalVarAddrPrefix/Suffix or - // FunctionAddrPrefix/Suffix (these all default to "" ) - if (isa(GV)) { - O << MAI->getFunctionAddrPrefix() - << Mang->getMangledName(GV) - << MAI->getFunctionAddrSuffix(); - } else { - O << MAI->getGlobalVarAddrPrefix() - << Mang->getMangledName(GV) - << MAI->getGlobalVarAddrSuffix(); - } + // name of the variable or function as the address value. + O << Mang->getMangledName(GV); } else if (const ConstantExpr *CE = dyn_cast(CV)) { const TargetData *TD = TM.getTargetData(); unsigned Opcode = CE->getOpcode(); Modified: llvm/trunk/lib/MC/MCAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmInfo.cpp?rev=81946&r1=81945&r2=81946&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCAsmInfo.cpp (original) +++ llvm/trunk/lib/MC/MCAsmInfo.cpp Tue Sep 15 18:11:32 2009 @@ -30,10 +30,6 @@ GlobalPrefix = ""; PrivateGlobalPrefix = "."; LinkerPrivateGlobalPrefix = ""; - GlobalVarAddrPrefix = ""; - GlobalVarAddrSuffix = ""; - FunctionAddrPrefix = ""; - FunctionAddrSuffix = ""; PersonalityPrefix = ""; PersonalitySuffix = ""; NeedsIndirectEncoding = false; From scallanan at apple.com Tue Sep 15 18:37:51 2009 From: scallanan at apple.com (Sean Callanan) Date: Tue, 15 Sep 2009 23:37:51 -0000 Subject: [llvm-commits] [llvm] r81953 - /llvm/trunk/lib/Target/X86/X86InstrInfo.td Message-ID: <200909152337.n8FNbplE027719@zion.cs.uiuc.edu> Author: spyffe Date: Tue Sep 15 18:37:51 2009 New Revision: 81953 URL: http://llvm.org/viewvc/llvm-project?rev=81953&view=rev Log: Added far return instructions (that is, returns to code in other segments) to the Intel instruction tables. Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=81953&r1=81952&r2=81953&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Tue Sep 15 18:37:51 2009 @@ -566,6 +566,10 @@ def RETI : Ii16<0xC2, RawFrm, (outs), (ins i16imm:$amt, variable_ops), "ret\t$amt", [(X86retflag timm:$amt)]>; + def LRET : I <0xCB, RawFrm, (outs), (ins), + "lret", []>; + def LRETI : Ii16<0xCA, RawFrm, (outs), (ins i16imm:$amt), + "lret\t$amt", []>; } // All branches are RawFrm, Void, Branch, and Terminators From daniel at zuster.org Tue Sep 15 18:40:07 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 15 Sep 2009 23:40:07 -0000 Subject: [llvm-commits] [llvm] r81954 - /llvm/trunk/docs/CommandGuide/opt.pod Message-ID: <200909152340.n8FNe7iq028003@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Sep 15 18:40:07 2009 New Revision: 81954 URL: http://llvm.org/viewvc/llvm-project?rev=81954&view=rev Log: Put back non-obsolete -f sections for 'opt'. Modified: llvm/trunk/docs/CommandGuide/opt.pod Modified: llvm/trunk/docs/CommandGuide/opt.pod URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/CommandGuide/opt.pod?rev=81954&r1=81953&r2=81954&view=diff ============================================================================== --- llvm/trunk/docs/CommandGuide/opt.pod (original) +++ llvm/trunk/docs/CommandGuide/opt.pod Tue Sep 15 18:40:07 2009 @@ -38,6 +38,12 @@ =over +=item B<-f> + +Enable binary output on terminals. Normally, B will refuse to +write raw bitcode output if the output stream is a terminal. With this option, +B will write raw bitcode regardless of the output device. + =item B<-help> Print a summary of command line options. From daniel at zuster.org Tue Sep 15 18:41:43 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 15 Sep 2009 16:41:43 -0700 Subject: [llvm-commits] [llvm] r81911 - in /llvm/trunk/docs/CommandGuide: llc.pod opt.pod In-Reply-To: <7BED6F84-135F-4226-87D8-B326C8005233@apple.com> References: <200909152031.n8FKVZ4C002735@zion.cs.uiuc.edu> <7BED6F84-135F-4226-87D8-B326C8005233@apple.com> Message-ID: <6a8523d60909151641x16b28090u56c0f6128993bb4d@mail.gmail.com> Fixed, thanks. - Daniel On Tue, Sep 15, 2009 at 1:40 PM, Dan Gohman wrote: > > On Sep 15, 2009, at 1:31 PM, Daniel Dunbar wrote: > > >> Author: ddunbar >> Date: Tue Sep 15 15:31:35 2009 >> New Revision: 81911 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=81911&view=rev >> Log: >> Remove references to obsolete -f option. > > Hi Danial, the -f option isn't completely obsolete. It's been > reduced to meaning "don't suppress binary output to a tty", which > is a small part of its original meaning, but at the moment > it still does mean that. > > Dan > > From daniel at zuster.org Tue Sep 15 18:43:26 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 15 Sep 2009 16:43:26 -0700 Subject: [llvm-commits] [llvm] r80710 - in /llvm/trunk/lib: CodeGen/AsmPrinter/DwarfException.cpp Target/ARM/AsmPrinter/ARMAsmPrinter.cpp In-Reply-To: <6A35B456-A8BA-4904-A85C-02F5ABEF8406@apple.com> References: <200909011855.n81It8kt026907@zion.cs.uiuc.edu> <6a8523d60909022010h2feb03ebx5399164845f47918@mail.gmail.com> <6a8523d60909022159h1792b4c3taa44e0b552a5e5d5@mail.gmail.com> <6a8523d60909022201j5634507fh4ef373a5d1afe195@mail.gmail.com> <6a8523d60909030046x118c428ch856e2f8b8019aedf@mail.gmail.com> <6A35B456-A8BA-4904-A85C-02F5ABEF8406@apple.com> Message-ID: <6a8523d60909151643j5de93483q646e3066b0efa53e@mail.gmail.com> Done in r81912. - Daniel On Thu, Sep 3, 2009 at 9:47 AM, Chris Lattner wrote: > > On Sep 3, 2009, at 12:46 AM, Daniel Dunbar wrote: > >> On Wed, Sep 2, 2009 at 10:24 PM, Chris Lattner wrote: >>> >>> On Sep 2, 2009, at 10:01 PM, Daniel Dunbar wrote: >>>> >>>> On Wed, Sep 2, 2009 at 9:59 PM, Daniel Dunbar wrote: >>>>> >>>>> I'm happy to work on fixing this if someone has a good plan. >>>>> raw_ostream doesn't really seem to need its 64 byte buffer, for >>>>> example. When I first implemented >>>> >>>> ... the magic I-ownz-your-buffer ..., that is. >>> >>> Ah, ok, bumping it up to 64 with a comment about this seems reasonable. >> >> That seems burdensome for all callers, we should probably fix the API. >> What if we dropped the raw_ostream required buffer size to 4, since I >> think thats actually all that is required? > > Yes, that would be a much better solution, > > -chris > From daniel at zuster.org Tue Sep 15 18:45:47 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 15 Sep 2009 16:45:47 -0700 Subject: [llvm-commits] [llvm] r80929 - in /llvm/trunk: include/llvm/MC/MCAsmLexer.h lib/Target/X86/AsmParser/X86AsmParser.cpp tools/llvm-mc/AsmLexer.cpp tools/llvm-mc/AsmLexer.h tools/llvm-mc/llvm-mc.cpp In-Reply-To: <200909031715.n83HF7M8030983@zion.cs.uiuc.edu> References: <200909031715.n83HF7M8030983@zion.cs.uiuc.edu> Message-ID: <6a8523d60909151645q1344091bq37c9d2df8b5b9884@mail.gmail.com> Hi Kevin, One comment... On Thu, Sep 3, 2009 at 10:15 AM, Kevin Enderby wrote: > Author: enderby > Date: Thu Sep ?3 12:15:07 2009 > New Revision: 80929 > > URL: http://llvm.org/viewvc/llvm-project?rev=80929&view=rev > Log: > Removed the non-target independent AsmToken::Register enum constant > from MCAsmLexer.h in preparation of supporting other targets. ?Changed the > X86AsmParser code to reflect this by removing AsmLexer::LexPercent and looking > for AsmToken::Percent when parsing in places that used AsmToken::Register. > Then changed X86ATTAsmParser::ParseRegister to parse out registers as an > AsmToken::Percent followed by an AsmToken::Identifier. > ============================================================================== > --- llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp (original) > +++ llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp Thu Sep ?3 12:15:07 2009 > @@ -230,20 +230,23 @@ > > > ?bool X86ATTAsmParser::ParseRegister(X86Operand &Op) { > + ?const AsmToken &TokPercent = getLexer().getTok(); > + ?assert(TokPercent.is(AsmToken::Percent) && "Invalid token kind!"); > + ?getLexer().Lex(); // Eat percent token. > + > ? const AsmToken &Tok = getLexer().getTok(); > - ?assert(Tok.is(AsmToken::Register) && "Invalid token kind!"); > + ?assert(TokPercent.is(AsmToken::Identifier) && "Invalid token kind!"); This should be a branch not an assert (so a user error is detected), I think code like 'mov $0, %%eax' will assert currently. - Daniel From enderby at apple.com Tue Sep 15 18:52:11 2009 From: enderby at apple.com (Kevin Enderby) Date: Tue, 15 Sep 2009 16:52:11 -0700 Subject: [llvm-commits] [llvm] r80929 - in /llvm/trunk: include/llvm/MC/MCAsmLexer.h lib/Target/X86/AsmParser/X86AsmParser.cpp tools/llvm-mc/AsmLexer.cpp tools/llvm-mc/AsmLexer.h tools/llvm-mc/llvm-mc.cpp In-Reply-To: <6a8523d60909151645q1344091bq37c9d2df8b5b9884@mail.gmail.com> References: <200909031715.n83HF7M8030983@zion.cs.uiuc.edu> <6a8523d60909151645q1344091bq37c9d2df8b5b9884@mail.gmail.com> Message-ID: Yep that user error would assert currently. I'll fix it up. Thanks for the catch, Kev On Sep 15, 2009, at 4:45 PM, Daniel Dunbar wrote: > Hi Kevin, > > One comment... > > On Thu, Sep 3, 2009 at 10:15 AM, Kevin Enderby > wrote: >> Author: enderby >> Date: Thu Sep 3 12:15:07 2009 >> New Revision: 80929 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=80929&view=rev >> Log: >> Removed the non-target independent AsmToken::Register enum constant >> from MCAsmLexer.h in preparation of supporting other targets. >> Changed the >> X86AsmParser code to reflect this by removing AsmLexer::LexPercent >> and looking >> for AsmToken::Percent when parsing in places that used >> AsmToken::Register. >> Then changed X86ATTAsmParser::ParseRegister to parse out registers >> as an >> AsmToken::Percent followed by an AsmToken::Identifier. > >> ===================================================================== >> ========= >> --- llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp (original) >> +++ llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp Thu Sep >> 3 12:15:07 2009 >> @@ -230,20 +230,23 @@ >> >> >> bool X86ATTAsmParser::ParseRegister(X86Operand &Op) { >> + const AsmToken &TokPercent = getLexer().getTok(); >> + assert(TokPercent.is(AsmToken::Percent) && "Invalid token kind!"); >> + getLexer().Lex(); // Eat percent token. >> + >> const AsmToken &Tok = getLexer().getTok(); >> - assert(Tok.is(AsmToken::Register) && "Invalid token kind!"); >> + assert(TokPercent.is(AsmToken::Identifier) && "Invalid token >> kind!"); > > This should be a branch not an assert (so a user error is detected), I > think code like 'mov $0, %%eax' will assert currently. > > - Daniel From bob.wilson at apple.com Tue Sep 15 18:55:57 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Tue, 15 Sep 2009 23:55:57 -0000 Subject: [llvm-commits] [llvm] r81959 - /llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Message-ID: <200909152355.n8FNtvvN030118@zion.cs.uiuc.edu> Author: bwilson Date: Tue Sep 15 18:55:57 2009 New Revision: 81959 URL: http://llvm.org/viewvc/llvm-project?rev=81959&view=rev Log: Expand all v2f64 arithmetic operations for Neon. Radar 7200803. (This should also fix the SingleSource/UnitTests/Vector/sumarray-dbl test.) Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=81959&r1=81958&r2=81959&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Tue Sep 15 18:55:57 2009 @@ -237,6 +237,33 @@ addQRTypeForNEON(MVT::v4i32); addQRTypeForNEON(MVT::v2i64); + // v2f64 is legal so that QR subregs can be extracted as f64 elements, but + // neither Neon nor VFP support any arithmetic operations on it. + setOperationAction(ISD::FADD, MVT::v2f64, Expand); + setOperationAction(ISD::FSUB, MVT::v2f64, Expand); + setOperationAction(ISD::FMUL, MVT::v2f64, Expand); + setOperationAction(ISD::FDIV, MVT::v2f64, Expand); + setOperationAction(ISD::FREM, MVT::v2f64, Expand); + setOperationAction(ISD::FCOPYSIGN, MVT::v2f64, Expand); + setOperationAction(ISD::VSETCC, MVT::v2f64, Expand); + setOperationAction(ISD::FNEG, MVT::v2f64, Expand); + setOperationAction(ISD::FABS, MVT::v2f64, Expand); + setOperationAction(ISD::FSQRT, MVT::v2f64, Expand); + setOperationAction(ISD::FSIN, MVT::v2f64, Expand); + setOperationAction(ISD::FCOS, MVT::v2f64, Expand); + setOperationAction(ISD::FPOWI, MVT::v2f64, Expand); + setOperationAction(ISD::FPOW, MVT::v2f64, Expand); + setOperationAction(ISD::FLOG, MVT::v2f64, Expand); + setOperationAction(ISD::FLOG2, MVT::v2f64, Expand); + setOperationAction(ISD::FLOG10, MVT::v2f64, Expand); + setOperationAction(ISD::FEXP, MVT::v2f64, Expand); + setOperationAction(ISD::FEXP2, MVT::v2f64, Expand); + setOperationAction(ISD::FCEIL, MVT::v2f64, Expand); + setOperationAction(ISD::FTRUNC, MVT::v2f64, Expand); + setOperationAction(ISD::FRINT, MVT::v2f64, Expand); + setOperationAction(ISD::FNEARBYINT, MVT::v2f64, Expand); + setOperationAction(ISD::FFLOOR, MVT::v2f64, Expand); + setTargetDAGCombine(ISD::INTRINSIC_WO_CHAIN); setTargetDAGCombine(ISD::SHL); setTargetDAGCombine(ISD::SRL); From sabre at nondot.org Tue Sep 15 19:08:07 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 16 Sep 2009 00:08:07 -0000 Subject: [llvm-commits] [llvm] r81961 - /llvm/trunk/lib/Analysis/ConstantFolding.cpp Message-ID: <200909160008.n8G087nA031717@zion.cs.uiuc.edu> Author: lattner Date: Tue Sep 15 19:08:07 2009 New Revision: 81961 URL: http://llvm.org/viewvc/llvm-project?rev=81961&view=rev Log: simplify some code Modified: llvm/trunk/lib/Analysis/ConstantFolding.cpp Modified: llvm/trunk/lib/Analysis/ConstantFolding.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ConstantFolding.cpp?rev=81961&r1=81960&r2=81961&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ConstantFolding.cpp (original) +++ llvm/trunk/lib/Analysis/ConstantFolding.cpp Tue Sep 15 19:08:07 2009 @@ -379,9 +379,9 @@ return ConstantFoldCompareInstOperands(CI->getPredicate(), Ops.data(), Ops.size(), Context, TD); - else - return ConstantFoldInstOperands(I->getOpcode(), I->getType(), - Ops.data(), Ops.size(), Context, TD); + + return ConstantFoldInstOperands(I->getOpcode(), I->getType(), + Ops.data(), Ops.size(), Context, TD); } /// ConstantFoldConstantExpression - Attempt to fold the constant expression @@ -398,9 +398,8 @@ return ConstantFoldCompareInstOperands(CE->getPredicate(), Ops.data(), Ops.size(), Context, TD); - else - return ConstantFoldInstOperands(CE->getOpcode(), CE->getType(), - Ops.data(), Ops.size(), Context, TD); + return ConstantFoldInstOperands(CE->getOpcode(), CE->getType(), + Ops.data(), Ops.size(), Context, TD); } /// ConstantFoldInstOperands - Attempt to constant fold an instruction with the From sabre at nondot.org Tue Sep 15 19:08:42 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 16 Sep 2009 00:08:42 -0000 Subject: [llvm-commits] [llvm] r81962 - in /llvm/trunk: include/llvm/CodeGen/AsmPrinter.h lib/CodeGen/AsmPrinter/AsmPrinter.cpp lib/CodeGen/AsmPrinter/DwarfDebug.cpp lib/CodeGen/AsmPrinter/DwarfException.cpp Message-ID: <200909160008.n8G08gWr031800@zion.cs.uiuc.edu> Author: lattner Date: Tue Sep 15 19:08:41 2009 New Revision: 81962 URL: http://llvm.org/viewvc/llvm-project?rev=81962&view=rev Log: eliminate the horrid AsmPrinter::getGlobalLinkName method, inlining it into all of its call sites and simplifying them. Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/AsmPrinter.h?rev=81962&r1=81961&r2=81962&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/AsmPrinter.h (original) +++ llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Tue Sep 15 19:08:41 2009 @@ -159,12 +159,6 @@ /// bool isVerbose() const { return VerboseAsm; } - /// getGlobalLinkName - Returns the asm/link name of of the specified - /// global variable. Should be overridden by each target asm printer to - /// generate the appropriate value. - virtual const std::string &getGlobalLinkName(const GlobalVariable *GV, - std::string &LinkName) const; - /// EmitExternalGlobal - Emit the external reference to a global variable. /// Should be overridden if an indirect reference should be used. virtual void EmitExternalGlobal(const GlobalVariable *GV); Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=81962&r1=81961&r2=81962&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Tue Sep 15 19:08:41 2009 @@ -509,20 +509,10 @@ } } -/// getGlobalLinkName - Returns the asm/link name of of the specified -/// global variable. Should be overridden by each target asm printer to -/// generate the appropriate value. -const std::string &AsmPrinter::getGlobalLinkName(const GlobalVariable *GV, - std::string &LinkName) const { - LinkName += Mang->getMangledName(GV); - return LinkName; -} - /// EmitExternalGlobal - Emit the external reference to a global variable. /// Should be overridden if an indirect reference should be used. void AsmPrinter::EmitExternalGlobal(const GlobalVariable *GV) { - std::string GLN; - O << getGlobalLinkName(GV, GLN); + O << Mang->getMangledName(GV); } Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=81962&r1=81961&r2=81962&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Tue Sep 15 19:08:41 2009 @@ -23,6 +23,7 @@ #include "llvm/Target/TargetLoweringObjectFile.h" #include "llvm/Target/TargetRegisterInfo.h" #include "llvm/ADT/StringExtras.h" +#include "llvm/Support/Mangler.h" #include "llvm/Support/Timer.h" #include "llvm/Support/Debug.h" #include "llvm/System/Path.h" @@ -1501,9 +1502,8 @@ // Add address. DIEBlock *Block = new DIEBlock(); AddUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_addr); - std::string GLN; AddObjectLabel(Block, 0, dwarf::DW_FORM_udata, - Asm->getGlobalLinkName(DI_GV.getGlobal(), GLN)); + Asm->Mang->getMangledName(DI_GV.getGlobal())); AddBlock(VariableDie, dwarf::DW_AT_location, 0, Block); // Add to map. Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp?rev=81962&r1=81961&r2=81962&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Tue Sep 15 19:08:41 2009 @@ -872,8 +872,7 @@ PrintRelDirective(); if (GV) { - std::string GLN; - O << Asm->getGlobalLinkName(GV, GLN); + O << Asm->Mang->getMangledName(GV); } else { O << "0x0"; } From sabre at nondot.org Tue Sep 15 19:14:19 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 16 Sep 2009 00:14:19 -0000 Subject: [llvm-commits] [llvm] r81965 - in /llvm/trunk/lib/Target/PowerPC: AsmPrinter/PPCAsmPrinter.cpp PPCMCAsmInfo.cpp Message-ID: <200909160014.n8G0EJwT032526@zion.cs.uiuc.edu> Author: lattner Date: Tue Sep 15 19:14:19 2009 New Revision: 81965 URL: http://llvm.org/viewvc/llvm-project?rev=81965&view=rev Log: eliminate the PPC backend's implementation of EmitExternalGlobal and use PersonalityPrefix/Suffix to achieve the same effect (like the x86 backend). This changes the code generated for ppc static mode, but guess what, we were generating this before: .byte 0x9B ; Personality (indirect pcrel sdata4) .long ___gxx_personality_v0-. ; Personality which is not correct! (it is not an 'indirect' reference). Modified: llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp llvm/trunk/lib/Target/PowerPC/PPCMCAsmInfo.cpp Modified: llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp?rev=81965&r1=81964&r2=81965&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp Tue Sep 15 19:14:19 2009 @@ -341,8 +341,6 @@ const char *Modifier); virtual bool runOnMachineFunction(MachineFunction &F) = 0; - - virtual void EmitExternalGlobal(const GlobalVariable *GV); }; /// PPCLinuxAsmPrinter - PowerPC assembly printer, customized for Linux @@ -462,19 +460,6 @@ } } -/// EmitExternalGlobal - In this case we need to use the indirect symbol. -/// -void PPCAsmPrinter::EmitExternalGlobal(const GlobalVariable *GV) { - std::string Name; - - if (TM.getRelocationModel() != Reloc::Static) { - Name = Mang->getMangledName(GV, "$non_lazy_ptr", true); - } else { - Name = Mang->getMangledName(GV); - } - O << Name; -} - /// PrintAsmOperand - Print out an operand for an inline asm expression. /// bool PPCAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, Modified: llvm/trunk/lib/Target/PowerPC/PPCMCAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCMCAsmInfo.cpp?rev=81965&r1=81964&r2=81965&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCMCAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCMCAsmInfo.cpp Tue Sep 15 19:14:19 2009 @@ -22,6 +22,9 @@ if (!is64Bit) Data64bitsDirective = 0; // We can't emit a 64-bit unit in PPC32 mode. AssemblerDialect = 1; // New-Style mnemonics. + + PersonalityPrefix = "L"; + PersonalitySuffix = "$non_lazy_ptr"; } PPCLinuxMCAsmInfo::PPCLinuxMCAsmInfo(bool is64Bit) { From bob.wilson at apple.com Tue Sep 15 19:17:29 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Wed, 16 Sep 2009 00:17:29 -0000 Subject: [llvm-commits] [llvm] r81966 - /llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Message-ID: <200909160017.n8G0HTrW000498@zion.cs.uiuc.edu> Author: bwilson Date: Tue Sep 15 19:17:28 2009 New Revision: 81966 URL: http://llvm.org/viewvc/llvm-project?rev=81966&view=rev Log: Neon does not support vector divide or remainder. Expand them. Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=81966&r1=81965&r2=81966&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Tue Sep 15 19:17:28 2009 @@ -99,6 +99,14 @@ AddPromotedToType (ISD::XOR, VT.getSimpleVT(), PromotedBitwiseVT.getSimpleVT()); } + + // Neon does not support vector divide/remainder operations. + setOperationAction(ISD::SDIV, VT.getSimpleVT(), Expand); + setOperationAction(ISD::UDIV, VT.getSimpleVT(), Expand); + setOperationAction(ISD::FDIV, VT.getSimpleVT(), Expand); + setOperationAction(ISD::SREM, VT.getSimpleVT(), Expand); + setOperationAction(ISD::UREM, VT.getSimpleVT(), Expand); + setOperationAction(ISD::FREM, VT.getSimpleVT(), Expand); } void ARMTargetLowering::addDRTypeForNEON(EVT VT) { From sabre at nondot.org Tue Sep 15 19:17:39 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 16 Sep 2009 00:17:39 -0000 Subject: [llvm-commits] [llvm] r81967 - in /llvm/trunk: include/llvm/CodeGen/AsmPrinter.h lib/CodeGen/AsmPrinter/AsmPrinter.cpp lib/CodeGen/AsmPrinter/DwarfException.cpp Message-ID: <200909160017.n8G0Hde1000531@zion.cs.uiuc.edu> Author: lattner Date: Tue Sep 15 19:17:39 2009 New Revision: 81967 URL: http://llvm.org/viewvc/llvm-project?rev=81967&view=rev Log: Eliminate AsmPrinter::EmitExternalGlobal, inlining its (now) one implementation into its one caller. This eliminates a totally awesome and gratuitous hack where we casted a Function* to GlobalVariable*. Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/AsmPrinter.h?rev=81967&r1=81966&r2=81967&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/AsmPrinter.h (original) +++ llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Tue Sep 15 19:17:39 2009 @@ -159,10 +159,6 @@ /// bool isVerbose() const { return VerboseAsm; } - /// EmitExternalGlobal - Emit the external reference to a global variable. - /// Should be overridden if an indirect reference should be used. - virtual void EmitExternalGlobal(const GlobalVariable *GV); - /// getCurrentFunctionEHName - Called to return the CurrentFnEHName. /// std::string getCurrentFunctionEHName(const MachineFunction *MF) const; Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=81967&r1=81966&r2=81967&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Tue Sep 15 19:17:39 2009 @@ -509,13 +509,6 @@ } } -/// EmitExternalGlobal - Emit the external reference to a global variable. -/// Should be overridden if an indirect reference should be used. -void AsmPrinter::EmitExternalGlobal(const GlobalVariable *GV) { - O << Mang->getMangledName(GV); -} - - //===----------------------------------------------------------------------===// /// LEB 128 number encoding. Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp?rev=81967&r1=81966&r2=81967&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Tue Sep 15 19:17:39 2009 @@ -163,7 +163,7 @@ O << MAI->getData32bitsDirective(); O << MAI->getPersonalityPrefix(); - Asm->EmitExternalGlobal((const GlobalVariable *)(Personality)); + O << Asm->Mang->getMangledName(Personality); O << MAI->getPersonalitySuffix(); if (strcmp(MAI->getPersonalitySuffix(), "+4 at GOTPCREL")) From sabre at nondot.org Tue Sep 15 19:24:31 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 16 Sep 2009 00:24:31 -0000 Subject: [llvm-commits] [llvm] r81968 - /llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Message-ID: <200909160024.n8G0OVq0001386@zion.cs.uiuc.edu> Author: lattner Date: Tue Sep 15 19:24:31 2009 New Revision: 81968 URL: http://llvm.org/viewvc/llvm-project?rev=81968&view=rev Log: remove a dead bool. Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/AsmPrinter.h?rev=81968&r1=81967&r2=81968&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/AsmPrinter.h (original) +++ llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Tue Sep 15 19:24:31 2009 @@ -134,11 +134,6 @@ /// bool VerboseAsm; - /// ExuberantAsm - Emit many more comments in assembly output if - /// this is true. - /// - bool ExuberantAsm; - /// Private state for PrintSpecial() // Assign a unique ID to this machine instruction. mutable const MachineInstr *LastMI; From bob.wilson at apple.com Tue Sep 15 19:32:15 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Wed, 16 Sep 2009 00:32:15 -0000 Subject: [llvm-commits] [llvm] r81969 - /llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Message-ID: <200909160032.n8G0WFQs002345@zion.cs.uiuc.edu> Author: bwilson Date: Tue Sep 15 19:32:15 2009 New Revision: 81969 URL: http://llvm.org/viewvc/llvm-project?rev=81969&view=rev Log: Expand some more vector operations not supported by Neon. Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=81969&r1=81968&r2=81969&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Tue Sep 15 19:32:15 2009 @@ -272,6 +272,12 @@ setOperationAction(ISD::FNEARBYINT, MVT::v2f64, Expand); setOperationAction(ISD::FFLOOR, MVT::v2f64, Expand); + // Neon does not support some operations on v1i64 and v2i64 types. + setOperationAction(ISD::MUL, MVT::v1i64, Expand); + setOperationAction(ISD::MUL, MVT::v2i64, Expand); + setOperationAction(ISD::VSETCC, MVT::v1i64, Expand); + setOperationAction(ISD::VSETCC, MVT::v2i64, Expand); + setTargetDAGCombine(ISD::INTRINSIC_WO_CHAIN); setTargetDAGCombine(ISD::SHL); setTargetDAGCombine(ISD::SRL); From sabre at nondot.org Tue Sep 15 19:35:39 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 16 Sep 2009 00:35:39 -0000 Subject: [llvm-commits] [llvm] r81970 - in /llvm/trunk: include/llvm/CodeGen/AsmPrinter.h lib/CodeGen/AsmPrinter/AsmPrinter.cpp lib/CodeGen/AsmPrinter/DwarfException.cpp Message-ID: <200909160035.n8G0Zd0X002778@zion.cs.uiuc.edu> Author: lattner Date: Tue Sep 15 19:35:39 2009 New Revision: 81970 URL: http://llvm.org/viewvc/llvm-project?rev=81970&view=rev Log: inline AsmPrinter::getCurrentFunctionEHName into its only caller. Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/AsmPrinter.h?rev=81970&r1=81969&r2=81970&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/AsmPrinter.h (original) +++ llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Tue Sep 15 19:35:39 2009 @@ -154,10 +154,6 @@ /// bool isVerbose() const { return VerboseAsm; } - /// getCurrentFunctionEHName - Called to return the CurrentFnEHName. - /// - std::string getCurrentFunctionEHName(const MachineFunction *MF) const; - /// getFunctionNumber - Return a unique ID for the current function. /// unsigned getFunctionNumber() const { return FunctionNumber; } Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=81970&r1=81969&r2=81970&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Tue Sep 15 19:35:39 2009 @@ -212,21 +212,13 @@ return false; } -std::string -AsmPrinter::getCurrentFunctionEHName(const MachineFunction *MF) const { - assert(MF && "No machine function?"); - return Mang->getMangledName(MF->getFunction(), ".eh", - MAI->is_EHSymbolPrivate()); -} - void AsmPrinter::SetupMachineFunction(MachineFunction &MF) { // What's my mangled name? CurrentFnName = Mang->getMangledName(MF.getFunction()); IncrementFunctionNumber(); - if (VerboseAsm) { + if (VerboseAsm) LI = &getAnalysis(); - } } namespace { Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp?rev=81970&r1=81969&r2=81970&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Tue Sep 15 19:35:39 2009 @@ -960,9 +960,12 @@ EmitLabel("eh_func_end", SubprogramCount); EmitExceptionTable(); + std::string FunctionEHName = + Asm->Mang->getMangledName(MF->getFunction(), ".eh", + Asm->MAI->is_EHSymbolPrivate()); + // Save EH frame information - EHFrames.push_back(FunctionEHFrameInfo(getAsm()->getCurrentFunctionEHName(MF), - SubprogramCount, + EHFrames.push_back(FunctionEHFrameInfo(FunctionEHName, SubprogramCount, MMI->getPersonalityIndex(), MF->getFrameInfo()->hasCalls(), !MMI->getLandingPads().empty(), From scallanan at apple.com Tue Sep 15 20:13:52 2009 From: scallanan at apple.com (Sean Callanan) Date: Wed, 16 Sep 2009 01:13:52 -0000 Subject: [llvm-commits] [llvm] r81979 - in /llvm/trunk/lib/Target/X86: X86InstrFPStack.td X86InstrSSE.td Message-ID: <200909160113.n8G1DrB2007707@zion.cs.uiuc.edu> Author: spyffe Date: Tue Sep 15 20:13:52 2009 New Revision: 81979 URL: http://llvm.org/viewvc/llvm-project?rev=81979&view=rev Log: Added a variety of floating-point and SSE instructions. All of these do not have patterns (they're for the disassembler). Many of the floating-point instructions will probably be rolled into definitions that have patterns, and may eventually be superseded by mdefs. So I put them together and left a comment. Modified: llvm/trunk/lib/Target/X86/X86InstrFPStack.td llvm/trunk/lib/Target/X86/X86InstrSSE.td Modified: llvm/trunk/lib/Target/X86/X86InstrFPStack.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrFPStack.td?rev=81979&r1=81978&r2=81979&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrFPStack.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrFPStack.td Tue Sep 15 20:13:52 2009 @@ -303,6 +303,36 @@ } def TST_F : FPI<0xE4, RawFrm, (outs), (ins), "ftst">, D9; +// Versions of FP instructions that take a single memory operand. Added for the +// disassembler; remove as they are included with patterns elsewhere. +def FCOM32m : FPI<0xD8, MRM2m, (outs), (ins f32mem:$src), "fcom\t$src">; +def FCOMP32m : FPI<0xD8, MRM3m, (outs), (ins f32mem:$src), "fcomp\t$src">; + +def FLDENVm : FPI<0xD9, MRM4m, (outs), (ins f32mem:$src), "fldenv\t$src">; +def FSTENVm : FPI<0xD9, MRM6m, (outs f32mem:$dst), (ins), "fstenv\t$dst">; + +def FICOM32m : FPI<0xDA, MRM2m, (outs), (ins i32mem:$src), "ficom{l}\t$src">; +def FICOMP32m: FPI<0xDA, MRM3m, (outs), (ins i32mem:$src), "ficomp{l}\t$src">; + +def FCOM64m : FPI<0xDC, MRM2m, (outs), (ins f64mem:$src), "fcom\t$src">; +def FCOMP64m : FPI<0xDC, MRM3m, (outs), (ins f64mem:$src), "fcomp\t$src">; + +def FLD64m : FPI<0xDD, MRM0m, (outs), (ins f64mem:$src), "fld\t$src">; +def FISTTP32m: FPI<0xDD, MRM1m, (outs i32mem:$dst), (ins), "fisttp{l}\t$dst">; +def FST64m : FPI<0xDD, MRM2m, (outs f64mem:$dst), (ins), "fst\t$dst">; +def FSTP64m : FPI<0xDD, MRM3m, (outs f64mem:$dst), (ins), "fld\t$dst">; +def FRSTORm : FPI<0xDD, MRM4m, (outs f32mem:$dst), (ins), "frstor\t$dst">; +def FSAVEm : FPI<0xDD, MRM6m, (outs f32mem:$dst), (ins), "fsave\t$dst">; +def FSTSWm : FPI<0xDD, MRM7m, (outs f32mem:$dst), (ins), "fstsw\t$dst">; + +def FICOM16m : FPI<0xDE, MRM2m, (outs), (ins i16mem:$src), "ficom{w}\t$src">; +def FICOMP16m: FPI<0xDE, MRM3m, (outs), (ins i16mem:$src), "ficomp{w}\t$src">; + +def FBLDm : FPI<0xDF, MRM4m, (outs), (ins f32mem:$src), "fbld\t$src">; +def FILD64m : FPI<0xDF, MRM5m, (outs), (ins i64mem:$src), "fild{q}\t$src">; +def FBSTPm : FPI<0xDF, MRM6m, (outs f32mem:$dst), (ins), "fbstp\t$dst">; +def FISTP64m : FPI<0xDF, MRM7m, (outs i64mem:$dst), (ins), "fistp{q}\t$dst">; + // Floating point cmovs. multiclass FPCMov { def _Fp32 : FpIf32<(outs RFP32:$dst), (ins RFP32:$src1, RFP32:$src2), Modified: llvm/trunk/lib/Target/X86/X86InstrSSE.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrSSE.td?rev=81979&r1=81978&r2=81979&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrSSE.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrSSE.td Tue Sep 15 20:13:52 2009 @@ -1096,6 +1096,27 @@ "cvtsi2sd\t{$src, $dst|$dst, $src}", [(set FR64:$dst, (sint_to_fp (loadi32 addr:$src)))]>; +def CVTPD2DQrm : S3DI<0xE6, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), + "cvtpd2dq\t{$src, $dst|$dst, $src}", []>; +def CVTPD2DQrr : S3DI<0xE6, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), + "cvtpd2dq\t{$src, $dst|$dst, $src}", []>; +def CVTDQ2PDrm : S3SI<0xE6, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), + "cvtdq2pd\t{$src, $dst|$dst, $src}", []>; +def CVTDQ2PDrr : S3SI<0xE6, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), + "cvtdq2pd\t{$src, $dst|$dst, $src}", []>; +def CVTPS2DQrr : PDI<0x5B, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), + "cvtps2dq\t{$src, $dst|$dst, $src}", []>; +def CVTPS2DQrm : PDI<0x5B, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), + "cvtps2dq\t{$src, $dst|$dst, $src}", []>; +def CVTDQ2PSrr : PSI<0x5B, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), + "cvtdq2ps\t{$src, $dst|$dst, $src}", []>; +def CVTDQ2PSrm : PSI<0x5B, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), + "cvtdq2ps\t{$src, $dst|$dst, $src}", []>; +def COMISDrr: PDI<0x2F, MRMSrcReg, (outs), (ins VR128:$src1, VR128:$src2), + "comisd\t{$src2, $src1|$src1, $src2}", []>; +def COMISDrm: PDI<0x2F, MRMSrcMem, (outs), (ins VR128:$src1, f128mem:$src2), + "comisd\t{$src2, $src1|$src1, $src2}", []>; + // SSE2 instructions with XS prefix def CVTSS2SDrr : I<0x5A, MRMSrcReg, (outs FR64:$dst), (ins FR32:$src), "cvtss2sd\t{$src, $dst|$dst, $src}", From sabre at nondot.org Tue Sep 15 20:26:31 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 16 Sep 2009 01:26:31 -0000 Subject: [llvm-commits] [llvm] r81984 - in /llvm/trunk: include/llvm/MC/MCExpr.h lib/MC/MCExpr.cpp Message-ID: <200909160126.n8G1QWGf009371@zion.cs.uiuc.edu> Author: lattner Date: Tue Sep 15 20:26:31 2009 New Revision: 81984 URL: http://llvm.org/viewvc/llvm-project?rev=81984&view=rev Log: add a helper method for creating MCSymbol and MCSymbolRefExpr at the same time. Modified: llvm/trunk/include/llvm/MC/MCExpr.h llvm/trunk/lib/MC/MCExpr.cpp Modified: llvm/trunk/include/llvm/MC/MCExpr.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCExpr.h?rev=81984&r1=81983&r2=81984&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCExpr.h (original) +++ llvm/trunk/include/llvm/MC/MCExpr.h Tue Sep 15 20:26:31 2009 @@ -19,6 +19,7 @@ class MCSymbol; class MCValue; class raw_ostream; +class StringRef; /// MCExpr - Base class for the full range of assembler expressions which are /// needed for parsing. @@ -119,7 +120,10 @@ /// @{ static const MCSymbolRefExpr *Create(const MCSymbol *Symbol, MCContext &Ctx); - + static const MCSymbolRefExpr *Create(const StringRef &Name, MCContext &Ctx); + + + /// @} /// @name Accessors /// @{ Modified: llvm/trunk/lib/MC/MCExpr.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCExpr.cpp?rev=81984&r1=81983&r2=81984&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCExpr.cpp (original) +++ llvm/trunk/lib/MC/MCExpr.cpp Tue Sep 15 20:26:31 2009 @@ -133,6 +133,12 @@ return new (Ctx) MCSymbolRefExpr(Sym); } +const MCSymbolRefExpr *MCSymbolRefExpr::Create(const StringRef &Name, + MCContext &Ctx) { + return Create(Ctx.GetOrCreateSymbol(Name), Ctx); +} + + /* *** */ bool MCExpr::EvaluateAsAbsolute(MCContext &Ctx, int64_t &Res) const { From sabre at nondot.org Tue Sep 15 20:29:11 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 16 Sep 2009 01:29:11 -0000 Subject: [llvm-commits] [llvm] r81985 - in /llvm/trunk/lib/ExecutionEngine/JIT: JITDwarfEmitter.cpp JITDwarfEmitter.h Message-ID: <200909160129.n8G1TBxh009699@zion.cs.uiuc.edu> Author: lattner Date: Tue Sep 15 20:29:11 2009 New Revision: 81985 URL: http://llvm.org/viewvc/llvm-project?rev=81985&view=rev Log: remove a dead variable. Modified: llvm/trunk/lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp llvm/trunk/lib/ExecutionEngine/JIT/JITDwarfEmitter.h Modified: llvm/trunk/lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp?rev=81985&r1=81984&r2=81985&view=diff ============================================================================== --- llvm/trunk/lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp (original) +++ llvm/trunk/lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp Tue Sep 15 20:29:11 2009 @@ -39,7 +39,6 @@ unsigned char* EndFunction) { const TargetMachine& TM = F.getTarget(); TD = TM.getTargetData(); - needsIndirectEncoding = TM.getMCAsmInfo()->getNeedsIndirectEncoding(); stackGrowthDirection = TM.getFrameInfo()->getStackGrowthDirection(); RI = TM.getRegisterInfo(); JCE = &jce; @@ -608,7 +607,6 @@ unsigned char* EndFunction) { const TargetMachine& TM = F.getTarget(); TD = TM.getTargetData(); - needsIndirectEncoding = TM.getMCAsmInfo()->getNeedsIndirectEncoding(); stackGrowthDirection = TM.getFrameInfo()->getStackGrowthDirection(); RI = TM.getRegisterInfo(); JCE = &jce; Modified: llvm/trunk/lib/ExecutionEngine/JIT/JITDwarfEmitter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JITDwarfEmitter.h?rev=81985&r1=81984&r2=81985&view=diff ============================================================================== --- llvm/trunk/lib/ExecutionEngine/JIT/JITDwarfEmitter.h (original) +++ llvm/trunk/lib/ExecutionEngine/JIT/JITDwarfEmitter.h Tue Sep 15 20:29:11 2009 @@ -32,7 +32,6 @@ const TargetRegisterInfo* RI; MachineModuleInfo* MMI; JIT& Jit; - bool needsIndirectEncoding; bool stackGrowthDirection; unsigned char* EmitExceptionTable(MachineFunction* MF, From daniel at zuster.org Tue Sep 15 20:34:53 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 16 Sep 2009 01:34:53 -0000 Subject: [llvm-commits] [llvm] r81987 - in /llvm/trunk/utils/lit: LitFormats.py TestFormats.py Message-ID: <200909160134.n8G1Yreo010423@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Sep 15 20:34:52 2009 New Revision: 81987 URL: http://llvm.org/viewvc/llvm-project?rev=81987&view=rev Log: lit: Add a custom test format for use in clang. Modified: llvm/trunk/utils/lit/LitFormats.py llvm/trunk/utils/lit/TestFormats.py Modified: llvm/trunk/utils/lit/LitFormats.py URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/LitFormats.py?rev=81987&r1=81986&r2=81987&view=diff ============================================================================== --- llvm/trunk/utils/lit/LitFormats.py (original) +++ llvm/trunk/utils/lit/LitFormats.py Tue Sep 15 20:34:52 2009 @@ -1,2 +1,2 @@ -from TestFormats import GoogleTest, ShTest, TclTest +from TestFormats import GoogleTest, ShTest, TclTest, SyntaxCheckTest Modified: llvm/trunk/utils/lit/TestFormats.py URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/TestFormats.py?rev=81987&r1=81986&r2=81987&view=diff ============================================================================== --- llvm/trunk/utils/lit/TestFormats.py (original) +++ llvm/trunk/utils/lit/TestFormats.py Tue Sep 15 20:34:52 2009 @@ -89,3 +89,56 @@ class TclTest(FileBasedTest): def execute(self, test, litConfig): return TestRunner.executeTclTest(test, litConfig) + +### + +import re +import tempfile + +class SyntaxCheckTest: + # FIXME: Refactor into generic test for running some command on a directory + # of inputs. + + def __init__(self, compiler, dir, recursive, pattern, extra_cxx_args=[]): + self.compiler = str(compiler) + self.dir = str(dir) + self.recursive = bool(recursive) + self.pattern = re.compile(pattern) + self.extra_cxx_args = list(extra_cxx_args) + + def getTestsInDirectory(self, testSuite, path_in_suite, + litConfig, localConfig): + for dirname,subdirs,filenames in os.walk(self.dir): + if not self.recursive: + subdirs[:] = [] + + for filename in filenames: + if (not self.pattern.match(filename) or + filename in localConfig.excludes): + continue + + path = os.path.join(dirname,filename) + suffix = path[len(self.dir):] + if suffix.startswith(os.sep): + suffix = suffix[1:] + test = Test.Test(testSuite, + path_in_suite + tuple(suffix.split(os.sep)), + localConfig) + # FIXME: Hack? + test.source_path = path + yield test + + def execute(self, test, litConfig): + tmp = tempfile.NamedTemporaryFile(suffix='.cpp') + print >>tmp, '#include "%s"' % test.source_path + tmp.flush() + + cmd = [self.compiler, '-x', 'c++', '-fsyntax-only', tmp.name] + cmd.extend(self.extra_cxx_args) + out, err, exitCode = TestRunner.executeCommand(cmd) + + diags = out + err + if not exitCode and not diags.strip(): + return Test.PASS,'' + + return Test.FAIL, diags From vhernandez at apple.com Tue Sep 15 20:37:48 2009 From: vhernandez at apple.com (Victor Hernandez) Date: Tue, 15 Sep 2009 18:37:48 -0700 Subject: [llvm-commits] [PATCH] extend SelectionDAGBuild to treat malloc calls the same as MallocInst (patch #4) In-Reply-To: References: <05892D6F-5D3B-45FD-8FA0-82EB6A686B63@apple.com> Message-ID: <669A9FAC-73A2-4782-B5A1-0F8C97DB0C60@apple.com> On Sep 15, 2009, at 2:39 PM, Eli Friedman wrote: > On Tue, Sep 15, 2009 at 1:44 PM, Victor Hernandez > wrote: >> SelectionDAGBuild is the only pass in CodeGen that handles MallocInst >> specially. This patch extends that code to handle malloc calls also. > > This part is both wrong and not necessary. > Eli, Thanks for the feedback. I was under the impression that visitMalloc() did something malloc- specific that was needed even when using a malloc call and bitcast instead of MallocInst. Looking at the code, I see that visitCall() and visitBitCast() do all that is necessary for SelectionDAG translating. Do you have any thoughts on the 3 other patches I sent out? thanks, Victor From sabre at nondot.org Tue Sep 15 20:47:02 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 16 Sep 2009 01:47:02 -0000 Subject: [llvm-commits] [llvm] r81991 - in /llvm/trunk: include/llvm/MC/MCAsmInfo.h include/llvm/Target/TargetLoweringObjectFile.h lib/CodeGen/AsmPrinter/DwarfException.cpp lib/MC/MCAsmInfo.cpp lib/MC/MCAsmInfoDarwin.cpp lib/Target/PowerPC/PPCMCAsmInfo.cpp lib/Target/TargetLoweringObjectFile.cpp lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86MCAsmInfo.cpp lib/Target/X86/X86TargetObjectFile.cpp lib/Target/X86/X86TargetObjectFile.h Message-ID: <200909160147.n8G1lBVu011949@zion.cs.uiuc.edu> Author: lattner Date: Tue Sep 15 20:46:41 2009 New Revision: 81991 URL: http://llvm.org/viewvc/llvm-project?rev=81991&view=rev Log: Big change #1 for personality function references: Eliminate the PersonalityPrefix/Suffix & NeedsIndirectEncoding fields from MAI: they aren't part of the asm syntax, they are related to the structure of the object file. To replace their functionality, add a new TLOF::getSymbolForDwarfGlobalReference method which asks targets to decide how to reference a global from EH in a pc-relative way. The default implementation just returns the symbol. The default darwin implementation references the symbol through an indirect $non_lazy_ptr stub. The bizarro x86-64 darwin specialization handles the weird "foo at GOTPCREL+4" hack. DwarfException.cpp now uses this to emit the reference to the symbol in the right way, and this also eliminates another horrible hack from DwarfException.cpp: - if (strcmp(MAI->getPersonalitySuffix(), "+4 at GOTPCREL")) - O << "-" << MAI->getPCSymbol(); Added: llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp llvm/trunk/lib/Target/X86/X86TargetObjectFile.h Modified: llvm/trunk/include/llvm/MC/MCAsmInfo.h llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp llvm/trunk/lib/MC/MCAsmInfo.cpp llvm/trunk/lib/MC/MCAsmInfoDarwin.cpp llvm/trunk/lib/Target/PowerPC/PPCMCAsmInfo.cpp llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.cpp llvm/trunk/lib/Target/X86/X86MCAsmInfo.cpp Modified: llvm/trunk/include/llvm/MC/MCAsmInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCAsmInfo.h?rev=81991&r1=81990&r2=81991&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCAsmInfo.h (original) +++ llvm/trunk/include/llvm/MC/MCAsmInfo.h Tue Sep 15 20:46:41 2009 @@ -84,17 +84,6 @@ /// is "l" on Darwin, currently used for some ObjC metadata. const char *LinkerPrivateGlobalPrefix; // Defaults to "" - /// PersonalityPrefix/Suffix - If these are nonempty, these strings will - /// enclose any personality function in the common frame section. - /// - const char *PersonalityPrefix; // Defaults to "" - const char *PersonalitySuffix; // Defaults to "" - - /// NeedsIndirectEncoding - If set, we need to set the indirect encoding bit - /// for EH in Dwarf. - /// - bool NeedsIndirectEncoding; // Defaults to false - /// InlineAsmStart/End - If these are nonempty, they contain a directive to /// emit before and after an inline assembly statement. const char *InlineAsmStart; // Defaults to "#APP\n" @@ -353,15 +342,6 @@ const char *getLinkerPrivateGlobalPrefix() const { return LinkerPrivateGlobalPrefix; } - const char *getPersonalityPrefix() const { - return PersonalityPrefix; - } - const char *getPersonalitySuffix() const { - return PersonalitySuffix; - } - bool getNeedsIndirectEncoding() const { - return NeedsIndirectEncoding; - } const char *getInlineAsmStart() const { return InlineAsmStart; } Modified: llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h?rev=81991&r1=81990&r2=81991&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h (original) +++ llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h Tue Sep 15 20:46:41 2009 @@ -26,6 +26,7 @@ class StringRef; class TargetMachine; class MCAsmInfo; + class MCExpr; class TargetLoweringObjectFile { MCContext *Ctx; @@ -173,6 +174,22 @@ return 0; } + /// getSymbolForDwarfGlobalReference - Return an MCExpr to use for a + /// pc-relative reference to the specified global variable from exception + /// handling information. In addition to the symbol, this returns + /// by-reference: + /// + /// IsIndirect - True if the returned symbol is actually a stub that contains + /// the address of the symbol, false if the symbol is the global itself. + /// + /// IsPCRel - True if the symbol reference is already pc-relative, false if + /// the caller needs to subtract off the address of the reference from the + /// symbol. + /// + virtual const MCExpr * + getSymbolForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang, + bool &IsIndirect, bool &IsPCRel) const; + protected: virtual const MCSection * SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind, @@ -298,6 +315,12 @@ const MCSection *getNonLazySymbolPointerSection() const { return NonLazySymbolPointerSection; } + + /// getSymbolForDwarfGlobalReference - The mach-o version of this method + /// defaults to returning a stub reference. + virtual const MCExpr * + getSymbolForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang, + bool &IsIndirect, bool &IsPCRel) const; }; Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp?rev=81991&r1=81990&r2=81991&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Tue Sep 15 20:46:41 2009 @@ -17,9 +17,11 @@ #include "llvm/CodeGen/MachineFrameInfo.h" #include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineLocation.h" +#include "llvm/MC/MCAsmInfo.h" +#include "llvm/MC/MCContext.h" +#include "llvm/MC/MCExpr.h" #include "llvm/MC/MCSection.h" #include "llvm/MC/MCStreamer.h" -#include "llvm/MC/MCAsmInfo.h" #include "llvm/Target/TargetData.h" #include "llvm/Target/TargetFrameInfo.h" #include "llvm/Target/TargetLoweringObjectFile.h" @@ -75,20 +77,22 @@ /// EmitCIE - Emit a Common Information Entry (CIE). This holds information that /// is shared among many Frame Description Entries. There is at least one CIE /// in every non-empty .debug_frame section. -void DwarfException::EmitCIE(const Function *Personality, unsigned Index) { +void DwarfException::EmitCIE(const Function *PersonalityFn, unsigned Index) { // Size and sign of stack growth. int stackGrowth = Asm->TM.getFrameInfo()->getStackGrowthDirection() == TargetFrameInfo::StackGrowsUp ? TD->getPointerSize() : -TD->getPointerSize(); + const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering(); + // Begin eh frame section. - Asm->OutStreamer.SwitchSection(Asm->getObjFileLowering().getEHFrameSection()); + Asm->OutStreamer.SwitchSection(TLOF.getEHFrameSection()); if (MAI->is_EHSymbolPrivate()) O << MAI->getPrivateGlobalPrefix(); - O << "EH_frame" << Index << ":\n"; + EmitLabel("section_eh_frame", Index); // Define base labels. @@ -107,11 +111,22 @@ Asm->EOL("CIE Version"); // The personality presence indicates that language specific information will - // show up in the eh frame. - - // FIXME: Don't hardcode these encodings. + // show up in the eh frame. Find out how we are supposed to lower the + // personality function reference: + const MCExpr *PersonalityRef = 0; + bool IsPersonalityIndirect = false, IsPersonalityPCRel = false; + if (PersonalityFn) { + // FIXME: HANDLE STATIC CODEGEN MODEL HERE. + + // In non-static mode, ask the object file how to represent this reference. + PersonalityRef = + TLOF.getSymbolForDwarfGlobalReference(PersonalityFn, Asm->Mang, + IsPersonalityIndirect, + IsPersonalityPCRel); + } + unsigned PerEncoding = dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4; - if (Personality && MAI->getNeedsIndirectEncoding()) + if (IsPersonalityIndirect) PerEncoding |= dwarf::DW_EH_PE_indirect; unsigned LSDAEncoding = dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4; unsigned FDEEncoding = dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4; @@ -120,7 +135,7 @@ unsigned AugmentationSize = 0; char *APtr = Augmentation + 1; - if (Personality) { + if (PersonalityRef) { // There is a personality function. *APtr++ = 'P'; AugmentationSize += 1 + SizeOfEncodedValue(PerEncoding); @@ -159,15 +174,27 @@ Asm->EOL("Personality", PerEncoding); // If there is a personality, we need to indicate the function's location. - if (Personality) { - O << MAI->getData32bitsDirective(); - - O << MAI->getPersonalityPrefix(); - O << Asm->Mang->getMangledName(Personality); - O << MAI->getPersonalitySuffix(); + if (PersonalityRef) { + // If the reference to the personality function symbol is not already + // pc-relative, then we need to subtract our current address from it. Do + // this by emitting a label and subtracting it from the expression we + // already have. This is equivalent to emitting "foo - .", but we have to + // emit the label for "." directly. + if (!IsPersonalityPCRel) { + SmallString<64> Name; + raw_svector_ostream(Name) << MAI->getPrivateGlobalPrefix() + << "personalityref_addr" << Asm->getFunctionNumber() << "_" << Index; + MCSymbol *DotSym = Asm->OutContext.GetOrCreateSymbol(Name.str()); + Asm->OutStreamer.EmitLabel(DotSym); + + PersonalityRef = + MCBinaryExpr::CreateSub(PersonalityRef, + MCSymbolRefExpr::Create(DotSym,Asm->OutContext), + Asm->OutContext); + } - if (strcmp(MAI->getPersonalitySuffix(), "+4 at GOTPCREL")) - O << "-" << MAI->getPCSymbol(); + O << MAI->getData32bitsDirective(); + PersonalityRef->print(O, MAI); Asm->EOL("Personality"); Asm->EmitInt8(LSDAEncoding); @@ -185,8 +212,7 @@ // On Darwin the linker honors the alignment of eh_frame, which means it must // be 8-byte on 64-bit targets to match what gcc does. Otherwise you get // holes which confuse readers of eh_frame. - Asm->EmitAlignment(TD->getPointerSize() == sizeof(int32_t) ? 2 : 3, - 0, 0, false); + Asm->EmitAlignment(TD->getPointerSize() == 4 ? 2 : 3, 0, 0, false); EmitLabel("eh_frame_common_end", Index); Asm->EOL(); Modified: llvm/trunk/lib/MC/MCAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmInfo.cpp?rev=81991&r1=81990&r2=81991&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCAsmInfo.cpp (original) +++ llvm/trunk/lib/MC/MCAsmInfo.cpp Tue Sep 15 20:46:41 2009 @@ -30,9 +30,6 @@ GlobalPrefix = ""; PrivateGlobalPrefix = "."; LinkerPrivateGlobalPrefix = ""; - PersonalityPrefix = ""; - PersonalitySuffix = ""; - NeedsIndirectEncoding = false; InlineAsmStart = "APP"; InlineAsmEnd = "NO_APP"; AssemblerDialect = 0; Modified: llvm/trunk/lib/MC/MCAsmInfoDarwin.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmInfoDarwin.cpp?rev=81991&r1=81990&r2=81991&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCAsmInfoDarwin.cpp (original) +++ llvm/trunk/lib/MC/MCAsmInfoDarwin.cpp Tue Sep 15 20:46:41 2009 @@ -20,9 +20,8 @@ // Syntax: GlobalPrefix = "_"; PrivateGlobalPrefix = "L"; - LinkerPrivateGlobalPrefix = "l"; // Marker for some ObjC metadata + LinkerPrivateGlobalPrefix = "l"; NeedsSet = true; - NeedsIndirectEncoding = true; AllowQuotesInName = true; HasSingleParameterDotFile = false; Modified: llvm/trunk/lib/Target/PowerPC/PPCMCAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCMCAsmInfo.cpp?rev=81991&r1=81990&r2=81991&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCMCAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCMCAsmInfo.cpp Tue Sep 15 20:46:41 2009 @@ -22,9 +22,6 @@ if (!is64Bit) Data64bitsDirective = 0; // We can't emit a 64-bit unit in PPC32 mode. AssemblerDialect = 1; // New-Style mnemonics. - - PersonalityPrefix = "L"; - PersonalitySuffix = "$non_lazy_ptr"; } PPCLinuxMCAsmInfo::PPCLinuxMCAsmInfo(bool is64Bit) { Modified: llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp?rev=81991&r1=81990&r2=81991&view=diff ============================================================================== --- llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp (original) +++ llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp Tue Sep 15 20:46:41 2009 @@ -18,6 +18,7 @@ #include "llvm/Function.h" #include "llvm/GlobalVariable.h" #include "llvm/MC/MCContext.h" +#include "llvm/MC/MCExpr.h" #include "llvm/MC/MCSectionMachO.h" #include "llvm/MC/MCSectionELF.h" #include "llvm/Target/TargetData.h" @@ -275,6 +276,30 @@ return DataSection; } +/// getSymbolForDwarfGlobalReference - Return an MCExpr to use for a +/// pc-relative reference to the specified global variable from exception +/// handling information. In addition to the symbol, this returns +/// by-reference: +/// +/// IsIndirect - True if the returned symbol is actually a stub that contains +/// the address of the symbol, false if the symbol is the global itself. +/// +/// IsPCRel - True if the symbol reference is already pc-relative, false if +/// the caller needs to subtract off the address of the reference from the +/// symbol. +/// +const MCExpr *TargetLoweringObjectFile:: +getSymbolForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang, + bool &IsIndirect, bool &IsPCRel) const { + // The generic implementation of this just returns a direct reference to the + // symbol. + IsIndirect = false; + IsPCRel = false; + + SmallString<128> Name; + Mang->getNameWithPrefix(Name, GV, false); + return MCSymbolRefExpr::Create(Name.str(), getContext()); +} //===----------------------------------------------------------------------===// @@ -929,6 +954,19 @@ return true; } +const MCExpr *TargetLoweringObjectFileMachO:: +getSymbolForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang, + bool &IsIndirect, bool &IsPCRel) const { + // The mach-o version of this method defaults to returning a stub reference. + IsIndirect = true; + IsPCRel = false; + + SmallString<128> Name; + Mang->getNameWithPrefix(Name, GV, true); + Name += "$non_lazy_ptr"; + return MCSymbolRefExpr::Create(Name.str(), getContext()); +} + //===----------------------------------------------------------------------===// // COFF @@ -1046,3 +1084,4 @@ return getDataSection(); } + Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=81991&r1=81990&r2=81991&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Tue Sep 15 20:46:41 2009 @@ -16,6 +16,7 @@ #include "X86InstrBuilder.h" #include "X86ISelLowering.h" #include "X86TargetMachine.h" +#include "X86TargetObjectFile.h" #include "llvm/CallingConv.h" #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" @@ -36,7 +37,6 @@ #include "llvm/Support/MathExtras.h" #include "llvm/Support/Debug.h" #include "llvm/Support/ErrorHandling.h" -#include "llvm/Target/TargetLoweringObjectFile.h" #include "llvm/Target/TargetOptions.h" #include "llvm/ADT/SmallSet.h" #include "llvm/ADT/StringExtras.h" @@ -63,6 +63,8 @@ switch (TM.getSubtarget().TargetType) { default: llvm_unreachable("unknown subtarget type"); case X86Subtarget::isDarwin: + if (TM.getSubtarget().is64Bit()) + return new X8664_MachoTargetObjectFile(); return new TargetLoweringObjectFileMachO(); case X86Subtarget::isELF: return new TargetLoweringObjectFileELF(); Modified: llvm/trunk/lib/Target/X86/X86MCAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86MCAsmInfo.cpp?rev=81991&r1=81990&r2=81991&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86MCAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86MCAsmInfo.cpp Tue Sep 15 20:46:41 2009 @@ -57,14 +57,6 @@ // Leopard and above support aligned common symbols. COMMDirectiveTakesAlignment = Triple.getDarwinMajorNumber() >= 9; - if (is64Bit) { - PersonalityPrefix = ""; - PersonalitySuffix = "+4 at GOTPCREL"; - } else { - PersonalityPrefix = "L"; - PersonalitySuffix = "$non_lazy_ptr"; - } - CommentString = "##"; PCSymbol = "."; Added: llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp?rev=81991&view=auto ============================================================================== --- llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp (added) +++ llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp Tue Sep 15 20:46:41 2009 @@ -0,0 +1,33 @@ +//===-- llvm/Target/X86/X86TargetObjectFile.cpp - X86 Object Info ---------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "X86TargetObjectFile.h" +#include "llvm/ADT/SmallString.h" +#include "llvm/Support/Mangler.h" +#include "llvm/MC/MCExpr.h" +using namespace llvm; + +const MCExpr *X8664_MachoTargetObjectFile:: +getSymbolForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang, + bool &IsIndirect, bool &IsPCRel) const { + + // On Darwin/X86-64, we can reference dwarf symbols with foo at GOTPCREL+4, which + // is an indirect pc-relative reference. + IsIndirect = true; + IsPCRel = true; + + SmallString<128> Name; + Mang->getNameWithPrefix(Name, GV, false); + Name += "@GOTPCREL"; + const MCExpr *Res = + MCSymbolRefExpr::Create(Name.str(), getContext()); + const MCExpr *Four = MCConstantExpr::Create(4, getContext()); + return MCBinaryExpr::CreateAdd(Res, Four, getContext()); +} + Added: llvm/trunk/lib/Target/X86/X86TargetObjectFile.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetObjectFile.h?rev=81991&view=auto ============================================================================== --- llvm/trunk/lib/Target/X86/X86TargetObjectFile.h (added) +++ llvm/trunk/lib/Target/X86/X86TargetObjectFile.h Tue Sep 15 20:46:41 2009 @@ -0,0 +1,28 @@ +//===-- llvm/Target/X86/X86TargetObjectFile.h - X86 Object Info -*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_TARGET_X86_TARGETOBJECTFILE_H +#define LLVM_TARGET_X86_TARGETOBJECTFILE_H + +#include "llvm/Target/TargetLoweringObjectFile.h" + +namespace llvm { + + /// X8664_MachoTargetObjectFile - This TLOF implementation is used for + /// Darwin/x86-64. + class X8664_MachoTargetObjectFile : public TargetLoweringObjectFileMachO { + public: + + virtual const MCExpr * + getSymbolForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang, + bool &IsIndirect, bool &IsPCRel) const; + }; +} // end namespace llvm + +#endif From scallanan at apple.com Tue Sep 15 20:55:01 2009 From: scallanan at apple.com (Sean Callanan) Date: Wed, 16 Sep 2009 01:55:01 -0000 Subject: [llvm-commits] [llvm] r81992 - /llvm/trunk/lib/Target/X86/X86InstrFPStack.td Message-ID: <200909160155.n8G1tCj7012895@zion.cs.uiuc.edu> Author: spyffe Date: Tue Sep 15 20:54:38 2009 New Revision: 81992 URL: http://llvm.org/viewvc/llvm-project?rev=81992&view=rev Log: Removed a few instructions that were already covered by other definitions. Modified: llvm/trunk/lib/Target/X86/X86InstrFPStack.td Modified: llvm/trunk/lib/Target/X86/X86InstrFPStack.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrFPStack.td?rev=81992&r1=81991&r2=81992&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrFPStack.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrFPStack.td Tue Sep 15 20:54:38 2009 @@ -317,10 +317,7 @@ def FCOM64m : FPI<0xDC, MRM2m, (outs), (ins f64mem:$src), "fcom\t$src">; def FCOMP64m : FPI<0xDC, MRM3m, (outs), (ins f64mem:$src), "fcomp\t$src">; -def FLD64m : FPI<0xDD, MRM0m, (outs), (ins f64mem:$src), "fld\t$src">; def FISTTP32m: FPI<0xDD, MRM1m, (outs i32mem:$dst), (ins), "fisttp{l}\t$dst">; -def FST64m : FPI<0xDD, MRM2m, (outs f64mem:$dst), (ins), "fst\t$dst">; -def FSTP64m : FPI<0xDD, MRM3m, (outs f64mem:$dst), (ins), "fld\t$dst">; def FRSTORm : FPI<0xDD, MRM4m, (outs f32mem:$dst), (ins), "frstor\t$dst">; def FSAVEm : FPI<0xDD, MRM6m, (outs f32mem:$dst), (ins), "fsave\t$dst">; def FSTSWm : FPI<0xDD, MRM7m, (outs f32mem:$dst), (ins), "fstsw\t$dst">; @@ -329,9 +326,7 @@ def FICOMP16m: FPI<0xDE, MRM3m, (outs), (ins i16mem:$src), "ficomp{w}\t$src">; def FBLDm : FPI<0xDF, MRM4m, (outs), (ins f32mem:$src), "fbld\t$src">; -def FILD64m : FPI<0xDF, MRM5m, (outs), (ins i64mem:$src), "fild{q}\t$src">; def FBSTPm : FPI<0xDF, MRM6m, (outs f32mem:$dst), (ins), "fbstp\t$dst">; -def FISTP64m : FPI<0xDF, MRM7m, (outs i64mem:$dst), (ins), "fistp{q}\t$dst">; // Floating point cmovs. multiclass FPCMov { From gohman at apple.com Tue Sep 15 21:02:10 2009 From: gohman at apple.com (Dan Gohman) Date: Wed, 16 Sep 2009 02:02:10 -0000 Subject: [llvm-commits] [llvm] r81993 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/phi-merge-gep.ll Message-ID: <200909160202.n8G22EkD013750@zion.cs.uiuc.edu> Author: djg Date: Tue Sep 15 21:01:52 2009 New Revision: 81993 URL: http://llvm.org/viewvc/llvm-project?rev=81993&view=rev Log: Don't sink gep operators through phi nodes if the result would require more than one phi, since that leads to higher register pressure on entry to the phi. This is especially problematic when the phi is in a loop header, as it increases register pressure throughout the loop. Added: llvm/trunk/test/Transforms/InstCombine/phi-merge-gep.ll Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=81993&r1=81992&r2=81993&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Tue Sep 15 21:01:52 2009 @@ -326,7 +326,7 @@ // instruction. Instead, visit methods should return the value returned by // this function. Instruction *EraseInstFromFunction(Instruction &I) { - DEBUG(errs() << "IC: erase " << I); + DEBUG(errs() << "IC: erase " << I << '\n'); assert(I.use_empty() && "Cannot erase instruction that is used!"); // Make sure that we reprocess all operands now that we reduced their @@ -10401,6 +10401,10 @@ // This is true if all GEP bases are allocas and if all indices into them are // constants. bool AllBasePointersAreAllocas = true; + + // We don't want to replace this phi if the replacement would require + // more than one phi. + bool NeededPhi = false; // Scan to see if all operands are the same opcode, all have one use, and all // kill their operands (i.e. the operands have one use). @@ -10432,7 +10436,16 @@ if (FirstInst->getOperand(op)->getType() !=GEP->getOperand(op)->getType()) return 0; + + // If we already needed a PHI for an earlier operand, and another operand + // also requires a PHI, we'd be introducing more PHIs than we're + // eliminating, which increases register pressure on entry to the PHI's + // block. + if (NeededPhi) + return 0; + FixedOperands[op] = 0; // Needs a PHI. + NeededPhi = true; } } Added: llvm/trunk/test/Transforms/InstCombine/phi-merge-gep.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/phi-merge-gep.ll?rev=81993&view=auto ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/phi-merge-gep.ll (added) +++ llvm/trunk/test/Transforms/InstCombine/phi-merge-gep.ll Tue Sep 15 21:01:52 2009 @@ -0,0 +1,101 @@ +; RUN: opt < %s -S -instcombine > %t +; RUN: grep {= getelementptr} %t | count 20 +; RUN: grep {= phi} %t | count 13 + +; Don't push the geps through these phis; they have multiple uses! + +define void @foo(float* %Ar, float* %Ai, i64 %As, float* %Cr, float* %Ci, i64 %Cs, i64 %n) nounwind { +entry: + %0 = getelementptr inbounds float* %Ar, i64 0 ; [#uses=1] + %1 = getelementptr inbounds float* %Ai, i64 0 ; [#uses=1] + %2 = mul i64 %n, %As ; [#uses=1] + %3 = getelementptr inbounds float* %Ar, i64 %2 ; [#uses=1] + %4 = mul i64 %n, %As ; [#uses=1] + %5 = getelementptr inbounds float* %Ai, i64 %4 ; [#uses=1] + %6 = mul i64 %n, 2 ; [#uses=1] + %7 = mul i64 %6, %As ; [#uses=1] + %8 = getelementptr inbounds float* %Ar, i64 %7 ; [#uses=1] + %9 = mul i64 %n, 2 ; [#uses=1] + %10 = mul i64 %9, %As ; [#uses=1] + %11 = getelementptr inbounds float* %Ai, i64 %10 ; [#uses=1] + %12 = getelementptr inbounds float* %Cr, i64 0 ; [#uses=1] + %13 = getelementptr inbounds float* %Ci, i64 0 ; [#uses=1] + %14 = mul i64 %n, %Cs ; [#uses=1] + %15 = getelementptr inbounds float* %Cr, i64 %14 ; [#uses=1] + %16 = mul i64 %n, %Cs ; [#uses=1] + %17 = getelementptr inbounds float* %Ci, i64 %16 ; [#uses=1] + %18 = mul i64 %n, 2 ; [#uses=1] + %19 = mul i64 %18, %Cs ; [#uses=1] + %20 = getelementptr inbounds float* %Cr, i64 %19 ; [#uses=1] + %21 = mul i64 %n, 2 ; [#uses=1] + %22 = mul i64 %21, %Cs ; [#uses=1] + %23 = getelementptr inbounds float* %Ci, i64 %22 ; [#uses=1] + br label %bb13 + +bb: ; preds = %bb13 + %24 = load float* %A0r.0, align 4 ; [#uses=1] + %25 = load float* %A0i.0, align 4 ; [#uses=1] + %26 = load float* %A1r.0, align 4 ; [#uses=2] + %27 = load float* %A1i.0, align 4 ; [#uses=2] + %28 = load float* %A2r.0, align 4 ; [#uses=2] + %29 = load float* %A2i.0, align 4 ; [#uses=2] + %30 = fadd float %26, %28 ; [#uses=2] + %31 = fadd float %27, %29 ; [#uses=2] + %32 = fsub float %26, %28 ; [#uses=1] + %33 = fsub float %27, %29 ; [#uses=1] + %34 = fadd float %24, %30 ; [#uses=2] + %35 = fadd float %25, %31 ; [#uses=2] + %36 = fmul float %30, -1.500000e+00 ; [#uses=1] + %37 = fmul float %31, -1.500000e+00 ; [#uses=1] + %38 = fadd float %34, %36 ; [#uses=2] + %39 = fadd float %35, %37 ; [#uses=2] + %40 = fmul float %32, 0x3FEBB67AE0000000 ; [#uses=2] + %41 = fmul float %33, 0x3FEBB67AE0000000 ; [#uses=2] + %42 = fadd float %38, %41 ; [#uses=1] + %43 = fsub float %39, %40 ; [#uses=1] + %44 = fsub float %38, %41 ; [#uses=1] + %45 = fadd float %39, %40 ; [#uses=1] + store float %34, float* %C0r.0, align 4 + store float %35, float* %C0i.0, align 4 + store float %42, float* %C1r.0, align 4 + store float %43, float* %C1i.0, align 4 + store float %44, float* %C2r.0, align 4 + store float %45, float* %C2i.0, align 4 + %46 = getelementptr inbounds float* %A0r.0, i64 %As ; [#uses=1] + %47 = getelementptr inbounds float* %A0i.0, i64 %As ; [#uses=1] + %48 = getelementptr inbounds float* %A1r.0, i64 %As ; [#uses=1] + %49 = getelementptr inbounds float* %A1i.0, i64 %As ; [#uses=1] + %50 = getelementptr inbounds float* %A2r.0, i64 %As ; [#uses=1] + %51 = getelementptr inbounds float* %A2i.0, i64 %As ; [#uses=1] + %52 = getelementptr inbounds float* %C0r.0, i64 %Cs ; [#uses=1] + %53 = getelementptr inbounds float* %C0i.0, i64 %Cs ; [#uses=1] + %54 = getelementptr inbounds float* %C1r.0, i64 %Cs ; [#uses=1] + %55 = getelementptr inbounds float* %C1i.0, i64 %Cs ; [#uses=1] + %56 = getelementptr inbounds float* %C2r.0, i64 %Cs ; [#uses=1] + %57 = getelementptr inbounds float* %C2i.0, i64 %Cs ; [#uses=1] + %58 = add nsw i64 %i.0, 1 ; [#uses=1] + br label %bb13 + +bb13: ; preds = %bb, %entry + %i.0 = phi i64 [ 0, %entry ], [ %58, %bb ] ; [#uses=2] + %C2i.0 = phi float* [ %23, %entry ], [ %57, %bb ] ; [#uses=2] + %C2r.0 = phi float* [ %20, %entry ], [ %56, %bb ] ; [#uses=2] + %C1i.0 = phi float* [ %17, %entry ], [ %55, %bb ] ; [#uses=2] + %C1r.0 = phi float* [ %15, %entry ], [ %54, %bb ] ; [#uses=2] + %C0i.0 = phi float* [ %13, %entry ], [ %53, %bb ] ; [#uses=2] + %C0r.0 = phi float* [ %12, %entry ], [ %52, %bb ] ; [#uses=2] + %A2i.0 = phi float* [ %11, %entry ], [ %51, %bb ] ; [#uses=2] + %A2r.0 = phi float* [ %8, %entry ], [ %50, %bb ] ; [#uses=2] + %A1i.0 = phi float* [ %5, %entry ], [ %49, %bb ] ; [#uses=2] + %A1r.0 = phi float* [ %3, %entry ], [ %48, %bb ] ; [#uses=2] + %A0i.0 = phi float* [ %1, %entry ], [ %47, %bb ] ; [#uses=2] + %A0r.0 = phi float* [ %0, %entry ], [ %46, %bb ] ; [#uses=2] + %59 = icmp slt i64 %i.0, %n ; [#uses=1] + br i1 %59, label %bb, label %bb14 + +bb14: ; preds = %bb13 + br label %return + +return: ; preds = %bb14 + ret void +} From scallanan at apple.com Tue Sep 15 21:28:54 2009 From: scallanan at apple.com (Sean Callanan) Date: Wed, 16 Sep 2009 02:28:54 -0000 Subject: [llvm-commits] [llvm] r81994 - in /llvm/trunk/lib/Target/X86: X86Instr64bit.td X86InstrInfo.td Message-ID: <200909160228.n8G2SvGE016899@zion.cs.uiuc.edu> Author: spyffe Date: Tue Sep 15 21:28:43 2009 New Revision: 81994 URL: http://llvm.org/viewvc/llvm-project?rev=81994&view=rev Log: Added the definitions for one-bit left shifts to the Intel instruction tables. The patterns will stay blank because ADD reg, reg is faster, but having the encoding available is useful for the disassembler. Modified: llvm/trunk/lib/Target/X86/X86Instr64bit.td llvm/trunk/lib/Target/X86/X86InstrInfo.td Modified: llvm/trunk/lib/Target/X86/X86Instr64bit.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Instr64bit.td?rev=81994&r1=81993&r2=81994&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86Instr64bit.td (original) +++ llvm/trunk/lib/Target/X86/X86Instr64bit.td Tue Sep 15 21:28:43 2009 @@ -752,8 +752,10 @@ def SHL64ri : RIi8<0xC1, MRM4r, (outs GR64:$dst), (ins GR64:$src1, i8imm:$src2), "shl{q}\t{$src2, $dst|$dst, $src2}", [(set GR64:$dst, (shl GR64:$src1, (i8 imm:$src2)))]>; -// NOTE: We don't use shifts of a register by one, because 'add reg,reg' is -// cheaper. +// NOTE: We don't include patterns for shifts of a register by one, because +// 'add reg,reg' is cheaper. +def SHL64r1 : RI<0xD1, MRM4r, (outs GR64:$dst), (ins GR64:$src1), + "shr{q}\t$dst", []>; } // isTwoAddress let Uses = [CL] in Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=81994&r1=81993&r2=81994&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Tue Sep 15 21:28:43 2009 @@ -1974,8 +1974,17 @@ def SHL32ri : Ii8<0xC1, MRM4r, (outs GR32:$dst), (ins GR32:$src1, i8imm:$src2), "shl{l}\t{$src2, $dst|$dst, $src2}", [(set GR32:$dst, (shl GR32:$src1, (i8 imm:$src2)))]>; -// NOTE: We don't use shifts of a register by one, because 'add reg,reg' is -// cheaper. + +// NOTE: We don't include patterns for shifts of a register by one, because +// 'add reg,reg' is cheaper. + +def SHL8r1 : I<0xD0, MRM4r, (outs GR8:$dst), (ins GR8:$src1), + "shl{b}\t$dst", []>; +def SHL16r1 : I<0xD1, MRM4r, (outs GR16:$dst), (ins GR16:$src1), + "shl{w}\t$dst", []>, OpSize; +def SHL32r1 : I<0xD1, MRM4r, (outs GR32:$dst), (ins GR32:$src1), + "shl{l}\t$dst", []>; + } // isConvertibleToThreeAddress = 1 let isTwoAddress = 0 in { From scallanan at apple.com Tue Sep 15 21:57:14 2009 From: scallanan at apple.com (Sean Callanan) Date: Wed, 16 Sep 2009 02:57:14 -0000 Subject: [llvm-commits] [llvm] r81995 - /llvm/trunk/lib/Target/X86/X86InstrInfo.td Message-ID: <200909160257.n8G2vFYj020545@zion.cs.uiuc.edu> Author: spyffe Date: Tue Sep 15 21:57:13 2009 New Revision: 81995 URL: http://llvm.org/viewvc/llvm-project?rev=81995&view=rev Log: Added the ENTER instruction, which sets up a stack frame, to the Intel instruction tables. Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=81995&r1=81994&r2=81995&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Tue Sep 15 21:57:13 2009 @@ -694,6 +694,11 @@ "lcall{l}\t{*}$dst", []>; } +// Constructing a stack frame. + +def ENTER : I<0xC8, RawFrm, (outs), (ins i16imm:$len, i8imm:$lvl), + "enter\t$len, $lvl", []>; + // Tail call stuff. let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1 in From eli.friedman at gmail.com Tue Sep 15 22:02:54 2009 From: eli.friedman at gmail.com (Eli Friedman) Date: Tue, 15 Sep 2009 20:02:54 -0700 Subject: [llvm-commits] [PATCH] extend analysis passes to treat malloc calls the same as MallocInst (patch #2) In-Reply-To: <13429790-6CCE-4644-A1EE-A554440F22E7@apple.com> References: <13429790-6CCE-4644-A1EE-A554440F22E7@apple.com> Message-ID: On Tue, Sep 15, 2009 at 1:44 PM, Victor Hernandez wrote: > These are the changes to make all the analysis passes apply the same > analysis to malloc calls as to MallocInst. Index: lib/Analysis/AliasAnalysis.cpp =================================================================== --- lib/Analysis/AliasAnalysis.cpp (revision 81898) +++ lib/Analysis/AliasAnalysis.cpp (working copy) @@ -31,6 +31,7 @@ #include "llvm/IntrinsicInst.h" #include "llvm/Instructions.h" #include "llvm/Type.h" +#include "llvm/Analysis/MallocHelper.h" #include "llvm/Target/TargetData.h" using namespace llvm; @@ -239,7 +240,7 @@ /// NoAlias returns /// bool llvm::isIdentifiedObject(const Value *V) { - if (isa(V) || isNoAliasCall(V)) + if (isa(V) || isMalloc(V) || isNoAliasCall(V)) return true; if (isa(V) && !isa(V)) return true; Unnecessary change, assuming malloc gets a noalias attribute; isIdentifiedObject is only used on values with the bitcasts stripped off. Index: lib/Analysis/BasicAliasAnalysis.cpp =================================================================== --- lib/Analysis/BasicAliasAnalysis.cpp (revision 81898) +++ lib/Analysis/BasicAliasAnalysis.cpp (working copy) @@ -15,6 +15,7 @@ #include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Analysis/CaptureTracking.h" +#include "llvm/Analysis/MallocHelper.h" #include "llvm/Analysis/Passes.h" #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" @@ -82,7 +83,7 @@ /// object that never escapes from the function. static bool isNonEscapingLocalObject(const Value *V) { // If this is a local allocation, check to see if it escapes. - if (isa(V) || isNoAliasCall(V)) + if (isa(V) || isMalloc(V) || isNoAliasCall(V)) return !PointerMayBeCaptured(V, false); // If this is an argument that corresponds to a byval or noalias argument, Same as above. @@ -111,6 +112,20 @@ AccessTy = AI->getType()->getElementType(); else return false; + } else if (const CallInst* CI = extractMallocCall(V)) { + if (isArrayMalloc(V)) + return false; + if (const Type* PT = getMallocAllocatedType(CI)) + AccessTy = PT; + else + return false; + } else if (const CallInst* CI = extractMallocCallFromBitCast(V)) { + if (isArrayMalloc(V)) + return false; + if (const Type* PT = getMallocAllocatedType(CI)) + AccessTy = PT; + else + return false; } else if (const Argument *A = dyn_cast(V)) { if (A->hasByValAttr()) AccessTy = cast(A->getType())->getElementType(); It would be much more straightforward to just use the size argument to the malloc here; also, V is never a bitcast. @@ -328,8 +343,8 @@ return NoAlias; // Arguments can't alias with local allocations or noalias calls. - if ((isa(O1) && (isa(O2) || isNoAliasCall(O2))) || - (isa(O2) && (isa(O1) || isNoAliasCall(O1)))) + if ((isa(O1) && (isa(O2) || isMalloc(O2) || isNoAliasCall(O2))) || + (isa(O2) && (isa(O1) || isMalloc(O1) || isNoAliasCall(O1)))) return NoAlias; // Most objects can't alias null. Unnecessary change, assuming malloc gets a noalias attribute. Index: lib/Analysis/PointerTracking.cpp =================================================================== --- lib/Analysis/PointerTracking.cpp (revision 81898) +++ lib/Analysis/PointerTracking.cpp (working copy) @@ -13,6 +13,7 @@ #include "llvm/Analysis/ConstantFolding.h" #include "llvm/Analysis/Dominators.h" #include "llvm/Analysis/LoopInfo.h" +#include "llvm/Analysis/MallocHelper.h" #include "llvm/Analysis/PointerTracking.h" #include "llvm/Analysis/ScalarEvolution.h" #include "llvm/Analysis/ScalarEvolutionExpressions.h" @@ -99,6 +100,22 @@ return SE->getSCEV(arraySize); } + if (CallInst *CI = extractMallocCall(V)) { + Value *arraySize = getMallocArraySize(CI); + Ty = getMallocAllocatedType(CI); + if (!Ty || !arraySize) return SE->getCouldNotCompute(); + // arraySize elements of type Ty. + return SE->getSCEV(arraySize); + } + + if (CallInst *CI = extractMallocCallFromBitCast(V)) { + Value *arraySize = getMallocArraySize(CI); + Ty = getMallocAllocatedType(CI); + if (!Ty || !arraySize) return SE->getCouldNotCompute(); + // arraySize elements of type Ty. + return SE->getSCEV(arraySize); + } + if (GlobalVariable *GV = dyn_cast(V)) { if (GV->hasDefinitiveInitializer()) { Constant *C = GV->getInitializer(); Will this mess up with malloc used as a char array? Index: lib/Analysis/ValueTracking.cpp =================================================================== --- lib/Analysis/ValueTracking.cpp (revision 81898) +++ lib/Analysis/ValueTracking.cpp (working copy) @@ -20,6 +20,7 @@ #include "llvm/IntrinsicInst.h" #include "llvm/LLVMContext.h" #include "llvm/Operator.h" +#include "llvm/Analysis/MallocHelper.h" #include "llvm/Target/TargetData.h" #include "llvm/Support/GetElementPtrTypeIterator.h" #include "llvm/Support/MathExtras.h" @@ -621,6 +622,24 @@ break; } } + } else if (CallInst* CI = extractMallocCall(I)) { + unsigned Align = 0; + const Type* T = getMallocAllocatedType(CI); + if (TD && T) { + // Malloc returns maximally aligned memory. + Align = TD->getABITypeAlignment(T); + Align = + std::max(Align, + (unsigned)TD->getABITypeAlignment( + Type::getDoubleTy(V->getContext()))); + Align = + std::max(Align, + (unsigned)TD->getABITypeAlignment( + Type::getInt64Ty(V->getContext()))); + } + if (Align > 0) + KnownZero = Mask & APInt::getLowBitsSet(BitWidth, + CountTrailingZeros_32(Align)); } break; } This is simply wrong; we can't make that guarantee for malloc. Consider, for example, a malloc used as an SSE vector on Windows. More generally, getMallocAllocatedType seems a bit suspect in that an i8 array will get messed up by the change to getMallocAllocatedType. -Eli From natebegeman at mac.com Tue Sep 15 22:21:11 2009 From: natebegeman at mac.com (Nate Begeman) Date: Wed, 16 Sep 2009 03:21:11 -0000 Subject: [llvm-commits] [llvm] r81996 - /llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Message-ID: <200909160321.n8G3LGOY023451@zion.cs.uiuc.edu> Author: sampo Date: Tue Sep 15 22:20:46 2009 New Revision: 81996 URL: http://llvm.org/viewvc/llvm-project?rev=81996&view=rev Log: Do not try and sink a load whose chain result has more than one use, when trying to create RMW opportunities in the x86 backend. This can cause a cycle to appear in the graph, since the other uses may eventually feed into the TokenFactor we are sinking the load below. Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp?rev=81996&r1=81995&r2=81996&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Tue Sep 15 22:20:46 2009 @@ -364,7 +364,9 @@ Store.getOperand(2), Store.getOperand(3)); } -/// isRMWLoad - Return true if N is a load that's part of RMW sub-DAG. +/// isRMWLoad - Return true if N is a load that's part of RMW sub-DAG. The +/// chain produced by the load must only be used by the store's chain operand, +/// otherwise this may produce a cycle in the DAG. /// static bool isRMWLoad(SDValue N, SDValue Chain, SDValue Address, SDValue &Load) { @@ -382,8 +384,9 @@ return false; if (N.hasOneUse() && + LD->hasNUsesOfValue(1, 1) && N.getOperand(1) == Address && - N.getNode()->isOperandOf(Chain.getNode())) { + LD->isOperandOf(Chain.getNode())) { Load = N; return true; } From sabre at nondot.org Tue Sep 15 23:12:51 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 16 Sep 2009 04:12:51 -0000 Subject: [llvm-commits] [llvm] r81997 - /llvm/trunk/tools/llvm-mc/AsmParser.cpp Message-ID: <200909160412.n8G4Cr1l029654@zion.cs.uiuc.edu> Author: lattner Date: Tue Sep 15 23:12:47 2009 New Revision: 81997 URL: http://llvm.org/viewvc/llvm-project?rev=81997&view=rev Log: use an accessor to simplify code. Modified: llvm/trunk/tools/llvm-mc/AsmParser.cpp Modified: llvm/trunk/tools/llvm-mc/AsmParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.cpp?rev=81997&r1=81996&r2=81997&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmParser.cpp (original) +++ llvm/trunk/tools/llvm-mc/AsmParser.cpp Tue Sep 15 23:12:47 2009 @@ -208,15 +208,12 @@ Res = MCUnaryExpr::CreateLNot(Res, getContext()); return false; case AsmToken::String: - case AsmToken::Identifier: { + case AsmToken::Identifier: // This is a label, this should be parsed as part of an expression, to // handle things like LFOO+4. - MCSymbol *Sym = CreateSymbol(Lexer.getTok().getIdentifier()); - - Res = MCSymbolRefExpr::Create(Sym, getContext()); + Res = MCSymbolRefExpr::Create(Lexer.getTok().getIdentifier(), getContext()); Lexer.Lex(); // Eat identifier. return false; - } case AsmToken::Integer: Res = MCConstantExpr::Create(Lexer.getTok().getIntVal(), getContext()); Lexer.Lex(); // Eat token. From tonic at nondot.org Tue Sep 15 23:31:10 2009 From: tonic at nondot.org (Tanya Lattner) Date: Tue, 15 Sep 2009 23:31:10 -0500 Subject: [llvm-commits] CVS: llvm-www/devmtg/register.php Message-ID: <200909160431.n8G4VAOL032087@zion.cs.uiuc.edu> Changes in directory llvm-www/devmtg: register.php updated: 1.7 -> 1.8 --- Log message: Registration cap of 190. --- Diffs of the changes: (+9 -0) register.php | 9 +++++++++ 1 files changed, 9 insertions(+) Index: llvm-www/devmtg/register.php diff -u llvm-www/devmtg/register.php:1.7 llvm-www/devmtg/register.php:1.8 --- llvm-www/devmtg/register.php:1.7 Thu Jul 9 13:18:34 2009 +++ llvm-www/devmtg/register.php Tue Sep 15 23:26:19 2009 @@ -194,6 +194,15 @@ ?>
LLVM Developers' Meeting - Registration
+= 190){ +print '

Registration is now closed.

'; +exit; +} +?> Author: ssen Date: Tue Sep 15 23:44:00 2009 New Revision: 81999 URL: http://llvm.org/viewvc/llvm-project?rev=81999&view=rev Log: fix cmake build Modified: llvm/trunk/lib/Target/X86/CMakeLists.txt Modified: llvm/trunk/lib/Target/X86/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/CMakeLists.txt?rev=81999&r1=81998&r2=81999&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/CMakeLists.txt (original) +++ llvm/trunk/lib/Target/X86/CMakeLists.txt Tue Sep 15 23:44:00 2009 @@ -26,6 +26,7 @@ X86RegisterInfo.cpp X86Subtarget.cpp X86TargetMachine.cpp + X86TargetObjectFile.cpp X86FastISel.cpp ) From kremenek at apple.com Tue Sep 15 23:44:05 2009 From: kremenek at apple.com (Ted Kremenek) Date: Wed, 16 Sep 2009 04:44:05 -0000 Subject: [llvm-commits] [llvm] r81998 - /llvm/tags/checker/checker-0.210/ Message-ID: <200909160444.n8G4i6cO001312@zion.cs.uiuc.edu> Author: kremenek Date: Tue Sep 15 23:44:00 2009 New Revision: 81998 URL: http://llvm.org/viewvc/llvm-project?rev=81998&view=rev Log: Removing checker-0.210. Removed: llvm/tags/checker/checker-0.210/ From kremenek at apple.com Tue Sep 15 23:44:57 2009 From: kremenek at apple.com (Ted Kremenek) Date: Wed, 16 Sep 2009 04:44:57 -0000 Subject: [llvm-commits] [llvm] r82001 - /llvm/tags/checker/checker-0.220/ Message-ID: <200909160444.n8G4ivLL001456@zion.cs.uiuc.edu> Author: kremenek Date: Tue Sep 15 23:44:56 2009 New Revision: 82001 URL: http://llvm.org/viewvc/llvm-project?rev=82001&view=rev Log: Removing checker-0.220. Removed: llvm/tags/checker/checker-0.220/ From kremenek at apple.com Tue Sep 15 23:45:21 2009 From: kremenek at apple.com (Ted Kremenek) Date: Wed, 16 Sep 2009 04:45:21 -0000 Subject: [llvm-commits] [llvm] r82003 - /llvm/tags/checker/checker-0.220/ Message-ID: <200909160445.n8G4jLcl001527@zion.cs.uiuc.edu> Author: kremenek Date: Tue Sep 15 23:45:20 2009 New Revision: 82003 URL: http://llvm.org/viewvc/llvm-project?rev=82003&view=rev Log: Tagging checker-0.220. Added: llvm/tags/checker/checker-0.220/ - copied from r82002, llvm/trunk/ From kremenek at apple.com Tue Sep 15 23:55:47 2009 From: kremenek at apple.com (Ted Kremenek) Date: Wed, 16 Sep 2009 04:55:47 -0000 Subject: [llvm-commits] [llvm] r82005 - /llvm/tags/checker/checker-0.210/ Message-ID: <200909160455.n8G4tlSc002924@zion.cs.uiuc.edu> Author: kremenek Date: Tue Sep 15 23:55:35 2009 New Revision: 82005 URL: http://llvm.org/viewvc/llvm-project?rev=82005&view=rev Log: Restore checker-0.210 tag. Added: llvm/tags/checker/checker-0.210/ - copied from r81997, llvm/tags/checker/checker-0.210/ From sabre at nondot.org Tue Sep 15 23:57:26 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 16 Sep 2009 04:57:26 -0000 Subject: [llvm-commits] [llvm] r82006 - in /llvm/trunk: include/llvm/CodeGen/AsmPrinter.h lib/CodeGen/AsmPrinter/AsmPrinter.cpp lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h Message-ID: <200909160457.n8G4vU1C003166@zion.cs.uiuc.edu> Author: lattner Date: Tue Sep 15 23:57:15 2009 New Revision: 82006 URL: http://llvm.org/viewvc/llvm-project?rev=82006&view=rev Log: remove the AsmPrinter::printMCInst hook hack now that we have MCInstPrinter. Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/AsmPrinter.h?rev=82006&r1=82005&r2=82006&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/AsmPrinter.h (original) +++ llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Tue Sep 15 23:57:15 2009 @@ -321,12 +321,6 @@ /// EmitComments - Pretty-print comments for basic blocks void EmitComments(const MachineBasicBlock &MBB) const; - /// printMCInst - Print an MCInst for this target. - /// - /// Note, this is only a temporary hack to allow the MCStreamer to print - /// instructions, do not use this function outside of llvm-mc. - virtual void printMCInst(const MCInst *MI); - /// GetMBBSymbol - Return the MCSymbol corresponding to the specified basic /// block label. MCSymbol *GetMBBSymbol(unsigned MBBID) const; Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=82006&r1=82005&r2=82006&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Tue Sep 15 23:57:15 2009 @@ -1711,10 +1711,6 @@ O << Offset; } -void AsmPrinter::printMCInst(const MCInst *MI) { - llvm_unreachable("MCInst printing unavailable on this target!"); -} - GCMetadataPrinter *AsmPrinter::GetOrCreateGCPrinter(GCStrategy *S) { if (!S->usesMetadata()) return 0; Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h?rev=82006&r1=82005&r2=82006&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h (original) +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h Tue Sep 15 23:57:15 2009 @@ -63,8 +63,7 @@ void printInstructionThroughMCStreamer(const MachineInstr *MI); - // FIXME: REMOVE. - virtual void printMCInst(const MCInst *MI); + void printMCInst(const MCInst *MI); void printSymbolOperand(const MachineOperand &MO); From sabre at nondot.org Tue Sep 15 23:59:31 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 16 Sep 2009 04:59:31 -0000 Subject: [llvm-commits] [llvm] r82008 - /llvm/trunk/docs/DeveloperPolicy.html Message-ID: <200909160459.n8G4xWxe003438@zion.cs.uiuc.edu> Author: lattner Date: Tue Sep 15 23:59:30 2009 New Revision: 82008 URL: http://llvm.org/viewvc/llvm-project?rev=82008&view=rev Log: Ted is christened as the owner of the clang static analyzer. Modified: llvm/trunk/docs/DeveloperPolicy.html Modified: llvm/trunk/docs/DeveloperPolicy.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/DeveloperPolicy.html?rev=82008&r1=82007&r2=82008&view=diff ============================================================================== --- llvm/trunk/docs/DeveloperPolicy.html (original) +++ llvm/trunk/docs/DeveloperPolicy.html Tue Sep 15 23:59:30 2009 @@ -192,6 +192,8 @@
  • Evan Cheng: Code generator and all targets.
  • +
  • Ted Kremenek: Clang Static Analyzer.
  • +
  • Chris Lattner: Everything else.
  • From sabre at nondot.org Wed Sep 16 00:20:33 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 16 Sep 2009 05:20:33 -0000 Subject: [llvm-commits] [llvm] r82010 - in /llvm/trunk/lib/Target/X86: AsmPrinter/X86ATTAsmPrinter.cpp X86Subtarget.h Message-ID: <200909160520.n8G5KYhR006035@zion.cs.uiuc.edu> Author: lattner Date: Wed Sep 16 00:20:33 2009 New Revision: 82010 URL: http://llvm.org/viewvc/llvm-project?rev=82010&view=rev Log: rearrange X86ATTAsmPrinter::doFinalization, making a scan of the global variable list only happen for COFF targets. Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp llvm/trunk/lib/Target/X86/X86Subtarget.h Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp?rev=82010&r1=82009&r2=82010&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp Wed Sep 16 00:20:33 2009 @@ -889,13 +889,6 @@ } bool X86ATTAsmPrinter::doFinalization(Module &M) { - // Print out module-level global variables here. - for (Module::const_global_iterator I = M.global_begin(), E = M.global_end(); - I != E; ++I) { - if (I->hasDLLExportLinkage()) - DLLExportedGVs.insert(Mang->getMangledName(I)); - } - if (Subtarget->isTargetDarwin()) { // All darwin targets use mach-o. TargetLoweringObjectFileMachO &TLOFMacho = @@ -903,7 +896,7 @@ // Add the (possibly multiple) personalities to the set of global value // stubs. Only referenced functions get into the Personalities list. - if (MAI->doesSupportExceptionHandling() && MMI && !Subtarget->is64Bit()) { + if (!Subtarget->is64Bit()) { const std::vector &Personalities = MMI->getPersonalities(); for (unsigned i = 0, e = Personalities.size(); i != e; ++i) { if (Personalities[i] == 0) @@ -984,37 +977,46 @@ // linker can safely perform dead code stripping. Since LLVM never // generates code that does this, it is always safe to set. O << "\t.subsections_via_symbols\n"; - } else if (Subtarget->isTargetCygMing()) { - // Emit type information for external functions - for (StringSet<>::iterator i = CygMingStubs.begin(), e = CygMingStubs.end(); - i != e; ++i) { - O << "\t.def\t " << i->getKeyData() + } + + if (Subtarget->isTargetCOFF()) { + for (Module::const_global_iterator I = M.global_begin(), E = M.global_end(); + I != E; ++I) + if (I->hasDLLExportLinkage()) + DLLExportedGVs.insert(Mang->getMangledName(I)); + + if (Subtarget->isTargetCygMing()) { + // Emit type information for external functions + for (StringSet<>::iterator i = CygMingStubs.begin(), e = CygMingStubs.end(); + i != e; ++i) { + O << "\t.def\t " << i->getKeyData() << ";\t.scl\t" << COFF::C_EXT << ";\t.type\t" << (COFF::DT_FCN << COFF::N_BTSHFT) << ";\t.endef\n"; + } } - } - - // Output linker support code for dllexported globals on windows. - if (!DLLExportedGVs.empty() || !DLLExportedFns.empty()) { - // dllexport symbols only exist on coff targets. - TargetLoweringObjectFileCOFF &TLOFMacho = - static_cast(getObjFileLowering()); + // Output linker support code for dllexported globals on windows. + if (!DLLExportedGVs.empty() || !DLLExportedFns.empty()) { + // dllexport symbols only exist on coff targets. + TargetLoweringObjectFileCOFF &TLOFCOFF = + static_cast(getObjFileLowering()); + + OutStreamer.SwitchSection(TLOFCOFF.getCOFFSection(".section .drectve", + true, + SectionKind::getMetadata())); - OutStreamer.SwitchSection(TLOFMacho.getCOFFSection(".section .drectve",true, - SectionKind::getMetadata())); - - for (StringSet<>::iterator i = DLLExportedGVs.begin(), - e = DLLExportedGVs.end(); i != e; ++i) - O << "\t.ascii \" -export:" << i->getKeyData() << ",data\"\n"; - - for (StringSet<>::iterator i = DLLExportedFns.begin(), - e = DLLExportedFns.end(); - i != e; ++i) - O << "\t.ascii \" -export:" << i->getKeyData() << "\"\n"; + for (StringSet<>::iterator i = DLLExportedGVs.begin(), + e = DLLExportedGVs.end(); i != e; ++i) + O << "\t.ascii \" -export:" << i->getKeyData() << ",data\"\n"; + + for (StringSet<>::iterator i = DLLExportedFns.begin(), + e = DLLExportedFns.end(); + i != e; ++i) + O << "\t.ascii \" -export:" << i->getKeyData() << "\"\n"; + } } - + // Do common shutdown. return AsmPrinter::doFinalization(M); } Modified: llvm/trunk/lib/Target/X86/X86Subtarget.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Subtarget.h?rev=82010&r1=82009&r2=82010&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86Subtarget.h (original) +++ llvm/trunk/lib/Target/X86/X86Subtarget.h Wed Sep 16 00:20:33 2009 @@ -148,12 +148,20 @@ bool isTargetDarwin() const { return TargetType == isDarwin; } bool isTargetELF() const { return TargetType == isELF; } + bool isTargetWindows() const { return TargetType == isWindows; } bool isTargetMingw() const { return TargetType == isMingw; } + bool isTargetCygwin() const { return TargetType == isCygwin; } bool isTargetCygMing() const { return TargetType == isMingw || TargetType == isCygwin; } - bool isTargetCygwin() const { return TargetType == isCygwin; } + + /// isTargetCOFF - Return true if this is any COFF/Windows target variant. + bool isTargetCOFF() const { + return TargetType == isMingw || TargetType == isCygwin || + TargetType == isWindows; + } + bool isTargetWin64() const { return Is64Bit && (TargetType == isMingw || TargetType == isWindows); } From sabre at nondot.org Wed Sep 16 00:25:43 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 16 Sep 2009 05:25:43 -0000 Subject: [llvm-commits] [llvm] r82011 - /llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp Message-ID: <200909160525.n8G5Phk8006695@zion.cs.uiuc.edu> Author: lattner Date: Wed Sep 16 00:25:43 2009 New Revision: 82011 URL: http://llvm.org/viewvc/llvm-project?rev=82011&view=rev Log: tidy up Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp?rev=82011&r1=82010&r2=82011&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp Wed Sep 16 00:25:43 2009 @@ -732,11 +732,9 @@ } void X86ATTAsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) { - const TargetData *TD = TM.getTargetData(); - if (!GVar->hasInitializer()) return; // External global require no code - + // Check to see if this is a special global used by LLVM, if so, emit it. if (EmitSpecialLLVMGlobal(GVar)) { if (Subtarget->isTargetDarwin() && @@ -748,6 +746,8 @@ } return; } + + const TargetData *TD = TM.getTargetData(); std::string name = Mang->getMangledName(GVar); Constant *C = GVar->getInitializer(); From sabre at nondot.org Wed Sep 16 00:26:00 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 16 Sep 2009 05:26:00 -0000 Subject: [llvm-commits] [llvm] r82012 - in /llvm/trunk: include/llvm/CodeGen/MachineModuleInfo.h lib/CodeGen/MachineModuleInfo.cpp Message-ID: <200909160526.n8G5Q1dp006747@zion.cs.uiuc.edu> Author: lattner Date: Wed Sep 16 00:26:00 2009 New Revision: 82012 URL: http://llvm.org/viewvc/llvm-project?rev=82012&view=rev Log: the pointer MMI keeps will start out with object-file format specific stuff Modified: llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp Modified: llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h?rev=82012&r1=82011&r2=82012&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h Wed Sep 16 00:26:00 2009 @@ -91,9 +91,10 @@ /// schemes and reformated for specific use. /// class MachineModuleInfo : public ImmutablePass { - /// TargetMMI - This is the target-specific implementation of - /// MachineModuleInfoImpl, which lets them accumulate whatever info they want. - MachineModuleInfoImpl *TargetMMI; + /// ObjFileMMI - This is the object-file-format-specific implementation of + /// MachineModuleInfoImpl, which lets targets accumulate whatever info they + /// want. + MachineModuleInfoImpl *ObjFileMMI; // LabelIDList - One entry per assigned label. Normally the entry is equal to // the list index(+1). If the entry is zero then the label has been deleted. @@ -161,18 +162,18 @@ /// backends that would like to do so. /// template - Ty *getInfo() { - if (TargetMMI == 0) - TargetMMI = new Ty(*this); + Ty *getObjFileInfo() { + if (ObjFileMMI == 0) + ObjFileMMI = new Ty(*this); - assert((void*)dynamic_cast(TargetMMI) == (void*)TargetMMI && + assert((void*)dynamic_cast(ObjFileMMI) == (void*)ObjFileMMI && "Invalid concrete type or multiple inheritence for getInfo"); - return static_cast(TargetMMI); + return static_cast(ObjFileMMI); } template - const Ty *getInfo() const { - return const_cast(this)->getInfo(); + const Ty *getObjFileInfo() const { + return const_cast(this)->getObjFileInfo(); } /// AnalyzeModule - Scan the module for global debug information. Modified: llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp?rev=82012&r1=82011&r2=82012&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp Wed Sep 16 00:26:00 2009 @@ -39,7 +39,7 @@ MachineModuleInfo::MachineModuleInfo() : ImmutablePass(&ID) -, TargetMMI(0) +, ObjFileMMI(0) , CallsEHReturn(0) , CallsUnwindInit(0) , DbgInfoAvailable(false) { @@ -48,7 +48,7 @@ } MachineModuleInfo::~MachineModuleInfo() { - delete TargetMMI; + delete ObjFileMMI; } /// doInitialization - Initialize the state for a new module. From sabre at nondot.org Wed Sep 16 00:36:07 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 16 Sep 2009 05:36:07 -0000 Subject: [llvm-commits] [llvm] r82013 - /llvm/trunk/docs/DeveloperPolicy.html Message-ID: <200909160536.n8G5a7T0007991@zion.cs.uiuc.edu> Author: lattner Date: Wed Sep 16 00:36:07 2009 New Revision: 82013 URL: http://llvm.org/viewvc/llvm-project?rev=82013&view=rev Log: Doug is now the code owner for most of the Clang frontend. Modified: llvm/trunk/docs/DeveloperPolicy.html Modified: llvm/trunk/docs/DeveloperPolicy.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/DeveloperPolicy.html?rev=82013&r1=82012&r2=82013&view=diff ============================================================================== --- llvm/trunk/docs/DeveloperPolicy.html (original) +++ llvm/trunk/docs/DeveloperPolicy.html Wed Sep 16 00:36:07 2009 @@ -188,13 +188,15 @@
  • Anton Korobeynikov: Exception handling, debug information, and Windows codegen.
  • -
  • Duncan Sands: llvm-gcc 4.2.
  • -
  • Evan Cheng: Code generator and all targets.
  • +
  • Doug Gregor: Clang Basic, Lex, Parse, and Sema Libraries.
  • +
  • Ted Kremenek: Clang Static Analyzer.
  • Chris Lattner: Everything else.
  • + +
  • Duncan Sands: llvm-gcc 4.2.
  • Note that code ownership is completely different than reviewers: anyone can From sabre at nondot.org Wed Sep 16 00:36:54 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 16 Sep 2009 05:36:54 -0000 Subject: [llvm-commits] [llvm] r82014 - /llvm/trunk/docs/DeveloperPolicy.html Message-ID: <200909160536.n8G5as8Y008094@zion.cs.uiuc.edu> Author: lattner Date: Wed Sep 16 00:36:54 2009 New Revision: 82014 URL: http://llvm.org/viewvc/llvm-project?rev=82014&view=rev Log: make more clear since it is sorted by last name now. Modified: llvm/trunk/docs/DeveloperPolicy.html Modified: llvm/trunk/docs/DeveloperPolicy.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/DeveloperPolicy.html?rev=82014&r1=82013&r2=82014&view=diff ============================================================================== --- llvm/trunk/docs/DeveloperPolicy.html (original) +++ llvm/trunk/docs/DeveloperPolicy.html Wed Sep 16 00:36:54 2009 @@ -194,7 +194,7 @@

  • Ted Kremenek: Clang Static Analyzer.
  • -
  • Chris Lattner: Everything else.
  • +
  • Chris Lattner: Everything not covered by someone else.
  • Duncan Sands: llvm-gcc 4.2.
  • From sabre at nondot.org Wed Sep 16 00:37:13 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 16 Sep 2009 05:37:13 -0000 Subject: [llvm-commits] [llvm] r82015 - /llvm/trunk/docs/DeveloperPolicy.html Message-ID: <200909160537.n8G5bD24008147@zion.cs.uiuc.edu> Author: lattner Date: Wed Sep 16 00:37:13 2009 New Revision: 82015 URL: http://llvm.org/viewvc/llvm-project?rev=82015&view=rev Log: I can sort, no really. Modified: llvm/trunk/docs/DeveloperPolicy.html Modified: llvm/trunk/docs/DeveloperPolicy.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/DeveloperPolicy.html?rev=82015&r1=82014&r2=82015&view=diff ============================================================================== --- llvm/trunk/docs/DeveloperPolicy.html (original) +++ llvm/trunk/docs/DeveloperPolicy.html Wed Sep 16 00:37:13 2009 @@ -185,15 +185,15 @@ else. The current code owners are:

      -
    1. Anton Korobeynikov: Exception handling, debug information, and - Windows codegen.
    2. -
    3. Evan Cheng: Code generator and all targets.
    4. Doug Gregor: Clang Basic, Lex, Parse, and Sema Libraries.
    5. Ted Kremenek: Clang Static Analyzer.
    6. +
    7. Anton Korobeynikov: Exception handling, debug information, and + Windows codegen.
    8. +
    9. Chris Lattner: Everything not covered by someone else.
    10. Duncan Sands: llvm-gcc 4.2.
    11. From sabre at nondot.org Wed Sep 16 00:42:13 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 16 Sep 2009 05:42:13 -0000 Subject: [llvm-commits] [llvm] r82016 - /llvm/trunk/docs/DeveloperPolicy.html Message-ID: <200909160542.n8G5gDnj008776@zion.cs.uiuc.edu> Author: lattner Date: Wed Sep 16 00:42:12 2009 New Revision: 82016 URL: http://llvm.org/viewvc/llvm-project?rev=82016&view=rev Log: apparently russians are really hard to sort or something! Modified: llvm/trunk/docs/DeveloperPolicy.html Modified: llvm/trunk/docs/DeveloperPolicy.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/DeveloperPolicy.html?rev=82016&r1=82015&r2=82016&view=diff ============================================================================== --- llvm/trunk/docs/DeveloperPolicy.html (original) +++ llvm/trunk/docs/DeveloperPolicy.html Wed Sep 16 00:42:12 2009 @@ -189,11 +189,11 @@
    12. Doug Gregor: Clang Basic, Lex, Parse, and Sema Libraries.
    13. -
    14. Ted Kremenek: Clang Static Analyzer.
    15. -
    16. Anton Korobeynikov: Exception handling, debug information, and Windows codegen.
    17. +
    18. Ted Kremenek: Clang Static Analyzer.
    19. +
    20. Chris Lattner: Everything not covered by someone else.
    21. Duncan Sands: llvm-gcc 4.2.
    22. From tonic at nondot.org Wed Sep 16 00:46:51 2009 From: tonic at nondot.org (Tanya Lattner) Date: Wed, 16 Sep 2009 00:46:51 -0500 Subject: [llvm-commits] CVS: llvm-www/devmtg/2009-10/index.php Message-ID: <200909160546.n8G5kpOJ009354@zion.cs.uiuc.edu> Changes in directory llvm-www/devmtg/2009-10: index.php updated: 1.12 -> 1.13 --- Log message: Add list of talks. --- Diffs of the changes: (+24 -1) index.php | 25 ++++++++++++++++++++++++- 1 files changed, 24 insertions(+), 1 deletion(-) Index: llvm-www/devmtg/2009-10/index.php diff -u llvm-www/devmtg/2009-10/index.php:1.12 llvm-www/devmtg/2009-10/index.php:1.13 --- llvm-www/devmtg/2009-10/index.php:1.12 Wed Sep 9 15:27:17 2009 +++ llvm-www/devmtg/2009-10/index.php Wed Sep 16 00:45:44 2009 @@ -56,6 +56,7 @@ This year's meeting is being coordinated by Ted Kremenek and Tanya Lattner.

      Registration
      +

      Registration is limited to 190 attendees.

      Register Now!! (Registration deadline is September 20, 2009)

      @@ -95,8 +96,30 @@
      Agenda
      -

      Volunteer to give a talk! (All talk proposals must be received by August 23, 2009)

      + +

      This is not a finalized schedule, but a list of the talks that will be given. We will update once we have the final schedule. You can expect the day to start at 8:45, with breakfast from 8:00-8:45.

      + + + + + + + + + + + + + + + + + + + +
      Talk TitleSpeaker
      Accelerating Ruby with LLVMEvan Phoenix
      ClangDough Gregor, Chris Lattner, Ted Kremenek
      CoVaC: Compiler Validation by Program Analysis of the Cross-ProductAnna Zaks
      Future Works in LLVM Register AllocationLang Hames
      LLVM on 180k CoresDavid Greene
      Object Code EmissionBruno Cardoso Lopes
      OpenCLNate Begeman
      Optimizing ActionScript Bytecode using LLVMScott Petersen
      The Parfait Bug-CheckerCristina Cifuentes
      PLANG: Translating nVidia PTX language to LLVM IRVinod Grover
      Precise and efficient garbage collection in VMKit with MMTkNicolas Geoffray
      Reimplementing llvm-gcc as a gcc pluginDuncan Sands
      ScalarEvolution: What's New, What's CoolDan Gohman
      SoftBound: Highly Compatible and Complete Spatial Memory Safety for CSantosh Nagarakatte
      Targeting XCore resources from LLVMRichard Osborne
      Tutorial: Building backend in 24 hoursAnton Korobeynikov
      Unladen Swallow: Python on LLVMCollin Winter
      {0,+,2} + %1 = sext i32 %i.01 to i64 ; [#uses=1] + +; CHECK: %2 = getelementptr inbounds double* %d, i64 %1 +; CHECK: --> {%d,+,16} + %2 = getelementptr inbounds double* %d, i64 %1 ; [#uses=1] + + %3 = load double* %2, align 8 ; [#uses=1] + %4 = sext i32 %i.01 to i64 ; [#uses=1] + %5 = getelementptr inbounds double* %q, i64 %4 ; [#uses=1] + %6 = load double* %5, align 8 ; [#uses=1] + %7 = or i32 %i.01, 1 ; [#uses=1] + +; CHECK: %8 = sext i32 %7 to i64 +; CHECK: --> {1,+,2} + %8 = sext i32 %7 to i64 ; [#uses=1] + +; CHECK: %9 = getelementptr inbounds double* %q, i64 %8 +; CHECK: {(8 + %q),+,16} + %9 = getelementptr inbounds double* %q, i64 %8 ; [#uses=1] + +; Artificially repeat the above three instructions, this time using +; add nsw instead of or. + %t7 = add nsw i32 %i.01, 1 ; [#uses=1] + +; CHECK: %t8 = sext i32 %t7 to i64 +; CHECK: --> {1,+,2} + %t8 = sext i32 %t7 to i64 ; [#uses=1] + +; CHECK: %t9 = getelementptr inbounds double* %q, i64 %t8 +; CHECK: {(8 + %q),+,16} + %t9 = getelementptr inbounds double* %q, i64 %t8 ; [#uses=1] + + %10 = load double* %9, align 8 ; [#uses=1] + %11 = fadd double %6, %10 ; [#uses=1] + %12 = fadd double %11, 3.200000e+00 ; [#uses=1] + %13 = fmul double %3, %12 ; [#uses=1] + %14 = sext i32 %i.01 to i64 ; [#uses=1] + %15 = getelementptr inbounds double* %d, i64 %14 ; [#uses=1] + store double %13, double* %15, align 8 + %16 = add nsw i32 %i.01, 2 ; [#uses=2] + br label %bb1 + +bb1: ; preds = %bb + %17 = icmp slt i32 %16, %n ; [#uses=1] + br i1 %17, label %bb, label %bb1.return_crit_edge + +bb1.return_crit_edge: ; preds = %bb1 + br label %return + +return: ; preds = %bb1.return_crit_edge, %entry + ret void +} + +; CHECK: Loop bb: backedge-taken count is ((-1 + %n) /u 2) +; CHECK: Loop bb: max backedge-taken count is 1073741823 From baldrick at free.fr Thu Sep 17 13:14:38 2009 From: baldrick at free.fr (Duncan Sands) Date: Thu, 17 Sep 2009 18:14:38 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r82152 - in /llvm-gcc-4.2/trunk/gcc: config.gcc config/exec-stack.h config/i386/openbsd.h config/i386/openbsd64.h config/i386/openbsdelf.h config/openbsd-libpthread.h config/openbsd.h Message-ID: <200909171814.n8HIEcfE029467@zion.cs.uiuc.edu> Author: baldrick Date: Thu Sep 17 13:14:37 2009 New Revision: 82152 URL: http://llvm.org/viewvc/llvm-project?rev=82152&view=rev Log: Update OpenBSD target configurations for llvm-gcc based on the gcc 4.2 port, and most importantly enable pic when building an llvm enabled configuration. Patch by Jonathan Gray. Added: llvm-gcc-4.2/trunk/gcc/config/exec-stack.h llvm-gcc-4.2/trunk/gcc/config/i386/openbsd64.h llvm-gcc-4.2/trunk/gcc/config/openbsd-libpthread.h Modified: llvm-gcc-4.2/trunk/gcc/config.gcc llvm-gcc-4.2/trunk/gcc/config/i386/openbsd.h llvm-gcc-4.2/trunk/gcc/config/i386/openbsdelf.h llvm-gcc-4.2/trunk/gcc/config/openbsd.h Modified: llvm-gcc-4.2/trunk/gcc/config.gcc URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config.gcc?rev=82152&r1=82151&r2=82152&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config.gcc (original) +++ llvm-gcc-4.2/trunk/gcc/config.gcc Thu Sep 17 13:14:37 2009 @@ -1152,10 +1152,15 @@ ;; i[34567]86-*-openbsd*) tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h" - tm_file="${tm_file} openbsd.h i386/openbsdelf.h" + tm_file="${tm_file} openbsd.h openbsd-libpthread.h i386/openbsdelf.h" gas=yes gnu_ld=yes ;; +x86_64-*-openbsd*) + tm_file="i386/biarch64.h i386/i386.h i386/unix.h i386/att.h dbxelf.h elfos.h openbsd.h openbsd-libpthread.h i386/x86-64.h i386/openbsd64.h" + tm_file="${tm_file} exec-stack.h" + tmake_file="t-libc-ok t-openbsd i386/t-openbsd" + ;; i[34567]86-*-coff*) tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h dbxcoff.h i386/i386-coff.h" use_fixproto=yes Added: llvm-gcc-4.2/trunk/gcc/config/exec-stack.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/exec-stack.h?rev=82152&view=auto ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/exec-stack.h (added) +++ llvm-gcc-4.2/trunk/gcc/config/exec-stack.h Thu Sep 17 13:14:37 2009 @@ -0,0 +1,40 @@ +/* Enable stack execute around trampoline address. + Copyright (C) 2002 Free Software Foundation, Inc. + +This file is part of GNU CC. + +GNU CC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU CC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +#undef FINALIZE_TRAMPOLINE +#define FINALIZE_TRAMPOLINE(TRAMP) \ + emit_library_call(gen_rtx_SYMBOL_REF (Pmode, "__enable_execute_stack"), \ + 0, VOIDmode, 1, memory_address (SImode, (TRAMP)), Pmode) + +#undef TRANSFER_FROM_TRAMPOLINE +#define TRANSFER_FROM_TRAMPOLINE \ +extern void __enable_execute_stack (void *); \ +void \ +__enable_execute_stack (addr) \ + void *addr; \ +{ \ + long size = getpagesize (); \ + long mask = ~(size-1); \ + char *page = (char *) (((long) addr) & mask); \ + char *end = (char *) ((((long) (addr + TRAMPOLINE_SIZE)) & mask) + size); \ + \ + if (mprotect (page, end - page, PROT_READ | PROT_WRITE | PROT_EXEC) < 0) \ + perror ("mprotect of trampoline code"); \ +} Modified: llvm-gcc-4.2/trunk/gcc/config/i386/openbsd.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/openbsd.h?rev=82152&r1=82151&r2=82152&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/i386/openbsd.h (original) +++ llvm-gcc-4.2/trunk/gcc/config/i386/openbsd.h Thu Sep 17 13:14:37 2009 @@ -41,10 +41,10 @@ /* This must agree with */ #undef SIZE_TYPE -#define SIZE_TYPE "unsigned int" +#define SIZE_TYPE "long unsigned int" #undef PTRDIFF_TYPE -#define PTRDIFF_TYPE "int" +#define PTRDIFF_TYPE "long int" #undef WCHAR_TYPE #define WCHAR_TYPE "int" @@ -52,6 +52,9 @@ #undef WCHAR_TYPE_SIZE #define WCHAR_TYPE_SIZE 32 +#undef WINT_TYPE +#define WINT_TYPE "int" + /* Assembler format: overall framework. */ #undef ASM_APP_ON Added: llvm-gcc-4.2/trunk/gcc/config/i386/openbsd64.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/openbsd64.h?rev=82152&view=auto ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/i386/openbsd64.h (added) +++ llvm-gcc-4.2/trunk/gcc/config/i386/openbsd64.h Thu Sep 17 13:14:37 2009 @@ -0,0 +1,121 @@ +/* Configuration for an OpenBSD x86-64 target. + + Copyright (C) 2003 Free Software Foundation, Inc. + +This file is part of GNU CC. + +GNU CC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU CC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +#undef TARGET_VERSION +#define TARGET_VERSION fprintf (stderr, " (OpenBSD/x86-64 ELF)") + +/* This gets defined in tm.h->linux.h->svr4.h, and keeps us from using + libraries compiled with the native cc, so undef it. */ +#undef NO_DOLLAR_IN_LABEL + +/* Override the default comment-starter of "/". */ +#undef ASM_COMMENT_START +#define ASM_COMMENT_START "#" + +/* Run-time target specifications */ + +#define TARGET_OS_CPP_BUILTINS() \ + do \ + { \ + OPENBSD_OS_CPP_BUILTINS_ELF(); \ + if (TARGET_64BIT) \ + OPENBSD_OS_CPP_BUILTINS_LP64(); \ + } \ + while (0) + +/* As an elf system, we need crtbegin/crtend stuff. */ +#undef STARTFILE_SPEC +#define STARTFILE_SPEC "\ + %{!shared: %{pg:gcrt0%O%s} %{!pg:%{p:gcrt0%O%s} %{!p:crt0%O%s}} \ + crtbegin%O%s} %{shared:crtbeginS%O%s}" +#undef ENDFILE_SPEC +#define ENDFILE_SPEC "%{!shared:crtend%O%s} %{shared:crtendS%O%s}" + +/* Layout of source language data types. */ + +/* This must agree with */ +#undef SIZE_TYPE +#define SIZE_TYPE "long unsigned int" + +#undef PTRDIFF_TYPE +#define PTRDIFF_TYPE "long int" + +#undef WCHAR_TYPE +#define WCHAR_TYPE "int" + +#undef WCHAR_TYPE_SIZE +#define WCHAR_TYPE_SIZE 32 + +/* Assembler format: overall framework. */ + +#undef ASM_APP_ON +#define ASM_APP_ON "#APP\n" + +#undef ASM_APP_OFF +#define ASM_APP_OFF "#NO_APP\n" + +#undef SET_ASM_OP +#define SET_ASM_OP "\t.set\t" + +/* The following macros were originally stolen from i386v4.h. + These have to be defined to get PIC code correct. */ + +/* Assembler format: dispatch tables. */ + +/* Assembler format: sections. */ + +/* Stack & calling: aggregate returns. */ + +/* Don't default to pcc-struct-return, because gcc is the only compiler, and + we want to retain compatibility with older gcc versions. */ +#define DEFAULT_PCC_STRUCT_RETURN 0 + +/* Assembler format: alignment output. */ + +/* Stack & calling: profiling. */ + +/* OpenBSD's profiler recovers all information from the stack pointer. + The icky part is not here, but in machine/profile.h. */ +#undef FUNCTION_PROFILER +#define FUNCTION_PROFILER(FILE, LABELNO) \ + fputs (flag_pic ? "\tcall __mcount at PLT\n": "\tcall __mcount\n", FILE); + +/* Assembler format: exception region output. */ + +/* Assembler format: alignment output. */ + +/* Note that we pick up ASM_OUTPUT_MAX_SKIP_ALIGN from i386/gas.h */ + +/* Note that we pick up ASM_OUTPUT_MI_THUNK from unix.h. */ + +#undef LINK_SPEC +#define LINK_SPEC \ + "%{!shared:%{!nostdlib:%{!r*:%{!e*:-e __start}}}} \ + %{shared:-shared} %{R*} \ + %{static:-Bstatic} \ + %{!static:-Bdynamic} \ + %{assert*} \ + %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.so}" + +#define OBSD_HAS_CORRECT_SPECS + +#undef JUMP_TABLES_IN_TEXT_SECTION +#define JUMP_TABLES_IN_TEXT_SECTION (flag_pic) Modified: llvm-gcc-4.2/trunk/gcc/config/i386/openbsdelf.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/openbsdelf.h?rev=82152&r1=82151&r2=82152&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/i386/openbsdelf.h (original) +++ llvm-gcc-4.2/trunk/gcc/config/i386/openbsdelf.h Thu Sep 17 13:14:37 2009 @@ -56,10 +56,10 @@ /* This must agree with */ #undef SIZE_TYPE -#define SIZE_TYPE "unsigned int" +#define SIZE_TYPE "long unsigned int" #undef PTRDIFF_TYPE -#define PTRDIFF_TYPE "int" +#define PTRDIFF_TYPE "long int" #undef WCHAR_TYPE #define WCHAR_TYPE "int" @@ -111,9 +111,6 @@ /* Assembler format: exception region output. */ -/* our configuration still doesn't handle dwarf2 correctly */ -#define DWARF2_UNWIND_INFO 0 - /* Assembler format: alignment output. */ /* Note that we pick up ASM_OUTPUT_MAX_SKIP_ALIGN from i386/gas.h */ Added: llvm-gcc-4.2/trunk/gcc/config/openbsd-libpthread.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/openbsd-libpthread.h?rev=82152&view=auto ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/openbsd-libpthread.h (added) +++ llvm-gcc-4.2/trunk/gcc/config/openbsd-libpthread.h Thu Sep 17 13:14:37 2009 @@ -0,0 +1,23 @@ +/* LIB_SPEC appropriate for OpenBSD. Include -lpthread if -pthread is + specified on the command line. */ +/* Copyright (C) 2004 Free Software Foundation, Inc. + +This file is part of GNU CC. + +GNU CC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU CC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +#define OBSD_LIB_SPEC "%{!shared:%{pthread:-lpthread} -lc}" + Modified: llvm-gcc-4.2/trunk/gcc/config/openbsd.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/openbsd.h?rev=82152&r1=82151&r2=82152&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/openbsd.h (original) +++ llvm-gcc-4.2/trunk/gcc/config/openbsd.h Thu Sep 17 13:14:37 2009 @@ -73,6 +73,37 @@ /* Controlling the compilation driver. */ /* TARGET_OS_CPP_BUILTINS() common to all OpenBSD targets. */ +#define OPENBSD_OS_CPP_BUILTINS_COMMON() \ + do \ + { \ + builtin_define ("__OpenBSD__"); \ + builtin_define ("__unix__"); \ + builtin_define ("__ANSI_COMPAT"); \ + builtin_assert ("system=unix"); \ + builtin_assert ("system=bsd"); \ + builtin_assert ("system=OpenBSD"); \ + } \ + while (0) + +/* TARGET_OS_CPP_BUILTINS() common to all OpenBSD ELF targets. */ +#define OPENBSD_OS_CPP_BUILTINS_ELF() \ + do \ + { \ + OPENBSD_OS_CPP_BUILTINS_COMMON(); \ + builtin_define ("__ELF__"); \ + } \ + while (0) + +/* TARGET_OS_CPP_BUILTINS() common to all LP64 OpenBSD targets. */ +#define OPENBSD_OS_CPP_BUILTINS_LP64() \ + do \ + { \ + builtin_define ("_LP64"); \ + builtin_define ("__LP64__"); \ + } \ + while (0) + +/* XXX old stuff TARGET_OS_CPP_BUILTINS() common to all OpenBSD targets. */ #define OPENBSD_OS_CPP_BUILTINS() \ do \ { \ @@ -96,15 +127,8 @@ #define OBSD_CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_POSIX_THREADS}" #endif -/* LIB_SPEC appropriate for OpenBSD. */ -#ifdef HAS_LIBC_R -/* -lc(_r)?(_p)?, select _r for threads, and _p for p or pg. */ -# define OBSD_LIB_SPEC "%{!shared:-lc%{pthread:_r}%{p:_p}%{!p:%{pg:_p}}}" -#else -/* Include -lpthread if -pthread is specified on the command line. */ -# define OBSD_LIB_SPEC "%{!shared:%{pthread:-lpthread%{p:_p}%{!p:%{pg:_p}}}} %{!shared:-lc%{p:_p}%{!p:%{pg:_p}}}" -#endif - +#undef LIB_SPEC +#define LIB_SPEC OBSD_LIB_SPEC #ifndef OBSD_HAS_CORRECT_SPECS @@ -140,6 +164,10 @@ "%{g:%{!nostdlib:-L/usr/lib/debug}} %{!shared:%{!nostdlib:%{!r*:%{!e*:-e start}}}} %{shared:-Bshareable -x} -dc -dp %{R*} %{static:-Bstatic} %{assert*}" #endif +#if defined(HAVE_LD_EH_FRAME_HDR) +#define LINK_EH_SPEC "%{!static:--eh-frame-hdr} " +#endif + #undef LIB_SPEC #define LIB_SPEC OBSD_LIB_SPEC #endif @@ -282,10 +310,6 @@ /* Storage layout. */ -/* Otherwise, since we support weak, gthr.h erroneously tries to use - #pragma weak. */ -#define GTHREAD_USE_WEAK 0 - /* bug work around: we don't want to support #pragma weak, but the current code layout needs HANDLE_PRAGMA_WEAK asserted for __attribute((weak)) to work. On the other hand, we don't define HANDLE_PRAGMA_WEAK directly, @@ -307,5 +331,18 @@ perror ("mprotect of trampoline code"); \ } +/* LLVM LOCAL begin */ +#ifdef ENABLE_LLVM + +/* Yes, we're supporting PIC codegen for OpenBSD targets! */ +#define LLVM_SET_TARGET_OPTIONS(argvec) \ + if (flag_pic) \ + argvec.push_back ("--relocation-model=pic"); \ + else \ + argvec.push_back ("--relocation-model=static"); + +#endif +/* LLVM LOCAL end */ + #include #include From anton at korobeynikov.info Thu Sep 17 13:18:45 2009 From: anton at korobeynikov.info (Anton Korobeynikov) Date: Thu, 17 Sep 2009 22:18:45 +0400 Subject: [llvm-commits] [llvm-gcc-4.2] r82152 - in /llvm-gcc-4.2/trunk/gcc: config.gcc config/exec-stack.h config/i386/openbsd.h config/i386/openbsd64.h config/i386/openbsdelf.h config/openbsd-libpthread.h config/openbsd.h In-Reply-To: <200909171814.n8HIEcfE029467@zion.cs.uiuc.edu> References: <200909171814.n8HIEcfE029467@zion.cs.uiuc.edu> Message-ID: Hi, Duncan > Update OpenBSD target configurations for llvm-gcc based on the gcc 4.2 port, > and most importantly enable pic when building an llvm enabled configuration. > Patch by Jonathan Gray. Shouldn't we add LLVM LOCAL markers? Even for whole new files? -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University From snaroff at apple.com Thu Sep 17 13:32:28 2009 From: snaroff at apple.com (Steve Naroff) Date: Thu, 17 Sep 2009 18:32:28 -0000 Subject: [llvm-commits] [llvm] r82153 - /llvm/tags/cremebrulee/cremebrulee-7/ Message-ID: <200909171832.n8HIWS0v031675@zion.cs.uiuc.edu> Author: snaroff Date: Thu Sep 17 13:32:28 2009 New Revision: 82153 URL: http://llvm.org/viewvc/llvm-project?rev=82153&view=rev Log: Tagging cremebrulee-7. Added: llvm/tags/cremebrulee/cremebrulee-7/ - copied from r82152, llvm/trunk/ From clattner at apple.com Thu Sep 17 13:34:05 2009 From: clattner at apple.com (Chris Lattner) Date: Thu, 17 Sep 2009 11:34:05 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r82079 - /llvm-gcc-4.2/trunk/gcc/opts.c In-Reply-To: <352a1fb20909170936k414fb72fpfddd06949a00a107@mail.gmail.com> References: <200909162102.n8GL2uTl011881@zion.cs.uiuc.edu> <4AB1DCB4.2040200@gmail.com> <0E2B6420-DA4A-4746-B59C-48F413AC35F9@apple.com> <352a1fb20909170936k414fb72fpfddd06949a00a107@mail.gmail.com> Message-ID: <5671B55C-F8EB-4CA5-8CB9-2B07B96441FC@apple.com> On Sep 17, 2009, at 9:36 AM, Devang Patel wrote: > Evan, > > It'd be useful to update llvm-gcc specific man page (doc/llvm-gcc.1) > to mention this diversion from gcc. Otherwise, gcc man page says -O is > same as -O1. I agree, the man page needs to be updated, -Chris From snaroff at apple.com Thu Sep 17 13:36:54 2009 From: snaroff at apple.com (Steve Naroff) Date: Thu, 17 Sep 2009 18:36:54 -0000 Subject: [llvm-commits] [llvm] r82155 - /llvm/tags/cremebrulee/cremebrulee-7/trunk/ Message-ID: <200909171836.n8HIasV4032226@zion.cs.uiuc.edu> Author: snaroff Date: Thu Sep 17 13:36:54 2009 New Revision: 82155 URL: http://llvm.org/viewvc/llvm-project?rev=82155&view=rev Log: Tagging cremebrulee-7. Added: llvm/tags/cremebrulee/cremebrulee-7/trunk/ - copied from r82154, llvm/trunk/ From sabre at nondot.org Thu Sep 17 13:49:53 2009 From: sabre at nondot.org (Chris Lattner) Date: Thu, 17 Sep 2009 18:49:53 -0000 Subject: [llvm-commits] [llvm] r82157 - in /llvm/trunk: include/llvm/Target/TargetLoweringObjectFile.h lib/CodeGen/AsmPrinter/DwarfException.cpp lib/Target/TargetLoweringObjectFile.cpp lib/Target/X86/X86TargetObjectFile.cpp lib/Target/X86/X86TargetObjectFile.h Message-ID: <200909171849.n8HInrOf001403@zion.cs.uiuc.edu> Author: lattner Date: Thu Sep 17 13:49:52 2009 New Revision: 82157 URL: http://llvm.org/viewvc/llvm-project?rev=82157&view=rev Log: pass machinemoduleinfo down into getSymbolForDwarfGlobalReference, currently unused. Modified: llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp llvm/trunk/lib/Target/X86/X86TargetObjectFile.h Modified: llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h?rev=82157&r1=82156&r2=82157&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h (original) +++ llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h Thu Sep 17 13:49:52 2009 @@ -18,15 +18,16 @@ #include "llvm/MC/SectionKind.h" namespace llvm { + class MachineModuleInfo; class Mangler; + class MCAsmInfo; + class MCExpr; class MCSection; class MCSectionMachO; class MCContext; class GlobalValue; class StringRef; class TargetMachine; - class MCAsmInfo; - class MCExpr; class TargetLoweringObjectFile { MCContext *Ctx; @@ -188,6 +189,7 @@ /// virtual const MCExpr * getSymbolForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang, + MachineModuleInfo *MMI, bool &IsIndirect, bool &IsPCRel) const; protected: @@ -320,6 +322,7 @@ /// defaults to returning a stub reference. virtual const MCExpr * getSymbolForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang, + MachineModuleInfo *MMI, bool &IsIndirect, bool &IsPCRel) const; }; Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp?rev=82157&r1=82156&r2=82157&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Thu Sep 17 13:49:52 2009 @@ -121,6 +121,7 @@ // In non-static mode, ask the object file how to represent this reference. PersonalityRef = TLOF.getSymbolForDwarfGlobalReference(PersonalityFn, Asm->Mang, + Asm->MMI, IsPersonalityIndirect, IsPersonalityPCRel); } Modified: llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp?rev=82157&r1=82156&r2=82157&view=diff ============================================================================== --- llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp (original) +++ llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp Thu Sep 17 13:49:52 2009 @@ -290,6 +290,7 @@ /// const MCExpr *TargetLoweringObjectFile:: getSymbolForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang, + MachineModuleInfo *MMI, bool &IsIndirect, bool &IsPCRel) const { // The generic implementation of this just returns a direct reference to the // symbol. @@ -956,6 +957,7 @@ const MCExpr *TargetLoweringObjectFileMachO:: getSymbolForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang, + MachineModuleInfo *MMI, bool &IsIndirect, bool &IsPCRel) const { // The mach-o version of this method defaults to returning a stub reference. IsIndirect = true; Modified: llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp?rev=82157&r1=82156&r2=82157&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp (original) +++ llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp Thu Sep 17 13:49:52 2009 @@ -15,6 +15,7 @@ const MCExpr *X8664_MachoTargetObjectFile:: getSymbolForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang, + MachineModuleInfo *MMI, bool &IsIndirect, bool &IsPCRel) const { // On Darwin/X86-64, we can reference dwarf symbols with foo at GOTPCREL+4, which Modified: llvm/trunk/lib/Target/X86/X86TargetObjectFile.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetObjectFile.h?rev=82157&r1=82156&r2=82157&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86TargetObjectFile.h (original) +++ llvm/trunk/lib/Target/X86/X86TargetObjectFile.h Thu Sep 17 13:49:52 2009 @@ -21,6 +21,7 @@ virtual const MCExpr * getSymbolForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang, + MachineModuleInfo *MMI, bool &IsIndirect, bool &IsPCRel) const; }; } // end namespace llvm From vhernandez at apple.com Thu Sep 17 14:51:52 2009 From: vhernandez at apple.com (Victor Hernandez) Date: Thu, 17 Sep 2009 12:51:52 -0700 Subject: [llvm-commits] [PATCH] extend transform passes to treat malloc calls the same as MallocInst (patch #3) In-Reply-To: References: <099A54D1-9659-4DB1-B64C-6AF8AB805D84@apple.com> Message-ID: <3B9F4B48-441F-48B1-9612-485FEC51EFC2@apple.com> On Sep 16, 2009, at 6:19 PM, Dan Gohman wrote: > Hi Victor, > > I haven't finished reviewing this, but here are all the comments I > had time to come up with so far: > > Please use spaces instead of tabs. Damn FileMerge. Will fix up my tabs. > > in FunctionAttributes.cpp: > @@ -247,8 +248,11 @@ > if (Instruction *RVI = dyn_cast(RetVal)) > switch (RVI->getOpcode()) { > // Extend the analysis by looking upwards. > + case Instruction::BitCast: > + if (isMalloc(RVI)) > + break; > + // fall through > case Instruction::GetElementPtr: > - case Instruction::BitCast: > FlowsToReturn.insert(RVI->getOperand(0)); > continue; > case Instruction::Select: { > @@ -267,6 +271,8 @@ > case Instruction::Malloc: > break; > case Instruction::Call: > + if (isMalloc(RVI)) > + break; > case Instruction::Invoke: { > CallSite CS(RVI); > if (CS.paramHasAttr(0, Attribute::NoAlias)) > > Those break statements are inside a switch, so they aren't > breaking to where they appear to be intended. As we discussed, the breaks are correct. They are supposed to break out of the switch statement. > > In InstructionCombining.cpp: > > @@ -9459,6 +9488,7 @@ > Align = PrefAlign; > } > } > + // No alignment changes needed for malloc calls > > This should rather say that no alignment changes are possible > for malloc calls (short of calling a different function). Comment fixed. > > I assume that for those big regions of copied code in GlobalOpt.cpp > the original code for MallocInst will go away soon, right? Yes, it all goes away once I delete MallocInst. > > Dan > > > On Sep 15, 2009, at 1:44 PM, Victor Hernandez wrote: > >> These are the changes to make all the transform passes apply the >> same analysis to malloc calls as to MallocInst. >> >> >> >> Victor_______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From baldrick at free.fr Thu Sep 17 14:56:56 2009 From: baldrick at free.fr (Duncan Sands) Date: Thu, 17 Sep 2009 19:56:56 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r82161 - in /llvm-gcc-4.2/trunk/gcc: config.gcc config/exec-stack.h config/i386/openbsd.h config/i386/openbsd64.h config/i386/openbsdelf.h config/openbsd-libpthread.h config/openbsd.h Message-ID: <200909171956.n8HJuv3H010091@zion.cs.uiuc.edu> Author: baldrick Date: Thu Sep 17 14:56:56 2009 New Revision: 82161 URL: http://llvm.org/viewvc/llvm-project?rev=82161&view=rev Log: Add LLVM local markers that were forgotten in the previous commit. Modified: llvm-gcc-4.2/trunk/gcc/config.gcc llvm-gcc-4.2/trunk/gcc/config/exec-stack.h llvm-gcc-4.2/trunk/gcc/config/i386/openbsd.h llvm-gcc-4.2/trunk/gcc/config/i386/openbsd64.h llvm-gcc-4.2/trunk/gcc/config/i386/openbsdelf.h llvm-gcc-4.2/trunk/gcc/config/openbsd-libpthread.h llvm-gcc-4.2/trunk/gcc/config/openbsd.h Modified: llvm-gcc-4.2/trunk/gcc/config.gcc URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config.gcc?rev=82161&r1=82160&r2=82161&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config.gcc (original) +++ llvm-gcc-4.2/trunk/gcc/config.gcc Thu Sep 17 14:56:56 2009 @@ -1152,15 +1152,18 @@ ;; i[34567]86-*-openbsd*) tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h" +# LLVM local tm_file="${tm_file} openbsd.h openbsd-libpthread.h i386/openbsdelf.h" gas=yes gnu_ld=yes ;; +# LLVM local begin x86_64-*-openbsd*) tm_file="i386/biarch64.h i386/i386.h i386/unix.h i386/att.h dbxelf.h elfos.h openbsd.h openbsd-libpthread.h i386/x86-64.h i386/openbsd64.h" tm_file="${tm_file} exec-stack.h" tmake_file="t-libc-ok t-openbsd i386/t-openbsd" ;; +# LLVM local end i[34567]86-*-coff*) tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h dbxcoff.h i386/i386-coff.h" use_fixproto=yes Modified: llvm-gcc-4.2/trunk/gcc/config/exec-stack.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/exec-stack.h?rev=82161&r1=82160&r2=82161&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/exec-stack.h (original) +++ llvm-gcc-4.2/trunk/gcc/config/exec-stack.h Thu Sep 17 14:56:56 2009 @@ -1,3 +1,4 @@ +/* LLVM LOCAL begin (ENTIRE FILE!) */ /* Enable stack execute around trampoline address. Copyright (C) 2002 Free Software Foundation, Inc. @@ -38,3 +39,4 @@ if (mprotect (page, end - page, PROT_READ | PROT_WRITE | PROT_EXEC) < 0) \ perror ("mprotect of trampoline code"); \ } +/* LLVM LOCAL end (ENTIRE FILE!) */ Modified: llvm-gcc-4.2/trunk/gcc/config/i386/openbsd.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/openbsd.h?rev=82161&r1=82160&r2=82161&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/i386/openbsd.h (original) +++ llvm-gcc-4.2/trunk/gcc/config/i386/openbsd.h Thu Sep 17 14:56:56 2009 @@ -41,9 +41,11 @@ /* This must agree with */ #undef SIZE_TYPE +/* LLVM local */ #define SIZE_TYPE "long unsigned int" #undef PTRDIFF_TYPE +/* LLVM local */ #define PTRDIFF_TYPE "long int" #undef WCHAR_TYPE @@ -52,9 +54,11 @@ #undef WCHAR_TYPE_SIZE #define WCHAR_TYPE_SIZE 32 +/* LLVM local begin */ #undef WINT_TYPE #define WINT_TYPE "int" +/* LLVM local end */ /* Assembler format: overall framework. */ #undef ASM_APP_ON Modified: llvm-gcc-4.2/trunk/gcc/config/i386/openbsd64.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/openbsd64.h?rev=82161&r1=82160&r2=82161&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/i386/openbsd64.h (original) +++ llvm-gcc-4.2/trunk/gcc/config/i386/openbsd64.h Thu Sep 17 14:56:56 2009 @@ -1,3 +1,4 @@ +/* LLVM LOCAL begin (ENTIRE FILE!) */ /* Configuration for an OpenBSD x86-64 target. Copyright (C) 2003 Free Software Foundation, Inc. @@ -119,3 +120,4 @@ #undef JUMP_TABLES_IN_TEXT_SECTION #define JUMP_TABLES_IN_TEXT_SECTION (flag_pic) +/* LLVM LOCAL end (ENTIRE FILE!) */ Modified: llvm-gcc-4.2/trunk/gcc/config/i386/openbsdelf.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/openbsdelf.h?rev=82161&r1=82160&r2=82161&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/i386/openbsdelf.h (original) +++ llvm-gcc-4.2/trunk/gcc/config/i386/openbsdelf.h Thu Sep 17 14:56:56 2009 @@ -56,9 +56,11 @@ /* This must agree with */ #undef SIZE_TYPE +/* LLVM local */ #define SIZE_TYPE "long unsigned int" #undef PTRDIFF_TYPE +/* LLVM local */ #define PTRDIFF_TYPE "long int" #undef WCHAR_TYPE @@ -111,6 +113,8 @@ /* Assembler format: exception region output. */ +/* LLVM local begin */ +/* LLVM local end */ /* Assembler format: alignment output. */ /* Note that we pick up ASM_OUTPUT_MAX_SKIP_ALIGN from i386/gas.h */ Modified: llvm-gcc-4.2/trunk/gcc/config/openbsd-libpthread.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/openbsd-libpthread.h?rev=82161&r1=82160&r2=82161&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/openbsd-libpthread.h (original) +++ llvm-gcc-4.2/trunk/gcc/config/openbsd-libpthread.h Thu Sep 17 14:56:56 2009 @@ -1,3 +1,4 @@ +/* LLVM LOCAL begin (ENTIRE FILE!) */ /* LIB_SPEC appropriate for OpenBSD. Include -lpthread if -pthread is specified on the command line. */ /* Copyright (C) 2004 Free Software Foundation, Inc. @@ -21,3 +22,4 @@ #define OBSD_LIB_SPEC "%{!shared:%{pthread:-lpthread} -lc}" +/* LLVM LOCAL end (ENTIRE FILE!) */ Modified: llvm-gcc-4.2/trunk/gcc/config/openbsd.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/openbsd.h?rev=82161&r1=82160&r2=82161&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/openbsd.h (original) +++ llvm-gcc-4.2/trunk/gcc/config/openbsd.h Thu Sep 17 14:56:56 2009 @@ -73,6 +73,7 @@ /* Controlling the compilation driver. */ /* TARGET_OS_CPP_BUILTINS() common to all OpenBSD targets. */ +/* LLVM local begin */ #define OPENBSD_OS_CPP_BUILTINS_COMMON() \ do \ { \ @@ -104,6 +105,7 @@ while (0) /* XXX old stuff TARGET_OS_CPP_BUILTINS() common to all OpenBSD targets. */ +/* LLVM local end */ #define OPENBSD_OS_CPP_BUILTINS() \ do \ { \ @@ -127,8 +129,10 @@ #define OBSD_CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_POSIX_THREADS}" #endif +/* LLVM local begin */ #undef LIB_SPEC #define LIB_SPEC OBSD_LIB_SPEC +/* LLVM local end */ #ifndef OBSD_HAS_CORRECT_SPECS @@ -164,10 +168,12 @@ "%{g:%{!nostdlib:-L/usr/lib/debug}} %{!shared:%{!nostdlib:%{!r*:%{!e*:-e start}}}} %{shared:-Bshareable -x} -dc -dp %{R*} %{static:-Bstatic} %{assert*}" #endif +/* LLVM local begin */ #if defined(HAVE_LD_EH_FRAME_HDR) #define LINK_EH_SPEC "%{!static:--eh-frame-hdr} " #endif +/* LLVM local end */ #undef LIB_SPEC #define LIB_SPEC OBSD_LIB_SPEC #endif @@ -310,6 +316,8 @@ /* Storage layout. */ +/* LLVM local begin */ +/* LLVM local end */ /* bug work around: we don't want to support #pragma weak, but the current code layout needs HANDLE_PRAGMA_WEAK asserted for __attribute((weak)) to work. On the other hand, we don't define HANDLE_PRAGMA_WEAK directly, @@ -342,7 +350,7 @@ argvec.push_back ("--relocation-model=static"); #endif -/* LLVM LOCAL end */ +/* LLVM LOCAL end */ #include #include From gohman at apple.com Thu Sep 17 15:12:05 2009 From: gohman at apple.com (Dan Gohman) Date: Thu, 17 Sep 2009 20:12:05 -0000 Subject: [llvm-commits] [llvm] r82162 - /llvm/trunk/lib/Target/ARM/AsmParser/ Message-ID: <200909172012.n8HKC6aH012041@zion.cs.uiuc.edu> Author: djg Date: Thu Sep 17 15:12:05 2009 New Revision: 82162 URL: http://llvm.org/viewvc/llvm-project?rev=82162&view=rev Log: Add an svn:ignore. Modified: llvm/trunk/lib/Target/ARM/AsmParser/ (props changed) Propchange: llvm/trunk/lib/Target/ARM/AsmParser/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Thu Sep 17 15:12:05 2009 @@ -0,0 +1,4 @@ +Debug +Release-Asserts +Release +Debug+Checks From rjmccall at apple.com Thu Sep 17 15:35:18 2009 From: rjmccall at apple.com (John McCall) Date: Thu, 17 Sep 2009 20:35:18 -0000 Subject: [llvm-commits] [llvm] r82163 - /llvm/trunk/include/llvm/ADT/PointerIntPair.h Message-ID: <200909172035.n8HKZI2W015104@zion.cs.uiuc.edu> Author: rjmccall Date: Thu Sep 17 15:35:18 2009 New Revision: 82163 URL: http://llvm.org/viewvc/llvm-project?rev=82163&view=rev Log: Fix a few places where PointerIntPair was using PointerLikeTypeTraits instead of the PtrTraits provided. Allows PointerIntPair to contain a PointerUnion safely, as long as the bits add up. Modified: llvm/trunk/include/llvm/ADT/PointerIntPair.h Modified: llvm/trunk/include/llvm/ADT/PointerIntPair.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/PointerIntPair.h?rev=82163&r1=82162&r2=82163&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/PointerIntPair.h (original) +++ llvm/trunk/include/llvm/ADT/PointerIntPair.h Thu Sep 17 15:35:18 2009 @@ -65,7 +65,8 @@ } PointerTy getPointer() const { - return reinterpret_cast(Value & PointerBitMask); + return PtrTraits::getFromVoidPointer( + reinterpret_cast(Value & PointerBitMask)); } IntType getInt() const { @@ -73,7 +74,8 @@ } void setPointer(PointerTy Ptr) { - intptr_t PtrVal = reinterpret_cast(Ptr); + intptr_t PtrVal + = reinterpret_cast(PtrTraits::getAsVoidPointer(Ptr)); assert((PtrVal & ((1 << PtrTraits::NumLowBitsAvailable)-1)) == 0 && "Pointer is not sufficiently aligned"); // Preserve all low bits, just update the pointer. @@ -141,8 +143,7 @@ return PointerIntPair::getFromOpaqueValue(P); } enum { - NumLowBitsAvailable = - PointerLikeTypeTraits::NumLowBitsAvailable - IntBits + NumLowBitsAvailable = PtrTraits::NumLowBitsAvailable - IntBits }; }; From gohman at apple.com Thu Sep 17 15:36:53 2009 From: gohman at apple.com (Dan Gohman) Date: Thu, 17 Sep 2009 13:36:53 -0700 Subject: [llvm-commits] [PATCH] get all MallocInst transforms/analysis to operate on malloc calls instead (patch #1) In-Reply-To: <0DCE4E98-5D92-4748-A804-B1EBBA14A240@apple.com> References: <0DCE4E98-5D92-4748-A804-B1EBBA14A240@apple.com> Message-ID: Hi Victor, This patch looks good, with one general area of comments: Instruction.cpp and Verifier.cpp now have their own copy of isMalloc. I guess this is to avoid a library dependence, but it's unfortunate. The Verifier may move out of VMCore some day, but Instructions.cpp is more problematic. It seems that CreateMalloc no longer belongs in VMCore; could it be moved? That would avoid at least one of the isMalloc copies. BTW, lib/Analysis currently has an overload of isMalloc which takes a non-const Value*. This isn't needed; the const-qualified one will always work here. Dan On Sep 15, 2009, at 1:38 PM, Victor Hernandez wrote: > This is the first of 4 patches that will result in malloc calls > having the same transforms/analysis applied to them as are currently > done to MallocInst. > This first patch includes changes to the malloc call creation code > (AllocTy is now the element type of the malloc, not the resulting > pointer type) and a bug fix to getMallocArraySize (the case where > the array size is a product of 2 constants was broken). > Also included are changes isSafeToSpeculativelyExecute() and > Verifier to treat malloc calls the same as MallocInst. > > > > Victor > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From mrs at apple.com Thu Sep 17 16:16:58 2009 From: mrs at apple.com (Mike Stump) Date: Thu, 17 Sep 2009 14:16:58 -0700 Subject: [llvm-commits] [llvm] r82040 - /llvm/trunk/lib/CodeGen/MachineModuleInfoImpls.cpp In-Reply-To: <4AB1C66E.3090507@mxc.ca> References: <200909161143.n8GBhCSq003928@zion.cs.uiuc.edu> <4AB1C66E.3090507@mxc.ca> Message-ID: On Sep 16, 2009, at 10:17 PM, Nick Lewycky wrote: > Benjamin Kramer wrote: >> Author: d0k >> Date: Wed Sep 16 06:43:12 2009 >> New Revision: 82040 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=82040&view=rev >> Log: >> Don't sort the vector when it is empty. This should fix some >> expensive checking >> failures. > > qsort? Why are we using qsort? Further hate for qsort, we want a stable sort, qsort isn't, so that we can have determinism and cross host comparisons of codegen... From vhernandez at apple.com Thu Sep 17 17:21:42 2009 From: vhernandez at apple.com (Victor Hernandez) Date: Thu, 17 Sep 2009 15:21:42 -0700 Subject: [llvm-commits] [PATCH] get all MallocInst transforms/analysis to operate on malloc calls instead (patch #1) In-Reply-To: References: <0DCE4E98-5D92-4748-A804-B1EBBA14A240@apple.com> Message-ID: <88F12B35-2FED-4F4B-8604-083A59EC7BF9@apple.com> On Sep 17, 2009, at 1:36 PM, Dan Gohman wrote: > Hi Victor, > > This patch looks good, with one general area of comments: > > Instruction.cpp and Verifier.cpp now have their own copy of isMalloc. > I guess this is to avoid a library dependence, but it's unfortunate. I agree that it is unfortunate; I did this to avoid adding all of MallocHelper into VMCore. I will add comments explaining that they code should match. > > The Verifier may move out of VMCore some day, but Instructions.cpp is > more problematic. It seems that CreateMalloc no longer belongs in > VMCore; could it be moved? That would avoid at least one of the > isMalloc copies. I cannot move CreateMalloc out of VMCore because it will be used by Core.cpp's LLVMBuildMalloc and LLVMBuildArrayMalloc. We agreed that it is ok to keep CreateMalloc where it is. > > BTW, lib/Analysis currently has an overload of isMalloc which takes > a non-const Value*. This isn't needed; the const-qualified one will > always work here. Thanks. I got rid of that extra function. Victor > > Dan > > On Sep 15, 2009, at 1:38 PM, Victor Hernandez wrote: > >> This is the first of 4 patches that will result in malloc calls >> having the same transforms/analysis applied to them as are >> currently done to MallocInst. >> This first patch includes changes to the malloc call creation code >> (AllocTy is now the element type of the malloc, not the resulting >> pointer type) and a bug fix to getMallocArraySize (the case where >> the array size is a product of 2 constants was broken). >> Also included are changes isSafeToSpeculativelyExecute() and >> Verifier to treat malloc calls the same as MallocInst. >> >> >> >> Victor >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From dpatel at apple.com Thu Sep 17 18:04:48 2009 From: dpatel at apple.com (Devang Patel) Date: Thu, 17 Sep 2009 23:04:48 -0000 Subject: [llvm-commits] [llvm] r82175 - in /llvm/trunk/lib/AsmParser: LLParser.cpp LLParser.h Message-ID: <200909172304.n8HN4mf9001890@zion.cs.uiuc.edu> Author: dpatel Date: Thu Sep 17 18:04:48 2009 New Revision: 82175 URL: http://llvm.org/viewvc/llvm-project?rev=82175&view=rev Log: Fix parsing of optional metadata for 'load', 'store' and 'alloc' instructions. Modified: llvm/trunk/lib/AsmParser/LLParser.cpp llvm/trunk/lib/AsmParser/LLParser.h Modified: llvm/trunk/lib/AsmParser/LLParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=82175&r1=82174&r2=82175&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/LLParser.cpp (original) +++ llvm/trunk/lib/AsmParser/LLParser.cpp Thu Sep 17 18:04:48 2009 @@ -1025,6 +1025,28 @@ return false; } +/// ParseOptionalDbgInfo +/// ::= /* empty */ +/// ::= 'dbg' !42 +bool LLParser::ParseOptionalDbgInfo() { + + if (!EatIfPresent(lltok::kw_dbg)) + return false; + if (Lex.getKind() != lltok::Metadata) + return TokError("Expected '!' here"); + Lex.Lex(); + MetadataBase *Node; + if (ParseMDNode(Node)) return true; + + Metadata &TheMetadata = M->getContext().getMetadata(); + unsigned MDDbgKind = TheMetadata.getMDKind("dbg"); + if (!MDDbgKind) + MDDbgKind = TheMetadata.RegisterMDKind("dbg"); + MDsOnInst.push_back(std::make_pair(MDDbgKind, cast(Node))); + + return false; +} + /// ParseOptionalAlignment /// ::= /* empty */ /// ::= 'align' 4 @@ -1039,17 +1061,24 @@ return false; } -/// ParseOptionalCommaAlignment -/// ::= /* empty */ -/// ::= ',' 'align' 4 -bool LLParser::ParseOptionalCommaAlignment(unsigned &Alignment) { - Alignment = 0; - if (!EatIfPresent(lltok::comma)) - return false; - return ParseToken(lltok::kw_align, "expected 'align'") || - ParseUInt32(Alignment); +/// ParseOptionalInfo +/// ::= OptionalInfo (',' OptionalInfo)+ +bool LLParser::ParseOptionalInfo(unsigned &Alignment) { + + // FIXME: Handle customized metadata info attached with an instruction. + do { + if (Lex.getKind() == lltok::kw_dbg) { + if (ParseOptionalDbgInfo()) return true; + } else if (Lex.getKind() == lltok::kw_align) { + if (ParseOptionalAlignment(Alignment)) return true; + } else + return true; + } while (EatIfPresent(lltok::comma)); + + return false; } + /// ParseIndexList /// ::= (',' uint32)+ bool LLParser::ParseIndexList(SmallVectorImpl &Indices) { @@ -2621,26 +2650,18 @@ if (ParseToken(lltok::equal, "expected '=' after instruction name")) return true; } - + if (ParseInstruction(Inst, BB, PFS)) return true; - - // Parse optional debug info - if (Lex.getKind() == lltok::comma) { - Lex.Lex(); - if (Lex.getKind() == lltok::kw_dbg) { - Lex.Lex(); - if (Lex.getKind() != lltok::Metadata) - return TokError("Expected '!' here"); - Lex.Lex(); - MetadataBase *N = 0; - if (ParseMDNode(N)) return true; - Metadata &TheMetadata = M->getContext().getMetadata(); - unsigned MDDbgKind = TheMetadata.getMDKind("dbg"); - if (!MDDbgKind) - MDDbgKind = TheMetadata.RegisterMDKind("dbg"); - TheMetadata.setMD(MDDbgKind, cast(N), Inst); - } - } + if (EatIfPresent(lltok::comma)) + ParseOptionalDbgInfo(); + + // Set metadata attached with this instruction. + Metadata &TheMetadata = M->getContext().getMetadata(); + for (SmallVector, 2>::iterator + MDI = MDsOnInst.begin(), MDE = MDsOnInst.end(); MDI != MDE; ++MDI) + TheMetadata.setMD(MDI->first, MDI->second, Inst); + MDsOnInst.clear(); + BB->getInstList().push_back(Inst); // Set the name on the instruction. @@ -2820,41 +2841,55 @@ //===----------------------------------------------------------------------===// /// ParseRet - Parse a return instruction. -/// ::= 'ret' void -/// ::= 'ret' TypeAndValue -/// ::= 'ret' TypeAndValue (',' TypeAndValue)+ [[obsolete: LLVM 3.0]] +/// ::= 'ret' void (',' 'dbg' !1) +/// ::= 'ret' TypeAndValue (',' 'dbg' !1) +/// ::= 'ret' TypeAndValue (',' TypeAndValue)+ (',' 'dbg' !1) +/// [[obsolete: LLVM 3.0]] bool LLParser::ParseRet(Instruction *&Inst, BasicBlock *BB, PerFunctionState &PFS) { PATypeHolder Ty(Type::getVoidTy(Context)); if (ParseType(Ty, true /*void allowed*/)) return true; if (Ty == Type::getVoidTy(Context)) { + if (EatIfPresent(lltok::comma)) + if (ParseOptionalDbgInfo()) return true; Inst = ReturnInst::Create(Context); return false; } Value *RV; if (ParseValue(Ty, RV, PFS)) return true; - - // The normal case is one return value. - if (Lex.getKind() == lltok::comma) { - // FIXME: LLVM 3.0 remove MRV support for 'ret i32 1, i32 2', requiring use - // of 'ret {i32,i32} {i32 1, i32 2}' - SmallVector RVs; - RVs.push_back(RV); - - while (EatIfPresent(lltok::comma)) { - if (ParseTypeAndValue(RV, PFS)) return true; - RVs.push_back(RV); - } - RV = UndefValue::get(PFS.getFunction().getReturnType()); - for (unsigned i = 0, e = RVs.size(); i != e; ++i) { - Instruction *I = InsertValueInst::Create(RV, RVs[i], i, "mrv"); - BB->getInstList().push_back(I); - RV = I; + if (EatIfPresent(lltok::comma)) { + // Parse optional 'dbg' + if (Lex.getKind() == lltok::kw_dbg) { + if (ParseOptionalDbgInfo()) return true; + } else { + // The normal case is one return value. + // FIXME: LLVM 3.0 remove MRV support for 'ret i32 1, i32 2', requiring use + // of 'ret {i32,i32} {i32 1, i32 2}' + SmallVector RVs; + RVs.push_back(RV); + + do { + // If optional 'dbg' is seen then this is the end of MRV. + if (Lex.getKind() == lltok::kw_dbg) + break; + if (ParseTypeAndValue(RV, PFS)) return true; + RVs.push_back(RV); + } while (EatIfPresent(lltok::comma)); + + RV = UndefValue::get(PFS.getFunction().getReturnType()); + for (unsigned i = 0, e = RVs.size(); i != e; ++i) { + Instruction *I = InsertValueInst::Create(RV, RVs[i], i, "mrv"); + BB->getInstList().push_back(I); + RV = I; + } } } + if (EatIfPresent(lltok::comma)) + if (ParseOptionalDbgInfo()) return true; + Inst = ReturnInst::Create(Context, RV); return false; } @@ -3393,8 +3428,8 @@ //===----------------------------------------------------------------------===// /// ParseAlloc -/// ::= 'malloc' Type (',' TypeAndValue)? (',' OptionalAlignment)? -/// ::= 'alloca' Type (',' TypeAndValue)? (',' OptionalAlignment)? +/// ::= 'malloc' Type (',' TypeAndValue)? (',' OptionalInfo)? +/// ::= 'alloca' Type (',' TypeAndValue)? (',' OptionalInfo)? bool LLParser::ParseAlloc(Instruction *&Inst, PerFunctionState &PFS, unsigned Opc) { PATypeHolder Ty(Type::getVoidTy(Context)); @@ -3404,11 +3439,12 @@ if (ParseType(Ty)) return true; if (EatIfPresent(lltok::comma)) { - if (Lex.getKind() == lltok::kw_align) { - if (ParseOptionalAlignment(Alignment)) return true; - } else if (ParseTypeAndValue(Size, SizeLoc, PFS) || - ParseOptionalCommaAlignment(Alignment)) { - return true; + if (Lex.getKind() == lltok::kw_align || Lex.getKind() == lltok::kw_dbg) { + if (ParseOptionalInfo(Alignment)) return true; + } else { + if (ParseTypeAndValue(Size, SizeLoc, PFS)) return true; + if (EatIfPresent(lltok::comma)) + if (ParseOptionalInfo(Alignment)) return true; } } @@ -3434,14 +3470,15 @@ } /// ParseLoad -/// ::= 'volatile'? 'load' TypeAndValue (',' 'align' i32)? +/// ::= 'volatile'? 'load' TypeAndValue (',' OptionalInfo)? bool LLParser::ParseLoad(Instruction *&Inst, PerFunctionState &PFS, bool isVolatile) { Value *Val; LocTy Loc; - unsigned Alignment; - if (ParseTypeAndValue(Val, Loc, PFS) || - ParseOptionalCommaAlignment(Alignment)) - return true; + unsigned Alignment = 0; + if (ParseTypeAndValue(Val, Loc, PFS)) return true; + + if (EatIfPresent(lltok::comma)) + if (ParseOptionalInfo(Alignment)) return true; if (!isa(Val->getType()) || !cast(Val->getType())->getElementType()->isFirstClassType()) @@ -3456,12 +3493,14 @@ bool LLParser::ParseStore(Instruction *&Inst, PerFunctionState &PFS, bool isVolatile) { Value *Val, *Ptr; LocTy Loc, PtrLoc; - unsigned Alignment; + unsigned Alignment = 0; if (ParseTypeAndValue(Val, Loc, PFS) || ParseToken(lltok::comma, "expected ',' after store operand") || - ParseTypeAndValue(Ptr, PtrLoc, PFS) || - ParseOptionalCommaAlignment(Alignment)) + ParseTypeAndValue(Ptr, PtrLoc, PFS)) return true; + + if (EatIfPresent(lltok::comma)) + if (ParseOptionalInfo(Alignment)) return true; if (!isa(Ptr->getType())) return Error(PtrLoc, "store operand must be a pointer"); Modified: llvm/trunk/lib/AsmParser/LLParser.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.h?rev=82175&r1=82174&r2=82175&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/LLParser.h (original) +++ llvm/trunk/lib/AsmParser/LLParser.h Thu Sep 17 18:04:48 2009 @@ -48,7 +48,7 @@ /// MetadataCache - This map keeps track of parsed metadata constants. std::map MetadataCache; std::map > ForwardRefMDNodes; - + SmallVector, 2> MDsOnInst; struct UpRefRecord { /// Loc - This is the location of the upref. LocTy Loc; @@ -128,7 +128,8 @@ bool ParseOptionalVisibility(unsigned &Visibility); bool ParseOptionalCallingConv(CallingConv::ID &CC); bool ParseOptionalAlignment(unsigned &Alignment); - bool ParseOptionalCommaAlignment(unsigned &Alignment); + bool ParseOptionalDbgInfo(); + bool ParseOptionalInfo(unsigned &Alignment); bool ParseIndexList(SmallVectorImpl &Indices); // Top-Level Entities From dpatel at apple.com Thu Sep 17 18:05:08 2009 From: dpatel at apple.com (Devang Patel) Date: Thu, 17 Sep 2009 23:05:08 -0000 Subject: [llvm-commits] [llvm] r82176 - /llvm/trunk/test/Feature/md_on_instruction.ll Message-ID: <200909172305.n8HN58MF001943@zion.cs.uiuc.edu> Author: dpatel Date: Thu Sep 17 18:05:07 2009 New Revision: 82176 URL: http://llvm.org/viewvc/llvm-project?rev=82176&view=rev Log: A testcase! Added: llvm/trunk/test/Feature/md_on_instruction.ll Added: llvm/trunk/test/Feature/md_on_instruction.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Feature/md_on_instruction.ll?rev=82176&view=auto ============================================================================== --- llvm/trunk/test/Feature/md_on_instruction.ll (added) +++ llvm/trunk/test/Feature/md_on_instruction.ll Thu Sep 17 18:05:07 2009 @@ -0,0 +1,23 @@ +; RUN: llvm-as < %s -disable-output + +define i32 @foo() nounwind ssp { +entry: + %retval = alloca i32 ; [#uses=2] + call void @llvm.dbg.func.start(metadata !0) + store i32 42, i32* %retval, dbg !3 + br label %0, dbg !3 + +;
    @@ -158,6 +159,13 @@ 5:30-7:30DINNER (Must have registered w/ dinner option) --> + +
    BOFs
    +

    Unique to this year's Developer Meeting, we will have Birds-of-a-Feather sessions (BOFs) that will coincide with the talks. For those unfamiliar with BOFs, these are attendee organized meetings for people to meet, exchange ideas, and share information on a variety of topics. BOF slots will be 40 minutes long. BOFs will be printed on the official schedule and be put on the website so attendees can plan to attend. +

    +If you are interested in organizing a BOF, please <email us no later than September 26th. +

    +
    Getting There

    The meeting will be held in building Changes in directory llvm-www/devmtg/2009-10: index.php updated: 1.17 -> 1.18 --- Log message: Remove extra character. --- Diffs of the changes: (+1 -1) index.php | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm-www/devmtg/2009-10/index.php diff -u llvm-www/devmtg/2009-10/index.php:1.17 llvm-www/devmtg/2009-10/index.php:1.18 --- llvm-www/devmtg/2009-10/index.php:1.17 Fri Sep 18 16:24:47 2009 +++ llvm-www/devmtg/2009-10/index.php Fri Sep 18 16:25:52 2009 @@ -163,7 +163,7 @@

    Unique to this year's Developer Meeting, we will have Birds-of-a-Feather sessions (BOFs) that will coincide with the talks. For those unfamiliar with BOFs, these are attendee organized meetings for people to meet, exchange ideas, and share information on a variety of topics. BOF slots will be 40 minutes long. BOFs will be printed on the official schedule and be put on the website so attendees can plan to attend.

    -If you are interested in organizing a BOF, please <email us no later than September 26th. +If you are interested in organizing a BOF, please email us no later than September 26th.

    Getting There
    From vhernandez at apple.com Fri Sep 18 16:34:52 2009 From: vhernandez at apple.com (Victor Hernandez) Date: Fri, 18 Sep 2009 21:34:52 -0000 Subject: [llvm-commits] [llvm] r82281 - in /llvm/trunk/lib/Analysis: BasicAliasAnalysis.cpp IPA/Andersens.cpp IPA/GlobalsModRef.cpp MemoryDependenceAnalysis.cpp PointerTracking.cpp Message-ID: <200909182134.n8ILYqvs025413@zion.cs.uiuc.edu> Author: hernande Date: Fri Sep 18 16:34:51 2009 New Revision: 82281 URL: http://llvm.org/viewvc/llvm-project?rev=82281&view=rev Log: Enhance analysis passes so that they apply the same analysis to malloc calls as to MallocInst. Reviewed by Eli Friedman. Modified: llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp llvm/trunk/lib/Analysis/IPA/Andersens.cpp llvm/trunk/lib/Analysis/IPA/GlobalsModRef.cpp llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp llvm/trunk/lib/Analysis/PointerTracking.cpp Modified: llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp?rev=82281&r1=82280&r2=82281&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp (original) +++ llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp Fri Sep 18 16:34:51 2009 @@ -15,6 +15,7 @@ #include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Analysis/CaptureTracking.h" +#include "llvm/Analysis/MallocHelper.h" #include "llvm/Analysis/Passes.h" #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" @@ -102,7 +103,7 @@ /// isObjectSmallerThan - Return true if we can prove that the object specified /// by V is smaller than Size. static bool isObjectSmallerThan(const Value *V, unsigned Size, - const TargetData &TD) { + LLVMContext &Context, const TargetData &TD) { const Type *AccessTy; if (const GlobalVariable *GV = dyn_cast(V)) { AccessTy = GV->getType()->getElementType(); @@ -111,6 +112,12 @@ AccessTy = AI->getType()->getElementType(); else return false; + } else if (const CallInst* CI = extractMallocCall(V)) { + if (!isArrayMalloc(V, Context, &TD)) + // The size is the argument to the malloc call. + if (const ConstantInt* C = dyn_cast(CI->getOperand(1))) + return (C->getZExtValue() < Size); + return false; } else if (const Argument *A = dyn_cast(V)) { if (A->hasByValAttr()) AccessTy = cast(A->getType())->getElementType(); @@ -340,9 +347,10 @@ // If the size of one access is larger than the entire object on the other // side, then we know such behavior is undefined and can assume no alias. + LLVMContext &Context = V1->getContext(); if (TD) - if ((V1Size != ~0U && isObjectSmallerThan(O2, V1Size, *TD)) || - (V2Size != ~0U && isObjectSmallerThan(O1, V2Size, *TD))) + if ((V1Size != ~0U && isObjectSmallerThan(O2, V1Size, Context, *TD)) || + (V2Size != ~0U && isObjectSmallerThan(O1, V2Size, Context, *TD))) return NoAlias; // If one pointer is the result of a call/invoke and the other is a Modified: llvm/trunk/lib/Analysis/IPA/Andersens.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IPA/Andersens.cpp?rev=82281&r1=82280&r2=82281&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/IPA/Andersens.cpp (original) +++ llvm/trunk/lib/Analysis/IPA/Andersens.cpp Fri Sep 18 16:34:51 2009 @@ -64,6 +64,7 @@ #include "llvm/Support/InstIterator.h" #include "llvm/Support/InstVisitor.h" #include "llvm/Analysis/AliasAnalysis.h" +#include "llvm/Analysis/MallocHelper.h" #include "llvm/Analysis/Passes.h" #include "llvm/Support/Debug.h" #include "llvm/System/Atomic.h" @@ -592,9 +593,12 @@ friend class InstVisitor; void visitReturnInst(ReturnInst &RI); void visitInvokeInst(InvokeInst &II) { visitCallSite(CallSite(&II)); } - void visitCallInst(CallInst &CI) { visitCallSite(CallSite(&CI)); } + void visitCallInst(CallInst &CI) { + if (isMalloc(&CI)) visitAllocationInst(CI); + else visitCallSite(CallSite(&CI)); + } void visitCallSite(CallSite CS); - void visitAllocationInst(AllocationInst &AI); + void visitAllocationInst(Instruction &I); void visitLoadInst(LoadInst &LI); void visitStoreInst(StoreInst &SI); void visitGetElementPtrInst(GetElementPtrInst &GEP); @@ -790,6 +794,8 @@ ValueNodes[&*II] = NumObjects++; if (AllocationInst *AI = dyn_cast(&*II)) ObjectNodes[AI] = NumObjects++; + else if (isMalloc(&*II)) + ObjectNodes[&*II] = NumObjects++; } // Calls to inline asm need to be added as well because the callee isn't @@ -1161,10 +1167,10 @@ } } -void Andersens::visitAllocationInst(AllocationInst &AI) { - unsigned ObjectIndex = getObject(&AI); - GraphNodes[ObjectIndex].setValue(&AI); - Constraints.push_back(Constraint(Constraint::AddressOf, getNodeValue(AI), +void Andersens::visitAllocationInst(Instruction &I) { + unsigned ObjectIndex = getObject(&I); + GraphNodes[ObjectIndex].setValue(&I); + Constraints.push_back(Constraint(Constraint::AddressOf, getNodeValue(I), ObjectIndex)); } @@ -2813,7 +2819,7 @@ else errs() << "(unnamed)"; - if (isa(V) || isa(V)) + if (isa(V) || isa(V) || isMalloc(V)) if (N == &GraphNodes[getObject(V)]) errs() << ""; } Modified: llvm/trunk/lib/Analysis/IPA/GlobalsModRef.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IPA/GlobalsModRef.cpp?rev=82281&r1=82280&r2=82281&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/IPA/GlobalsModRef.cpp (original) +++ llvm/trunk/lib/Analysis/IPA/GlobalsModRef.cpp Fri Sep 18 16:34:51 2009 @@ -23,6 +23,7 @@ #include "llvm/DerivedTypes.h" #include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Analysis/CallGraph.h" +#include "llvm/Analysis/MallocHelper.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/InstIterator.h" @@ -236,6 +237,9 @@ } } else if (GetElementPtrInst *GEP = dyn_cast(*UI)) { if (AnalyzeUsesOfPointer(GEP, Readers, Writers)) return true; + } else if (BitCastInst *BCI = dyn_cast(*UI)) { + if (AnalyzeUsesOfPointer(BCI, Readers, Writers, OkayStoreDest)) + return true; } else if (CallInst *CI = dyn_cast(*UI)) { // Make sure that this is just the function being called, not that it is // passing into the function. @@ -299,7 +303,7 @@ // Check the value being stored. Value *Ptr = SI->getOperand(0)->getUnderlyingObject(); - if (isa(Ptr)) { + if (isa(Ptr) || isMalloc(Ptr)) { // Okay, easy case. } else if (CallInst *CI = dyn_cast(Ptr)) { Function *F = CI->getCalledFunction(); @@ -435,7 +439,8 @@ if (cast(*II).isVolatile()) // Treat volatile stores as reading memory somewhere. FunctionEffect |= Ref; - } else if (isa(*II) || isa(*II)) { + } else if (isa(*II) || isa(*II) || + isMalloc(&cast(*II))) { FunctionEffect |= ModRef; } Modified: llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp?rev=82281&r1=82280&r2=82281&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp (original) +++ llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp Fri Sep 18 16:34:51 2009 @@ -20,6 +20,7 @@ #include "llvm/IntrinsicInst.h" #include "llvm/Function.h" #include "llvm/Analysis/AliasAnalysis.h" +#include "llvm/Analysis/MallocHelper.h" #include "llvm/ADT/Statistic.h" #include "llvm/ADT/STLExtras.h" #include "llvm/Support/PredIteratorCache.h" @@ -233,6 +234,15 @@ continue; } + if (isMalloc(Inst)) { + Value *AccessPtr = MemPtr->getUnderlyingObject(); + + if (AccessPtr == Inst || + AA->alias(Inst, 1, AccessPtr, 1) == AliasAnalysis::MustAlias) + return MemDepResult::getDef(Inst); + continue; + } + // See if this instruction (e.g. a call or vaarg) mod/ref's the pointer. switch (AA->getModRefInfo(Inst, MemPtr, MemSize)) { case AliasAnalysis::NoModRef: Modified: llvm/trunk/lib/Analysis/PointerTracking.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/PointerTracking.cpp?rev=82281&r1=82280&r2=82281&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/PointerTracking.cpp (original) +++ llvm/trunk/lib/Analysis/PointerTracking.cpp Fri Sep 18 16:34:51 2009 @@ -13,6 +13,7 @@ #include "llvm/Analysis/ConstantFolding.h" #include "llvm/Analysis/Dominators.h" #include "llvm/Analysis/LoopInfo.h" +#include "llvm/Analysis/MallocHelper.h" #include "llvm/Analysis/PointerTracking.h" #include "llvm/Analysis/ScalarEvolution.h" #include "llvm/Analysis/ScalarEvolutionExpressions.h" @@ -99,6 +100,14 @@ return SE->getSCEV(arraySize); } + if (CallInst *CI = extractMallocCall(V)) { + Value *arraySize = getMallocArraySize(CI, P->getContext(), TD); + Ty = getMallocAllocatedType(CI); + if (!Ty || !arraySize) return SE->getCouldNotCompute(); + // arraySize elements of type Ty. + return SE->getSCEV(arraySize); + } + if (GlobalVariable *GV = dyn_cast(V)) { if (GV->hasDefinitiveInitializer()) { Constant *C = GV->getInitializer(); From isanbard at gmail.com Fri Sep 18 16:37:56 2009 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 18 Sep 2009 21:37:56 -0000 Subject: [llvm-commits] [llvm] r82282 - in /llvm/trunk/lib/CodeGen/AsmPrinter: DwarfException.cpp DwarfException.h Message-ID: <200909182137.n8ILbuSs025847@zion.cs.uiuc.edu> Author: void Date: Fri Sep 18 16:37:56 2009 New Revision: 82282 URL: http://llvm.org/viewvc/llvm-project?rev=82282&view=rev Log: Factor out label difference creation. Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.h Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp?rev=82282&r1=82281&r2=82282&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Fri Sep 18 16:37:56 2009 @@ -74,6 +74,25 @@ return 0; } +/// CreateLabelDiff - Emit a label and subtract it from the expression we +/// already have. This is equivalent to emitting "foo - .", but we have to emit +/// the label for "." directly. +const MCExpr *DwarfException::CreateLabelDiff(const MCExpr *ExprRef, + const char *LabelName, + unsigned Index) { + SmallString<64> Name; + raw_svector_ostream(Name) << MAI->getPrivateGlobalPrefix() + << LabelName << Asm->getFunctionNumber() + << "_" << Index; + MCSymbol *DotSym = Asm->OutContext.GetOrCreateSymbol(Name.str()); + Asm->OutStreamer.EmitLabel(DotSym); + + return MCBinaryExpr::CreateSub(ExprRef, + MCSymbolRefExpr::Create(DotSym, + Asm->OutContext), + Asm->OutContext); +} + /// EmitCIE - Emit a Common Information Entry (CIE). This holds information that /// is shared among many Frame Description Entries. There is at least one CIE /// in every non-empty .debug_frame section. @@ -176,23 +195,9 @@ // If there is a personality, we need to indicate the function's location. if (PersonalityRef) { - // If the reference to the personality function symbol is not already - // pc-relative, then we need to subtract our current address from it. Do - // this by emitting a label and subtracting it from the expression we - // already have. This is equivalent to emitting "foo - .", but we have to - // emit the label for "." directly. - if (!IsPersonalityPCRel) { - SmallString<64> Name; - raw_svector_ostream(Name) << MAI->getPrivateGlobalPrefix() - << "personalityref_addr" << Asm->getFunctionNumber() << "_" << Index; - MCSymbol *DotSym = Asm->OutContext.GetOrCreateSymbol(Name.str()); - Asm->OutStreamer.EmitLabel(DotSym); - - PersonalityRef = - MCBinaryExpr::CreateSub(PersonalityRef, - MCSymbolRefExpr::Create(DotSym,Asm->OutContext), - Asm->OutContext); - } + if (!IsPersonalityPCRel) + PersonalityRef = CreateLabelDiff(PersonalityRef, "personalityref_addr", + Index); O << MAI->getData32bitsDirective(); PersonalityRef->print(O, MAI); @@ -912,24 +917,8 @@ IsTypeInfoIndirect, IsTypeInfoPCRel); - if (!IsTypeInfoPCRel) { - // If the reference to the type info symbol is not already - // pc-relative, then we need to subtract our current address from it. - // Do this by emitting a label and subtracting it from the expression - // we already have. This is equivalent to emitting "foo - .", but we - // have to emit the label for "." directly. - SmallString<64> Name; - raw_svector_ostream(Name) << MAI->getPrivateGlobalPrefix() - << "typeinforef_addr" << Asm->getFunctionNumber() << "_" << Index; - MCSymbol *DotSym = Asm->OutContext.GetOrCreateSymbol(Name.str()); - Asm->OutStreamer.EmitLabel(DotSym); - - TypeInfoRef = - MCBinaryExpr::CreateSub(TypeInfoRef, - MCSymbolRefExpr::Create(DotSym, - Asm->OutContext), - Asm->OutContext); - } + if (!IsTypeInfoPCRel) + TypeInfoRef = CreateLabelDiff(TypeInfoRef, "typeinforef_addr", Index); O << MAI->getData32bitsDirective(); TypeInfoRef->print(O, MAI); Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.h?rev=82282&r1=82281&r2=82282&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.h (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.h Fri Sep 18 16:37:56 2009 @@ -25,6 +25,7 @@ struct LandingPadInfo; class MachineModuleInfo; class MCAsmInfo; +class MCExpr; class Timer; class raw_ostream; @@ -168,6 +169,11 @@ const SmallVectorImpl &FirstActions); void EmitExceptionTable(); + /// CreateLabelDiff - Emit a label and subtract it from the expression we + /// already have. This is equivalent to emitting "foo - .", but we have to + /// emit the label for "." directly. + const MCExpr *CreateLabelDiff(const MCExpr *ExprRef, const char *LabelName, + unsigned Index); public: //===--------------------------------------------------------------------===// // Main entry points. From echristo at apple.com Fri Sep 18 16:39:02 2009 From: echristo at apple.com (Eric Christopher) Date: Fri, 18 Sep 2009 14:39:02 -0700 Subject: [llvm-commits] [llvm] r82282 - in /llvm/trunk/lib/CodeGen/AsmPrinter: DwarfException.cpp DwarfException.h In-Reply-To: <200909182137.n8ILbuSs025847@zion.cs.uiuc.edu> References: <200909182137.n8ILbuSs025847@zion.cs.uiuc.edu> Message-ID: <4DBD26D9-4A4F-4BA9-B9CA-128217F5D938@apple.com> On Sep 18, 2009, at 2:37 PM, Bill Wendling wrote: > Factor out label difference creation. Very nice. Thanks Bill! -eric From bob.wilson at apple.com Fri Sep 18 16:42:44 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Fri, 18 Sep 2009 21:42:44 -0000 Subject: [llvm-commits] [llvm] r82284 - /llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp Message-ID: <200909182142.n8ILgivh026503@zion.cs.uiuc.edu> Author: bwilson Date: Fri Sep 18 16:42:44 2009 New Revision: 82284 URL: http://llvm.org/viewvc/llvm-project?rev=82284&view=rev Log: Fix a typo in an assertion message. Modified: llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp Modified: llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp?rev=82284&r1=82283&r2=82284&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp Fri Sep 18 16:42:44 2009 @@ -1021,7 +1021,7 @@ const MachineFrameInfo *MFI = MF.getFrameInfo(); ARMFunctionInfo *AFI = MF.getInfo(); assert(!AFI->isThumb1OnlyFunction() && - "This eliminateFrameIndex does not suppor Thumb1!"); + "This eliminateFrameIndex does not support Thumb1!"); while (!MI.getOperand(i).isFI()) { ++i; From bob.wilson at apple.com Fri Sep 18 16:43:11 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Fri, 18 Sep 2009 21:43:11 -0000 Subject: [llvm-commits] [llvm] r82285 - /llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp Message-ID: <200909182143.n8ILhCgf026572@zion.cs.uiuc.edu> Author: bwilson Date: Fri Sep 18 16:43:11 2009 New Revision: 82285 URL: http://llvm.org/viewvc/llvm-project?rev=82285&view=rev Log: Fix a comment typo and some whitespace. Modified: llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp Modified: llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp?rev=82285&r1=82284&r2=82285&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp (original) +++ llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp Fri Sep 18 16:43:11 2009 @@ -570,7 +570,7 @@ // Round up the size to a multiple of the alignment, but only if there are // calls or alloca's in the function. This ensures that any calls to - // subroutines have their stack frames suitable aligned. + // subroutines have their stack frames suitably aligned. // Also do this if we need runtime alignment of the stack. In this case // offsets will be relative to SP not FP; round up the stack size so this // works. @@ -584,7 +584,7 @@ if (RegInfo->hasReservedCallFrame(Fn)) Offset += FFI->getMaxCallFrameSize(); - unsigned AlignMask = std::max(TFI.getStackAlignment(),MaxAlign) - 1; + unsigned AlignMask = std::max(TFI.getStackAlignment(), MaxAlign) - 1; Offset = (Offset + AlignMask) & ~uint64_t(AlignMask); } From sabre at nondot.org Fri Sep 18 17:01:31 2009 From: sabre at nondot.org (Chris Lattner) Date: Fri, 18 Sep 2009 22:01:31 -0000 Subject: [llvm-commits] [llvm] r82290 - /llvm/trunk/include/llvm/Support/StandardPasses.h Message-ID: <200909182201.n8IM1VFV029103@zion.cs.uiuc.edu> Author: lattner Date: Fri Sep 18 17:01:30 2009 New Revision: 82290 URL: http://llvm.org/viewvc/llvm-project?rev=82290&view=rev Log: reduce indentation by using an early exit, and add a comment, no functionality change. Modified: llvm/trunk/include/llvm/Support/StandardPasses.h Modified: llvm/trunk/include/llvm/Support/StandardPasses.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/StandardPasses.h?rev=82290&r1=82289&r2=82290&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/StandardPasses.h (original) +++ llvm/trunk/include/llvm/Support/StandardPasses.h Fri Sep 18 17:01:30 2009 @@ -80,6 +80,8 @@ } } + /// createStandardModulePasses - Add the standard module passes. This is + /// expected to be run after the standard function passes. static inline void createStandardModulePasses(PassManager *PM, unsigned OptimizationLevel, bool OptimizeSize, @@ -91,70 +93,71 @@ if (OptimizationLevel == 0) { if (InliningPass) PM->add(InliningPass); - } else { - if (UnitAtATime) - PM->add(createRaiseAllocationsPass()); // call %malloc -> malloc inst - PM->add(createCFGSimplificationPass()); // Clean up disgusting code - // Kill useless allocas - PM->add(createPromoteMemoryToRegisterPass()); - if (UnitAtATime) { - PM->add(createGlobalOptimizerPass()); // Optimize out global vars - PM->add(createGlobalDCEPass()); // Remove unused fns and globs - // IP Constant Propagation - PM->add(createIPConstantPropagationPass()); - PM->add(createDeadArgEliminationPass()); // Dead argument elimination - } - PM->add(createInstructionCombiningPass()); // Clean up after IPCP & DAE - PM->add(createCFGSimplificationPass()); // Clean up after IPCP & DAE - if (UnitAtATime) { - if (HaveExceptions) - PM->add(createPruneEHPass()); // Remove dead EH info - PM->add(createFunctionAttrsPass()); // Set readonly/readnone attrs - } - if (InliningPass) - PM->add(InliningPass); - if (OptimizationLevel > 2) - PM->add(createArgumentPromotionPass()); // Scalarize uninlined fn args - if (SimplifyLibCalls) - PM->add(createSimplifyLibCallsPass()); // Library Call Optimizations - PM->add(createInstructionCombiningPass()); // Cleanup for scalarrepl. - PM->add(createJumpThreadingPass()); // Thread jumps. - PM->add(createCFGSimplificationPass()); // Merge & remove BBs - PM->add(createScalarReplAggregatesPass()); // Break up aggregate allocas - PM->add(createInstructionCombiningPass()); // Combine silly seq's - PM->add(createCondPropagationPass()); // Propagate conditionals - PM->add(createTailCallEliminationPass()); // Eliminate tail calls - PM->add(createCFGSimplificationPass()); // Merge & remove BBs - PM->add(createReassociatePass()); // Reassociate expressions - PM->add(createLoopRotatePass()); // Rotate Loop - PM->add(createLICMPass()); // Hoist loop invariants - PM->add(createLoopUnswitchPass(OptimizeSize)); - PM->add(createInstructionCombiningPass()); - PM->add(createIndVarSimplifyPass()); // Canonicalize indvars - PM->add(createLoopDeletionPass()); // Delete dead loops - if (UnrollLoops) - PM->add(createLoopUnrollPass()); // Unroll small loops - PM->add(createInstructionCombiningPass()); // Clean up after the unroller - PM->add(createGVNPass()); // Remove redundancies - PM->add(createMemCpyOptPass()); // Remove memcpy / form memset - PM->add(createSCCPPass()); // Constant prop with SCCP + return; + } - // Run instcombine after redundancy elimination to exploit opportunities - // opened up by them. - PM->add(createInstructionCombiningPass()); - PM->add(createCondPropagationPass()); // Propagate conditionals - PM->add(createDeadStoreEliminationPass()); // Delete dead stores - PM->add(createAggressiveDCEPass()); // Delete dead instructions - PM->add(createCFGSimplificationPass()); // Merge & remove BBs - - if (UnitAtATime) { - PM->add(createStripDeadPrototypesPass()); // Get rid of dead prototypes - PM->add(createDeadTypeEliminationPass()); // Eliminate dead types - } - - if (OptimizationLevel > 1 && UnitAtATime) - PM->add(createConstantMergePass()); // Merge dup global constants + if (UnitAtATime) + PM->add(createRaiseAllocationsPass()); // call %malloc -> malloc inst + PM->add(createCFGSimplificationPass()); // Clean up disgusting code + // Kill useless allocas + PM->add(createPromoteMemoryToRegisterPass()); + if (UnitAtATime) { + PM->add(createGlobalOptimizerPass()); // Optimize out global vars + PM->add(createGlobalDCEPass()); // Remove unused fns and globs + // IP Constant Propagation + PM->add(createIPConstantPropagationPass()); + PM->add(createDeadArgEliminationPass()); // Dead argument elimination } + PM->add(createInstructionCombiningPass()); // Clean up after IPCP & DAE + PM->add(createCFGSimplificationPass()); // Clean up after IPCP & DAE + if (UnitAtATime) { + if (HaveExceptions) + PM->add(createPruneEHPass()); // Remove dead EH info + PM->add(createFunctionAttrsPass()); // Set readonly/readnone attrs + } + if (InliningPass) + PM->add(InliningPass); + if (OptimizationLevel > 2) + PM->add(createArgumentPromotionPass()); // Scalarize uninlined fn args + if (SimplifyLibCalls) + PM->add(createSimplifyLibCallsPass()); // Library Call Optimizations + PM->add(createInstructionCombiningPass()); // Cleanup for scalarrepl. + PM->add(createJumpThreadingPass()); // Thread jumps. + PM->add(createCFGSimplificationPass()); // Merge & remove BBs + PM->add(createScalarReplAggregatesPass()); // Break up aggregate allocas + PM->add(createInstructionCombiningPass()); // Combine silly seq's + PM->add(createCondPropagationPass()); // Propagate conditionals + PM->add(createTailCallEliminationPass()); // Eliminate tail calls + PM->add(createCFGSimplificationPass()); // Merge & remove BBs + PM->add(createReassociatePass()); // Reassociate expressions + PM->add(createLoopRotatePass()); // Rotate Loop + PM->add(createLICMPass()); // Hoist loop invariants + PM->add(createLoopUnswitchPass(OptimizeSize)); + PM->add(createInstructionCombiningPass()); + PM->add(createIndVarSimplifyPass()); // Canonicalize indvars + PM->add(createLoopDeletionPass()); // Delete dead loops + if (UnrollLoops) + PM->add(createLoopUnrollPass()); // Unroll small loops + PM->add(createInstructionCombiningPass()); // Clean up after the unroller + PM->add(createGVNPass()); // Remove redundancies + PM->add(createMemCpyOptPass()); // Remove memcpy / form memset + PM->add(createSCCPPass()); // Constant prop with SCCP + + // Run instcombine after redundancy elimination to exploit opportunities + // opened up by them. + PM->add(createInstructionCombiningPass()); + PM->add(createCondPropagationPass()); // Propagate conditionals + PM->add(createDeadStoreEliminationPass()); // Delete dead stores + PM->add(createAggressiveDCEPass()); // Delete dead instructions + PM->add(createCFGSimplificationPass()); // Merge & remove BBs + + if (UnitAtATime) { + PM->add(createStripDeadPrototypesPass()); // Get rid of dead prototypes + PM->add(createDeadTypeEliminationPass()); // Eliminate dead types + } + + if (OptimizationLevel > 1 && UnitAtATime) + PM->add(createConstantMergePass()); // Merge dup global constants } static inline void addOnePass(PassManager *PM, Pass *P, bool AndVerify) { From sabre at nondot.org Fri Sep 18 17:03:29 2009 From: sabre at nondot.org (Chris Lattner) Date: Fri, 18 Sep 2009 22:03:29 -0000 Subject: [llvm-commits] [llvm] r82291 - /llvm/trunk/include/llvm/Support/StandardPasses.h Message-ID: <200909182203.n8IM3T0C029365@zion.cs.uiuc.edu> Author: lattner Date: Fri Sep 18 17:03:29 2009 New Revision: 82291 URL: http://llvm.org/viewvc/llvm-project?rev=82291&view=rev Log: remove an extraneous mem2reg pass early in the pipe. Since this is run after the 'standard function passes', SRoA was recently run. This saves a domfrontier construction. Thanks to Eli for noticing this. Modified: llvm/trunk/include/llvm/Support/StandardPasses.h Modified: llvm/trunk/include/llvm/Support/StandardPasses.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/StandardPasses.h?rev=82291&r1=82290&r2=82291&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/StandardPasses.h (original) +++ llvm/trunk/include/llvm/Support/StandardPasses.h Fri Sep 18 17:03:29 2009 @@ -99,8 +99,6 @@ if (UnitAtATime) PM->add(createRaiseAllocationsPass()); // call %malloc -> malloc inst PM->add(createCFGSimplificationPass()); // Clean up disgusting code - // Kill useless allocas - PM->add(createPromoteMemoryToRegisterPass()); if (UnitAtATime) { PM->add(createGlobalOptimizerPass()); // Optimize out global vars PM->add(createGlobalDCEPass()); // Remove unused fns and globs From kremenek at apple.com Fri Sep 18 17:21:02 2009 From: kremenek at apple.com (Ted Kremenek) Date: Fri, 18 Sep 2009 22:21:02 -0000 Subject: [llvm-commits] [llvm] r82294 - /llvm/tags/checker/checker-0.220/ Message-ID: <200909182221.n8IML2F7031742@zion.cs.uiuc.edu> Author: kremenek Date: Fri Sep 18 17:21:01 2009 New Revision: 82294 URL: http://llvm.org/viewvc/llvm-project?rev=82294&view=rev Log: Removing checker-0.220. Removed: llvm/tags/checker/checker-0.220/ From vhernandez at apple.com Fri Sep 18 17:35:49 2009 From: vhernandez at apple.com (Victor Hernandez) Date: Fri, 18 Sep 2009 22:35:49 -0000 Subject: [llvm-commits] [llvm] r82300 - in /llvm/trunk/lib/Transforms: IPO/FunctionAttrs.cpp IPO/GlobalOpt.cpp Scalar/GVN.cpp Scalar/InstructionCombining.cpp Scalar/Reassociate.cpp Scalar/SCCP.cpp Scalar/SimplifyLibCalls.cpp Scalar/TailDuplication.cpp Utils/InlineCost.cpp Message-ID: <200909182235.n8IMZnYJ001246@zion.cs.uiuc.edu> Author: hernande Date: Fri Sep 18 17:35:49 2009 New Revision: 82300 URL: http://llvm.org/viewvc/llvm-project?rev=82300&view=rev Log: Enhance transform passes so that they apply the same tranforms to malloc calls as to MallocInst. Reviewed by Dan Gohman. Modified: llvm/trunk/lib/Transforms/IPO/FunctionAttrs.cpp llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp llvm/trunk/lib/Transforms/Scalar/GVN.cpp llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp llvm/trunk/lib/Transforms/Scalar/SCCP.cpp llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp llvm/trunk/lib/Transforms/Scalar/TailDuplication.cpp llvm/trunk/lib/Transforms/Utils/InlineCost.cpp Modified: llvm/trunk/lib/Transforms/IPO/FunctionAttrs.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/FunctionAttrs.cpp?rev=82300&r1=82299&r2=82300&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/FunctionAttrs.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/FunctionAttrs.cpp Fri Sep 18 17:35:49 2009 @@ -26,6 +26,7 @@ #include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Analysis/CallGraph.h" #include "llvm/Analysis/CaptureTracking.h" +#include "llvm/Analysis/MallocHelper.h" #include "llvm/ADT/SmallSet.h" #include "llvm/ADT/Statistic.h" #include "llvm/ADT/UniqueVector.h" @@ -152,8 +153,8 @@ // Writes memory. Just give up. return false; - if (isa(I)) - // MallocInst claims not to write memory! PR3754. + if (isa(I) || isMalloc(I)) + // malloc claims not to write memory! PR3754. return false; // If this instruction may read memory, remember that. @@ -247,8 +248,11 @@ if (Instruction *RVI = dyn_cast(RetVal)) switch (RVI->getOpcode()) { // Extend the analysis by looking upwards. - case Instruction::GetElementPtr: case Instruction::BitCast: + if (isMalloc(RVI)) + break; + // fall through + case Instruction::GetElementPtr: FlowsToReturn.insert(RVI->getOperand(0)); continue; case Instruction::Select: { @@ -267,6 +271,8 @@ case Instruction::Malloc: break; case Instruction::Call: + if (isMalloc(RVI)) + break; case Instruction::Invoke: { CallSite CS(RVI); if (CS.paramHasAttr(0, Attribute::NoAlias)) Modified: llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp?rev=82300&r1=82299&r2=82300&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp Fri Sep 18 17:35:49 2009 @@ -24,6 +24,7 @@ #include "llvm/Module.h" #include "llvm/Pass.h" #include "llvm/Analysis/ConstantFolding.h" +#include "llvm/Analysis/MallocHelper.h" #include "llvm/Target/TargetData.h" #include "llvm/Support/CallSite.h" #include "llvm/Support/Compiler.h" @@ -939,6 +940,138 @@ return NewGV; } +/// OptimizeGlobalAddressOfMalloc - This function takes the specified global +/// variable, and transforms the program as if it always contained the result of +/// the specified malloc. Because it is always the result of the specified +/// malloc, there is no reason to actually DO the malloc. Instead, turn the +/// malloc into a global, and any loads of GV as uses of the new global. +static GlobalVariable *OptimizeGlobalAddressOfMalloc(GlobalVariable *GV, + CallInst *CI, + BitCastInst *BCI, + LLVMContext &Context, + TargetData* TD) { + const Type *IntPtrTy = TD->getIntPtrType(Context); + + DEBUG(errs() << "PROMOTING MALLOC GLOBAL: " << *GV << " MALLOC = " << *CI); + + ConstantInt *NElements = cast(getMallocArraySize(CI, + Context, TD)); + if (NElements->getZExtValue() != 1) { + // If we have an array allocation, transform it to a single element + // allocation to make the code below simpler. + Type *NewTy = ArrayType::get(getMallocAllocatedType(CI), + NElements->getZExtValue()); + Value* NewM = CallInst::CreateMalloc(CI, IntPtrTy, NewTy); + Instruction* NewMI = cast(NewM); + Value* Indices[2]; + Indices[0] = Indices[1] = Constant::getNullValue(IntPtrTy); + Value *NewGEP = GetElementPtrInst::Create(NewMI, Indices, Indices + 2, + NewMI->getName()+".el0", CI); + BCI->replaceAllUsesWith(NewGEP); + BCI->eraseFromParent(); + CI->eraseFromParent(); + BCI = cast(NewMI); + CI = extractMallocCallFromBitCast(NewMI); + } + + // Create the new global variable. The contents of the malloc'd memory is + // undefined, so initialize with an undef value. + // FIXME: This new global should have the alignment returned by malloc. Code + // could depend on malloc returning large alignment (on the mac, 16 bytes) but + // this would only guarantee some lower alignment. + const Type *MAT = getMallocAllocatedType(CI); + Constant *Init = UndefValue::get(MAT); + GlobalVariable *NewGV = new GlobalVariable(*GV->getParent(), + MAT, false, + GlobalValue::InternalLinkage, Init, + GV->getName()+".body", + GV, + GV->isThreadLocal()); + + // Anything that used the malloc now uses the global directly. + BCI->replaceAllUsesWith(NewGV); + + Constant *RepValue = NewGV; + if (NewGV->getType() != GV->getType()->getElementType()) + RepValue = ConstantExpr::getBitCast(RepValue, + GV->getType()->getElementType()); + + // If there is a comparison against null, we will insert a global bool to + // keep track of whether the global was initialized yet or not. + GlobalVariable *InitBool = + new GlobalVariable(Context, Type::getInt1Ty(Context), false, + GlobalValue::InternalLinkage, + ConstantInt::getFalse(Context), GV->getName()+".init", + GV->isThreadLocal()); + bool InitBoolUsed = false; + + // Loop over all uses of GV, processing them in turn. + std::vector Stores; + while (!GV->use_empty()) + if (LoadInst *LI = dyn_cast(GV->use_back())) { + while (!LI->use_empty()) { + Use &LoadUse = LI->use_begin().getUse(); + if (!isa(LoadUse.getUser())) + LoadUse = RepValue; + else { + ICmpInst *ICI = cast(LoadUse.getUser()); + // Replace the cmp X, 0 with a use of the bool value. + Value *LV = new LoadInst(InitBool, InitBool->getName()+".val", ICI); + InitBoolUsed = true; + switch (ICI->getPredicate()) { + default: llvm_unreachable("Unknown ICmp Predicate!"); + case ICmpInst::ICMP_ULT: + case ICmpInst::ICMP_SLT: + LV = ConstantInt::getFalse(Context); // X < null -> always false + break; + case ICmpInst::ICMP_ULE: + case ICmpInst::ICMP_SLE: + case ICmpInst::ICMP_EQ: + LV = BinaryOperator::CreateNot(LV, "notinit", ICI); + break; + case ICmpInst::ICMP_NE: + case ICmpInst::ICMP_UGE: + case ICmpInst::ICMP_SGE: + case ICmpInst::ICMP_UGT: + case ICmpInst::ICMP_SGT: + break; // no change. + } + ICI->replaceAllUsesWith(LV); + ICI->eraseFromParent(); + } + } + LI->eraseFromParent(); + } else { + StoreInst *SI = cast(GV->use_back()); + // The global is initialized when the store to it occurs. + new StoreInst(ConstantInt::getTrue(Context), InitBool, SI); + SI->eraseFromParent(); + } + + // If the initialization boolean was used, insert it, otherwise delete it. + if (!InitBoolUsed) { + while (!InitBool->use_empty()) // Delete initializations + cast(InitBool->use_back())->eraseFromParent(); + delete InitBool; + } else + GV->getParent()->getGlobalList().insert(GV, InitBool); + + + // Now the GV is dead, nuke it and the malloc. + GV->eraseFromParent(); + BCI->eraseFromParent(); + CI->eraseFromParent(); + + // To further other optimizations, loop over all users of NewGV and try to + // constant prop them. This will promote GEP instructions with constant + // indices into GEP constant-exprs, which will allow global-opt to hack on it. + ConstantPropUsersOf(NewGV, Context); + if (RepValue != NewGV) + ConstantPropUsersOf(RepValue, Context); + + return NewGV; +} + /// ValueIsOnlyUsedLocallyOrStoredToOneGlobal - Scan the use-list of V checking /// to make sure that there are no complex uses of V. We permit simple things /// like dereferencing the pointer, but not storing through the address, unless @@ -1086,7 +1219,7 @@ /// AllGlobalLoadUsesSimpleEnoughForHeapSRA - If all users of values loaded from /// GV are simple enough to perform HeapSRA, return true. static bool AllGlobalLoadUsesSimpleEnoughForHeapSRA(GlobalVariable *GV, - MallocInst *MI) { + Instruction *StoredVal) { SmallPtrSet LoadUsingPHIs; SmallPtrSet LoadUsingPHIsPerLoad; for (Value::use_iterator UI = GV->use_begin(), E = GV->use_end(); UI != E; @@ -1110,7 +1243,7 @@ Value *InVal = PN->getIncomingValue(op); // PHI of the stored value itself is ok. - if (InVal == MI) continue; + if (InVal == StoredVal) continue; if (PHINode *InPN = dyn_cast(InVal)) { // One of the PHIs in our set is (optimistically) ok. @@ -1444,6 +1577,191 @@ return cast(FieldGlobals[0]); } +/// PerformHeapAllocSRoA - CI is an allocation of an array of structures. Break +/// it up into multiple allocations of arrays of the fields. +static GlobalVariable *PerformHeapAllocSRoA(GlobalVariable *GV, + CallInst *CI, BitCastInst* BCI, + LLVMContext &Context, + TargetData *TD){ + DEBUG(errs() << "SROA HEAP ALLOC: " << *GV << " MALLOC CALL = " << *CI + << " BITCAST = " << *BCI << '\n'); + const Type* MAT = getMallocAllocatedType(CI); + const StructType *STy = cast(MAT); + + // There is guaranteed to be at least one use of the malloc (storing + // it into GV). If there are other uses, change them to be uses of + // the global to simplify later code. This also deletes the store + // into GV. + ReplaceUsesOfMallocWithGlobal(BCI, GV); + + // Okay, at this point, there are no users of the malloc. Insert N + // new mallocs at the same place as CI, and N globals. + std::vector FieldGlobals; + std::vector FieldMallocs; + + for (unsigned FieldNo = 0, e = STy->getNumElements(); FieldNo != e;++FieldNo){ + const Type *FieldTy = STy->getElementType(FieldNo); + const PointerType *PFieldTy = PointerType::getUnqual(FieldTy); + + GlobalVariable *NGV = + new GlobalVariable(*GV->getParent(), + PFieldTy, false, GlobalValue::InternalLinkage, + Constant::getNullValue(PFieldTy), + GV->getName() + ".f" + Twine(FieldNo), GV, + GV->isThreadLocal()); + FieldGlobals.push_back(NGV); + + Value *NMI = CallInst::CreateMalloc(CI, TD->getIntPtrType(Context), FieldTy, + getMallocArraySize(CI, Context, TD), + BCI->getName() + ".f" + Twine(FieldNo)); + FieldMallocs.push_back(NMI); + new StoreInst(NMI, NGV, BCI); + } + + // The tricky aspect of this transformation is handling the case when malloc + // fails. In the original code, malloc failing would set the result pointer + // of malloc to null. In this case, some mallocs could succeed and others + // could fail. As such, we emit code that looks like this: + // F0 = malloc(field0) + // F1 = malloc(field1) + // F2 = malloc(field2) + // if (F0 == 0 || F1 == 0 || F2 == 0) { + // if (F0) { free(F0); F0 = 0; } + // if (F1) { free(F1); F1 = 0; } + // if (F2) { free(F2); F2 = 0; } + // } + Value *RunningOr = 0; + for (unsigned i = 0, e = FieldMallocs.size(); i != e; ++i) { + Value *Cond = new ICmpInst(BCI, ICmpInst::ICMP_EQ, FieldMallocs[i], + Constant::getNullValue(FieldMallocs[i]->getType()), + "isnull"); + if (!RunningOr) + RunningOr = Cond; // First seteq + else + RunningOr = BinaryOperator::CreateOr(RunningOr, Cond, "tmp", BCI); + } + + // Split the basic block at the old malloc. + BasicBlock *OrigBB = BCI->getParent(); + BasicBlock *ContBB = OrigBB->splitBasicBlock(BCI, "malloc_cont"); + + // Create the block to check the first condition. Put all these blocks at the + // end of the function as they are unlikely to be executed. + BasicBlock *NullPtrBlock = BasicBlock::Create(Context, "malloc_ret_null", + OrigBB->getParent()); + + // Remove the uncond branch from OrigBB to ContBB, turning it into a cond + // branch on RunningOr. + OrigBB->getTerminator()->eraseFromParent(); + BranchInst::Create(NullPtrBlock, ContBB, RunningOr, OrigBB); + + // Within the NullPtrBlock, we need to emit a comparison and branch for each + // pointer, because some may be null while others are not. + for (unsigned i = 0, e = FieldGlobals.size(); i != e; ++i) { + Value *GVVal = new LoadInst(FieldGlobals[i], "tmp", NullPtrBlock); + Value *Cmp = new ICmpInst(*NullPtrBlock, ICmpInst::ICMP_NE, GVVal, + Constant::getNullValue(GVVal->getType()), + "tmp"); + BasicBlock *FreeBlock = BasicBlock::Create(Context, "free_it", + OrigBB->getParent()); + BasicBlock *NextBlock = BasicBlock::Create(Context, "next", + OrigBB->getParent()); + BranchInst::Create(FreeBlock, NextBlock, Cmp, NullPtrBlock); + + // Fill in FreeBlock. + new FreeInst(GVVal, FreeBlock); + new StoreInst(Constant::getNullValue(GVVal->getType()), FieldGlobals[i], + FreeBlock); + BranchInst::Create(NextBlock, FreeBlock); + + NullPtrBlock = NextBlock; + } + + BranchInst::Create(ContBB, NullPtrBlock); + + // CI and BCI are no longer needed, remove them. + BCI->eraseFromParent(); + CI->eraseFromParent(); + + /// InsertedScalarizedLoads - As we process loads, if we can't immediately + /// update all uses of the load, keep track of what scalarized loads are + /// inserted for a given load. + DenseMap > InsertedScalarizedValues; + InsertedScalarizedValues[GV] = FieldGlobals; + + std::vector > PHIsToRewrite; + + // Okay, the malloc site is completely handled. All of the uses of GV are now + // loads, and all uses of those loads are simple. Rewrite them to use loads + // of the per-field globals instead. + for (Value::use_iterator UI = GV->use_begin(), E = GV->use_end(); UI != E;) { + Instruction *User = cast(*UI++); + + if (LoadInst *LI = dyn_cast(User)) { + RewriteUsesOfLoadForHeapSRoA(LI, InsertedScalarizedValues, PHIsToRewrite, + Context); + continue; + } + + // Must be a store of null. + StoreInst *SI = cast(User); + assert(isa(SI->getOperand(0)) && + "Unexpected heap-sra user!"); + + // Insert a store of null into each global. + for (unsigned i = 0, e = FieldGlobals.size(); i != e; ++i) { + const PointerType *PT = cast(FieldGlobals[i]->getType()); + Constant *Null = Constant::getNullValue(PT->getElementType()); + new StoreInst(Null, FieldGlobals[i], SI); + } + // Erase the original store. + SI->eraseFromParent(); + } + + // While we have PHIs that are interesting to rewrite, do it. + while (!PHIsToRewrite.empty()) { + PHINode *PN = PHIsToRewrite.back().first; + unsigned FieldNo = PHIsToRewrite.back().second; + PHIsToRewrite.pop_back(); + PHINode *FieldPN = cast(InsertedScalarizedValues[PN][FieldNo]); + assert(FieldPN->getNumIncomingValues() == 0 &&"Already processed this phi"); + + // Add all the incoming values. This can materialize more phis. + for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i) { + Value *InVal = PN->getIncomingValue(i); + InVal = GetHeapSROAValue(InVal, FieldNo, InsertedScalarizedValues, + PHIsToRewrite, Context); + FieldPN->addIncoming(InVal, PN->getIncomingBlock(i)); + } + } + + // Drop all inter-phi links and any loads that made it this far. + for (DenseMap >::iterator + I = InsertedScalarizedValues.begin(), E = InsertedScalarizedValues.end(); + I != E; ++I) { + if (PHINode *PN = dyn_cast(I->first)) + PN->dropAllReferences(); + else if (LoadInst *LI = dyn_cast(I->first)) + LI->dropAllReferences(); + } + + // Delete all the phis and loads now that inter-references are dead. + for (DenseMap >::iterator + I = InsertedScalarizedValues.begin(), E = InsertedScalarizedValues.end(); + I != E; ++I) { + if (PHINode *PN = dyn_cast(I->first)) + PN->eraseFromParent(); + else if (LoadInst *LI = dyn_cast(I->first)) + LI->eraseFromParent(); + } + + // The old global is now dead, remove it. + GV->eraseFromParent(); + + ++NumHeapSRA; + return cast(FieldGlobals[0]); +} + /// TryToOptimizeStoreOfMallocToGlobal - This function is called when we see a /// pointer global variable with a single value stored it that is a malloc or /// cast of malloc. @@ -1533,6 +1851,99 @@ return false; } +/// TryToOptimizeStoreOfMallocToGlobal - This function is called when we see a +/// pointer global variable with a single value stored it that is a malloc or +/// cast of malloc. +static bool TryToOptimizeStoreOfMallocToGlobal(GlobalVariable *GV, + CallInst *CI, + BitCastInst *BCI, + Module::global_iterator &GVI, + TargetData *TD, + LLVMContext &Context) { + // If we can't figure out the type being malloced, then we can't optimize. + const Type *AllocTy = getMallocAllocatedType(CI); + assert(AllocTy); + + // If this is a malloc of an abstract type, don't touch it. + if (!AllocTy->isSized()) + return false; + + // We can't optimize this global unless all uses of it are *known* to be + // of the malloc value, not of the null initializer value (consider a use + // that compares the global's value against zero to see if the malloc has + // been reached). To do this, we check to see if all uses of the global + // would trap if the global were null: this proves that they must all + // happen after the malloc. + if (!AllUsesOfLoadedValueWillTrapIfNull(GV)) + return false; + + // We can't optimize this if the malloc itself is used in a complex way, + // for example, being stored into multiple globals. This allows the + // malloc to be stored into the specified global, loaded setcc'd, and + // GEP'd. These are all things we could transform to using the global + // for. + { + SmallPtrSet PHIs; + if (!ValueIsOnlyUsedLocallyOrStoredToOneGlobal(BCI, GV, PHIs)) + return false; + } + + // If we have a global that is only initialized with a fixed size malloc, + // transform the program to use global memory instead of malloc'd memory. + // This eliminates dynamic allocation, avoids an indirection accessing the + // data, and exposes the resultant global to further GlobalOpt. + if (ConstantInt *NElements = + dyn_cast(getMallocArraySize(CI, Context, TD))) { + // Restrict this transformation to only working on small allocations + // (2048 bytes currently), as we don't want to introduce a 16M global or + // something. + if (TD && + NElements->getZExtValue() * TD->getTypeAllocSize(AllocTy) < 2048) { + GVI = OptimizeGlobalAddressOfMalloc(GV, CI, BCI, Context, TD); + return true; + } + } + + // If the allocation is an array of structures, consider transforming this + // into multiple malloc'd arrays, one for each field. This is basically + // SRoA for malloc'd memory. + + // If this is an allocation of a fixed size array of structs, analyze as a + // variable size array. malloc [100 x struct],1 -> malloc struct, 100 + if (!isArrayMalloc(CI, Context, TD)) + if (const ArrayType *AT = dyn_cast(AllocTy)) + AllocTy = AT->getElementType(); + + if (const StructType *AllocSTy = dyn_cast(AllocTy)) { + // This the structure has an unreasonable number of fields, leave it + // alone. + if (AllocSTy->getNumElements() <= 16 && AllocSTy->getNumElements() != 0 && + AllGlobalLoadUsesSimpleEnoughForHeapSRA(GV, BCI)) { + + // If this is a fixed size array, transform the Malloc to be an alloc of + // structs. malloc [100 x struct],1 -> malloc struct, 100 + if (const ArrayType *AT = dyn_cast(getMallocAllocatedType(CI))) { + Value* NumElements = ConstantInt::get(Type::getInt32Ty(Context), + AT->getNumElements()); + Value* NewMI = CallInst::CreateMalloc(CI, TD->getIntPtrType(Context), + AllocSTy, NumElements, + BCI->getName()); + Value *Cast = new BitCastInst(NewMI, getMallocType(CI), "tmp", CI); + BCI->replaceAllUsesWith(Cast); + BCI->eraseFromParent(); + CI->eraseFromParent(); + BCI = cast(NewMI); + CI = extractMallocCallFromBitCast(NewMI); + } + + GVI = PerformHeapAllocSRoA(GV, CI, BCI, Context, TD); + return true; + } + } + + return false; +} + // OptimizeOnceStoredGlobal - Try to optimize globals based on the knowledge // that only one value (besides its initializer) is ever stored to the global. static bool OptimizeOnceStoredGlobal(GlobalVariable *GV, Value *StoredOnceVal, @@ -1558,6 +1969,16 @@ } else if (MallocInst *MI = dyn_cast(StoredOnceVal)) { if (TryToOptimizeStoreOfMallocToGlobal(GV, MI, GVI, TD, Context)) return true; + } else if (CallInst *CI = extractMallocCall(StoredOnceVal)) { + if (getMallocAllocatedType(CI)) { + BitCastInst* BCI = NULL; + for (Value::use_iterator UI = CI->use_begin(), E = CI->use_end(); + UI != E; ) + BCI = dyn_cast(cast(*UI++)); + if (BCI && + TryToOptimizeStoreOfMallocToGlobal(GV, CI, BCI, GVI, TD, Context)) + return true; + } } } Modified: llvm/trunk/lib/Transforms/Scalar/GVN.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/GVN.cpp?rev=82300&r1=82299&r2=82300&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/GVN.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/GVN.cpp Fri Sep 18 17:35:49 2009 @@ -32,6 +32,7 @@ #include "llvm/ADT/Statistic.h" #include "llvm/Analysis/Dominators.h" #include "llvm/Analysis/AliasAnalysis.h" +#include "llvm/Analysis/MallocHelper.h" #include "llvm/Analysis/MemoryDependenceAnalysis.h" #include "llvm/Support/CFG.h" #include "llvm/Support/CommandLine.h" @@ -982,7 +983,7 @@ Instruction *DepInst = DepInfo.getInst(); // Loading the allocation -> undef. - if (isa(DepInst)) { + if (isa(DepInst) || isMalloc(DepInst)) { ValuesPerBlock.push_back(std::make_pair(DepBB, UndefValue::get(LI->getType()))); continue; @@ -1270,7 +1271,7 @@ // If this load really doesn't depend on anything, then we must be loading an // undef value. This can happen when loading for a fresh allocation with no // intervening stores, for example. - if (isa(DepInst)) { + if (isa(DepInst) || isMalloc(DepInst)) { L->replaceAllUsesWith(UndefValue::get(L->getType())); toErase.push_back(L); NumGVNLoad++; @@ -1393,7 +1394,7 @@ // Allocations are always uniquely numbered, so we can save time and memory // by fast failing them. - } else if (isa(I) || isa(I)) { + } else if (isa(I) || isMalloc(I) || isa(I)) { localAvail[I->getParent()]->table.insert(std::make_pair(num, I)); return false; } @@ -1558,8 +1559,8 @@ BE = CurrentBlock->end(); BI != BE; ) { Instruction *CurInst = BI++; - if (isa(CurInst) || isa(CurInst) || - isa(CurInst) || + if (isa(CurInst) || isMalloc(CurInst) || + isa(CurInst) || isa(CurInst) || (CurInst->getType() == Type::getVoidTy(F.getContext())) || CurInst->mayReadFromMemory() || CurInst->mayHaveSideEffects() || isa(CurInst)) Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=82300&r1=82299&r2=82300&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Fri Sep 18 17:35:49 2009 @@ -42,6 +42,7 @@ #include "llvm/GlobalVariable.h" #include "llvm/Operator.h" #include "llvm/Analysis/ConstantFolding.h" +#include "llvm/Analysis/MallocHelper.h" #include "llvm/Analysis/ValueTracking.h" #include "llvm/Target/TargetData.h" #include "llvm/Transforms/Utils/BasicBlockUtils.h" @@ -89,6 +90,7 @@ /// Add - Add the specified instruction to the worklist if it isn't already /// in it. void Add(Instruction *I) { + DEBUG(errs() << "IC: ADD: " << *I << '\n'); if (WorklistMap.insert(std::make_pair(I, Worklist.size())).second) Worklist.push_back(I); } @@ -326,7 +328,7 @@ // instruction. Instead, visit methods should return the value returned by // this function. Instruction *EraseInstFromFunction(Instruction &I) { - DEBUG(errs() << "IC: erase " << I << '\n'); + DEBUG(errs() << "IC: ERASE " << I << '\n'); assert(I.use_empty() && "Cannot erase instruction that is used!"); // Make sure that we reprocess all operands now that we reduced their @@ -5891,9 +5893,9 @@ // icmp , - Global/Stack value // addresses never equal each other! We already know that Op0 != Op1. - if ((isa(Op0) || isa(Op0) || + if ((isa(Op0) || isa(Op0) || isMalloc(Op0) || isa(Op0)) && - (isa(Op1) || isa(Op1) || + (isa(Op1) || isa(Op1) || isMalloc(Op1) || isa(Op1))) return ReplaceInstUsesWith(I, ConstantInt::get(Type::getInt1Ty(*Context), !I.isTrueWhenEqual())); @@ -6231,8 +6233,33 @@ // can assume it is successful and remove the malloc. if (LHSI->hasOneUse() && isa(RHSC)) { Worklist.Add(LHSI); - return ReplaceInstUsesWith(I, ConstantInt::get(Type::getInt1Ty(*Context), - !I.isTrueWhenEqual())); + return ReplaceInstUsesWith(I, + ConstantInt::get(Type::getInt1Ty(*Context), + !I.isTrueWhenEqual())); + } + break; + case Instruction::Call: + // If we have (malloc != null), and if the malloc has a single use, we + // can assume it is successful and remove the malloc. + if (isMalloc(LHSI) && LHSI->hasOneUse() && + isa(RHSC)) { + Worklist.Add(LHSI); + return ReplaceInstUsesWith(I, + ConstantInt::get(Type::getInt1Ty(*Context), + !I.isTrueWhenEqual())); + } + break; + case Instruction::BitCast: + // If we have (malloc != null), and if the malloc has a single use, we + // can assume it is successful and remove the malloc. + CallInst* CI = extractMallocCallFromBitCast(LHSI); + if (CI && CI->hasOneUse() && LHSI->hasOneUse() + && isa(RHSC)) { + Worklist.Add(LHSI); + Worklist.Add(CI); + return ReplaceInstUsesWith(I, + ConstantInt::get(Type::getInt1Ty(*Context), + !I.isTrueWhenEqual())); } break; } @@ -8784,8 +8811,10 @@ if (SrcPTy->getAddressSpace() != DstPTy->getAddressSpace()) return 0; - // If we are casting a malloc or alloca to a pointer to a type of the same + // If we are casting a alloca to a pointer to a type of the same // size, rewrite the allocation instruction to allocate the "right" type. + // There is no need to modify malloc calls because it is their bitcast that + // needs to be cleaned up. if (AllocationInst *AI = dyn_cast(Src)) if (Instruction *V = PromoteCastOfAllocation(CI, *AI)) return V; @@ -9459,6 +9488,7 @@ Align = PrefAlign; } } + // No alignment changes are possible for malloc calls } return Align; @@ -9796,7 +9826,7 @@ TerminatorInst *TI = II->getParent()->getTerminator(); bool CannotRemove = false; for (++BI; &*BI != TI; ++BI) { - if (isa(BI)) { + if (isa(BI) || isMalloc(BI)) { CannotRemove = true; break; } @@ -11060,7 +11090,8 @@ if (Offset == 0) { // If the bitcast is of an allocation, and the allocation will be // converted to match the type of the cast, don't touch this. - if (isa(BCI->getOperand(0))) { + if (isa(BCI->getOperand(0)) || + isMalloc(BCI->getOperand(0))) { // See if the bitcast simplifies, if so, don't nuke this GEP yet. if (Instruction *I = visitBitCast(*BCI)) { if (I != BCI) { @@ -11191,6 +11222,21 @@ EraseInstFromFunction(FI); return EraseInstFromFunction(*MI); } + if (isMalloc(Op)) { + if (CallInst* CI = extractMallocCallFromBitCast(Op)) { + if (Op->hasOneUse() && CI->hasOneUse()) { + EraseInstFromFunction(FI); + EraseInstFromFunction(*CI); + return EraseInstFromFunction(*cast(Op)); + } + } else { + // Op is a call to malloc + if (Op->hasOneUse()) { + EraseInstFromFunction(FI); + return EraseInstFromFunction(*cast(Op)); + } + } + } return 0; } Modified: llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp?rev=82300&r1=82299&r2=82300&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp Fri Sep 18 17:35:49 2009 @@ -29,6 +29,7 @@ #include "llvm/IntrinsicInst.h" #include "llvm/LLVMContext.h" #include "llvm/Pass.h" +#include "llvm/Analysis/MallocHelper.h" #include "llvm/Assembly/Writer.h" #include "llvm/Support/CFG.h" #include "llvm/Support/Debug.h" @@ -121,7 +122,7 @@ if (I->getOpcode() == Instruction::PHI || I->getOpcode() == Instruction::Alloca || I->getOpcode() == Instruction::Load || - I->getOpcode() == Instruction::Malloc || + I->getOpcode() == Instruction::Malloc || isMalloc(I) || I->getOpcode() == Instruction::Invoke || (I->getOpcode() == Instruction::Call && !isa(I)) || Modified: llvm/trunk/lib/Transforms/Scalar/SCCP.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SCCP.cpp?rev=82300&r1=82299&r2=82300&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/SCCP.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/SCCP.cpp Fri Sep 18 17:35:49 2009 @@ -30,6 +30,7 @@ #include "llvm/LLVMContext.h" #include "llvm/Pass.h" #include "llvm/Analysis/ConstantFolding.h" +#include "llvm/Analysis/MallocHelper.h" #include "llvm/Analysis/ValueTracking.h" #include "llvm/Transforms/Utils/Local.h" #include "llvm/Support/CallSite.h" @@ -400,7 +401,12 @@ void visitStoreInst (Instruction &I); void visitLoadInst (LoadInst &I); void visitGetElementPtrInst(GetElementPtrInst &I); - void visitCallInst (CallInst &I) { visitCallSite(CallSite::get(&I)); } + void visitCallInst (CallInst &I) { + if (isMalloc(&I)) + markOverdefined(&I); + else + visitCallSite(CallSite::get(&I)); + } void visitInvokeInst (InvokeInst &II) { visitCallSite(CallSite::get(&II)); visitTerminatorInst(II); Modified: llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp?rev=82300&r1=82299&r2=82300&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp Fri Sep 18 17:35:49 2009 @@ -1853,7 +1853,13 @@ } break; case 'm': - if (Name == "memcmp") { + if (Name == "malloc") { + if (FTy->getNumParams() != 1 || + !isa(FTy->getReturnType())) + continue; + setDoesNotThrow(F); + setDoesNotAlias(F, 0); + } else if (Name == "memcmp") { if (FTy->getNumParams() != 3 || !isa(FTy->getParamType(0)) || !isa(FTy->getParamType(1))) Modified: llvm/trunk/lib/Transforms/Scalar/TailDuplication.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/TailDuplication.cpp?rev=82300&r1=82299&r2=82300&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/TailDuplication.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/TailDuplication.cpp Fri Sep 18 17:35:49 2009 @@ -28,6 +28,7 @@ #include "llvm/Type.h" #include "llvm/Support/CFG.h" #include "llvm/Analysis/ConstantFolding.h" +#include "llvm/Analysis/MallocHelper.h" #include "llvm/Transforms/Utils/Local.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/Debug.h" @@ -129,7 +130,7 @@ if (isa(I) || isa(I)) return false; // Allso alloca and malloc. - if (isa(I)) return false; + if (isa(I) || isMalloc(I)) return false; // Some vector instructions can expand into a number of instructions. if (isa(I) || isa(I) || Modified: llvm/trunk/lib/Transforms/Utils/InlineCost.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/InlineCost.cpp?rev=82300&r1=82299&r2=82300&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/InlineCost.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/InlineCost.cpp Fri Sep 18 17:35:49 2009 @@ -13,6 +13,7 @@ #include "llvm/Transforms/Utils/InlineCost.h" +#include "llvm/Analysis/MallocHelper.h" #include "llvm/Support/CallSite.h" #include "llvm/CallingConv.h" #include "llvm/IntrinsicInst.h" @@ -51,7 +52,7 @@ // Unfortunately, we don't know the pointer that may get propagated here, // so we can't make this decision. if (Inst.mayReadFromMemory() || Inst.mayHaveSideEffects() || - isa(Inst)) + isa(Inst) || isMalloc(&Inst)) continue; bool AllOperandsConstant = true; From kremenek at apple.com Fri Sep 18 17:37:55 2009 From: kremenek at apple.com (Ted Kremenek) Date: Fri, 18 Sep 2009 22:37:55 -0000 Subject: [llvm-commits] [llvm] r82302 - /llvm/tags/checker/checker-0.220/ Message-ID: <200909182237.n8IMbtux001538@zion.cs.uiuc.edu> Author: kremenek Date: Fri Sep 18 17:37:55 2009 New Revision: 82302 URL: http://llvm.org/viewvc/llvm-project?rev=82302&view=rev Log: Tagging checker-0.220. Added: llvm/tags/checker/checker-0.220/ - copied from r82301, llvm/trunk/ From bob.wilson at apple.com Fri Sep 18 18:20:24 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Fri, 18 Sep 2009 23:20:24 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r82305 - in /llvm-gcc-4.2/trunk/gcc/testsuite: ./ g++.apple/ gcc.apple/ gcc.c-torture/execute/ gcc.dg/ gcc.dg/format/ gcc.dg/vect/ lib/ obj-c++.dg/ objc.dg/ Message-ID: <200909182320.n8INKPxC007301@zion.cs.uiuc.edu> Author: bwilson Date: Fri Sep 18 18:20:23 2009 New Revision: 82305 URL: http://llvm.org/viewvc/llvm-project?rev=82305&view=rev Log: Merge a bunch of testsuite changes from Apple's gcc. These should have been included in the r76781 merge from Apple's gcc r155791 but were somehow overlooked. It looks like the previous merge took new test files but left out changes to existing testsuite files. I noticed the omission when Anton added some NEON changes to gcc/testsuite/lib/target-supports.exp. This changes some of the functions that Anton added, but it looks like Apple's version of that file does about the same thing. Modified: llvm-gcc-4.2/trunk/gcc/testsuite/ChangeLog.apple llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/6755006.C llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/block-no-trampoline-1.C llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/6020402-1.c llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/6310728.c llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/align-test-1.c llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/align-test-2.c llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/align-test-3.c llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/align-test-4.c llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/align-test-5c.c llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/arm-ne-zero.c llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/asm-block-29.c llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/asm-block-3.c llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/asm-block-49.c llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/asm-block-62.c llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/asm-block-63.c llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/asm-block-65.c llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/asm-block-67.c llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/block-copy-attrib-err.c llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/block-copy-destroy.c llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/block-encoding.c llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/builtin-cast.c llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/dwarf-files.c llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/inline-limit-1.c llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/iphoneos-minversion-default-1.c llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/objc-negtest.c llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/stack-protect-1.c llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/execute/align-3.c llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/format/branch-1.c llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/format/c90-printf-1.c llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/format/c90-scanf-1.c llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/format/strfmon-1.c llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/nonnull-3.c llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/sibcall-3.c llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/sibcall-4.c llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/vect/tree-vect.h llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/vect/vect.exp llvm-gcc-4.2/trunk/gcc/testsuite/lib/target-supports.exp llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/objc-property-enumtype.mm llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/property-synthesize-ivar-6.mm llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/objc-property-enumtype.m Modified: llvm-gcc-4.2/trunk/gcc/testsuite/ChangeLog.apple URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/ChangeLog.apple?rev=82305&r1=82304&r2=82305&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/ChangeLog.apple (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/ChangeLog.apple Fri Sep 18 18:20:23 2009 @@ -1,3 +1,8 @@ +2009-06-15 Fariborz Jahanian + + Radar 6936421 + * obj-c++.dg/property-as-initializer.mm: New + 2009-05-06 Fariborz Jahanian Radar 6083666 Modified: llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/6755006.C URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/g%2B%2B.apple/6755006.C?rev=82305&r1=82304&r2=82305&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/6755006.C (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/6755006.C Fri Sep 18 18:20:23 2009 @@ -1,7 +1,8 @@ // APPLE LOCAL file 6755006 //#include -// { dg-do run } -// { dg-options "-Os -m32" } +/* { dg-do run } */ +/* { dg-options { -m32 -Os } { target powerpc*-*-darwin* i?86-*-darwin* } } */ +/* { dg-options { -Os } { target arm*-*-darwin* } } */ #include #include enum foo { Modified: llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/block-no-trampoline-1.C URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/g%2B%2B.apple/block-no-trampoline-1.C?rev=82305&r1=82304&r2=82305&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/block-no-trampoline-1.C (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/block-no-trampoline-1.C Fri Sep 18 18:20:23 2009 @@ -14,6 +14,9 @@ abort(); } +extern "C" uint64_t +dispatch_benchmark(size_t count, void (^block)(void)); + class A { public: void foo(); Modified: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/6020402-1.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/6020402-1.c?rev=82305&r1=82304&r2=82305&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/6020402-1.c (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/6020402-1.c Fri Sep 18 18:20:23 2009 @@ -1,3 +1,4 @@ +/* { dg-do compile { target "i?86-*-*" } } */ /* { dg-options "-m64 -Os" } */ /* { dg-final { scan-assembler-not " orq\t" } } */ Modified: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/6310728.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/6310728.c?rev=82305&r1=82304&r2=82305&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/6310728.c (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/6310728.c Fri Sep 18 18:20:23 2009 @@ -1,5 +1,5 @@ /* APPLE LOCAL file 6310728 */ -/* { dg-do compile } */ +/* { dg-do compile { target "i?86-*-*" } } */ /* { dg-options { -mfix-and-continue -m64 } } */ typedef int int32_t; typedef int32_t SINT32 ; Modified: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/align-test-1.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/align-test-1.c?rev=82305&r1=82304&r2=82305&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/align-test-1.c (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/align-test-1.c Fri Sep 18 18:20:23 2009 @@ -1,6 +1,6 @@ /* APPLE LOCAL file Macintosh alignment */ -/* { dg-do run } */ +/* { dg-do run { target { powerpc*-*-darwin* i?86*-*-darwin* } } } */ /* { dg-options "-Wno-long-long" } */ /* Modified: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/align-test-2.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/align-test-2.c?rev=82305&r1=82304&r2=82305&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/align-test-2.c (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/align-test-2.c Fri Sep 18 18:20:23 2009 @@ -1,6 +1,6 @@ /* APPLE LOCAL file Macintosh alignment */ -/* { dg-do run } */ +/* { dg-do run { target { powerpc*-*-darwin* i?86*-*-darwin* } } } */ /* { dg-options "-Wno-long-long" } */ /* Modified: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/align-test-3.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/align-test-3.c?rev=82305&r1=82304&r2=82305&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/align-test-3.c (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/align-test-3.c Fri Sep 18 18:20:23 2009 @@ -1,6 +1,6 @@ /* APPLE LOCAL file Macintosh alignment */ -/* { dg-do run } */ +/* { dg-do run { target { powerpc*-*-darwin* i?86*-*-darwin* } } } */ /* { dg-options "-Wno-long-long" } */ /* Modified: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/align-test-4.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/align-test-4.c?rev=82305&r1=82304&r2=82305&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/align-test-4.c (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/align-test-4.c Fri Sep 18 18:20:23 2009 @@ -1,6 +1,6 @@ /* APPLE LOCAL file Macintosh alignment */ -/* { dg-do run } */ +/* { dg-do run { target { powerpc*-*-darwin* i?86*-*-darwin* } } } */ /* { dg-options "-Wno-long-long" } */ /* Modified: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/align-test-5c.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/align-test-5c.c?rev=82305&r1=82304&r2=82305&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/align-test-5c.c (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/align-test-5c.c Fri Sep 18 18:20:23 2009 @@ -1,7 +1,7 @@ /* APPLE LOCAL file Macintosh alignment */ /* align-test-5*.c are all the same code but with different options. */ -/* { dg-do run } */ +/* { dg-do run { target { powerpc*-*-darwin* i?86*-*-darwin* } } } */ /* { dg-options "-malign-mac68k -DSIZE=10" } */ /* { dg-skip-if "" { powerpc*-*-darwin* } { "-m64" } { "" } } */ Modified: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/arm-ne-zero.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/arm-ne-zero.c?rev=82305&r1=82304&r2=82305&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/arm-ne-zero.c (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/arm-ne-zero.c Fri Sep 18 18:20:23 2009 @@ -3,7 +3,7 @@ redundant move instruction. */ /* { dg-do compile { target arm*-*-darwin* } } */ -/* { dg-options "-Os" } */ +/* { dg-options "-Os -marm" } */ /* { dg-skip-if "Not valid with -mthumb" { *-*-* } { "-mthumb" } { "" } } */ int test_plus (int a, int b) { return (a + b) != 0; } Modified: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/asm-block-29.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/asm-block-29.c?rev=82305&r1=82304&r2=82305&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/asm-block-29.c (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/asm-block-29.c Fri Sep 18 18:20:23 2009 @@ -1,5 +1,5 @@ /* APPLE LOCAL file CW asm blocks */ -/* { dg-do assemble { target *-*-darwin* } } */ +/* { dg-do assemble { target powerpc*-*-darwin* i?86*-*-darwin* } } */ /* { dg-options { -fasm-blocks -msse3 } } */ /* Radar 4298005 */ Modified: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/asm-block-3.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/asm-block-3.c?rev=82305&r1=82304&r2=82305&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/asm-block-3.c (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/asm-block-3.c Fri Sep 18 18:20:23 2009 @@ -1,7 +1,7 @@ /* APPLE LOCAL file CW asm blocks */ /* Test single line asms */ -/* { dg-do compile } */ +/* { dg-do compile { target powerpc*-*-darwin* i?86*-*-darwin* } } */ /* { dg-options "-fasm-blocks" } */ void Modified: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/asm-block-49.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/asm-block-49.c?rev=82305&r1=82304&r2=82305&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/asm-block-49.c (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/asm-block-49.c Fri Sep 18 18:20:23 2009 @@ -1,5 +1,5 @@ /* APPLE LOCAL file CW asm blocks */ -/* { dg-do assemble { target *-*-darwin* } } */ +/* { dg-do assemble { target powerpc*-*-darwin* i?86*-*-darwin* } } */ /* { dg-options { -fasm-blocks } } */ /* Radar 4477426 4466768 */ Modified: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/asm-block-62.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/asm-block-62.c?rev=82305&r1=82304&r2=82305&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/asm-block-62.c (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/asm-block-62.c Fri Sep 18 18:20:23 2009 @@ -1,5 +1,5 @@ /* APPLE LOCAL file CW asm blocks */ -/* { dg-do compile { target *-*-darwin* } } */ +/* { dg-do compile { target powerpc*-*-darwin* i?86*-*-darwin* } } */ /* { dg-options { -fasm-blocks } } */ /* Radar 4197305 */ Modified: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/asm-block-63.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/asm-block-63.c?rev=82305&r1=82304&r2=82305&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/asm-block-63.c (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/asm-block-63.c Fri Sep 18 18:20:23 2009 @@ -1,5 +1,5 @@ /* APPLE LOCAL file CW asm blocks */ -/* { dg-do compile { target *-*-darwin* } } */ +/* { dg-do compile { target powerpc*-*-darwin* i?86*-*-darwin* } } */ /* { dg-options { -fasm-blocks } } */ /* Radar 4766972 */ Modified: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/asm-block-65.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/asm-block-65.c?rev=82305&r1=82304&r2=82305&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/asm-block-65.c (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/asm-block-65.c Fri Sep 18 18:20:23 2009 @@ -1,4 +1,4 @@ -/* { dg-do compile { target *-*-darwin* } } */ +/* { dg-do compile { target powerpc*-*-darwin* i?86*-*-darwin* } } */ /* { dg-options { -fasm-blocks } } */ /* Radar 5474682 */ Modified: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/asm-block-67.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/asm-block-67.c?rev=82305&r1=82304&r2=82305&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/asm-block-67.c (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/asm-block-67.c Fri Sep 18 18:20:23 2009 @@ -1,4 +1,4 @@ -/* { dg-do compile } */ +/* { dg-do compile { target powerpc*-*-darwin* i?86*-*-darwin* } } */ /* { dg-options "-fasm-blocks" } */ int i = 1st; /* { dg-error "invalid suffix \"st\" on integer constant" } */ Modified: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/block-copy-attrib-err.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/block-copy-attrib-err.c?rev=82305&r1=82304&r2=82305&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/block-copy-attrib-err.c (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/block-copy-attrib-err.c Fri Sep 18 18:20:23 2009 @@ -1,6 +1,7 @@ /* APPLE LOCAL file radar 6379842 - blocks */ /* { dg-do compile } */ -/* { dg-options "-ObjC -fblocks -m64 -fobjc-gc-only" } */ +/* { dg-options "-ObjC -fblocks -m64 -fobjc-gc-only" { target powerpc*-*-darwin* i?86*-*-darwin* } } */ +/* { dg-options "-ObjC -fblocks -fobjc-gc-only" {target arm*-*-darwin* } } */ @interface Thing {} Modified: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/block-copy-destroy.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/block-copy-destroy.c?rev=82305&r1=82304&r2=82305&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/block-copy-destroy.c (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/block-copy-destroy.c Fri Sep 18 18:20:23 2009 @@ -1,7 +1,8 @@ /* APPLE LOCAL file 5782740 - blocks */ /* Test generation of copy/destroy helper function. */ /* { dg-do compile } */ -/* { dg-options "-mmacosx-version-min=10.5 -ObjC -fblocks" { target *-*-darwin* } } */ +/* { dg-options "-mmacosx-version-min=10.5 -ObjC -fblocks" { target powerpc*-*-darwin* i?86*-*-darwin* } } */ +/* { dg-options "-iphoneos-version-min=4.0 -ObjC -fblocks" { target arm*-*-darwin* } } */ #import Modified: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/block-encoding.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/block-encoding.c?rev=82305&r1=82304&r2=82305&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/block-encoding.c (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/block-encoding.c Fri Sep 18 18:20:23 2009 @@ -1,7 +1,8 @@ /* APPLE LOCAL file radar 5849129 */ /* Test for encoding of a block pointer as '@'. */ /* { dg-do compile } */ -/* { dg-options "-mmacosx-version-min=10.5 -ObjC" { target *-*-darwin* } } */ +/* { dg-options "-mmacosx-version-min=10.5 -ObjC" { target powerpc*-*-darwin* i?86*-*-darwin* } } */ +/* { dg-options "-iphoneos-version-min=4.0 -ObjC" { target arm*-*-darwin* } } */ #import Modified: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/builtin-cast.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/builtin-cast.c?rev=82305&r1=82304&r2=82305&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/builtin-cast.c (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/builtin-cast.c Fri Sep 18 18:20:23 2009 @@ -1,5 +1,5 @@ /* APPLE LOCAL file radar 4629695 */ -/* { dg-do compile } */ +/* { dg-do compile { target i?86*-*-darwin* } } */ /* { dg-options "-m64" } */ /* { dg-final { scan-assembler "_memcmp" } } */ extern void abort (void); Modified: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/dwarf-files.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/dwarf-files.c?rev=82305&r1=82304&r2=82305&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/dwarf-files.c (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/dwarf-files.c Fri Sep 18 18:20:23 2009 @@ -1,6 +1,6 @@ /* APPLE LOCAL file */ /* Radar 5645155 */ -/* { dg-do compile } */ +/* { dg-do compile { target i?86-*-darwin* } } */ /* { dg-options "-c -g -fasm-blocks" } */ /* { dg-final { scan-assembler-times "dwarf-files.c" 2 } } */ asm(".globl _x\n" Modified: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/inline-limit-1.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/inline-limit-1.c?rev=82305&r1=82304&r2=82305&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/inline-limit-1.c (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/inline-limit-1.c Fri Sep 18 18:20:23 2009 @@ -1,5 +1,5 @@ /* APPLE LOCAL file 4209014 4210936 */ -/* { dg-do compile } */ +/* { dg-do compile { target { powerpc*-*-darwin* i?86*-*-darwin* } } } */ /* { dg-options "-Os" } */ /* Call to inlinex25 should be inlined. */ /* { dg-final { scan-assembler-not "(\tbl|\tcall)\[ \]*_?inlinex25" } } */ Modified: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/iphoneos-minversion-default-1.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/iphoneos-minversion-default-1.c?rev=82305&r1=82304&r2=82305&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/iphoneos-minversion-default-1.c (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/iphoneos-minversion-default-1.c Fri Sep 18 18:20:23 2009 @@ -6,7 +6,7 @@ /* { dg-do compile { target arm*-*-darwin* } } */ /* { dg-skip-if "Not valid with -mmacosx-version-min" { *-*-darwin* } { "-mmacosx-version-min=*" } { "" } } */ -#if (__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ != 20000) +#if (__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ != 30000) #error TEST FAILS #endif Modified: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/objc-negtest.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/objc-negtest.c?rev=82305&r1=82304&r2=82305&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/objc-negtest.c (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/objc-negtest.c Fri Sep 18 18:20:23 2009 @@ -1,4 +1,5 @@ /* APPLE LOCAL begin radar 4122328 */ +/* { dg-do compile { target i?86-*-darwin*i powerpc*-*-darwin* } } */ /* { dg-options "-fasm-blocks" } */ @class NSString; /* { dg-error "expected identifier or '\\(' before '@' token" } */ Modified: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/stack-protect-1.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/stack-protect-1.c?rev=82305&r1=82304&r2=82305&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/stack-protect-1.c (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/stack-protect-1.c Fri Sep 18 18:20:23 2009 @@ -1,5 +1,5 @@ /* APPLE LOCAL file stack-protector default 5095227 */ -/* { dg-do compile } */ +/* { dg-do compile { target i?86-*-darwin*i powerpc*-*-darwin* } } */ /* Verify that -fstack-protector is on by default and that it at least appears to work. */ extern void f2(char *); Modified: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/execute/align-3.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/execute/align-3.c?rev=82305&r1=82304&r2=82305&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/execute/align-3.c (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/execute/align-3.c Fri Sep 18 18:20:23 2009 @@ -7,7 +7,12 @@ int main() { + /* ARM thumb functions set the low bit of the address. */ +#if defined(__arm__) && defined(__thumb__) + if (((long)func & 0xFF) != 1) +#else if (((long)func & 0xFF) != 0) +#endif abort (); if (__alignof__(func) != 256) abort (); Modified: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/format/branch-1.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/format/branch-1.c?rev=82305&r1=82304&r2=82305&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/format/branch-1.c (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/format/branch-1.c Fri Sep 18 18:20:23 2009 @@ -22,6 +22,6 @@ printf ((nfoo > 1) ? "%ld foos" : ((nfoo > 0) ? "%d foo" : "%d foos"), nfoo); /* { dg-warning "long int" "wrong type" } */ printf ((nfoo > 1) ? "%d foos" : ((nfoo > 0) ? "%ld foo" : "%d foos"), nfoo); /* { dg-warning "long int" "wrong type" } */ /* Extra arguments to NULL should be complained about. */ - printf (NULL, "foo"); /* { dg-warning "too many" "NULL extra args" } */ - /* { dg-warning "null" "null format arg" { target *-*-* } 25 } */ + /* APPLE LOCAL 6821124 string arg is not non-null */ + /* removed lines */ } Modified: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/format/c90-printf-1.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/format/c90-printf-1.c?rev=82305&r1=82304&r2=82305&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/format/c90-printf-1.c (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/format/c90-printf-1.c Fri Sep 18 18:20:23 2009 @@ -227,11 +227,12 @@ printf ("\0"); /* { dg-warning "embedded" "warning for embedded NUL" } */ printf ("%d\0", i); /* { dg-warning "embedded" "warning for embedded NUL" } */ printf ("%d\0%d", i, i); /* { dg-warning "embedded|too many" "warning for embedded NUL" } */ - printf (NULL); /* { dg-warning "null" "null format string warning" } */ + /* APPLE LOCAL 6821124 string arg is not non-null */ + /* removed line */ printf ("%"); /* { dg-warning "trailing" "trailing % warning" } */ printf ("%++d", i); /* { dg-warning "repeated" "repeated flag warning" } */ printf ("%n", cn); /* { dg-warning "constant" "%n with const" } */ printf ((const char *)L"foo"); /* { dg-warning "wide" "wide string" } */ - printf ("%n", (int *)0); /* { dg-warning "null" "%n with NULL" } */ - printf ("%s", (char *)0); /* { dg-warning "null" "%s with NULL" } */ + /* APPLE LOCAL 6821124 begin string arg is not non-null */ + /* removed lines */ } Modified: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/format/c90-scanf-1.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/format/c90-scanf-1.c?rev=82305&r1=82304&r2=82305&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/format/c90-scanf-1.c (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/format/c90-scanf-1.c Fri Sep 18 18:20:23 2009 @@ -113,7 +113,8 @@ scanf ("\0"); /* { dg-warning "embedded" "warning for embedded NUL" } */ scanf ("%d\0", ip); /* { dg-warning "embedded" "warning for embedded NUL" } */ scanf ("%d\0%d", ip, ip); /* { dg-warning "embedded|too many" "warning for embedded NUL" } */ - scanf (NULL); /* { dg-warning "null" "null format string warning" } */ + /* APPLE LOCAL 6821124 string arg is not non-null */ + /* removed line */ scanf ("%"); /* { dg-warning "trailing" "trailing % warning" } */ scanf ("%d", (int *)0); /* { dg-warning "null" "writing into NULL" } */ } Modified: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/format/strfmon-1.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/format/strfmon-1.c?rev=82305&r1=82304&r2=82305&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/format/strfmon-1.c (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/format/strfmon-1.c Fri Sep 18 18:20:23 2009 @@ -56,7 +56,8 @@ /* Miscellaneous bogus formats. */ strfmon (s, m, "%n%n", d); /* { dg-warning "arguments" "too few args" } */ strfmon (s, m, ""); /* { dg-warning "zero-length" "empty" } */ - strfmon (s, m, NULL); /* { dg-warning "null" "null format string" } */ + /* APPLE LOCAL 6821124 string arg is not non-null */ + /* removed line */ strfmon (s, m, "%"); /* { dg-warning "trailing" "tailing %" } */ strfmon (s, m, "%n\0", d); /* { dg-warning "embedded" "embedded NUL" } */ strfmon (s, m, "%^^n", d); /* { dg-warning "repeated" "repeated flag" } */ Modified: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/nonnull-3.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/nonnull-3.c?rev=82305&r1=82304&r2=82305&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/nonnull-3.c (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/nonnull-3.c Fri Sep 18 18:20:23 2009 @@ -66,16 +66,12 @@ __builtin_nansf (NULL); /* { dg-warning "null" "null pointer check" } */ __builtin_nansl (NULL); /* { dg-warning "null" "null pointer check" } */ - __builtin_puts (NULL); /* { dg-warning "null" "null pointer check" } */ + /* APPLE LOCAL begin 6821124 puts string arg is not non-null */ __builtin_fputc (*s, NULL); /* { dg-warning "null" "null pointer check" } */ - __builtin_fputs (s, NULL); /* { dg-warning "null" "null pointer check" } */ - __builtin_fputs (NULL, p); /* { dg-warning "null" "null pointer check" } */ __builtin_fwrite (s, 16, 16, NULL); /* { dg-warning "null" "null pointer check" } */ __builtin_fwrite (NULL, 16, 16, p); /* { dg-warning "null" "null pointer check" } */ - __builtin_puts_unlocked (NULL); /* { dg-warning "null" "null pointer check" } */ __builtin_fputc_unlocked (*s, NULL); /* { dg-warning "null" "null pointer check" } */ - __builtin_fputs_unlocked (s, NULL); /* { dg-warning "null" "null pointer check" } */ - __builtin_fputs_unlocked (NULL, p); /* { dg-warning "null" "null pointer check" } */ + /* APPLE LOCAL end 6821124 puts string arg is not non-null */ __builtin_fwrite_unlocked (s, 16, 16, NULL); /* { dg-warning "null" "null pointer check" } */ __builtin_fwrite_unlocked (NULL, 16, 16, p); /* { dg-warning "null" "null pointer check" } */ Modified: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/sibcall-3.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/sibcall-3.c?rev=82305&r1=82304&r2=82305&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/sibcall-3.c (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/sibcall-3.c Fri Sep 18 18:20:23 2009 @@ -9,6 +9,8 @@ /* { dg-options "-O2 -foptimize-sibling-calls" } */ /* APPLE LOCAL ARM 5798689 sibcalls not implemented for Thumb mode */ /* { dg-skip-if "" { arm-*-darwin* } { "-mthumb" } { "" } } */ +/* APPLE LOCAL v7 merge. thumb mode is default for Darwin v7a */ +/* { dg-skip-if "" { arm-*-darwin* } { "-march=armv7a" } { "" } } */ /* The option -foptimize-sibling-calls is the default, but serves as marker. This test is xfailed on targets without sibcall patterns Modified: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/sibcall-4.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/sibcall-4.c?rev=82305&r1=82304&r2=82305&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/sibcall-4.c (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/sibcall-4.c Fri Sep 18 18:20:23 2009 @@ -9,6 +9,8 @@ /* { dg-options "-O2 -foptimize-sibling-calls" } */ /* APPLE LOCAL ARM 5798689 sibcalls not implemented for Thumb mode */ /* { dg-skip-if "" { arm-*-darwin* } { "-mthumb" } { "" } } */ +/* APPLE LOCAL v7 merge. thumb mode is default for Darwin v7a */ +/* { dg-skip-if "" { arm-*-darwin* } { "-march=armv7a" } { "" } } */ /* The option -foptimize-sibling-calls is the default, but serves as marker. This test is xfailed on targets without sibcall patterns Modified: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/vect/tree-vect.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/vect/tree-vect.h?rev=82305&r1=82304&r2=82305&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/vect/tree-vect.h (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/vect/tree-vect.h Fri Sep 18 18:20:23 2009 @@ -21,6 +21,20 @@ asm volatile (".byte 0xf2,0x0f,0x10,0xc0"); #elif defined(__sparc__) asm volatile (".word\t0x81b007c0"); +/* APPLE LOCAL begin v7 merge */ +#elif defined(__arm__) + { + /* On some processors without NEON support, this instruction may + be a no-op, on others it may trap, so check that it executes + correctly. */ + long long a = 0, b = 1; + asm ("vorr %P0, %P1, %P2" + : "=w" (a) + : "0" (a), "w" (b)); + if (a != 1) + exit (0); + } #endif +/* APPLE LOCAL end v7 merge */ signal (SIGILL, SIG_DFL); } Modified: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/vect/vect.exp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/vect/vect.exp?rev=82305&r1=82304&r2=82305&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/vect/vect.exp (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/vect/vect.exp Fri Sep 18 18:20:23 2009 @@ -73,6 +73,15 @@ } } elseif [istarget "ia64-*-*"] { set dg-do-what-default run +# APPLE LOCAL begin v7 merge +} elseif [is-effective-target arm_neon_ok] { + lappend DEFAULT_VECTCFLAGS "-mfpu=neon" "-mfloat-abi=softfp" + if [is-effective-target arm_neon_hw] { + set dg-do-what-default run + } else { + set dg-do-what-default compile + } +# APPLE LOCAL end v7 merge } else { return } Modified: llvm-gcc-4.2/trunk/gcc/testsuite/lib/target-supports.exp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/lib/target-supports.exp?rev=82305&r1=82304&r2=82305&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/lib/target-supports.exp (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/lib/target-supports.exp Fri Sep 18 18:20:23 2009 @@ -1263,13 +1263,16 @@ verbose "check_effective_target_vect_int: using cached result" 2 } else { set et_vect_int_saved 0 +# APPLE LOCAL begin v7 merge if { [istarget i?86-*-*] || [istarget powerpc*-*-*] || [istarget spu-*-*] || [istarget x86_64-*-*] || [istarget sparc*-*-*] || [istarget alpha*-*-*] - || [istarget ia64-*-*] } { + || [istarget ia64-*-*] + || [check_effective_target_arm32] } { +# APPLE LOCAL end v7 merge set et_vect_int_saved 1 } } @@ -1303,7 +1306,8 @@ verbose "check-effective_target_arm32: using cached result" 2 } else { set et_arm32_saved 0 - if { [istarget arm-*-*] +# APPLE LOCAL v7 merge + if { [istarget arm*-*-*] || [istarget strongarm*-*-*] || [istarget xscale-*-*] } { if ![string match "*-mthumb *" $compiler_flags] { @@ -1319,31 +1323,44 @@ # -mfloat-abi=softfp. Some multilibs may be incompatible with these # options. +# APPLE LOCAL begin check for FP needs to be sensitive to thumb vs thumb2 proc check_effective_target_arm_vfp_ok { } { - if { [check_effective_target_arm32] } { - return [check_no_compiler_messages arm_vfp_ok object { - int dummy; - } "-mfpu=vfp -mfloat-abi=softfp"] - } else { - return 0 - } + global compiler_flags + global TOOL_OPTIONS + set compiler_flags "" + # If running a subset of the test suite, $TOOL_OPTIONS may not exist. + catch {append compiler_flags " $TOOL_OPTIONS "} + return [check_no_messages_and_pattern arm_vfp_ok \ + "ARM_VFP_OK" assembly " + #if __VFP_FP__ && (!__thumb__ || __thumb2__) + #define ARM_VFP_OK 1 + #endif + " "$compiler_flags -mfpu=vfp -mfloat-abi=softfp -E -Wp,-dD,-dM"] } -# LLVM LOCAL begin # Return 1 if this is an ARM target supporting -mfpu=neon # -mfloat-abi=softfp. Some multilibs may be incompatible with these # options. proc check_effective_target_arm_neon_ok { } { - if { [check_effective_target_arm32] } { - return [check_no_compiler_messages arm_neon_ok object { - int dummy; - } "-mfpu=neon -mfloat-abi=softfp"] - } else { - return 0 + global compiler_flags + global TOOL_OPTIONS + set compiler_flags "" + if { [istarget arm*-*-*] } { + # If running a subset of the test suite, $TOOL_OPTIONS may not exist. + catch {append compiler_flags " $TOOL_OPTIONS "} + return [check_no_messages_and_pattern arm_neon_ok \ + "ARM_NEON_OK" assembly " + #if __ARM_NEON__ && (!__thumb__ || __thumb2__) + #define ARM_NEON_OK 1 + #endif + " "$compiler_flags -mfpu=neon -mfloat-abi=softfp -E -Wp,-dD,-dM"] } + return 0; } +# APPLE LOCAL end check for FP needs to be sensitive to thumb vs thumb2 +# APPLE LOCAL begin v7 merge # Return 1 if the target supports executing NEON instructions, 0 # otherwise. Cache the result. @@ -1352,52 +1369,51 @@ global tool if [info exists arm_neon_hw_available_saved] { - verbose "check_arm_neon_hw_available returning saved $arm_neon_hw_available_saved" 2 + verbose "check_arm_neon_hw_available returning saved $arm_neon_hw_available_saved" 2 } else { - set arm_neon_hw_available_saved 0 + set arm_neon_hw_available_saved 0 - # Set up, compile, and execute a test program containing NEON - # instructions. Include the current process ID in the file - # names to prevent conflicts with invocations for multiple - # testsuites. - set src neon[pid].c - set exe neon[pid].x - - set f [open $src "w"] - puts $f "int main() {" - puts $f " long long a = 0, b = 1;" - puts $f " asm (\"vorr %P0, %P1, %P2\"" - puts $f " : \"=w\" (a)" - puts $f " : \"0\" (a), \"w\" (b));" - puts $f " return (a != 1);" - puts $f "}" - close $f - - set opts "additional_flags=-mfpu=neon additional_flags=-mfloat-abi=softfp" - - verbose "check_arm_neon_hw_available compiling testfile $src" 2 - set lines [${tool}_target_compile $src $exe executable "$opts"] - file delete $src - - if [string match "" $lines] then { - # No error message, compilation succeeded. - set result [${tool}_load "./$exe" "" ""] - set status [lindex $result 0] - remote_file build delete $exe - verbose "check_arm_neon_hw_available testfile status is <$status>" 2 - - if { $status == "pass" } then { - set arm_neon_hw_available_saved 1 - } - } else { - verbose "check_arm_neon_hw_available testfile compilation failed" 2 - } + # Set up, compile, and execute a test program containing NEON + # instructions. Include the current process ID in the file + # names to prevent conflicts with invocations for multiple + # testsuites. + set src neon[pid].c + set exe neon[pid].x + + set f [open $src "w"] + puts $f "int main() {" + puts $f " long long a = 0, b = 1;" + puts $f " asm (\"vorr %P0, %P1, %P2\"" + puts $f " : \"=w\" (a)" + puts $f " : \"0\" (a), \"w\" (b));" + puts $f " return (a != 1);" + puts $f "}" + close $f + + set opts "additional_flags=-mfpu=neon additional_flags=-mfloat-abi=softfp" + + verbose "check_arm_neon_hw_available compiling testfile $src" 2 + set lines [${tool}_target_compile $src $exe executable "$opts"] + file delete $src + + if [string match "" $lines] then { + # No error message, compilation succeeded. + set result [${tool}_load "./$exe" "" ""] + set status [lindex $result 0] + remote_file build delete $exe + verbose "check_arm_neon_hw_available testfile status is <$status>" 2 + + if { $status == "pass" } then { + set arm_neon_hw_available_saved 1 + } + } else { + verbose "check_arm_neon_hw_availalble testfile compilation failed" 2 + } } return $arm_neon_hw_available_saved } -# LLVM LOCAL end - +# APPLE LOCAL end v7 merge # Return 1 if this is a PowerPC target with floating-point registers. proc check_effective_target_powerpc_fprs { } { @@ -1473,10 +1489,13 @@ verbose "check_effective_target_vect_shift: using cached result" 2 } else { set et_vect_shift_saved 0 +# APPLE LOCAL begin v7 merge if { [istarget powerpc*-*-*] || [istarget ia64-*-*] || [istarget i?86-*-*] - || [istarget x86_64-*-*] } { + || [istarget x86_64-*-*] + || [check_effective_target_arm32] } { +# APPLE LOCAL end v7 merge set et_vect_shift_saved 1 } } @@ -1490,10 +1509,13 @@ # This can change for different subtargets so do not cache the result. proc check_effective_target_vect_long { } { +# APPLE LOCAL begin v7 merge if { [istarget i?86-*-*] || ([istarget powerpc*-*-*] && [check_effective_target_ilp32]) || [istarget x86_64-*-*] + || [check_effective_target_arm32] || ([istarget sparc*-*-*] && [check_effective_target_ilp32]) } { +# APPLE LOCAL end v7 merge set answer 1 } else { set answer 0 @@ -1514,12 +1536,15 @@ verbose "check_effective_target_vect_float: using cached result" 2 } else { set et_vect_float_saved 0 +# APPLE LOCAL begin v7 merge if { [istarget i?86-*-*] || [istarget powerpc*-*-*] || [istarget spu-*-*] || [istarget mipsisa64*-*-*] || [istarget x86_64-*-*] - || [istarget ia64-*-*] } { + || [istarget ia64-*-*] + || [check_effective_target_arm32] } { +# APPLE LOCAL end v7 merge set et_vect_float_saved 1 } } @@ -1809,9 +1834,12 @@ verbose "check_effective_target_vect_no_align: using cached result" 2 } else { set et_vect_no_align_saved 0 +# APPLE LOCAL begin v7 merge if { [istarget mipsisa64*-*-*] || [istarget sparc*-*-*] - || [istarget ia64-*-*] } { + || [istarget ia64-*-*] + || [check_effective_target_arm32] } { +# APPLE LOCAL end v7 merge set et_vect_no_align_saved 1 } } @@ -1912,9 +1940,12 @@ verbose "check_effective_target_vect_int_mult: using cached result" 2 } else { set et_vect_int_mult_saved 0 +# APPLE LOCAL begin v7 merge if { [istarget powerpc*-*-*] || [istarget i?86-*-*] - || [istarget x86_64-*-*] } { + || [istarget x86_64-*-*] + || [check_effective_target_arm32] } { +# APPLE LOCAL end v7 merge set et_vect_int_mult_saved 1 } } Modified: llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/objc-property-enumtype.mm URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/obj-c%2B%2B.dg/objc-property-enumtype.mm?rev=82305&r1=82304&r2=82305&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/objc-property-enumtype.mm (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/objc-property-enumtype.mm Fri Sep 18 18:20:23 2009 @@ -2,7 +2,9 @@ /* Test that property of enum types don't cause error when setter call is generated. */ /* { dg-do run { target *-*-darwin* } } */ -/* { dg-options "-framework Foundation -Werror" } */ +/* { dg-options "-framework Foundation -Werror" { target arm*-*-darwin* } } */ +/* { dg-options "-mmacosx-version-min=10.5 -framework Foundation -Werror" { target i?86-*-darwin* } } */ +/* { dg-options "-mmacosx-version-min=10.5 -framework Foundation -Werror" { target powerpc*-*-darwin* } } */ #import Modified: llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/property-synthesize-ivar-6.mm URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/obj-c%2B%2B.dg/property-synthesize-ivar-6.mm?rev=82305&r1=82304&r2=82305&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/property-synthesize-ivar-6.mm (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/property-synthesize-ivar-6.mm Fri Sep 18 18:20:23 2009 @@ -20,7 +20,7 @@ @end @implementation Test6 - at synthesize prop; /* { dg-error "property \\'prop\\' attempting to use ivar \\'prop\\' in super class \\'Test6\\'" } */ + at synthesize prop; /* { dg-error "property \\'prop\\' attempting to use ivar \\'prop\\' declared in super class of \\'Test6\\'" } */ @end #endif Modified: llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/objc-property-enumtype.m URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/objc-property-enumtype.m?rev=82305&r1=82304&r2=82305&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/objc-property-enumtype.m (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/objc-property-enumtype.m Fri Sep 18 18:20:23 2009 @@ -2,7 +2,9 @@ /* Test that property of enum types don't cause error when setter call is generated. */ /* { dg-do run { target *-*-darwin* } } */ -/* { dg-options "-framework Foundation -Werror" } */ +/* { dg-options "-framework Foundation -Werror" { target arm*-*-darwin* } } */ +/* { dg-options "-mmacosx-version-min=10.5 -framework Foundation -Werror" { target i?86-*-darwin* } } */ +/* { dg-options "-mmacosx-version-min=10.5 -framework Foundation -Werror" { target powerpc*-*-darwin* } } */ #import From grosser at fim.uni-passau.de Fri Sep 18 13:15:41 2009 From: grosser at fim.uni-passau.de (Tobias Grosser) Date: Fri, 18 Sep 2009 20:15:41 +0200 Subject: [llvm-commits] [Patch] Fix --dot-cfg-only Message-ID: <1253297741.5199.7.camel@tobilaptop> Hi, The flag "--dot-cfg-only" is at the moment equivalent to the flag "--dot-cfg". It prints the content of all bbs, instead of printing empty bbs to make the CFG more readable. The attached patch fixes this behavior. Patch: patch-ViewCFGOnly.patch Tobi -------------- next part -------------- A non-text attachment was scrubbed... Name: patch-ViewCFGOnly.patch Type: text/x-patch Size: 368 bytes Desc: Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090918/1ab6b6dc/attachment.bin From vhdez at mac.com Fri Sep 18 13:44:10 2009 From: vhdez at mac.com (Victor Hernandez) Date: Fri, 18 Sep 2009 11:44:10 -0700 Subject: [llvm-commits] [PATCH] extend analysis passes to treat malloc calls the same as MallocInst (patch #2) In-Reply-To: <0CEDC499-34E3-4A4F-9906-90F3D3B60995@apple.com> References: <13429790-6CCE-4644-A1EE-A554440F22E7@apple.com> <0CEDC499-34E3-4A4F-9906-90F3D3B60995@apple.com> Message-ID: On Sep 18, 2009, at 8:55 AM, Victor Hernandez wrote: >> >> Index: lib/Analysis/ValueTracking.cpp >> =================================================================== >> --- lib/Analysis/ValueTracking.cpp (revision 81898) >> +++ lib/Analysis/ValueTracking.cpp (working copy) >> @@ -20,6 +20,7 @@ >> #include "llvm/IntrinsicInst.h" >> #include "llvm/LLVMContext.h" >> #include "llvm/Operator.h" >> +#include "llvm/Analysis/MallocHelper.h" >> #include "llvm/Target/TargetData.h" >> #include "llvm/Support/GetElementPtrTypeIterator.h" >> #include "llvm/Support/MathExtras.h" >> @@ -621,6 +622,24 @@ >> break; >> }1 >> } >> + } else if (CallInst* CI = extractMallocCall(I)) { >> + unsigned Align = 0; >> + const Type* T = getMallocAllocatedType(CI); >> + if (TD && T) { >> + // Malloc returns maximally aligned memory. >> + Align = TD->getABITypeAlignment(T); >> + Align = >> + std::max(Align, >> + (unsigned)TD->getABITypeAlignment( >> + Type::getDoubleTy(V->getContext()))); >> + Align = >> + std::max(Align, >> + (unsigned)TD->getABITypeAlignment( >> + Type::getInt64Ty(V->getContext()))); >> + } >> + if (Align > 0) >> + KnownZero = Mask & APInt::getLowBitsSet(BitWidth, >> + >> CountTrailingZeros_32(Align)); >> } >> break; >> } >> >> This is simply wrong; we can't make that guarantee for malloc. >> Consider, for example, a malloc used as an SSE vector on Windows. > > I agree that this is wrong; yet the bug you describe currently > exists in LLVM TOT and results in better codegen on some systems. > RaiseAllocations creates a MallocInst with no specified alignment. > KnownZero for MallocInst ends up getting the wrong alignment, just > like malloc calls would with this code. > > I am not sure what to do in this scenario. I agree that getting rid > of this code is correct for the example you mention, but the code is > currently resulting in aligned instructions being generated on > MacOSX/x86, so it's tempting to keep it in. > After discussing this further, I am not going to persist the current malloc alignment bug. I'll won't commit this patch, and file a bug to extend TargetData to identify the target-specific malloc alignment. Victor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090918/c0aa2329/attachment.html From sabre at nondot.org Fri Sep 18 19:00:59 2009 From: sabre at nondot.org (Chris Lattner) Date: Fri, 18 Sep 2009 19:00:59 -0500 Subject: [llvm-commits] CVS: llvm-www/devmtg/2009-10/index.php Message-ID: <200909190000.n8J00xBr013023@zion.cs.uiuc.edu> Changes in directory llvm-www/devmtg/2009-10: index.php updated: 1.18 -> 1.19 --- Log message: temporarily disable the list of attendees --- Diffs of the changes: (+3 -0) index.php | 3 +++ 1 files changed, 3 insertions(+) Index: llvm-www/devmtg/2009-10/index.php diff -u llvm-www/devmtg/2009-10/index.php:1.18 llvm-www/devmtg/2009-10/index.php:1.19 --- llvm-www/devmtg/2009-10/index.php:1.18 Fri Sep 18 16:25:52 2009 +++ llvm-www/devmtg/2009-10/index.php Fri Sep 18 19:00:38 2009 @@ -68,9 +68,11 @@

    We also ask that everyone planning on attending register (including speakers). This gives us an accurate tally of how many people will be there.

    +

    This table lists all attendees who have registered to attend this year's conference.

    +

    Total Confirmed:

    If your name is misspelled, or organization affiliation isn't correct, please email us, and we'll correct it.

    From edwintorok at gmail.com Sat Sep 19 02:24:06 2009 From: edwintorok at gmail.com (=?ISO-8859-1?Q?T=F6r=F6k_Edwin?=) Date: Sat, 19 Sep 2009 10:24:06 +0300 Subject: [llvm-commits] [llvm] r82300 - in /llvm/trunk/lib/Transforms: IPO/FunctionAttrs.cpp IPO/GlobalOpt.cpp Scalar/GVN.cpp Scalar/InstructionCombining.cpp Scalar/Reassociate.cpp Scalar/SCCP.cpp Scalar/SimplifyLibCalls.cpp Scalar/TailDuplication.cpp Utils/InlineCost.cpp In-Reply-To: <200909182235.n8IMZnYJ001246@zion.cs.uiuc.edu> References: <200909182235.n8IMZnYJ001246@zion.cs.uiuc.edu> Message-ID: <4AB48716.7020504@gmail.com> On 2009-09-19 01:35, Victor Hernandez wrote: > Author: hernande > Date: Fri Sep 18 17:35:49 2009 > New Revision: 82300 > > URL: http://llvm.org/viewvc/llvm-project?rev=82300&view=rev > Log: > Enhance transform passes so that they apply the same tranforms to malloc calls as to MallocInst. > > Reviewed by Dan Gohman. > > > + if (!isa(LoadUse.getUser())) > + LoadUse = RepValue; > + else { > + ICmpInst *ICI = cast(LoadUse.getUser()); > Can this condition be inverted to use dyn_cast instead of !isa and cast? > + // The tricky aspect of this transformation is handling the case when malloc > + // fails. In the original code, malloc failing would set the result pointer > + // of malloc to null. In this case, some mallocs could succeed and others > + // could fail. As such, we emit code that looks like this: > + // F0 = malloc(field0) > + // F1 = malloc(field1) > + // F2 = malloc(field2) > + // if (F0 == 0 || F1 == 0 || F2 == 0) { > + // if (F0) { free(F0); F0 = 0; } > + // if (F1) { free(F1); F1 = 0; } > + // if (F2) { free(F2); F2 = 0; } > + // } > Those 3 ifs are not needed, doing free(NULL) is perfectly fine, so it could look like this: F0 = malloc(field0); F1 = malloc(field1); F2 = malloc(field2); if (F0 == 0 || F1 == 0 || F2 == 0) { free(F0); free(F1); free(F2); F0 = 0; F1 = 0; F2 = 0; } If only one malloc fails then 3 frees will be called instead of 1, but malloc failing is an exceptional condition, so the time wasted by those extra 2 function calls don't matter. Instead by removing those 3 ifs you reduce code size. Best regards, --Edwin From isanbard at gmail.com Sat Sep 19 03:43:52 2009 From: isanbard at gmail.com (Bill Wendling) Date: Sat, 19 Sep 2009 08:43:52 -0000 Subject: [llvm-commits] [llvm] r82309 - /llvm/tags/Apple/llvmCore-2208.1/ Message-ID: <200909190843.n8J8hqQ1030536@zion.cs.uiuc.edu> Author: void Date: Sat Sep 19 03:43:52 2009 New Revision: 82309 URL: http://llvm.org/viewvc/llvm-project?rev=82309&view=rev Log: Creating llvmCore-2208.1 from Bender-SWB. Added: llvm/tags/Apple/llvmCore-2208.1/ - copied from r82308, llvm/branches/Apple/Bender-SWB/ From isanbard at gmail.com Sat Sep 19 03:44:00 2009 From: isanbard at gmail.com (Bill Wendling) Date: Sat, 19 Sep 2009 08:44:00 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r82310 - /llvm-gcc-4.2/tags/Apple/llvmgcc42-2208.1/ Message-ID: <200909190844.n8J8i0sb030561@zion.cs.uiuc.edu> Author: void Date: Sat Sep 19 03:44:00 2009 New Revision: 82310 URL: http://llvm.org/viewvc/llvm-project?rev=82310&view=rev Log: Creating llvmgcc42-2208.1 from Bender-SWB. Added: llvm-gcc-4.2/tags/Apple/llvmgcc42-2208.1/ - copied from r82309, llvm-gcc-4.2/branches/Apple/Bender-SWB/ From evan.cheng at apple.com Sat Sep 19 04:51:05 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Sat, 19 Sep 2009 09:51:05 -0000 Subject: [llvm-commits] [llvm] r82311 - in /llvm/trunk: lib/CodeGen/SelectionDAG/ lib/Target/ARM/ lib/Target/Alpha/ lib/Target/MSP430/ lib/Target/Mips/ lib/Target/PIC16/ lib/Target/PowerPC/ lib/Target/Sparc/ lib/Target/SystemZ/ lib/Target/X86/ lib/Target/XCore/ test/CodeGen/X86/ Message-ID: <200909190951.n8J9p5E7007710@zion.cs.uiuc.edu> Author: evancheng Date: Sat Sep 19 04:51:03 2009 New Revision: 82311 URL: http://llvm.org/viewvc/llvm-project?rev=82311&view=rev Log: Fix PR4926. When target hook EmitInstrWithCustomInserter() insert new basic blocks and update CFG, it should also inform sdisel of the changes so the phi source operands will come from the right basic blocks. Added: llvm/trunk/test/CodeGen/X86/2009-09-19-SchedCustomLoweringBug.ll Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.cpp llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.h llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=82311&r1=82310&r2=82311&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Sat Sep 19 04:51:03 2009 @@ -954,14 +954,15 @@ "This is not a machine PHI node that we are updating!"); // "default" BB. We can go there only from header BB. if (PHIBB == SDL->JTCases[i].second.Default) { - PHI->addOperand(MachineOperand::CreateReg(SDL->PHINodesToUpdate[pi].second, - false)); - PHI->addOperand(MachineOperand::CreateMBB(SDL->JTCases[i].first.HeaderBB)); + PHI->addOperand + (MachineOperand::CreateReg(SDL->PHINodesToUpdate[pi].second, false)); + PHI->addOperand + (MachineOperand::CreateMBB(SDL->JTCases[i].first.HeaderBB)); } // JT BB. Just iterate over successors here if (BB->succ_end() != std::find(BB->succ_begin(),BB->succ_end(), PHIBB)) { - PHI->addOperand(MachineOperand::CreateReg(SDL->PHINodesToUpdate[pi].second, - false)); + PHI->addOperand + (MachineOperand::CreateReg(SDL->PHINodesToUpdate[pi].second, false)); PHI->addOperand(MachineOperand::CreateMBB(BB)); } } @@ -999,7 +1000,8 @@ // handle them the right number of times. while ((BB = SDL->SwitchCases[i].TrueBB)) { // Handle LHS and RHS. // If new BB's are created during scheduling, the edges may have been - // updated. + // updated. That is, the edge from ThisBB to BB may have been split and + // BB's predecessor is now another block. DenseMap::iterator EI = SDL->EdgeMapping.find(BB); if (EI != SDL->EdgeMapping.end()) Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=82311&r1=82310&r2=82311&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Sat Sep 19 04:51:03 2009 @@ -2920,12 +2920,15 @@ F->insert(It, sinkMBB); // Update machine-CFG edges by first adding all successors of the current // block to the new block which will contain the Phi node for the select. - for(MachineBasicBlock::succ_iterator i = BB->succ_begin(), - e = BB->succ_end(); i != e; ++i) - sinkMBB->addSuccessor(*i); + // Also inform sdisel of the edge changes. + for (MachineBasicBlock::succ_iterator I = BB->succ_begin(), + E = BB->succ_end(); I != E; ++I) { + EM->insert(std::make_pair(*I, sinkMBB)); + sinkMBB->addSuccessor(*I); + } // Next, remove all successors of the current block, and add the true // and fallthrough blocks as its successors. - while(!BB->succ_empty()) + while (!BB->succ_empty()) BB->removeSuccessor(BB->succ_begin()); BB->addSuccessor(copy0MBB); BB->addSuccessor(sinkMBB); Modified: llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp?rev=82311&r1=82310&r2=82311&view=diff ============================================================================== --- llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp (original) +++ llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp Sat Sep 19 04:51:03 2009 @@ -855,6 +855,11 @@ MachineBasicBlock *llscMBB = F->CreateMachineBasicBlock(LLVM_BB); MachineBasicBlock *sinkMBB = F->CreateMachineBasicBlock(LLVM_BB); + // Inform sdisel of the edge changes. + for (MachineBasicBlock::succ_iterator I = BB->succ_begin(), + E = BB->succ_end(); I != E; ++I) + EM->insert(std::make_pair(*I, sinkMBB)); + sinkMBB->transferSuccessors(thisMBB); F->insert(It, llscMBB); Modified: llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.cpp?rev=82311&r1=82310&r2=82311&view=diff ============================================================================== --- llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.cpp Sat Sep 19 04:51:03 2009 @@ -712,6 +712,10 @@ .addImm(MI->getOperand(3).getImm()); F->insert(I, copy0MBB); F->insert(I, copy1MBB); + // Inform sdisel of the edge changes. + for (MachineBasicBlock::succ_iterator SI = BB->succ_begin(), + SE = BB->succ_end(); SI != SE; ++SI) + EM->insert(std::make_pair(*SI, copy1MBB)); // Update machine-CFG edges by transferring all successors of the current // block to the new block which will contain the Phi node for the select. copy1MBB->transferSuccessors(BB); Modified: llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp?rev=82311&r1=82310&r2=82311&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp (original) +++ llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp Sat Sep 19 04:51:03 2009 @@ -308,9 +308,12 @@ F->insert(It, sinkMBB); // Update machine-CFG edges by first adding all successors of the current // block to the new block which will contain the Phi node for the select. + // Also inform sdisel of the edge changes. for(MachineBasicBlock::succ_iterator i = BB->succ_begin(), - e = BB->succ_end(); i != e; ++i) + e = BB->succ_end(); i != e; ++i) { + EM->insert(std::make_pair(*i, sinkMBB)); sinkMBB->addSuccessor(*i); + } // Next, remove all successors of the current block, and add the true // and fallthrough blocks as its successors. while(!BB->succ_empty()) Modified: llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp?rev=82311&r1=82310&r2=82311&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp Sat Sep 19 04:51:03 2009 @@ -1840,9 +1840,18 @@ F->insert(It, copy0MBB); F->insert(It, sinkMBB); - // Update machine-CFG edges by transferring all successors of the current + // Update machine-CFG edges by first adding all successors of the current // block to the new block which will contain the Phi node for the select. - sinkMBB->transferSuccessors(BB); + // Also inform sdisel of the edge changes. + for (MachineBasicBlock::succ_iterator I = BB->succ_begin(), + E = BB->succ_end(); I != E; ++I) { + EM->insert(std::make_pair(*I, sinkMBB)); + sinkMBB->addSuccessor(*I); + } + // Next, remove all successors of the current block, and add the true + // and fallthrough blocks as its successors. + while (!BB->succ_empty()) + BB->removeSuccessor(BB->succ_begin()); // Next, add the true and fallthrough blocks as its successors. BB->addSuccessor(copy0MBB); BB->addSuccessor(sinkMBB); Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp?rev=82311&r1=82310&r2=82311&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Sat Sep 19 04:51:03 2009 @@ -4525,9 +4525,18 @@ .addImm(SelectPred).addReg(MI->getOperand(1).getReg()).addMBB(sinkMBB); F->insert(It, copy0MBB); F->insert(It, sinkMBB); - // Update machine-CFG edges by transferring all successors of the current + // Update machine-CFG edges by first adding all successors of the current // block to the new block which will contain the Phi node for the select. - sinkMBB->transferSuccessors(BB); + // Also inform sdisel of the edge changes. + for (MachineBasicBlock::succ_iterator I = BB->succ_begin(), + E = BB->succ_end(); I != E; ++I) { + EM->insert(std::make_pair(*I, sinkMBB)); + sinkMBB->addSuccessor(*I); + } + // Next, remove all successors of the current block, and add the true + // and fallthrough blocks as its successors. + while (!BB->succ_empty()) + BB->removeSuccessor(BB->succ_begin()); // Next, add the true and fallthrough blocks as its successors. BB->addSuccessor(copy0MBB); BB->addSuccessor(sinkMBB); Modified: llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp?rev=82311&r1=82310&r2=82311&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp (original) +++ llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp Sat Sep 19 04:51:03 2009 @@ -990,9 +990,18 @@ BuildMI(BB, dl, TII.get(BROpcode)).addMBB(sinkMBB).addImm(CC); F->insert(It, copy0MBB); F->insert(It, sinkMBB); - // Update machine-CFG edges by transferring all successors of the current + // Update machine-CFG edges by first adding all successors of the current // block to the new block which will contain the Phi node for the select. - sinkMBB->transferSuccessors(BB); + // Also inform sdisel of the edge changes. + for (MachineBasicBlock::succ_iterator I = BB->succ_begin(), + E = BB->succ_end(); I != E; ++I) { + EM->insert(std::make_pair(*I, sinkMBB)); + sinkMBB->addSuccessor(*I); + } + // Next, remove all successors of the current block, and add the true + // and fallthrough blocks as its successors. + while (!BB->succ_empty()) + BB->removeSuccessor(BB->succ_begin()); // Next, add the true and fallthrough blocks as its successors. BB->addSuccessor(copy0MBB); BB->addSuccessor(sinkMBB); Modified: llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.cpp?rev=82311&r1=82310&r2=82311&view=diff ============================================================================== --- llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.cpp (original) +++ llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.cpp Sat Sep 19 04:51:03 2009 @@ -810,6 +810,10 @@ BuildMI(BB, dl, TII.getBrCond(CC)).addMBB(copy1MBB); F->insert(I, copy0MBB); F->insert(I, copy1MBB); + // Inform sdisel of the edge changes. + for (MachineBasicBlock::succ_iterator SI = BB->succ_begin(), + SE = BB->succ_end(); SI != SE; ++SI) + EM->insert(std::make_pair(*SI, copy1MBB)); // Update machine-CFG edges by transferring all successors of the current // block to the new block which will contain the Phi node for the select. copy1MBB->transferSuccessors(BB); Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=82311&r1=82310&r2=82311&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Sat Sep 19 04:51:03 2009 @@ -7675,16 +7675,10 @@ const TargetInstrInfo *TII = getTargetMachine().getInstrInfo(); unsigned Opc; - - if (memArg) { - Opc = numArgs == 3 ? - X86::PCMPISTRM128rm : - X86::PCMPESTRM128rm; - } else { - Opc = numArgs == 3 ? - X86::PCMPISTRM128rr : - X86::PCMPESTRM128rr; - } + if (memArg) + Opc = numArgs == 3 ? X86::PCMPISTRM128rm : X86::PCMPESTRM128rm; + else + Opc = numArgs == 3 ? X86::PCMPISTRM128rr : X86::PCMPESTRM128rr; MachineInstrBuilder MIB = BuildMI(BB, dl, TII->get(Opc)); @@ -7773,7 +7767,8 @@ MachineBasicBlock * X86TargetLowering::EmitLoweredSelect(MachineInstr *MI, - MachineBasicBlock *BB) const { + MachineBasicBlock *BB, + DenseMap *EM) const { const TargetInstrInfo *TII = getTargetMachine().getInstrInfo(); DebugLoc DL = MI->getDebugLoc(); @@ -7800,10 +7795,18 @@ BuildMI(BB, DL, TII->get(Opc)).addMBB(sinkMBB); F->insert(It, copy0MBB); F->insert(It, sinkMBB); - // Update machine-CFG edges by transferring all successors of the current + // Update machine-CFG edges by first adding all successors of the current // block to the new block which will contain the Phi node for the select. - sinkMBB->transferSuccessors(BB); - + // Also inform sdisel of the edge changes. + for (MachineBasicBlock::succ_iterator I = BB->succ_begin(), + E = BB->succ_end(); I != E; ++I) { + EM->insert(std::make_pair(*I, sinkMBB)); + sinkMBB->addSuccessor(*I); + } + // Next, remove all successors of the current block, and add the true + // and fallthrough blocks as its successors. + while (!BB->succ_empty()) + BB->removeSuccessor(BB->succ_begin()); // Add the true and fallthrough blocks as its successors. BB->addSuccessor(copy0MBB); BB->addSuccessor(sinkMBB); @@ -7842,7 +7845,7 @@ case X86::CMOV_V4F32: case X86::CMOV_V2F64: case X86::CMOV_V2I64: - return EmitLoweredSelect(MI, BB); + return EmitLoweredSelect(MI, BB, EM); case X86::FP32_TO_INT16_IN_MEM: case X86::FP32_TO_INT32_IN_MEM: Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.h?rev=82311&r1=82310&r2=82311&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.h (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.h Sat Sep 19 04:51:03 2009 @@ -740,7 +740,8 @@ MachineBasicBlock *BB) const; MachineBasicBlock *EmitLoweredSelect(MachineInstr *I, - MachineBasicBlock *BB) const; + MachineBasicBlock *BB, + DenseMap *EM) const; /// Emit nodes that will be selected as "test Op0,Op0", or something /// equivalent, for use with the given x86 condition code. Modified: llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp?rev=82311&r1=82310&r2=82311&view=diff ============================================================================== --- llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp (original) +++ llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp Sat Sep 19 04:51:03 2009 @@ -1010,9 +1010,18 @@ .addReg(MI->getOperand(1).getReg()).addMBB(sinkMBB); F->insert(It, copy0MBB); F->insert(It, sinkMBB); - // Update machine-CFG edges by transferring all successors of the current + // Update machine-CFG edges by first adding all successors of the current // block to the new block which will contain the Phi node for the select. - sinkMBB->transferSuccessors(BB); + // Also inform sdisel of the edge changes. + for (MachineBasicBlock::succ_iterator I = BB->succ_begin(), + E = BB->succ_end(); I != E; ++I) { + EM->insert(std::make_pair(*I, sinkMBB)); + sinkMBB->addSuccessor(*I); + } + // Next, remove all successors of the current block, and add the true + // and fallthrough blocks as its successors. + while (!BB->succ_empty()) + BB->removeSuccessor(BB->succ_begin()); // Next, add the true and fallthrough blocks as its successors. BB->addSuccessor(copy0MBB); BB->addSuccessor(sinkMBB); Added: llvm/trunk/test/CodeGen/X86/2009-09-19-SchedCustomLoweringBug.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2009-09-19-SchedCustomLoweringBug.ll?rev=82311&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/2009-09-19-SchedCustomLoweringBug.ll (added) +++ llvm/trunk/test/CodeGen/X86/2009-09-19-SchedCustomLoweringBug.ll Sat Sep 19 04:51:03 2009 @@ -0,0 +1,30 @@ +; RUN: llc < %s -mtriple=i386-apple-darwin10 | FileCheck %s + +; PR4958 + +define i32 @main() nounwind ssp { +entry: +; CHECK: main: + %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] + br label %bb + +bb: ; preds = %bb1, %entry +; CHECK: movl %e +; CHECK-NEXT: addl $1 +; CHECK-NEXT: movl %e +; CHECK-NEXT: adcl $0 + %i.0 = phi i64 [ 0, %entry ], [ %0, %bb1 ] ; [#uses=1] + %0 = add nsw i64 %i.0, 1 ; [#uses=2] + %1 = icmp sgt i32 0, 0 ; [#uses=1] + br i1 %1, label %bb2, label %bb1 + +bb1: ; preds = %bb + %2 = icmp sle i64 %0, 1 ; [#uses=1] + br i1 %2, label %bb, label %bb2 + +bb2: ; preds = %bb1, %bb + br label %return + +return: ; preds = %bb2 + ret i32 0 +} From benny.kra at googlemail.com Sat Sep 19 05:01:45 2009 From: benny.kra at googlemail.com (Benjamin Kramer) Date: Sat, 19 Sep 2009 10:01:45 -0000 Subject: [llvm-commits] [llvm] r82312 - /llvm/trunk/lib/Support/CommandLine.cpp Message-ID: <200909191001.n8JA1jo2009237@zion.cs.uiuc.edu> Author: d0k Date: Sat Sep 19 05:01:45 2009 New Revision: 82312 URL: http://llvm.org/viewvc/llvm-project?rev=82312&view=rev Log: Try to speed up the slowest parts of the CommandLine library - Replace std::map #include #include #include @@ -105,7 +105,7 @@ /// structures that are easier to handle. static void GetOptionInfo(std::vector &PositionalOpts, std::vector &SinkOpts, - std::map &OptionsMap) { + StringMap &OptionsMap) { std::vector OptionNames; Option *CAOpt = 0; // The ConsumeAfter option if it exists. for (Option *O = RegisteredOptionList; O; O = O->getNextRegisteredOption()) { @@ -118,8 +118,7 @@ // Handle named options. for (size_t i = 0, e = OptionNames.size(); i != e; ++i) { // Add argument to the argument map! - if (!OptionsMap.insert(std::pair(OptionNames[i], - O)).second) { + if (OptionsMap.GetOrCreateValue(OptionNames[i], O).second != O) { errs() << ProgramName << ": CommandLine Error: Argument '" << OptionNames[i] << "' defined more than once!\n"; } @@ -151,7 +150,7 @@ /// command line. If there is a value specified (after an equal sign) return /// that as well. static Option *LookupOption(const char *&Arg, const char *&Value, - std::map &OptionsMap) { + StringMap &OptionsMap) { while (*Arg == '-') ++Arg; // Eat leading dashes const char *ArgEnd = Arg; @@ -165,8 +164,8 @@ if (*Arg == 0) return 0; // Look up the option. - std::map::iterator I = - OptionsMap.find(std::string(Arg, ArgEnd)); + StringMap::iterator I = + OptionsMap.find(llvm::StringRef(Arg, ArgEnd-Arg)); return I != OptionsMap.end() ? I->second : 0; } @@ -259,9 +258,9 @@ // static Option *getOptionPred(std::string Name, size_t &Length, bool (*Pred)(const Option*), - std::map &OptionsMap) { + StringMap &OptionsMap) { - std::map::iterator OMI = OptionsMap.find(Name); + StringMap::iterator OMI = OptionsMap.find(Name); if (OMI != OptionsMap.end() && Pred(OMI->second)) { Length = Name.length(); return OMI->second; @@ -417,7 +416,7 @@ // Process all registered options. std::vector PositionalOpts; std::vector SinkOpts; - std::map Opts; + StringMap Opts; GetOptionInfo(PositionalOpts, SinkOpts, Opts); assert((!Opts.empty() || !PositionalOpts.empty()) && @@ -727,7 +726,7 @@ } // Loop over args and make sure all required args are specified! - for (std::map::iterator I = Opts.begin(), + for (StringMap::iterator I = Opts.begin(), E = Opts.end(); I != E; ++I) { switch (I->second->getNumOccurrencesFlag()) { case Required: @@ -951,14 +950,12 @@ // argument string. If the option is not found, getNumOptions() is returned. // unsigned generic_parser_base::findOption(const char *Name) { - unsigned i = 0, e = getNumOptions(); - std::string N(Name); + unsigned e = getNumOptions(); - while (i != e) - if (getOption(i) == N) + for (unsigned i = 0; i != e; ++i) { + if (strcmp(getOption(i), Name) == 0) return i; - else - ++i; + } return e; } @@ -1017,11 +1014,11 @@ const bool ShowHidden; // isHidden/isReallyHidden - Predicates to be used to filter down arg lists. - inline static bool isHidden(std::pair &OptPair) { - return OptPair.second->getOptionHiddenFlag() >= Hidden; + inline static bool isHidden(Option *Opt) { + return Opt->getOptionHiddenFlag() >= Hidden; } - inline static bool isReallyHidden(std::pair &OptPair) { - return OptPair.second->getOptionHiddenFlag() == ReallyHidden; + inline static bool isReallyHidden(Option *Opt) { + return Opt->getOptionHiddenFlag() == ReallyHidden; } public: @@ -1035,12 +1032,15 @@ // Get all the options. std::vector PositionalOpts; std::vector SinkOpts; - std::map OptMap; + StringMap OptMap; GetOptionInfo(PositionalOpts, SinkOpts, OptMap); // Copy Options into a vector so we can sort them as we like... - std::vector > Opts; - copy(OptMap.begin(), OptMap.end(), std::back_inserter(Opts)); + std::vector Opts; + for (StringMap::iterator I = OptMap.begin(), E = OptMap.end(); + I != E; ++I) { + Opts.push_back(I->second); + } // Eliminate Hidden or ReallyHidden arguments, depending on ShowHidden Opts.erase(std::remove_if(Opts.begin(), Opts.end(), @@ -1051,8 +1051,8 @@ { // Give OptionSet a scope std::set OptionSet; for (unsigned i = 0; i != Opts.size(); ++i) - if (OptionSet.count(Opts[i].second) == 0) - OptionSet.insert(Opts[i].second); // Add new entry to set + if (OptionSet.count(Opts[i]) == 0) + OptionSet.insert(Opts[i]); // Add new entry to set else Opts.erase(Opts.begin()+i--); // Erase duplicate } @@ -1082,11 +1082,11 @@ // Compute the maximum argument length... MaxArgLen = 0; for (size_t i = 0, e = Opts.size(); i != e; ++i) - MaxArgLen = std::max(MaxArgLen, Opts[i].second->getOptionWidth()); + MaxArgLen = std::max(MaxArgLen, Opts[i]->getOptionWidth()); outs() << "OPTIONS:\n"; for (size_t i = 0, e = Opts.size(); i != e; ++i) - Opts[i].second->printOptionInfo(MaxArgLen); + Opts[i]->printOptionInfo(MaxArgLen); // Print any extra help the user has declared. for (std::vector::iterator I = MoreHelp->begin(), From evan.cheng at apple.com Sat Sep 19 05:08:52 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Sat, 19 Sep 2009 10:08:52 -0000 Subject: [llvm-commits] [llvm] r82313 - /llvm/trunk/include/llvm/Target/TargetLowering.h Message-ID: <200909191008.n8JA8qxL010128@zion.cs.uiuc.edu> Author: evancheng Date: Sat Sep 19 05:08:51 2009 New Revision: 82313 URL: http://llvm.org/viewvc/llvm-project?rev=82313&view=rev Log: Update comments. Modified: llvm/trunk/include/llvm/Target/TargetLowering.h Modified: llvm/trunk/include/llvm/Target/TargetLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLowering.h?rev=82313&r1=82312&r2=82313&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetLowering.h (original) +++ llvm/trunk/include/llvm/Target/TargetLowering.h Sat Sep 19 05:08:51 2009 @@ -1440,6 +1440,9 @@ // instructions are special in various ways, which require special support to // insert. The specified MachineInstr is created but not inserted into any // basic blocks, and the scheduler passes ownership of it to this method. + // When new basic blocks are inserted and the edges from MBB to its successors + // are modified, the method should insert pairs of into the + // DenseMap. virtual MachineBasicBlock *EmitInstrWithCustomInserter(MachineInstr *MI, MachineBasicBlock *MBB, DenseMap *EM) const; From evan.cheng at apple.com Sat Sep 19 05:09:16 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Sat, 19 Sep 2009 10:09:16 -0000 Subject: [llvm-commits] [llvm] r82314 - /llvm/trunk/lib/Target/X86/X86ISelLowering.h Message-ID: <200909191009.n8JA9GoB010190@zion.cs.uiuc.edu> Author: evancheng Date: Sat Sep 19 05:09:15 2009 New Revision: 82314 URL: http://llvm.org/viewvc/llvm-project?rev=82314&view=rev Log: Fix funky comments. Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.h Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.h?rev=82314&r1=82313&r2=82314&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.h (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.h Sat Sep 19 05:09:15 2009 @@ -696,15 +696,15 @@ /// Utility function to emit string processing sse4.2 instructions /// that return in xmm0. - // This takes the instruction to expand, the associated machine basic - // block, the number of args, and whether or not the second arg is - // in memory or not. + /// This takes the instruction to expand, the associated machine basic + /// block, the number of args, and whether or not the second arg is + /// in memory or not. MachineBasicBlock *EmitPCMP(MachineInstr *BInstr, MachineBasicBlock *BB, unsigned argNum, bool inMem) const; /// Utility function to emit atomic bitwise operations (and, or, xor). - // It takes the bitwise instruction to expand, the associated machine basic - // block, and the associated X86 opcodes for reg/reg and reg/imm. + /// It takes the bitwise instruction to expand, the associated machine basic + /// block, and the associated X86 opcodes for reg/reg and reg/imm. MachineBasicBlock *EmitAtomicBitwiseWithCustomInserter( MachineInstr *BInstr, MachineBasicBlock *BB, From baldrick at free.fr Sat Sep 19 06:25:44 2009 From: baldrick at free.fr (Duncan Sands) Date: Sat, 19 Sep 2009 11:25:44 -0000 Subject: [llvm-commits] [llvm] r82315 - /llvm/trunk/lib/Analysis/CFGPrinter.cpp Message-ID: <200909191125.n8JBPil8019735@zion.cs.uiuc.edu> Author: baldrick Date: Sat Sep 19 06:25:44 2009 New Revision: 82315 URL: http://llvm.org/viewvc/llvm-project?rev=82315&view=rev Log: The flag "--dot-cfg-only" is at the moment equivalent to the flag "--dot-cfg". It prints the content of all bbs, instead of printing empty bbs to make the CFG more readable. Fix this. Patch by Tobias Grosser. Modified: llvm/trunk/lib/Analysis/CFGPrinter.cpp Modified: llvm/trunk/lib/Analysis/CFGPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/CFGPrinter.cpp?rev=82315&r1=82314&r2=82315&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/CFGPrinter.cpp (original) +++ llvm/trunk/lib/Analysis/CFGPrinter.cpp Sat Sep 19 06:25:44 2009 @@ -110,7 +110,7 @@ CFGOnlyViewer() : FunctionPass(&ID) {} virtual bool runOnFunction(Function &F) { - F.viewCFG(); + F.viewCFGOnly(); return false; } From baldrick at free.fr Sat Sep 19 06:26:26 2009 From: baldrick at free.fr (Duncan Sands) Date: Sat, 19 Sep 2009 13:26:26 +0200 Subject: [llvm-commits] [Patch] Fix --dot-cfg-only In-Reply-To: <1253297741.5199.7.camel@tobilaptop> References: <1253297741.5199.7.camel@tobilaptop> Message-ID: <4AB4BFE2.2010101@free.fr> Hi Tobi, > The flag "--dot-cfg-only" is at the moment equivalent to the flag > "--dot-cfg". It prints the content of all bbs, instead of printing empty > bbs to make the CFG more readable. > > The attached patch fixes this behavior. thanks for the patch. I've applied it in commit 82315. Ciao, Duncan. From baldrick at free.fr Sat Sep 19 11:56:27 2009 From: baldrick at free.fr (Duncan Sands) Date: Sat, 19 Sep 2009 16:56:27 -0000 Subject: [llvm-commits] [gcc-plugin] r82316 - in /gcc-plugin/trunk: gcc-patches/gimple_to_tree.diff i386/llvm-target.cpp i386/llvm-target.h llvm-convert.cpp llvm-internal.h Message-ID: <200909191656.n8JGuRDZ029613@zion.cs.uiuc.edu> Author: baldrick Date: Sat Sep 19 11:56:26 2009 New Revision: 82316 URL: http://llvm.org/viewvc/llvm-project?rev=82316&view=rev Log: Handle GIMPLE_CALL directly, rather than going via trees. With this change, the plugin no longer uses gimple_to_tree and release_stmt_tree, which is a good thing because they were recently removed from GCC! Now that GIMPLE_CALL is no longer being turned into MODIFY_EXPR + CALL_EXPR, get rid of all code handling MODIFY_EXPR - it is dead. I had to rewrite (untested) the code for BUILT_IN_LOCK_RELEASE since it was generating a MODIFY_EXPR. Also, I had to remove the call to fold_builtin_next_arg from EmitBuiltinVAStart, because it doesn't take gimple. However this should be harmless because the gimplifier performs this check. Removed: gcc-plugin/trunk/gcc-patches/gimple_to_tree.diff Modified: gcc-plugin/trunk/i386/llvm-target.cpp gcc-plugin/trunk/i386/llvm-target.h gcc-plugin/trunk/llvm-convert.cpp gcc-plugin/trunk/llvm-internal.h Removed: gcc-plugin/trunk/gcc-patches/gimple_to_tree.diff URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/gcc-patches/gimple_to_tree.diff?rev=82315&view=auto ============================================================================== --- gcc-plugin/trunk/gcc-patches/gimple_to_tree.diff (original) +++ gcc-plugin/trunk/gcc-patches/gimple_to_tree.diff (removed) @@ -1,22 +0,0 @@ -Index: lto/gcc/cfgexpand.c -=================================================================== ---- lto.orig/gcc/cfgexpand.c 2009-08-31 10:39:47.371256259 +0200 -+++ lto/gcc/cfgexpand.c 2009-08-31 10:49:52.283196375 +0200 -@@ -124,7 +124,7 @@ - GIMPLE tuple STMT and returns the same statement in the form of a - tree. */ - --static tree -+tree - gimple_to_tree (gimple stmt) - { - tree t; -@@ -363,7 +363,7 @@ - - /* Release back to GC memory allocated by gimple_to_tree. */ - --static void -+void - release_stmt_tree (gimple stmt, tree stmt_tree) - { - tree_ann_common_t ann; Modified: gcc-plugin/trunk/i386/llvm-target.cpp URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/i386/llvm-target.cpp?rev=82316&r1=82315&r2=82316&view=diff ============================================================================== --- gcc-plugin/trunk/i386/llvm-target.cpp (original) +++ gcc-plugin/trunk/i386/llvm-target.cpp Sat Sep 19 11:56:26 2009 @@ -43,6 +43,7 @@ #include "target.h" #include "toplev.h" #include "tree.h" +#include "gimple.h" } // Plugin headers @@ -56,7 +57,7 @@ * code, emit the code now. If we can handle the code, this macro should emit * the code, return true. */ -bool TreeToLLVM::TargetIntrinsicLower(tree exp, +bool TreeToLLVM::TargetIntrinsicLower(gimple stmt, unsigned FnCode, const MemRef *DestLoc, Value *&Result, @@ -161,7 +162,7 @@ ((EV & 0x03) >> 0), ((EV & 0x0c) >> 2), ((EV & 0x30) >> 4)+4, ((EV & 0xc0) >> 6)+4); } else { - error_at(EXPR_LOCATION(exp), "mask must be an immediate"); + error_at(gimple_location(stmt), "mask must be an immediate"); Result = Ops[0]; } return true; @@ -171,7 +172,7 @@ Result = BuildVectorShuffle(Ops[0], Ops[1], ((EV & 0x01) >> 0), ((EV & 0x02) >> 1)+2); } else { - error_at(EXPR_LOCATION(exp), "mask must be an immediate"); + error_at(gimple_location(stmt), "mask must be an immediate"); Result = Ops[0]; } return true; @@ -183,7 +184,7 @@ ((EV & 0x03) >> 0), ((EV & 0x0c) >> 2), ((EV & 0x30) >> 4), ((EV & 0xc0) >> 6)); } else { - error_at(EXPR_LOCATION(exp), "mask must be an immediate"); + error_at(gimple_location(stmt), "mask must be an immediate"); Result = Ops[0]; } return true; @@ -205,7 +206,7 @@ ((EV & 0x30) >> 4), ((EV & 0xc0) >> 6), 4, 5, 6, 7); } else { - error_at(EXPR_LOCATION(exp), "mask must be an immediate"); + error_at(gimple_location(stmt), "mask must be an immediate"); Result = Ops[0]; } Modified: gcc-plugin/trunk/i386/llvm-target.h URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/i386/llvm-target.h?rev=82316&r1=82315&r2=82316&view=diff ============================================================================== --- gcc-plugin/trunk/i386/llvm-target.h (original) +++ gcc-plugin/trunk/i386/llvm-target.h Sat Sep 19 11:56:26 2009 @@ -885,9 +885,9 @@ * macro should call the target TreeToLLVM::TargetIntrinsicLower method and * return true.This macro is invoked from a method in the TreeToLLVM class. */ -#define LLVM_TARGET_INTRINSIC_LOWER(EXP, BUILTIN_CODE, DESTLOC, RESULT, \ +#define LLVM_TARGET_INTRINSIC_LOWER(STMT, BUILTIN_CODE, DESTLOC, RESULT, \ DESTTY, OPS) \ - TargetIntrinsicLower(EXP, BUILTIN_CODE, DESTLOC, RESULT, DESTTY, OPS); + TargetIntrinsicLower(STMT, BUILTIN_CODE, DESTLOC, RESULT, DESTTY, OPS); /* When extracting a register name for a constraint, use the string extracted from the magic symbol built for that register, rather than reg_names. Modified: gcc-plugin/trunk/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-convert.cpp?rev=82316&r1=82315&r2=82316&view=diff ============================================================================== --- gcc-plugin/trunk/llvm-convert.cpp (original) +++ gcc-plugin/trunk/llvm-convert.cpp Sat Sep 19 11:56:26 2009 @@ -805,7 +805,7 @@ RetVal = Builder.CreateBitCast(RetVal, PointerType::getUnqual(Type::getInt8Ty(Context))); RetVal = Builder.CreateGEP(RetVal, - ConstantInt::get(TD.getIntPtrType(Context), ReturnOffset)); + ConstantInt::get(TD.getIntPtrType(Context), ReturnOffset)); } RetVal = Builder.CreateBitCast(RetVal, PointerType::getUnqual(Fn->getReturnType())); @@ -909,9 +909,6 @@ return BB; } -extern "C" tree gimple_to_tree(gimple); -extern "C" void release_stmt_tree (gimple, tree); - void TreeToLLVM::EmitBasicBlock(basic_block bb) { // Avoid outputting a pointless branch at the end of the entry block. if (bb != ENTRY_BLOCK_PTR) @@ -934,7 +931,8 @@ // The phi defines the associated ssa name. tree name = gimple_phi_result(gcc_phi); assert(TREE_CODE(name) == SSA_NAME && "PHI result not an SSA name!"); - assert(SSANames.find(name) == SSANames.end() && "Multiply defined SSA name!"); + assert(SSANames.find(name) == SSANames.end() && + "Multiply defined SSA name!"); SSANames[name] = PHI; // The phi operands will be populated later - remember the phi node. @@ -948,24 +946,6 @@ gimple gimple_stmt = gsi_stmt(gsi); switch (gimple_code(gimple_stmt)) { - case GIMPLE_CALL: { - // TODO Handle gimple directly, rather than converting to a tree. - tree stmt = gimple_to_tree(gimple_stmt); - - // If this stmt returns an aggregate value (e.g. a call whose result is - // ignored), create a temporary to receive the value. Note that we don't - // do this for MODIFY_EXPRs as an efficiency hack. - MemRef DestLoc; - if (isAggregateTreeType(TREE_TYPE(stmt)) && - TREE_CODE(stmt)!= MODIFY_EXPR && TREE_CODE(stmt)!=INIT_EXPR) - DestLoc = CreateTempLoc(ConvertType(TREE_TYPE(stmt))); - - Emit(stmt, DestLoc.Ptr ? &DestLoc : NULL); - - release_stmt_tree(gimple_stmt, stmt); - break; - } - case GIMPLE_ASM: RenderGIMPLE_ASM(gimple_stmt); break; @@ -974,6 +954,10 @@ RenderGIMPLE_ASSIGN(gimple_stmt); break; + case GIMPLE_CALL: + RenderGIMPLE_CALL(gimple_stmt); + break; + case GIMPLE_COND: RenderGIMPLE_COND(gimple_stmt); break; @@ -1041,8 +1025,7 @@ } Value *TreeToLLVM::Emit(tree exp, const MemRef *DestLoc) { - assert((isAggregateTreeType(TREE_TYPE(exp)) == (DestLoc != 0) || - TREE_CODE(exp) == MODIFY_EXPR || TREE_CODE(exp) == INIT_EXPR) && + assert((isAggregateTreeType(TREE_TYPE(exp)) == (DestLoc != 0)) && "Didn't pass DestLoc to an aggregate expr, or passed it to scalar!"); Value *Result = 0; @@ -1083,9 +1066,6 @@ case SSA_NAME: Result = EmitSSA_NAME(exp); break; case OBJ_TYPE_REF: Result = EmitOBJ_TYPE_REF(exp); break; case ADDR_EXPR: Result = EmitADDR_EXPR(exp); break; - case CALL_EXPR: Result = EmitCALL_EXPR(exp, DestLoc); break; - case INIT_EXPR: - case MODIFY_EXPR: Result = EmitMODIFY_EXPR(exp, DestLoc); break; // Unary Operators case VIEW_CONVERT_EXPR: Result = EmitVIEW_CONVERT_EXPR(exp, DestLoc); break; @@ -1812,7 +1792,7 @@ const Type *IntTy = ConvertType(integer_type_node); - ExceptionValue = CreateTemporary(PointerType::getUnqual(Type::getInt8Ty(Context))); + ExceptionValue = CreateTemporary(Type::getInt8Ty(Context)->getPointerTo()); ExceptionValue->setName("eh_exception"); ExceptionSelectorValue = CreateTemporary(IntTy); @@ -2407,18 +2387,18 @@ ConvertType(TREE_TYPE(exp))); } -Value *TreeToLLVM::EmitCALL_EXPR(tree exp, const MemRef *DestLoc) { +Value *TreeToLLVM::EmitGimpleCallRHS(gimple stmt, const MemRef *DestLoc) { // Check for a built-in function call. If we can lower it directly, do so // now. - tree fndecl = get_callee_fndecl(exp); + tree fndecl = gimple_call_fndecl(stmt); if (fndecl && DECL_BUILT_IN(fndecl) && DECL_BUILT_IN_CLASS(fndecl) != BUILT_IN_FRONTEND) { Value *Res = 0; - if (EmitBuiltinCall(exp, fndecl, DestLoc, Res)) + if (EmitBuiltinCall(stmt, fndecl, DestLoc, Res)) return Res; } - tree call_expr = CALL_EXPR_FN(exp); + tree call_expr = gimple_call_fn(stmt); assert(TREE_TYPE (call_expr) && (TREE_CODE(TREE_TYPE (call_expr)) == POINTER_TYPE || TREE_CODE(TREE_TYPE (call_expr)) == REFERENCE_TYPE) @@ -2432,7 +2412,7 @@ const Type *Ty = TheTypeConverter->ConvertFunctionType(function_type, fndecl, - CALL_EXPR_STATIC_CHAIN(exp), + gimple_call_chain(stmt), CallingConv, PAL); // If this is a direct call to a function using a static chain then we need @@ -2440,13 +2420,12 @@ // parameter for the chain. Callee = Builder.CreateBitCast(Callee, PointerType::getUnqual(Ty)); - // EmitCall(exp, DestLoc); - Value *Result = EmitCallOf(Callee, exp, DestLoc, PAL); + Value *Result = EmitCallOf(Callee, stmt, DestLoc, PAL); // When calling a "noreturn" function output an unreachable instruction right // after the function to prevent LLVM from thinking that control flow will // fall into the subsequent block. - if (call_expr_flags(exp) & ECF_NORETURN) { + if (gimple_call_flags(stmt) & ECF_NORETURN) { Builder.CreateUnreachable(); EmitBlock(BasicBlock::Create(Context)); } @@ -2713,9 +2692,9 @@ } /// EmitCallOf - Emit a call to the specified callee with the operands specified -/// in the CALL_EXP 'exp'. If the result of the call is a scalar, return the +/// in the GIMPLE_CALL 'stmt'. If the result of the call is a scalar, return the /// result, otherwise store it in DestLoc. -Value *TreeToLLVM::EmitCallOf(Value *Callee, tree exp, const MemRef *DestLoc, +Value *TreeToLLVM::EmitCallOf(Value *Callee, gimple stmt, const MemRef *DestLoc, const AttrListPtr &InPAL) { BasicBlock *LandingPad = 0; // Non-zero indicates an invoke. @@ -2724,14 +2703,14 @@ PAL = cast(Callee)->getAttributes(); // Work out whether to use an invoke or an ordinary call. - if (!tree_could_throw_p(exp)) + if (!stmt_could_throw_p(stmt)) // This call does not throw - mark it 'nounwind'. PAL = PAL.addAttr(~0, Attribute::NoUnwind); if (!PAL.paramHasAttr(~0, Attribute::NoUnwind)) { // This call may throw. Determine if we need to generate // an invoke rather than a simple call. - int RegionNo = lookup_expr_eh_region(exp); + int RegionNo = lookup_stmt_eh_region(stmt); // Is the call contained in an exception handling region? if (RegionNo > 0) { @@ -2753,9 +2732,9 @@ } } - tree fndecl = get_callee_fndecl(exp); + tree fndecl = gimple_call_fndecl(stmt); tree fntype = fndecl ? - TREE_TYPE(fndecl) : TREE_TYPE (TREE_TYPE(CALL_EXPR_FN(exp))); + TREE_TYPE(fndecl) : TREE_TYPE (TREE_TYPE(gimple_call_fn(stmt))); // Determine the calling convention. CallingConv::ID CallingConvention = CallingConv::C; @@ -2767,36 +2746,37 @@ const PointerType *PFTy = cast(Callee->getType()); const FunctionType *FTy = cast(PFTy->getElementType()); FunctionCallArgumentConversion Client(CallOperands, FTy, DestLoc, - CALL_EXPR_RETURN_SLOT_OPT(exp), + gimple_call_return_slot_opt_p(stmt), Builder, CallingConvention); TheLLVMABI ABIConverter(Client); // Handle the result, including struct returns. - ABIConverter.HandleReturnType(TREE_TYPE(exp), - fndecl ? fndecl : exp, + ABIConverter.HandleReturnType(gimple_call_return_type(stmt), + fndecl ? fndecl : gimple_call_return_type(stmt), fndecl ? DECL_BUILT_IN(fndecl) : false); // Pass the static chain, if any, as the first parameter. - if (CALL_EXPR_STATIC_CHAIN(exp)) - CallOperands.push_back(Emit(CALL_EXPR_STATIC_CHAIN(exp), 0)); + if (gimple_call_chain(stmt)) + CallOperands.push_back(Emit(gimple_call_chain(stmt), 0)); // Loop over the arguments, expanding them and adding them to the op list. std::vector ScalarArgs; - for (tree arg = CALL_EXPR_ARGS(exp); arg; arg = TREE_CHAIN(arg)) { - tree type = TREE_TYPE(TREE_VALUE(arg)); + for (unsigned i = 0, e = gimple_call_num_args(stmt); i != e; ++i) { + tree arg = gimple_call_arg(stmt, i); + tree type = TREE_TYPE(arg); const Type *ArgTy = ConvertType(type); // Push the argument. if (ArgTy->isSingleValueType()) { // A scalar - push the value. - Client.pushValue(Emit(TREE_VALUE(arg), 0)); + Client.pushValue(Emit(arg, 0)); } else if (LLVM_SHOULD_PASS_AGGREGATE_AS_FCA(type, ArgTy)) { // A first class aggregate - push the value. - LValue ArgVal = EmitLV(TREE_VALUE(arg)); + LValue ArgVal = EmitLV(arg); Client.pushValue(Builder.CreateLoad(ArgVal.Ptr)); } else { // An aggregate - push the address. - LValue ArgVal = EmitLV(TREE_VALUE(arg)); + LValue ArgVal = EmitLV(arg); assert(!ArgVal.isBitfield() && "Bitfields are first-class types!"); Client.pushAddress(ArgVal.Ptr); } @@ -2856,7 +2836,7 @@ } if (Client.isShadowReturn()) - return Client.EmitShadowResult(TREE_TYPE(exp), DestLoc); + return Client.EmitShadowResult(gimple_call_return_type(stmt), DestLoc); if (Call->getType() == Type::getVoidTy(Context)) return 0; @@ -2890,148 +2870,6 @@ return 0; } -/// EmitMODIFY_EXPR - Note that MODIFY_EXPRs are rvalues only! -/// We also handle INIT_EXPRs here; these are built by the C++ FE on rare -/// occasions, and have slightly different semantics that don't affect us here. -/// -Value *TreeToLLVM::EmitMODIFY_EXPR(tree exp, const MemRef *DestLoc) { - tree lhs = TREE_OPERAND (exp, 0); - tree rhs = TREE_OPERAND (exp, 1); - - bool LHSSigned = !TYPE_UNSIGNED(TREE_TYPE(lhs)); - bool RHSSigned = !TYPE_UNSIGNED(TREE_TYPE(rhs)); - - // If this is the definition of an ssa name, record it in the SSANames map. - if (TREE_CODE(lhs) == SSA_NAME) { - assert(SSANames.find(lhs) == SSANames.end() && "Multiply defined SSA name!"); - Value *Val = Builder.CreateBitCast(Emit(rhs, 0), - ConvertType(TREE_TYPE(exp))); - return SSANames[lhs] = Val; - } else if (canEmitRegisterVariable(lhs)) { - // If this is a store to a register variable, EmitLV can't handle the dest - // (there is no l-value of a register variable). Emit an inline asm node - // that copies the value into the specified register. - Value *RHS = Emit(rhs, 0); - RHS = CastToAnyType(RHS, RHSSigned, ConvertType(TREE_TYPE(lhs)), LHSSigned); - EmitModifyOfRegisterVariable(lhs, RHS); - return RHS; - } - - LValue LV = EmitLV(lhs); - bool isVolatile = TREE_THIS_VOLATILE(lhs); - unsigned Alignment = LV.getAlignment(); - if (TREE_CODE(lhs) == COMPONENT_REF) - if (const StructType *STy = - dyn_cast(ConvertType(TREE_TYPE(TREE_OPERAND(lhs, 0))))) - if (STy->isPacked()) - // Packed struct members use 1 byte alignment - Alignment = 1; - - if (!LV.isBitfield()) { - const Type *ValTy = ConvertType(TREE_TYPE(rhs)); - if (ValTy->isSingleValueType()) { - // Non-bitfield, scalar value. Just emit a store. - Value *RHS = Emit(rhs, 0); - // Convert RHS to the right type if we can, otherwise convert the pointer. - const PointerType *PT = cast(LV.Ptr->getType()); - if (PT->getElementType()->canLosslesslyBitCastTo(RHS->getType())) - RHS = CastToAnyType(RHS, RHSSigned, PT->getElementType(), LHSSigned); - else - LV.Ptr = Builder.CreateBitCast(LV.Ptr, - PointerType::getUnqual(RHS->getType())); - StoreInst *SI = Builder.CreateStore(RHS, LV.Ptr, isVolatile); - SI->setAlignment(Alignment); - return RHS; - } - - // Non-bitfield aggregate value. - MemRef NewLoc(LV.Ptr, Alignment, isVolatile); - Emit(rhs, &NewLoc); - - if (DestLoc) - EmitAggregateCopy(*DestLoc, NewLoc, TREE_TYPE(exp)); - - return 0; - } - - // Last case, this is a store to a bitfield, so we have to emit a - // read/modify/write sequence. - - Value *RHS = Emit(rhs, 0); - - if (!LV.BitSize) - return RHS; - - const Type *ValTy = cast(LV.Ptr->getType())->getElementType(); - unsigned ValSizeInBits = ValTy->getPrimitiveSizeInBits(); - - // The number of stores needed to write the entire bitfield. - unsigned Strides = 1 + (LV.BitStart + LV.BitSize - 1) / ValSizeInBits; - - assert(ValTy->isInteger() && "Invalid bitfield lvalue!"); - assert(ValSizeInBits > LV.BitStart && "Bad bitfield lvalue!"); - assert(ValSizeInBits >= LV.BitSize && "Bad bitfield lvalue!"); - assert(2*ValSizeInBits > LV.BitSize+LV.BitStart && "Bad bitfield lvalue!"); - - Value *BitSource = CastToAnyType(RHS, RHSSigned, ValTy, LHSSigned); - - for (unsigned I = 0; I < Strides; I++) { - unsigned Index = BYTES_BIG_ENDIAN ? Strides - I - 1 : I; // LSB first - unsigned ThisFirstBit = Index * ValSizeInBits; - unsigned ThisLastBitPlusOne = ThisFirstBit + ValSizeInBits; - if (ThisFirstBit < LV.BitStart) - ThisFirstBit = LV.BitStart; - if (ThisLastBitPlusOne > LV.BitStart+LV.BitSize) - ThisLastBitPlusOne = LV.BitStart+LV.BitSize; - - Value *Ptr = Index ? - Builder.CreateGEP(LV.Ptr, ConstantInt::get(Type::getInt32Ty(Context), Index)) : - LV.Ptr; - LoadInst *LI = Builder.CreateLoad(Ptr, isVolatile); - LI->setAlignment(Alignment); - Value *OldVal = LI; - Value *NewVal = BitSource; - - unsigned BitsInVal = ThisLastBitPlusOne - ThisFirstBit; - unsigned FirstBitInVal = ThisFirstBit % ValSizeInBits; - - if (BYTES_BIG_ENDIAN) - FirstBitInVal = ValSizeInBits-FirstBitInVal-BitsInVal; - - // If not storing into the zero'th bit, shift the Src value to the left. - if (FirstBitInVal) { - Value *ShAmt = ConstantInt::get(ValTy, FirstBitInVal); - NewVal = Builder.CreateShl(NewVal, ShAmt); - } - - // Next, if this doesn't touch the top bit, mask out any bits that shouldn't - // be set in the result. - uint64_t MaskVal = ((1ULL << BitsInVal)-1) << FirstBitInVal; - Constant *Mask = ConstantInt::get(Type::getInt64Ty(Context), MaskVal); - Mask = Builder.getFolder().CreateTruncOrBitCast(Mask, ValTy); - - if (FirstBitInVal+BitsInVal != ValSizeInBits) - NewVal = Builder.CreateAnd(NewVal, Mask); - - // Next, mask out the bits this bit-field should include from the old value. - Mask = Builder.getFolder().CreateNot(Mask); - OldVal = Builder.CreateAnd(OldVal, Mask); - - // Finally, merge the two together and store it. - NewVal = Builder.CreateOr(OldVal, NewVal); - - StoreInst *SI = Builder.CreateStore(NewVal, Ptr, isVolatile); - SI->setAlignment(Alignment); - - if (I + 1 < Strides) { - Value *ShAmt = ConstantInt::get(ValTy, BitsInVal); - BitSource = Builder.CreateLShr(BitSource, ShAmt); - } - } - - return RHS; -} - Value *TreeToLLVM::EmitNOP_EXPR(tree type, tree op, const MemRef *DestLoc) { const Type *Ty = ConvertType(type); bool OpIsSigned = !TYPE_UNSIGNED(TREE_TYPE(op)); @@ -3796,7 +3634,8 @@ // Turn this into a 'call void asm sideeffect "", "{reg}"(Ty %RHS)'. std::vector ArgTys; ArgTys.push_back(ConvertType(TREE_TYPE(decl))); - FunctionType *FTy = FunctionType::get(Type::getVoidTy(Context), ArgTys, false); + FunctionType *FTy = FunctionType::get(Type::getVoidTy(Context), ArgTys, + false); const char *Name = reg_names[decode_reg_name(extractRegisterName(decl))]; @@ -4213,7 +4052,7 @@ for (unsigned i = 0, e = Ops.size(); i != e; ++i) Result = Builder.CreateInsertElement(Result, Ops[i], - ConstantInt::get(Type::getInt32Ty(Context), i)); + ConstantInt::get(Type::getInt32Ty(Context), i)); return Result; } @@ -4277,15 +4116,15 @@ /// /// This method returns true if the builtin is handled, otherwise false. /// -bool TreeToLLVM::EmitFrontendExpandedBuiltinCall(tree exp, tree fndecl, +bool TreeToLLVM::EmitFrontendExpandedBuiltinCall(gimple stmt, tree fndecl, const MemRef *DestLoc, Value *&Result) { #ifdef LLVM_TARGET_INTRINSIC_LOWER // Get the result type and operand line in an easy to consume format. const Type *ResultType = ConvertType(TREE_TYPE(TREE_TYPE(fndecl))); std::vector Operands; - for (tree Op = CALL_EXPR_ARGS(exp); Op; Op = TREE_CHAIN(Op)) { - tree OpVal = TREE_VALUE(Op); + for (unsigned i = 0, e = gimple_call_num_args(stmt); i != e; ++i) { + tree OpVal = gimple_call_arg(stmt, i); if (isAggregateTreeType(TREE_TYPE(OpVal))) { MemRef OpLoc = CreateTempLoc(ConvertType(TREE_TYPE(OpVal))); Emit(OpVal, &OpLoc); @@ -4296,7 +4135,7 @@ } unsigned FnCode = DECL_FUNCTION_CODE(fndecl); - return LLVM_TARGET_INTRINSIC_LOWER(exp, FnCode, DestLoc, Result, ResultType, + return LLVM_TARGET_INTRINSIC_LOWER(stmt, FnCode, DestLoc, Result, ResultType, Operands); #endif return false; @@ -4325,12 +4164,11 @@ } Value * -TreeToLLVM::BuildBinaryAtomicBuiltin(tree exp, Intrinsic::ID id) { - const Type *ResultTy = ConvertType(TREE_TYPE(exp)); - tree arglist = CALL_EXPR_ARGS(exp); +TreeToLLVM::BuildBinaryAtomicBuiltin(gimple stmt, Intrinsic::ID id) { + const Type *ResultTy = ConvertType(gimple_call_return_type(stmt)); Value* C[2] = { - Emit(TREE_VALUE(arglist), 0), - Emit(TREE_VALUE(TREE_CHAIN(arglist)), 0) + Emit(gimple_call_arg(stmt, 0), 0), + Emit(gimple_call_arg(stmt, 1), 0) }; const Type* Ty[2]; Ty[0] = ResultTy; @@ -4349,13 +4187,12 @@ } Value * -TreeToLLVM::BuildCmpAndSwapAtomicBuiltin(tree exp, tree type, bool isBool) { +TreeToLLVM::BuildCmpAndSwapAtomicBuiltin(gimple stmt, tree type, bool isBool) { const Type *ResultTy = ConvertType(type); - tree arglist = CALL_EXPR_ARGS(exp); Value* C[3] = { - Emit(TREE_VALUE(arglist), 0), - Emit(TREE_VALUE(TREE_CHAIN(arglist)), 0), - Emit(TREE_VALUE(TREE_CHAIN(TREE_CHAIN(arglist))), 0) + Emit(gimple_call_arg(stmt, 0), 0), + Emit(gimple_call_arg(stmt, 1), 0), + Emit(gimple_call_arg(stmt, 2), 0) }; const Type* Ty[2]; Ty[0] = ResultTy; @@ -4386,10 +4223,10 @@ return Result; } -/// EmitBuiltinCall - exp is a call to fndecl, a builtin function. Try to emit +/// EmitBuiltinCall - stmt is a call to fndecl, a builtin function. Try to emit /// the call in a special way, setting Result to the scalar result if necessary. /// If we can't handle the builtin, return false, otherwise return true. -bool TreeToLLVM::EmitBuiltinCall(tree exp, tree fndecl, +bool TreeToLLVM::EmitBuiltinCall(gimple stmt, tree fndecl, const MemRef *DestLoc, Value *&Result) { if (DECL_BUILT_IN_CLASS(fndecl) == BUILT_IN_MD) { unsigned FnCode = DECL_FUNCTION_CODE(fndecl); @@ -4408,12 +4245,12 @@ Intrinsic::ID IntrinsicID = Intrinsic::getIntrinsicForGCCBuiltin(TargetPrefix, BuiltinName); if (IntrinsicID == Intrinsic::not_intrinsic) { - if (EmitFrontendExpandedBuiltinCall(exp, fndecl, DestLoc, Result)) + if (EmitFrontendExpandedBuiltinCall(stmt, fndecl, DestLoc, Result)) return true; - error_at(EXPR_LOCATION(exp), "unsupported target builtin %<%s%> used", - BuiltinName); - const Type *ResTy = ConvertType(TREE_TYPE(exp)); + error_at(gimple_location(stmt), + "unsupported target builtin %<%s%> used", BuiltinName); + const Type *ResTy = ConvertType(gimple_call_return_type(stmt)); if (ResTy->isSingleValueType()) Result = UndefValue::get(ResTy); return true; @@ -4424,7 +4261,7 @@ Intrinsic::getDeclaration(TheModule, IntrinsicID); } - Result = EmitCallOf(TargetBuiltinCache[FnCode], exp, DestLoc, + Result = EmitCallOf(TargetBuiltinCache[FnCode], stmt, DestLoc, AttrListPtr()); return true; } @@ -4433,61 +4270,61 @@ switch (fcode) { default: return false; // Varargs builtins. - case BUILT_IN_VA_START: return EmitBuiltinVAStart(exp); - case BUILT_IN_VA_END: return EmitBuiltinVAEnd(exp); - case BUILT_IN_VA_COPY: return EmitBuiltinVACopy(exp); - case BUILT_IN_CONSTANT_P: return EmitBuiltinConstantP(exp, Result); - case BUILT_IN_ALLOCA: return EmitBuiltinAlloca(exp, Result); - case BUILT_IN_EXTEND_POINTER: return EmitBuiltinExtendPointer(exp, Result); - case BUILT_IN_EXPECT: return EmitBuiltinExpect(exp, DestLoc, Result); - case BUILT_IN_MEMCPY: return EmitBuiltinMemCopy(exp, Result, + case BUILT_IN_VA_START: return EmitBuiltinVAStart(stmt); + case BUILT_IN_VA_END: return EmitBuiltinVAEnd(stmt); + case BUILT_IN_VA_COPY: return EmitBuiltinVACopy(stmt); + case BUILT_IN_CONSTANT_P: return EmitBuiltinConstantP(stmt, Result); + case BUILT_IN_ALLOCA: return EmitBuiltinAlloca(stmt, Result); + case BUILT_IN_EXTEND_POINTER: return EmitBuiltinExtendPointer(stmt, Result); + case BUILT_IN_EXPECT: return EmitBuiltinExpect(stmt, DestLoc, Result); + case BUILT_IN_MEMCPY: return EmitBuiltinMemCopy(stmt, Result, false, false); - case BUILT_IN_MEMCPY_CHK: return EmitBuiltinMemCopy(exp, Result, + case BUILT_IN_MEMCPY_CHK: return EmitBuiltinMemCopy(stmt, Result, false, true); - case BUILT_IN_MEMMOVE: return EmitBuiltinMemCopy(exp, Result, + case BUILT_IN_MEMMOVE: return EmitBuiltinMemCopy(stmt, Result, true, false); - case BUILT_IN_MEMMOVE_CHK: return EmitBuiltinMemCopy(exp, Result, + case BUILT_IN_MEMMOVE_CHK: return EmitBuiltinMemCopy(stmt, Result, true, true); - case BUILT_IN_MEMSET: return EmitBuiltinMemSet(exp, Result, false); - case BUILT_IN_MEMSET_CHK: return EmitBuiltinMemSet(exp, Result, true); - case BUILT_IN_BZERO: return EmitBuiltinBZero(exp, Result); - case BUILT_IN_PREFETCH: return EmitBuiltinPrefetch(exp); - case BUILT_IN_FRAME_ADDRESS: return EmitBuiltinReturnAddr(exp, Result,true); - case BUILT_IN_RETURN_ADDRESS: return EmitBuiltinReturnAddr(exp, Result,false); - case BUILT_IN_STACK_SAVE: return EmitBuiltinStackSave(exp, Result); - case BUILT_IN_STACK_RESTORE: return EmitBuiltinStackRestore(exp); + case BUILT_IN_MEMSET: return EmitBuiltinMemSet(stmt, Result, false); + case BUILT_IN_MEMSET_CHK: return EmitBuiltinMemSet(stmt, Result, true); + case BUILT_IN_BZERO: return EmitBuiltinBZero(stmt, Result); + case BUILT_IN_PREFETCH: return EmitBuiltinPrefetch(stmt); + case BUILT_IN_FRAME_ADDRESS: return EmitBuiltinReturnAddr(stmt, Result,true); + case BUILT_IN_RETURN_ADDRESS: + return EmitBuiltinReturnAddr(stmt, Result,false); + case BUILT_IN_STACK_SAVE: return EmitBuiltinStackSave(stmt, Result); + case BUILT_IN_STACK_RESTORE: return EmitBuiltinStackRestore(stmt); case BUILT_IN_EXTRACT_RETURN_ADDR: - return EmitBuiltinExtractReturnAddr(exp, Result); + return EmitBuiltinExtractReturnAddr(stmt, Result); case BUILT_IN_FROB_RETURN_ADDR: - return EmitBuiltinFrobReturnAddr(exp, Result); + return EmitBuiltinFrobReturnAddr(stmt, Result); case BUILT_IN_INIT_TRAMPOLINE: - return EmitBuiltinInitTrampoline(exp, Result); + return EmitBuiltinInitTrampoline(stmt, Result); // Builtins used by the exception handling runtime. case BUILT_IN_DWARF_CFA: - return EmitBuiltinDwarfCFA(exp, Result); + return EmitBuiltinDwarfCFA(stmt, Result); #ifdef DWARF2_UNWIND_INFO case BUILT_IN_DWARF_SP_COLUMN: - return EmitBuiltinDwarfSPColumn(exp, Result); + return EmitBuiltinDwarfSPColumn(stmt, Result); case BUILT_IN_INIT_DWARF_REG_SIZES: - return EmitBuiltinInitDwarfRegSizes(exp, Result); + return EmitBuiltinInitDwarfRegSizes(stmt, Result); #endif case BUILT_IN_EH_RETURN: - return EmitBuiltinEHReturn(exp, Result); + return EmitBuiltinEHReturn(stmt, Result); #ifdef EH_RETURN_DATA_REGNO case BUILT_IN_EH_RETURN_DATA_REGNO: - return EmitBuiltinEHReturnDataRegno(exp, Result); + return EmitBuiltinEHReturnDataRegno(stmt, Result); #endif case BUILT_IN_UNWIND_INIT: - return EmitBuiltinUnwindInit(exp, Result); + return EmitBuiltinUnwindInit(stmt, Result); case BUILT_IN_OBJECT_SIZE: { - tree ArgList = CALL_EXPR_ARGS(exp); - if (!validate_arglist(exp, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE)) { + if (!validate_gimple_arglist(stmt, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE)) { error("Invalid builtin_object_size argument types"); return false; } - tree ObjSizeTree = TREE_VALUE (TREE_CHAIN (ArgList)); + tree ObjSizeTree = gimple_call_arg(stmt, 1); STRIP_NOPS (ObjSizeTree); if (TREE_CODE (ObjSizeTree) != INTEGER_CST || tree_int_cst_sgn (ObjSizeTree) < 0 @@ -4510,25 +4347,25 @@ case BUILT_IN_CLZ: // These GCC builtins always return int. case BUILT_IN_CLZL: case BUILT_IN_CLZLL: { - Value *Amt = Emit(TREE_VALUE(CALL_EXPR_ARGS(exp)), 0); + Value *Amt = Emit(gimple_call_arg(stmt, 0), 0); EmitBuiltinUnaryOp(Amt, Result, Intrinsic::ctlz); - const Type *DestTy = ConvertType(TREE_TYPE(exp)); + const Type *DestTy = ConvertType(gimple_call_return_type(stmt)); Result = Builder.CreateIntCast(Result, DestTy, "cast"); return true; } case BUILT_IN_CTZ: // These GCC builtins always return int. case BUILT_IN_CTZL: case BUILT_IN_CTZLL: { - Value *Amt = Emit(TREE_VALUE(CALL_EXPR_ARGS(exp)), 0); + Value *Amt = Emit(gimple_call_arg(stmt, 0), 0); EmitBuiltinUnaryOp(Amt, Result, Intrinsic::cttz); - const Type *DestTy = ConvertType(TREE_TYPE(exp)); + const Type *DestTy = ConvertType(gimple_call_return_type(stmt)); Result = Builder.CreateIntCast(Result, DestTy, "cast"); return true; } case BUILT_IN_PARITYLL: case BUILT_IN_PARITYL: case BUILT_IN_PARITY: { - Value *Amt = Emit(TREE_VALUE(CALL_EXPR_ARGS(exp)), 0); + Value *Amt = Emit(gimple_call_arg(stmt, 0), 0); EmitBuiltinUnaryOp(Amt, Result, Intrinsic::ctpop); Result = Builder.CreateBinOp(Instruction::And, Result, ConstantInt::get(Result->getType(), 1)); @@ -4537,17 +4374,17 @@ case BUILT_IN_POPCOUNT: // These GCC builtins always return int. case BUILT_IN_POPCOUNTL: case BUILT_IN_POPCOUNTLL: { - Value *Amt = Emit(TREE_VALUE(CALL_EXPR_ARGS(exp)), 0); + Value *Amt = Emit(gimple_call_arg(stmt, 0), 0); EmitBuiltinUnaryOp(Amt, Result, Intrinsic::ctpop); - const Type *DestTy = ConvertType(TREE_TYPE(exp)); + const Type *DestTy = ConvertType(gimple_call_return_type(stmt)); Result = Builder.CreateIntCast(Result, DestTy, "cast"); return true; } case BUILT_IN_BSWAP32: case BUILT_IN_BSWAP64: { - Value *Amt = Emit(TREE_VALUE(CALL_EXPR_ARGS(exp)), 0); + Value *Amt = Emit(gimple_call_arg(stmt, 0), 0); EmitBuiltinUnaryOp(Amt, Result, Intrinsic::bswap); - const Type *DestTy = ConvertType(TREE_TYPE(exp)); + const Type *DestTy = ConvertType(gimple_call_return_type(stmt)); Result = Builder.CreateIntCast(Result, DestTy, "cast"); return true; } @@ -4557,22 +4394,22 @@ case BUILT_IN_SQRTL: // If errno math has been disabled, expand these to llvm.sqrt calls. if (!flag_errno_math) { - Result = EmitBuiltinSQRT(exp); - Result = CastToFPType(Result, ConvertType(TREE_TYPE(exp))); + Result = EmitBuiltinSQRT(stmt); + Result = CastToFPType(Result, ConvertType(gimple_call_return_type(stmt))); return true; } break; case BUILT_IN_POWI: case BUILT_IN_POWIF: case BUILT_IN_POWIL: - Result = EmitBuiltinPOWI(exp); + Result = EmitBuiltinPOWI(stmt); return true; case BUILT_IN_POW: case BUILT_IN_POWF: case BUILT_IN_POWL: // If errno math has been disabled, expand these to llvm.pow calls. if (!flag_errno_math) { - Result = EmitBuiltinPOW(exp); + Result = EmitBuiltinPOW(stmt); return true; } break; @@ -4581,9 +4418,9 @@ case BUILT_IN_LOGL: // If errno math has been disabled, expand these to llvm.log calls. if (!flag_errno_math) { - Value *Amt = Emit(TREE_VALUE(CALL_EXPR_ARGS(exp)), 0); + Value *Amt = Emit(gimple_call_arg(stmt, 0), 0); EmitBuiltinUnaryOp(Amt, Result, Intrinsic::log); - Result = CastToFPType(Result, ConvertType(TREE_TYPE(exp))); + Result = CastToFPType(Result, ConvertType(gimple_call_return_type(stmt))); return true; } break; @@ -4592,9 +4429,9 @@ case BUILT_IN_LOG2L: // If errno math has been disabled, expand these to llvm.log2 calls. if (!flag_errno_math) { - Value *Amt = Emit(TREE_VALUE(CALL_EXPR_ARGS(exp)), 0); + Value *Amt = Emit(gimple_call_arg(stmt, 0), 0); EmitBuiltinUnaryOp(Amt, Result, Intrinsic::log2); - Result = CastToFPType(Result, ConvertType(TREE_TYPE(exp))); + Result = CastToFPType(Result, ConvertType(gimple_call_return_type(stmt))); return true; } break; @@ -4603,9 +4440,9 @@ case BUILT_IN_LOG10L: // If errno math has been disabled, expand these to llvm.log10 calls. if (!flag_errno_math) { - Value *Amt = Emit(TREE_VALUE(CALL_EXPR_ARGS(exp)), 0); + Value *Amt = Emit(gimple_call_arg(stmt, 0), 0); EmitBuiltinUnaryOp(Amt, Result, Intrinsic::log10); - Result = CastToFPType(Result, ConvertType(TREE_TYPE(exp))); + Result = CastToFPType(Result, ConvertType(gimple_call_return_type(stmt))); return true; } break; @@ -4614,9 +4451,9 @@ case BUILT_IN_EXPL: // If errno math has been disabled, expand these to llvm.exp calls. if (!flag_errno_math) { - Value *Amt = Emit(TREE_VALUE(CALL_EXPR_ARGS(exp)), 0); + Value *Amt = Emit(gimple_call_arg(stmt, 0), 0); EmitBuiltinUnaryOp(Amt, Result, Intrinsic::exp); - Result = CastToFPType(Result, ConvertType(TREE_TYPE(exp))); + Result = CastToFPType(Result, ConvertType(gimple_call_return_type(stmt))); return true; } break; @@ -4625,9 +4462,9 @@ case BUILT_IN_EXP2L: // If errno math has been disabled, expand these to llvm.exp2 calls. if (!flag_errno_math) { - Value *Amt = Emit(TREE_VALUE(CALL_EXPR_ARGS(exp)), 0); + Value *Amt = Emit(gimple_call_arg(stmt, 0), 0); EmitBuiltinUnaryOp(Amt, Result, Intrinsic::exp2); - Result = CastToFPType(Result, ConvertType(TREE_TYPE(exp))); + Result = CastToFPType(Result, ConvertType(gimple_call_return_type(stmt))); return true; } break; @@ -4636,11 +4473,11 @@ case BUILT_IN_FFSLL: { // FFS(X) -> (x == 0 ? 0 : CTTZ(x)+1) // The argument and return type of cttz should match the argument type of // the ffs, but should ignore the return type of ffs. - Value *Amt = Emit(TREE_VALUE(CALL_EXPR_ARGS(exp)), 0); + Value *Amt = Emit(gimple_call_arg(stmt, 0), 0); EmitBuiltinUnaryOp(Amt, Result, Intrinsic::cttz); Result = Builder.CreateAdd(Result, ConstantInt::get(Result->getType(), 1)); - Result = CastToUIntType(Result, ConvertType(TREE_TYPE(exp))); + Result = CastToUIntType(Result, ConvertType(gimple_call_return_type(stmt))); Value *Cond = Builder.CreateICmpEQ(Amt, Constant::getNullValue(Amt->getType())); @@ -4653,7 +4490,7 @@ //TODO Result = //TODO Builder.CreateCall(Intrinsic::getDeclaration(TheModule, //TODO Intrinsic::flt_rounds)); -//TODO Result = Builder.CreateBitCast(Result, ConvertType(TREE_TYPE(exp))); +//TODO Result = Builder.CreateBitCast(Result, ConvertType(gimple_call_return_type(stmt))); //TODO return true; //TODO } case BUILT_IN_TRAP: @@ -4667,17 +4504,17 @@ //TODO case BUILT_IN_ANNOTATION: { //TODO //TODO // Get file and line number -//TODO location_t locus = EXPR_LOCATION (exp); +//TODO location_t locus = gimple_location(stmt); //TODO Constant *lineNo = ConstantInt::get(Type::getInt32Ty, LOCATION_LINE(locus)); //TODO Constant *file = ConvertMetadataStringToGV(LOCATION_FILE(locus)); //TODO const Type *SBP= PointerType::getUnqual(Type::getInt8Ty(Context)); //TODO file = Builder.getFolder().CreateBitCast(file, SBP); //TODO //TODO // Get arguments. -//TODO tree arglist = CALL_EXPR_ARGS(exp); -//TODO Value *ExprVal = Emit(TREE_VALUE(arglist), 0); +//TODO tree arglist = CALL_EXPR_ARGS(stmt); +//TODO Value *ExprVal = Emit(gimple_call_arg(stmt, 0), 0); //TODO const Type *Ty = ExprVal->getType(); -//TODO Value *StrVal = Emit(TREE_VALUE(TREE_CHAIN(arglist)), 0); +//TODO Value *StrVal = Emit(gimple_call_arg(stmt, 1), 0); //TODO //TODO SmallVector Args; //TODO Args.push_back(ExprVal); @@ -4716,15 +4553,15 @@ // Note that Intrinsic::getDeclaration expects the type list in reversed // order, while CreateCall expects the parameter list in normal order. case BUILT_IN_BOOL_COMPARE_AND_SWAP_1: { - Result = BuildCmpAndSwapAtomicBuiltin(exp, unsigned_char_type_node, true); + Result = BuildCmpAndSwapAtomicBuiltin(stmt, unsigned_char_type_node, true); return true; } case BUILT_IN_BOOL_COMPARE_AND_SWAP_2: { - Result = BuildCmpAndSwapAtomicBuiltin(exp, short_unsigned_type_node, true); + Result = BuildCmpAndSwapAtomicBuiltin(stmt, short_unsigned_type_node, true); return true; } case BUILT_IN_BOOL_COMPARE_AND_SWAP_4: { - Result = BuildCmpAndSwapAtomicBuiltin(exp, unsigned_type_node, true); + Result = BuildCmpAndSwapAtomicBuiltin(stmt, unsigned_type_node, true); return true; } case BUILT_IN_BOOL_COMPARE_AND_SWAP_8: { @@ -4732,7 +4569,7 @@ if (!TARGET_64BIT) return false; #endif - Result = BuildCmpAndSwapAtomicBuiltin(exp, long_long_unsigned_type_node, + Result = BuildCmpAndSwapAtomicBuiltin(stmt, long_long_unsigned_type_node, true); return true; } @@ -4745,8 +4582,8 @@ case BUILT_IN_VAL_COMPARE_AND_SWAP_1: case BUILT_IN_VAL_COMPARE_AND_SWAP_2: case BUILT_IN_VAL_COMPARE_AND_SWAP_4: { - tree type = TREE_TYPE(exp); - Result = BuildCmpAndSwapAtomicBuiltin(exp, type, false); + tree type = gimple_call_return_type(stmt); + Result = BuildCmpAndSwapAtomicBuiltin(stmt, type, false); return true; } case BUILT_IN_FETCH_AND_ADD_8: @@ -4757,7 +4594,7 @@ case BUILT_IN_FETCH_AND_ADD_1: case BUILT_IN_FETCH_AND_ADD_2: case BUILT_IN_FETCH_AND_ADD_4: { - Result = BuildBinaryAtomicBuiltin(exp, Intrinsic::atomic_load_add); + Result = BuildBinaryAtomicBuiltin(stmt, Intrinsic::atomic_load_add); return true; } case BUILT_IN_FETCH_AND_SUB_8: @@ -4768,7 +4605,7 @@ case BUILT_IN_FETCH_AND_SUB_1: case BUILT_IN_FETCH_AND_SUB_2: case BUILT_IN_FETCH_AND_SUB_4: { - Result = BuildBinaryAtomicBuiltin(exp, Intrinsic::atomic_load_sub); + Result = BuildBinaryAtomicBuiltin(stmt, Intrinsic::atomic_load_sub); return true; } case BUILT_IN_FETCH_AND_OR_8: @@ -4779,7 +4616,7 @@ case BUILT_IN_FETCH_AND_OR_1: case BUILT_IN_FETCH_AND_OR_2: case BUILT_IN_FETCH_AND_OR_4: { - Result = BuildBinaryAtomicBuiltin(exp, Intrinsic::atomic_load_or); + Result = BuildBinaryAtomicBuiltin(stmt, Intrinsic::atomic_load_or); return true; } case BUILT_IN_FETCH_AND_AND_8: @@ -4790,7 +4627,7 @@ case BUILT_IN_FETCH_AND_AND_1: case BUILT_IN_FETCH_AND_AND_2: case BUILT_IN_FETCH_AND_AND_4: { - Result = BuildBinaryAtomicBuiltin(exp, Intrinsic::atomic_load_and); + Result = BuildBinaryAtomicBuiltin(stmt, Intrinsic::atomic_load_and); return true; } case BUILT_IN_FETCH_AND_XOR_8: @@ -4801,7 +4638,7 @@ case BUILT_IN_FETCH_AND_XOR_1: case BUILT_IN_FETCH_AND_XOR_2: case BUILT_IN_FETCH_AND_XOR_4: { - Result = BuildBinaryAtomicBuiltin(exp, Intrinsic::atomic_load_xor); + Result = BuildBinaryAtomicBuiltin(stmt, Intrinsic::atomic_load_xor); return true; } case BUILT_IN_FETCH_AND_NAND_8: @@ -4812,7 +4649,7 @@ case BUILT_IN_FETCH_AND_NAND_1: case BUILT_IN_FETCH_AND_NAND_2: case BUILT_IN_FETCH_AND_NAND_4: { - Result = BuildBinaryAtomicBuiltin(exp, Intrinsic::atomic_load_nand); + Result = BuildBinaryAtomicBuiltin(stmt, Intrinsic::atomic_load_nand); return true; } case BUILT_IN_LOCK_TEST_AND_SET_8: @@ -4823,7 +4660,7 @@ case BUILT_IN_LOCK_TEST_AND_SET_1: case BUILT_IN_LOCK_TEST_AND_SET_2: case BUILT_IN_LOCK_TEST_AND_SET_4: { - Result = BuildBinaryAtomicBuiltin(exp, Intrinsic::atomic_swap); + Result = BuildBinaryAtomicBuiltin(stmt, Intrinsic::atomic_swap); return true; } @@ -4835,11 +4672,10 @@ case BUILT_IN_ADD_AND_FETCH_1: case BUILT_IN_ADD_AND_FETCH_2: case BUILT_IN_ADD_AND_FETCH_4: { - const Type *ResultTy = ConvertType(TREE_TYPE(exp)); - tree arglist = CALL_EXPR_ARGS(exp); + const Type *ResultTy = ConvertType(gimple_call_return_type(stmt)); Value* C[2] = { - Emit(TREE_VALUE(arglist), 0), - Emit(TREE_VALUE(TREE_CHAIN(arglist)), 0) + Emit(gimple_call_arg(stmt, 0), 0), + Emit(gimple_call_arg(stmt, 1), 0) }; const Type* Ty[2]; Ty[0] = ResultTy; @@ -4873,11 +4709,10 @@ case BUILT_IN_SUB_AND_FETCH_1: case BUILT_IN_SUB_AND_FETCH_2: case BUILT_IN_SUB_AND_FETCH_4: { - const Type *ResultTy = ConvertType(TREE_TYPE(exp)); - tree arglist = CALL_EXPR_ARGS(exp); + const Type *ResultTy = ConvertType(gimple_call_return_type(stmt)); Value* C[2] = { - Emit(TREE_VALUE(arglist), 0), - Emit(TREE_VALUE(TREE_CHAIN(arglist)), 0) + Emit(gimple_call_arg(stmt, 0), 0), + Emit(gimple_call_arg(stmt, 1), 0) }; const Type* Ty[2]; Ty[0] = ResultTy; @@ -4911,11 +4746,10 @@ case BUILT_IN_OR_AND_FETCH_1: case BUILT_IN_OR_AND_FETCH_2: case BUILT_IN_OR_AND_FETCH_4: { - const Type *ResultTy = ConvertType(TREE_TYPE(exp)); - tree arglist = CALL_EXPR_ARGS(exp); + const Type *ResultTy = ConvertType(gimple_call_return_type(stmt)); Value* C[2] = { - Emit(TREE_VALUE(arglist), 0), - Emit(TREE_VALUE(TREE_CHAIN(arglist)), 0) + Emit(gimple_call_arg(stmt, 0), 0), + Emit(gimple_call_arg(stmt, 1), 0) }; const Type* Ty[2]; Ty[0] = ResultTy; @@ -4949,11 +4783,10 @@ case BUILT_IN_AND_AND_FETCH_1: case BUILT_IN_AND_AND_FETCH_2: case BUILT_IN_AND_AND_FETCH_4: { - const Type *ResultTy = ConvertType(TREE_TYPE(exp)); - tree arglist = CALL_EXPR_ARGS(exp); + const Type *ResultTy = ConvertType(gimple_call_return_type(stmt)); Value* C[2] = { - Emit(TREE_VALUE(arglist), 0), - Emit(TREE_VALUE(TREE_CHAIN(arglist)), 0) + Emit(gimple_call_arg(stmt, 0), 0), + Emit(gimple_call_arg(stmt, 1), 0) }; const Type* Ty[2]; Ty[0] = ResultTy; @@ -4987,11 +4820,10 @@ case BUILT_IN_XOR_AND_FETCH_1: case BUILT_IN_XOR_AND_FETCH_2: case BUILT_IN_XOR_AND_FETCH_4: { - const Type *ResultTy = ConvertType(TREE_TYPE(exp)); - tree arglist = CALL_EXPR_ARGS(exp); + const Type *ResultTy = ConvertType(gimple_call_return_type(stmt)); Value* C[2] = { - Emit(TREE_VALUE(arglist), 0), - Emit(TREE_VALUE(TREE_CHAIN(arglist)), 0) + Emit(gimple_call_arg(stmt, 0), 0), + Emit(gimple_call_arg(stmt, 1), 0) }; const Type* Ty[2]; Ty[0] = ResultTy; @@ -5025,11 +4857,10 @@ case BUILT_IN_NAND_AND_FETCH_1: case BUILT_IN_NAND_AND_FETCH_2: case BUILT_IN_NAND_AND_FETCH_4: { - const Type *ResultTy = ConvertType(TREE_TYPE(exp)); - tree arglist = CALL_EXPR_ARGS(exp); + const Type *ResultTy = ConvertType(gimple_call_return_type(stmt)); Value* C[2] = { - Emit(TREE_VALUE(arglist), 0), - Emit(TREE_VALUE(TREE_CHAIN(arglist)), 0) + Emit(gimple_call_arg(stmt, 0), 0), + Emit(gimple_call_arg(stmt, 1), 0) }; const Type* Ty[2]; Ty[0] = ResultTy; @@ -5065,26 +4896,23 @@ // The argument has typically been coerced to "volatile void*"; the // only way to find the size of the operation is from the builtin // opcode. - tree type; + const Type *Ty; switch(DECL_FUNCTION_CODE(fndecl)) { + case BUILT_IN_LOCK_RELEASE_16: // not handled; should use SSE on x86 + default: + abort(); case BUILT_IN_LOCK_RELEASE_1: - type = unsigned_char_type_node; break; + Ty = Type::getInt8Ty(Context); break; case BUILT_IN_LOCK_RELEASE_2: - type = short_unsigned_type_node; break; + Ty = Type::getInt16Ty(Context); break; case BUILT_IN_LOCK_RELEASE_4: - type = unsigned_type_node; break; + Ty = Type::getInt32Ty(Context); break; case BUILT_IN_LOCK_RELEASE_8: - type = long_long_unsigned_type_node; break; - case BUILT_IN_LOCK_RELEASE_16: // not handled; should use SSE on x86 - default: - abort(); + Ty = Type::getInt64Ty(Context); break; } - tree arglist = CALL_EXPR_ARGS(exp); - tree t1 = build1 (INDIRECT_REF, type, TREE_VALUE (arglist)); - TREE_THIS_VOLATILE(t1) = 1; - tree t = build2 (MODIFY_EXPR, type, t1, - build_int_cst (type, (HOST_WIDE_INT)0)); - EmitMODIFY_EXPR(t, 0); + Value *Ptr = Emit(gimple_call_arg(stmt, 0), 0); + Ptr = Builder.CreateBitCast(Ptr, Ty->getPointerTo()); + Builder.CreateStore(Constant::getNullValue(Ty), Ptr, true); Result = 0; return true; } @@ -5094,10 +4922,8 @@ #if 1 // FIXME: Should handle these GCC extensions eventually. case BUILT_IN_LONGJMP: { - tree arglist = CALL_EXPR_ARGS(exp); - - if (validate_arglist(exp, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE)) { - tree value = TREE_VALUE(TREE_CHAIN(arglist)); + if (validate_gimple_arglist(stmt, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE)) { + tree value = gimple_call_arg(stmt, 1); if (TREE_CODE(value) != INTEGER_CST || cast(Emit(value, 0))->getValue() != 1) { @@ -5121,7 +4947,7 @@ // FIXME: HACK: Just ignore these. { - const Type *Ty = ConvertType(TREE_TYPE(exp)); + const Type *Ty = ConvertType(gimple_call_return_type(stmt)); if (Ty != Type::getVoidTy(Context)) Result = Constant::getNullValue(Ty); return true; @@ -5143,8 +4969,8 @@ return true; } -Value *TreeToLLVM::EmitBuiltinSQRT(tree exp) { - Value *Amt = Emit(TREE_VALUE(CALL_EXPR_ARGS(exp)), 0); +Value *TreeToLLVM::EmitBuiltinSQRT(gimple stmt) { + Value *Amt = Emit(gimple_call_arg(stmt, 0), 0); const Type* Ty = Amt->getType(); return Builder.CreateCall(Intrinsic::getDeclaration(TheModule, @@ -5152,13 +4978,12 @@ Amt); } -Value *TreeToLLVM::EmitBuiltinPOWI(tree exp) { - tree ArgList = CALL_EXPR_ARGS(exp); - if (!validate_arglist(exp, REAL_TYPE, INTEGER_TYPE, VOID_TYPE)) +Value *TreeToLLVM::EmitBuiltinPOWI(gimple stmt) { + if (!validate_gimple_arglist(stmt, REAL_TYPE, INTEGER_TYPE, VOID_TYPE)) return 0; - Value *Val = Emit(TREE_VALUE(ArgList), 0); - Value *Pow = Emit(TREE_VALUE(TREE_CHAIN(ArgList)), 0); + Value *Val = Emit(gimple_call_arg(stmt, 0), 0); + Value *Pow = Emit(gimple_call_arg(stmt, 1), 0); const Type *Ty = Val->getType(); Pow = CastToSIntType(Pow, Type::getInt32Ty(Context)); @@ -5170,13 +4995,12 @@ Args.begin(), Args.end()); } -Value *TreeToLLVM::EmitBuiltinPOW(tree exp) { - tree ArgList = CALL_EXPR_ARGS(exp); - if (!validate_arglist(exp, REAL_TYPE, REAL_TYPE, VOID_TYPE)) +Value *TreeToLLVM::EmitBuiltinPOW(gimple stmt) { + if (!validate_gimple_arglist(stmt, REAL_TYPE, REAL_TYPE, VOID_TYPE)) return 0; - Value *Val = Emit(TREE_VALUE(ArgList), 0); - Value *Pow = Emit(TREE_VALUE(TREE_CHAIN(ArgList)), 0); + Value *Val = Emit(gimple_call_arg(stmt, 0), 0); + Value *Pow = Emit(gimple_call_arg(stmt, 1), 0); const Type *Ty = Val->getType(); SmallVector Args; @@ -5187,17 +5011,18 @@ Args.begin(), Args.end()); } -bool TreeToLLVM::EmitBuiltinConstantP(tree exp, Value *&Result) { - Result = Constant::getNullValue(ConvertType(TREE_TYPE(exp))); +bool TreeToLLVM::EmitBuiltinConstantP(gimple stmt, Value *&Result) { + Result = Constant::getNullValue(ConvertType(gimple_call_return_type(stmt))); return true; } -bool TreeToLLVM::EmitBuiltinExtendPointer(tree exp, Value *&Result) { - tree arglist = CALL_EXPR_ARGS(exp); - Value *Amt = Emit(TREE_VALUE(arglist), 0); - bool AmtIsSigned = !TYPE_UNSIGNED(TREE_TYPE(TREE_VALUE(arglist))); - bool ExpIsSigned = !TYPE_UNSIGNED(TREE_TYPE(exp)); - Result = CastToAnyType(Amt, AmtIsSigned, ConvertType(TREE_TYPE(exp)), +bool TreeToLLVM::EmitBuiltinExtendPointer(gimple stmt, Value *&Result) { + tree arg0 = gimple_call_arg(stmt, 0); + Value *Amt = Emit(arg0, 0); + bool AmtIsSigned = !TYPE_UNSIGNED(TREE_TYPE(arg0)); + bool ExpIsSigned = !TYPE_UNSIGNED(gimple_call_return_type(stmt)); + Result = CastToAnyType(Amt, AmtIsSigned, + ConvertType(gimple_call_return_type(stmt)), ExpIsSigned); return true; } @@ -5206,7 +5031,7 @@ /// size checking builtin calls (e.g. __builtin___memcpy_chk into the /// plain non-checking calls. If the size of the argument is either -1 (unknown) /// or large enough to ensure no overflow (> len), then it's safe to do so. -static bool OptimizeIntoPlainBuiltIn(tree exp, Value *Len, Value *Size) { +static bool OptimizeIntoPlainBuiltIn(gimple stmt, Value *Len, Value *Size) { if (BitCastInst *SizeBC = dyn_cast(Size)) Size = SizeBC->getOperand(0); ConstantInt *SizeCI = dyn_cast(Size); @@ -5222,9 +5047,9 @@ if (!LenCI) return false; if (SizeCI->getValue().ult(LenCI->getValue())) { - warning_at (EXPR_LOCATION(exp), 0, + warning_at (gimple_location(stmt), 0, "call to %D will always overflow destination buffer", - get_callee_fndecl(exp)); + gimple_call_fndecl(stmt)); return false; } return true; @@ -5232,31 +5057,30 @@ /// EmitBuiltinMemCopy - Emit an llvm.memcpy or llvm.memmove intrinsic, /// depending on the value of isMemMove. -bool TreeToLLVM::EmitBuiltinMemCopy(tree exp, Value *&Result, bool isMemMove, +bool TreeToLLVM::EmitBuiltinMemCopy(gimple stmt, Value *&Result, bool isMemMove, bool SizeCheck) { - tree arglist = CALL_EXPR_ARGS(exp); if (SizeCheck) { - if (!validate_arglist(exp, POINTER_TYPE, POINTER_TYPE, + if (!validate_gimple_arglist(stmt, POINTER_TYPE, POINTER_TYPE, INTEGER_TYPE, INTEGER_TYPE, VOID_TYPE)) return false; } else { - if (!validate_arglist(exp, POINTER_TYPE, POINTER_TYPE, + if (!validate_gimple_arglist(stmt, POINTER_TYPE, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE)) return false; } - tree Dst = TREE_VALUE(arglist); - tree Src = TREE_VALUE(TREE_CHAIN(arglist)); + tree Dst = gimple_call_arg(stmt, 0); + tree Src = gimple_call_arg(stmt, 1); unsigned SrcAlign = getPointerAlignment(Src); unsigned DstAlign = getPointerAlignment(Dst); Value *DstV = Emit(Dst, 0); Value *SrcV = Emit(Src, 0); - Value *Len = Emit(TREE_VALUE(TREE_CHAIN(TREE_CHAIN(arglist))), 0); + Value *Len = Emit(gimple_call_arg(stmt, 2), 0); if (SizeCheck) { - tree SizeArg = TREE_VALUE(TREE_CHAIN(TREE_CHAIN(TREE_CHAIN(arglist)))); + tree SizeArg = gimple_call_arg(stmt, 3); Value *Size = Emit(SizeArg, 0); - if (!OptimizeIntoPlainBuiltIn(exp, Len, Size)) + if (!OptimizeIntoPlainBuiltIn(stmt, Len, Size)) return false; } @@ -5266,60 +5090,57 @@ return true; } -bool TreeToLLVM::EmitBuiltinMemSet(tree exp, Value *&Result, bool SizeCheck) { - tree arglist = CALL_EXPR_ARGS(exp); +bool TreeToLLVM::EmitBuiltinMemSet(gimple stmt, Value *&Result, bool SizeCheck){ if (SizeCheck) { - if (!validate_arglist(exp, POINTER_TYPE, INTEGER_TYPE, + if (!validate_gimple_arglist(stmt, POINTER_TYPE, INTEGER_TYPE, INTEGER_TYPE, INTEGER_TYPE, VOID_TYPE)) return false; } else { - if (!validate_arglist(exp, POINTER_TYPE, INTEGER_TYPE, + if (!validate_gimple_arglist(stmt, POINTER_TYPE, INTEGER_TYPE, INTEGER_TYPE, VOID_TYPE)) return false; } - tree Dst = TREE_VALUE(arglist); + tree Dst = gimple_call_arg(stmt, 0); unsigned DstAlign = getPointerAlignment(Dst); Value *DstV = Emit(Dst, 0); - Value *Val = Emit(TREE_VALUE(TREE_CHAIN(arglist)), 0); - Value *Len = Emit(TREE_VALUE(TREE_CHAIN(TREE_CHAIN(arglist))), 0); + Value *Val = Emit(gimple_call_arg(stmt, 1), 0); + Value *Len = Emit(gimple_call_arg(stmt, 2), 0); if (SizeCheck) { - tree SizeArg = TREE_VALUE(TREE_CHAIN(TREE_CHAIN(TREE_CHAIN(arglist)))); + tree SizeArg = gimple_call_arg(stmt, 3); Value *Size = Emit(SizeArg, 0); - if (!OptimizeIntoPlainBuiltIn(exp, Len, Size)) + if (!OptimizeIntoPlainBuiltIn(stmt, Len, Size)) return false; } Result = EmitMemSet(DstV, Val, Len, DstAlign); return true; } -bool TreeToLLVM::EmitBuiltinBZero(tree exp, Value *&Result) { - tree arglist = CALL_EXPR_ARGS(exp); - if (!validate_arglist(exp, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE)) +bool TreeToLLVM::EmitBuiltinBZero(gimple stmt, Value *&Result) { + if (!validate_gimple_arglist(stmt, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE)) return false; - tree Dst = TREE_VALUE(arglist); + tree Dst = gimple_call_arg(stmt, 0); unsigned DstAlign = getPointerAlignment(Dst); Value *DstV = Emit(Dst, 0); Value *Val = Constant::getNullValue(Type::getInt32Ty(Context)); - Value *Len = Emit(TREE_VALUE(TREE_CHAIN(arglist)), 0); + Value *Len = Emit(gimple_call_arg(stmt, 1), 0); EmitMemSet(DstV, Val, Len, DstAlign); return true; } -bool TreeToLLVM::EmitBuiltinPrefetch(tree exp) { - tree arglist = CALL_EXPR_ARGS(exp); - if (!validate_arglist(exp, POINTER_TYPE, 0)) +bool TreeToLLVM::EmitBuiltinPrefetch(gimple stmt) { + if (!validate_gimple_arglist(stmt, POINTER_TYPE, 0)) return false; - Value *Ptr = Emit(TREE_VALUE(arglist), 0); + Value *Ptr = Emit(gimple_call_arg(stmt, 0), 0); Value *ReadWrite = 0; Value *Locality = 0; - if (TREE_CHAIN(arglist)) { // Args 1/2 are optional - ReadWrite = Emit(TREE_VALUE(TREE_CHAIN(arglist)), 0); + if (gimple_call_num_args(stmt) >= 1) { // Args 1/2 are optional + ReadWrite = Emit(gimple_call_arg(stmt, 1), 0); if (!isa(ReadWrite)) { error("second argument to %<__builtin_prefetch%> must be a constant"); ReadWrite = 0; @@ -5329,11 +5150,11 @@ ReadWrite = 0; } else { ReadWrite = Builder.getFolder().CreateIntCast(cast(ReadWrite), - Type::getInt32Ty(Context), false); + Type::getInt32Ty(Context), false); } - if (TREE_CHAIN(TREE_CHAIN(arglist))) { - Locality = Emit(TREE_VALUE(TREE_CHAIN(TREE_CHAIN(arglist))), 0); + if (gimple_call_num_args(stmt) >= 2) { + Locality = Emit(gimple_call_arg(stmt, 2), 0); if (!isa(Locality)) { error("third argument to %<__builtin_prefetch%> must be a constant"); Locality = 0; @@ -5342,7 +5163,7 @@ Locality = 0; } else { Locality = Builder.getFolder().CreateIntCast(cast(Locality), - Type::getInt32Ty(Context), false); + Type::getInt32Ty(Context), false); } } } @@ -5364,12 +5185,13 @@ /// EmitBuiltinReturnAddr - Emit an llvm.returnaddress or llvm.frameaddress /// instruction, depending on whether isFrame is true or not. -bool TreeToLLVM::EmitBuiltinReturnAddr(tree exp, Value *&Result, bool isFrame) { - tree arglist = CALL_EXPR_ARGS(exp); - if (!validate_arglist(exp, INTEGER_TYPE, VOID_TYPE)) +bool TreeToLLVM::EmitBuiltinReturnAddr(gimple stmt, Value *&Result, + bool isFrame) { + if (!validate_gimple_arglist(stmt, INTEGER_TYPE, VOID_TYPE)) return false; - ConstantInt *Level = dyn_cast(Emit(TREE_VALUE(arglist), 0)); + ConstantInt *Level = + dyn_cast(Emit(gimple_call_arg(stmt, 0), 0)); if (!Level) { if (isFrame) error("invalid argument to %<__builtin_frame_address%>"); @@ -5381,14 +5203,13 @@ Intrinsic::ID IID = !isFrame ? Intrinsic::returnaddress : Intrinsic::frameaddress; Result = Builder.CreateCall(Intrinsic::getDeclaration(TheModule, IID), Level); - Result = Builder.CreateBitCast(Result, ConvertType(TREE_TYPE(exp))); + Result = Builder.CreateBitCast(Result, + ConvertType(gimple_call_return_type(stmt))); return true; } -bool TreeToLLVM::EmitBuiltinExtractReturnAddr(tree exp, Value *&Result) { - tree arglist = CALL_EXPR_ARGS(exp); - - Value *Ptr = Emit(TREE_VALUE(arglist), 0); +bool TreeToLLVM::EmitBuiltinExtractReturnAddr(gimple stmt, Value *&Result) { + Value *Ptr = Emit(gimple_call_arg(stmt, 0), 0); // FIXME: Actually we should do something like this: // @@ -5403,10 +5224,8 @@ return true; } -bool TreeToLLVM::EmitBuiltinFrobReturnAddr(tree exp, Value *&Result) { - tree arglist = CALL_EXPR_ARGS(exp); - - Value *Ptr = Emit(TREE_VALUE(arglist), 0); +bool TreeToLLVM::EmitBuiltinFrobReturnAddr(gimple stmt, Value *&Result) { + Value *Ptr = Emit(gimple_call_arg(stmt, 0), 0); // FIXME: Actually we should do something like this: // @@ -5420,8 +5239,8 @@ return true; } -bool TreeToLLVM::EmitBuiltinStackSave(tree exp, Value *&Result) { - if (!validate_arglist(exp, VOID_TYPE)) +bool TreeToLLVM::EmitBuiltinStackSave(gimple stmt, Value *&Result) { + if (!validate_gimple_arglist(stmt, VOID_TYPE)) return false; Result = Builder.CreateCall(Intrinsic::getDeclaration(TheModule, @@ -5456,8 +5275,8 @@ #define HARD_REGNO_CALL_PART_CLOBBERED(REGNO, MODE) 0 #endif -bool TreeToLLVM::EmitBuiltinDwarfCFA(tree exp, Value *&Result) { - if (!validate_arglist(exp, VOID_TYPE)) +bool TreeToLLVM::EmitBuiltinDwarfCFA(gimple stmt, Value *&Result) { + if (!validate_gimple_arglist(stmt, VOID_TYPE)) return false; int cfa_offset = ARG_POINTER_CFA_OFFSET(exp); @@ -5470,24 +5289,23 @@ return true; } -bool TreeToLLVM::EmitBuiltinDwarfSPColumn(tree exp, Value *&Result) { - if (!validate_arglist(exp, VOID_TYPE)) +bool TreeToLLVM::EmitBuiltinDwarfSPColumn(gimple stmt, Value *&Result) { + if (!validate_gimple_arglist(stmt, VOID_TYPE)) return false; unsigned int dwarf_regnum = DWARF_FRAME_REGNUM(STACK_POINTER_REGNUM); - Result = ConstantInt::get(ConvertType(TREE_TYPE(exp)), dwarf_regnum); + Result = ConstantInt::get(ConvertType(gimple_call_return_type(stmt)), + dwarf_regnum); return true; } -bool TreeToLLVM::EmitBuiltinEHReturnDataRegno(tree exp, Value *&Result) { +bool TreeToLLVM::EmitBuiltinEHReturnDataRegno(gimple stmt, Value *&Result) { #ifdef EH_RETURN_DATA_REGNO - tree arglist = CALL_EXPR_ARGS(exp); - - if (!validate_arglist(exp, INTEGER_TYPE, VOID_TYPE)) + if (!validate_gimple_arglist(stmt, INTEGER_TYPE, VOID_TYPE)) return false; - tree which = TREE_VALUE (arglist); + tree which = gimple_call_arg(stmt, 0); unsigned HOST_WIDE_INT iwhich; if (TREE_CODE (which) != INTEGER_CST) { @@ -5502,21 +5320,19 @@ iwhich = DWARF_FRAME_REGNUM (iwhich); - Result = ConstantInt::get(ConvertType(TREE_TYPE(exp)), iwhich); + Result = ConstantInt::get(ConvertType(gimple_call_return_type(stmt)), iwhich); #endif return true; } -bool TreeToLLVM::EmitBuiltinEHReturn(tree exp, Value *&Result) { - tree arglist = CALL_EXPR_ARGS(exp); - - if (!validate_arglist(exp, INTEGER_TYPE, POINTER_TYPE, VOID_TYPE)) +bool TreeToLLVM::EmitBuiltinEHReturn(gimple stmt, Value *&Result) { + if (!validate_gimple_arglist(stmt, INTEGER_TYPE, POINTER_TYPE, VOID_TYPE)) return false; const Type *IntPtr = TD.getIntPtrType(Context); - Value *Offset = Emit(TREE_VALUE(arglist), 0); - Value *Handler = Emit(TREE_VALUE(TREE_CHAIN(arglist)), 0); + Value *Offset = Emit(gimple_call_arg(stmt, 0), 0); + Value *Handler = Emit(gimple_call_arg(stmt, 1), 0); Intrinsic::ID IID = (IntPtr == Type::getInt32Ty(Context) ? Intrinsic::eh_return_i32 : Intrinsic::eh_return_i64); @@ -5536,14 +5352,13 @@ return true; } -bool TreeToLLVM::EmitBuiltinInitDwarfRegSizes(tree exp, Value *&Result) { +bool TreeToLLVM::EmitBuiltinInitDwarfRegSizes(gimple stmt, Value *&Result) { #ifdef DWARF2_UNWIND_INFO unsigned int i; bool wrote_return_column = false; static bool reg_modes_initialized = false; - tree arglist = CALL_EXPR_ARGS(exp); - if (!validate_arglist(exp, POINTER_TYPE, VOID_TYPE)) + if (!validate_gimple_arglist(stmt, POINTER_TYPE, VOID_TYPE)) return false; if (!reg_modes_initialized) { @@ -5551,8 +5366,9 @@ reg_modes_initialized = true; } - Value *Addr = Builder.CreateBitCast(Emit(TREE_VALUE(arglist), 0), - PointerType::getUnqual(Type::getInt8Ty(Context))); + Value *Addr = + Builder.CreateBitCast(Emit(gimple_call_arg(stmt, 0), 0), + PointerType::getUnqual(Type::getInt8Ty(Context))); Constant *Size, *Idx; for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) { @@ -5580,14 +5396,18 @@ } if (!wrote_return_column) { - Size = ConstantInt::get(Type::getInt8Ty(Context), GET_MODE_SIZE (Pmode)); - Idx = ConstantInt::get(Type::getInt32Ty(Context), DWARF_FRAME_RETURN_COLUMN); + Size = ConstantInt::get(Type::getInt8Ty(Context), + GET_MODE_SIZE (Pmode)); + Idx = ConstantInt::get(Type::getInt32Ty(Context), + DWARF_FRAME_RETURN_COLUMN); Builder.CreateStore(Size, Builder.CreateGEP(Addr, Idx), false); } #ifdef DWARF_ALT_FRAME_RETURN_COLUMN - Size = ConstantInt::get(Type::getInt8Ty(Context), GET_MODE_SIZE (Pmode)); - Idx = ConstantInt::get(Type::getInt32Ty(Context), DWARF_ALT_FRAME_RETURN_COLUMN); + Size = ConstantInt::get(Type::getInt8Ty(Context), + GET_MODE_SIZE (Pmode)); + Idx = ConstantInt::get(Type::getInt32Ty(Context), + DWARF_ALT_FRAME_RETURN_COLUMN); Builder.CreateStore(Size, Builder.CreateGEP(Addr, Idx), false); #endif @@ -5598,8 +5418,8 @@ return true; } -bool TreeToLLVM::EmitBuiltinUnwindInit(tree exp, Value *&Result) { - if (!validate_arglist(exp, VOID_TYPE)) +bool TreeToLLVM::EmitBuiltinUnwindInit(gimple stmt, Value *&Result) { + if (!validate_gimple_arglist(stmt, VOID_TYPE)) return false; Result = Builder.CreateCall(Intrinsic::getDeclaration(TheModule, @@ -5608,12 +5428,11 @@ return true; } -bool TreeToLLVM::EmitBuiltinStackRestore(tree exp) { - tree arglist = CALL_EXPR_ARGS(exp); - if (!validate_arglist(exp, POINTER_TYPE, VOID_TYPE)) +bool TreeToLLVM::EmitBuiltinStackRestore(gimple stmt) { + if (!validate_gimple_arglist(stmt, POINTER_TYPE, VOID_TYPE)) return false; - Value *Ptr = Emit(TREE_VALUE(arglist), 0); + Value *Ptr = Emit(gimple_call_arg(stmt, 0), 0); Ptr = Builder.CreateBitCast(Ptr, PointerType::getUnqual(Type::getInt8Ty(Context))); @@ -5623,54 +5442,49 @@ } -bool TreeToLLVM::EmitBuiltinAlloca(tree exp, Value *&Result) { - tree arglist = CALL_EXPR_ARGS(exp); - if (!validate_arglist(exp, INTEGER_TYPE, VOID_TYPE)) +bool TreeToLLVM::EmitBuiltinAlloca(gimple stmt, Value *&Result) { + if (!validate_gimple_arglist(stmt, INTEGER_TYPE, VOID_TYPE)) return false; - Value *Amt = Emit(TREE_VALUE(arglist), 0); + Value *Amt = Emit(gimple_call_arg(stmt, 0), 0); Amt = CastToSIntType(Amt, Type::getInt32Ty(Context)); Result = Builder.CreateAlloca(Type::getInt8Ty(Context), Amt); return true; } -bool TreeToLLVM::EmitBuiltinExpect(tree exp, const MemRef *DestLoc, +bool TreeToLLVM::EmitBuiltinExpect(gimple stmt, const MemRef *DestLoc, Value *&Result) { // Ignore the hint for now, just expand the expr. This is safe, but not // optimal. - tree arglist = CALL_EXPR_ARGS(exp); - if (arglist == NULL_TREE || TREE_CHAIN(arglist) == NULL_TREE) + if (gimple_call_num_args(stmt) < 2) return true; - Result = Emit(TREE_VALUE(arglist), DestLoc); + Result = Emit(gimple_call_arg(stmt, 0), DestLoc); return true; } -bool TreeToLLVM::EmitBuiltinVAStart(tree exp) { - if (call_expr_nargs(exp) < 2) { - error_at (EXPR_LOCATION(exp), "too few arguments to function %"); +bool TreeToLLVM::EmitBuiltinVAStart(gimple stmt) { + if (gimple_call_num_args(stmt) < 2) { + error_at (gimple_location(stmt), + "too few arguments to function %"); return true; } tree fntype = TREE_TYPE(current_function_decl); if (TYPE_ARG_TYPES(fntype) == 0 || - (TREE_VALUE(tree_last(TYPE_ARG_TYPES(fntype))) == void_type_node)) { + (tree_last(TYPE_ARG_TYPES(fntype)) == void_type_node)) { error("% used in function with fixed args"); return true; } - // Check for errors. - if (fold_builtin_next_arg (exp, true)) - return true; - Constant *va_start = Intrinsic::getDeclaration(TheModule, Intrinsic::vastart); - Value *ArgVal = Emit(TREE_VALUE(CALL_EXPR_ARGS(exp)), 0); + Value *ArgVal = Emit(gimple_call_arg(stmt, 0), 0); ArgVal = Builder.CreateBitCast(ArgVal, PointerType::getUnqual(Type::getInt8Ty(Context))); Builder.CreateCall(va_start, ArgVal); return true; } -bool TreeToLLVM::EmitBuiltinVAEnd(tree exp) { - Value *Arg = Emit(TREE_VALUE(CALL_EXPR_ARGS(exp)), 0); +bool TreeToLLVM::EmitBuiltinVAEnd(gimple stmt) { + Value *Arg = Emit(gimple_call_arg(stmt, 0), 0); Arg = Builder.CreateBitCast(Arg, PointerType::getUnqual(Type::getInt8Ty(Context))); Builder.CreateCall(Intrinsic::getDeclaration(TheModule, Intrinsic::vaend), @@ -5678,9 +5492,9 @@ return true; } -bool TreeToLLVM::EmitBuiltinVACopy(tree exp) { - tree Arg1T = TREE_VALUE(CALL_EXPR_ARGS(exp)); - tree Arg2T = TREE_VALUE(TREE_CHAIN(CALL_EXPR_ARGS(exp))); +bool TreeToLLVM::EmitBuiltinVACopy(gimple stmt) { + tree Arg1T = gimple_call_arg(stmt, 0); + tree Arg2T = gimple_call_arg(stmt, 1); Value *Arg1 = Emit(Arg1T, 0); // Emit the address of the destination. // The second arg of llvm.va_copy is a pointer to a valist. @@ -5709,21 +5523,20 @@ return true; } -bool TreeToLLVM::EmitBuiltinInitTrampoline(tree exp, Value *&Result) { - tree arglist = CALL_EXPR_ARGS(exp); - if (!validate_arglist (exp, POINTER_TYPE, POINTER_TYPE, POINTER_TYPE, +bool TreeToLLVM::EmitBuiltinInitTrampoline(gimple stmt, Value *&Result) { + if (!validate_gimple_arglist(stmt, POINTER_TYPE, POINTER_TYPE, POINTER_TYPE, VOID_TYPE)) return false; static const Type *VPTy = PointerType::getUnqual(Type::getInt8Ty(Context)); - Value *Tramp = Emit(TREE_VALUE(arglist), 0); + Value *Tramp = Emit(gimple_call_arg(stmt, 0), 0); Tramp = Builder.CreateBitCast(Tramp, VPTy); - Value *Func = Emit(TREE_VALUE(TREE_CHAIN(arglist)), 0); + Value *Func = Emit(gimple_call_arg(stmt, 1), 0); Func = Builder.CreateBitCast(Func, VPTy); - Value *Chain = Emit(TREE_VALUE(TREE_CHAIN(TREE_CHAIN(arglist))), 0); + Value *Chain = Emit(gimple_call_arg(stmt, 2), 0); Chain = Builder.CreateBitCast(Chain, VPTy); Value *Ops[3] = { Tramp, Func, Chain }; @@ -7590,6 +7403,117 @@ } //===----------------------------------------------------------------------===// +// ... GIMPLE conversion helpers ... +//===----------------------------------------------------------------------===// + +/// WriteScalarToLHS - Store RHS, a non-aggregate value, into the given LHS. +void TreeToLLVM::WriteScalarToLHS(tree lhs, Value *RHS) { + // Perform a useless type conversion (useless_type_conversion_p). + RHS = Builder.CreateBitCast(RHS, ConvertType(TREE_TYPE(lhs))); + + // If this is the definition of an ssa name, record it in the SSANames map. + if (TREE_CODE(lhs) == SSA_NAME) { + assert(SSANames.find(lhs) == SSANames.end() &&"Multiply defined SSA name!"); + SSANames[lhs] = RHS; + return; + } + + if (canEmitRegisterVariable(lhs)) { + // If this is a store to a register variable, EmitLV can't handle the dest + // (there is no l-value of a register variable). Emit an inline asm node + // that copies the value into the specified register. + EmitModifyOfRegisterVariable(lhs, RHS); + return; + } + + LValue LV = EmitLV(lhs); + bool isVolatile = TREE_THIS_VOLATILE(lhs); + unsigned Alignment = LV.getAlignment(); + + if (!LV.isBitfield()) { + // Non-bitfield, scalar value. Just emit a store. + StoreInst *SI = Builder.CreateStore(RHS, LV.Ptr, isVolatile); + SI->setAlignment(Alignment); + return; + } + + // Last case, this is a store to a bitfield, so we have to emit a + // read/modify/write sequence. + + if (!LV.BitSize) + return; + + const Type *ValTy = cast(LV.Ptr->getType())->getElementType(); + unsigned ValSizeInBits = ValTy->getPrimitiveSizeInBits(); + + // The number of stores needed to write the entire bitfield. + unsigned Strides = 1 + (LV.BitStart + LV.BitSize - 1) / ValSizeInBits; + + assert(ValTy->isInteger() && "Invalid bitfield lvalue!"); + assert(ValSizeInBits > LV.BitStart && "Bad bitfield lvalue!"); + assert(ValSizeInBits >= LV.BitSize && "Bad bitfield lvalue!"); + assert(2*ValSizeInBits > LV.BitSize+LV.BitStart && "Bad bitfield lvalue!"); + + bool Signed = !TYPE_UNSIGNED(TREE_TYPE(lhs)); + RHS = CastToAnyType(RHS, Signed, ValTy, Signed); + + for (unsigned I = 0; I < Strides; I++) { + unsigned Index = BYTES_BIG_ENDIAN ? Strides - I - 1 : I; // LSB first + unsigned ThisFirstBit = Index * ValSizeInBits; + unsigned ThisLastBitPlusOne = ThisFirstBit + ValSizeInBits; + if (ThisFirstBit < LV.BitStart) + ThisFirstBit = LV.BitStart; + if (ThisLastBitPlusOne > LV.BitStart+LV.BitSize) + ThisLastBitPlusOne = LV.BitStart+LV.BitSize; + + Value *Ptr = Index ? + Builder.CreateGEP(LV.Ptr, ConstantInt::get(Type::getInt32Ty(Context), Index)) : + LV.Ptr; + LoadInst *LI = Builder.CreateLoad(Ptr, isVolatile); + LI->setAlignment(Alignment); + Value *OldVal = LI; + Value *NewVal = RHS; + + unsigned BitsInVal = ThisLastBitPlusOne - ThisFirstBit; + unsigned FirstBitInVal = ThisFirstBit % ValSizeInBits; + + if (BYTES_BIG_ENDIAN) + FirstBitInVal = ValSizeInBits-FirstBitInVal-BitsInVal; + + // If not storing into the zero'th bit, shift the Src value to the left. + if (FirstBitInVal) { + Value *ShAmt = ConstantInt::get(ValTy, FirstBitInVal); + NewVal = Builder.CreateShl(NewVal, ShAmt); + } + + // Next, if this doesn't touch the top bit, mask out any bits that shouldn't + // be set in the result. + uint64_t MaskVal = ((1ULL << BitsInVal)-1) << FirstBitInVal; + Constant *Mask = ConstantInt::get(Type::getInt64Ty(Context), MaskVal); + Mask = Builder.getFolder().CreateTruncOrBitCast(Mask, ValTy); + + if (FirstBitInVal+BitsInVal != ValSizeInBits) + NewVal = Builder.CreateAnd(NewVal, Mask); + + // Next, mask out the bits this bit-field should include from the old value. + Mask = Builder.getFolder().CreateNot(Mask); + OldVal = Builder.CreateAnd(OldVal, Mask); + + // Finally, merge the two together and store it. + NewVal = Builder.CreateOr(OldVal, NewVal); + + StoreInst *SI = Builder.CreateStore(NewVal, Ptr, isVolatile); + SI->setAlignment(Alignment); + + if (I + 1 < Strides) { + Value *ShAmt = ConstantInt::get(ValTy, BitsInVal); + RHS = Builder.CreateLShr(RHS, ShAmt); + } + } +} + + +//===----------------------------------------------------------------------===// // ... Convert GIMPLE to LLVM ... //===----------------------------------------------------------------------===// @@ -8014,147 +7938,48 @@ FreeConstTupleStrings(ReplacementStrings, NumInputs+NumOutputs); } -void TreeToLLVM::RenderGIMPLE_COND(gimple stmt) { - // Emit the comparison. - Value *Cond = EmitCompare(gimple_cond_lhs(stmt), gimple_cond_rhs(stmt), - gimple_cond_code(stmt)); - - // Extract the target basic blocks. - edge true_edge, false_edge; - extract_true_false_edges_from_block(gimple_bb(stmt), &true_edge, &false_edge); - BasicBlock *IfTrue = getBasicBlock(true_edge->dest); - BasicBlock *IfFalse = getBasicBlock(false_edge->dest); - - // Branch based on the condition. - Builder.CreateCondBr(Cond, IfTrue, IfFalse); -} - void TreeToLLVM::RenderGIMPLE_ASSIGN(gimple stmt) { tree lhs = gimple_assign_lhs(stmt); - - Value *RHS = 0; - - if (!isAggregateTreeType(TREE_TYPE(lhs))) - RHS = Builder.CreateBitCast(EmitGimpleAssignRHS(stmt, 0), - ConvertType(TREE_TYPE(lhs))); - - // If this is the definition of an ssa name, record it in the SSANames map. - if (TREE_CODE(lhs) == SSA_NAME) { - assert(SSANames.find(lhs) == SSANames.end() &&"Multiply defined SSA name!"); - assert(RHS && "SSA name has aggregate type!"); - SSANames[lhs] = RHS; - return; - } - - if (canEmitRegisterVariable(lhs)) { - // If this is a store to a register variable, EmitLV can't handle the dest - // (there is no l-value of a register variable). Emit an inline asm node - // that copies the value into the specified register. - assert(RHS && "Register has aggregate type!"); - EmitModifyOfRegisterVariable(lhs, RHS); - return; - } - - LValue LV = EmitLV(lhs); - bool isVolatile = TREE_THIS_VOLATILE(lhs); - unsigned Alignment = LV.getAlignment(); - if (TREE_CODE(lhs) == COMPONENT_REF) - if (const StructType *STy = - dyn_cast(ConvertType(TREE_TYPE(TREE_OPERAND(lhs, 0))))) - if (STy->isPacked()) - // Packed struct members use 1 byte alignment - Alignment = 1; - - if (!LV.isBitfield()) { - if (RHS) { - // Non-bitfield, scalar value. Just emit a store. - StoreInst *SI = Builder.CreateStore(RHS, LV.Ptr, isVolatile); - SI->setAlignment(Alignment); - return; - } - - // Non-bitfield aggregate value. - MemRef NewLoc(LV.Ptr, Alignment, isVolatile); + if (isAggregateTreeType(TREE_TYPE(lhs))) { + LValue LV = EmitLV(lhs); + MemRef NewLoc(LV.Ptr, LV.getAlignment(), TREE_THIS_VOLATILE(lhs)); // TODO: This case can presumably only happen with special gimple // assign right-hand-sides. Try to simplify by exploiting this. EmitGimpleAssignRHS(stmt, &NewLoc); return; } + WriteScalarToLHS(lhs, EmitGimpleAssignRHS(stmt, 0)); +} - // Last case, this is a store to a bitfield, so we have to emit a - // read/modify/write sequence. - assert(RHS && "Bitfield has aggregate type!"); - - if (!LV.BitSize) +void TreeToLLVM::RenderGIMPLE_CALL(gimple stmt) { + tree lhs = gimple_call_lhs(stmt); + if (!lhs) { + EmitGimpleCallRHS(stmt, 0); return; + } - const Type *ValTy = cast(LV.Ptr->getType())->getElementType(); - unsigned ValSizeInBits = ValTy->getPrimitiveSizeInBits(); - - // The number of stores needed to write the entire bitfield. - unsigned Strides = 1 + (LV.BitStart + LV.BitSize - 1) / ValSizeInBits; - - assert(ValTy->isInteger() && "Invalid bitfield lvalue!"); - assert(ValSizeInBits > LV.BitStart && "Bad bitfield lvalue!"); - assert(ValSizeInBits >= LV.BitSize && "Bad bitfield lvalue!"); - assert(2*ValSizeInBits > LV.BitSize+LV.BitStart && "Bad bitfield lvalue!"); - - bool Signed = !TYPE_UNSIGNED(TREE_TYPE(lhs)); - RHS = CastToAnyType(RHS, Signed, ValTy, Signed); - - for (unsigned I = 0; I < Strides; I++) { - unsigned Index = BYTES_BIG_ENDIAN ? Strides - I - 1 : I; // LSB first - unsigned ThisFirstBit = Index * ValSizeInBits; - unsigned ThisLastBitPlusOne = ThisFirstBit + ValSizeInBits; - if (ThisFirstBit < LV.BitStart) - ThisFirstBit = LV.BitStart; - if (ThisLastBitPlusOne > LV.BitStart+LV.BitSize) - ThisLastBitPlusOne = LV.BitStart+LV.BitSize; - - Value *Ptr = Index ? - Builder.CreateGEP(LV.Ptr, ConstantInt::get(Type::getInt32Ty(Context), Index)) : - LV.Ptr; - LoadInst *LI = Builder.CreateLoad(Ptr, isVolatile); - LI->setAlignment(Alignment); - Value *OldVal = LI; - Value *NewVal = RHS; - - unsigned BitsInVal = ThisLastBitPlusOne - ThisFirstBit; - unsigned FirstBitInVal = ThisFirstBit % ValSizeInBits; - - if (BYTES_BIG_ENDIAN) - FirstBitInVal = ValSizeInBits-FirstBitInVal-BitsInVal; - - // If not storing into the zero'th bit, shift the Src value to the left. - if (FirstBitInVal) { - Value *ShAmt = ConstantInt::get(ValTy, FirstBitInVal); - NewVal = Builder.CreateShl(NewVal, ShAmt); - } - - // Next, if this doesn't touch the top bit, mask out any bits that shouldn't - // be set in the result. - uint64_t MaskVal = ((1ULL << BitsInVal)-1) << FirstBitInVal; - Constant *Mask = ConstantInt::get(Type::getInt64Ty(Context), MaskVal); - Mask = Builder.getFolder().CreateTruncOrBitCast(Mask, ValTy); - - if (FirstBitInVal+BitsInVal != ValSizeInBits) - NewVal = Builder.CreateAnd(NewVal, Mask); - - // Next, mask out the bits this bit-field should include from the old value. - Mask = Builder.getFolder().CreateNot(Mask); - OldVal = Builder.CreateAnd(OldVal, Mask); + if (isAggregateTreeType(TREE_TYPE(lhs))) { + LValue LV = EmitLV(lhs); + MemRef NewLoc(LV.Ptr, LV.getAlignment(), TREE_THIS_VOLATILE(lhs)); + EmitGimpleCallRHS(stmt, &NewLoc); + return; + } + WriteScalarToLHS(lhs, EmitGimpleCallRHS(stmt, 0)); +} - // Finally, merge the two together and store it. - NewVal = Builder.CreateOr(OldVal, NewVal); +void TreeToLLVM::RenderGIMPLE_COND(gimple stmt) { + // Emit the comparison. + Value *Cond = EmitCompare(gimple_cond_lhs(stmt), gimple_cond_rhs(stmt), + gimple_cond_code(stmt)); - StoreInst *SI = Builder.CreateStore(NewVal, Ptr, isVolatile); - SI->setAlignment(Alignment); + // Extract the target basic blocks. + edge true_edge, false_edge; + extract_true_false_edges_from_block(gimple_bb(stmt), &true_edge, &false_edge); + BasicBlock *IfTrue = getBasicBlock(true_edge->dest); + BasicBlock *IfFalse = getBasicBlock(false_edge->dest); - if (I + 1 < Strides) { - Value *ShAmt = ConstantInt::get(ValTy, BitsInVal); - RHS = Builder.CreateLShr(RHS, ShAmt); - } - } + // Branch based on the condition. + Builder.CreateCondBr(Cond, IfTrue, IfFalse); } void TreeToLLVM::RenderGIMPLE_GOTO(gimple stmt) { Modified: gcc-plugin/trunk/llvm-internal.h URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-internal.h?rev=82316&r1=82315&r2=82316&view=diff ============================================================================== --- gcc-plugin/trunk/llvm-internal.h (original) +++ gcc-plugin/trunk/llvm-internal.h Sat Sep 19 11:56:26 2009 @@ -508,13 +508,17 @@ private: // Render* - Convert GIMPLE to LLVM. - void RenderGIMPLE_ASM(gimple_statement_d *); - void RenderGIMPLE_ASSIGN(gimple_statement_d *); - void RenderGIMPLE_COND(gimple_statement_d *); - void RenderGIMPLE_GOTO(gimple_statement_d *); - void RenderGIMPLE_RESX(gimple_statement_d *); - void RenderGIMPLE_RETURN(gimple_statement_d *); - void RenderGIMPLE_SWITCH(gimple_statement_d *); + void RenderGIMPLE_ASM(gimple stmt); + void RenderGIMPLE_ASSIGN(gimple stmt); + void RenderGIMPLE_CALL(gimple stmt); + void RenderGIMPLE_COND(gimple stmt); + void RenderGIMPLE_GOTO(gimple stmt); + void RenderGIMPLE_RESX(gimple stmt); + void RenderGIMPLE_RETURN(gimple stmt); + void RenderGIMPLE_SWITCH(gimple stmt); + + // Render helpers. + void WriteScalarToLHS(tree lhs, Value *Scalar); private: void EmitAutomaticVariableDecl(tree_node *decl); @@ -538,14 +542,13 @@ // Expressions. Value *EmitSSA_NAME(tree_node *exp); Value *EmitGimpleAssignRHS(gimple stmt, const MemRef *DestLoc); + Value *EmitGimpleCallRHS(gimple stmt, const MemRef *DestLoc); Value *EmitLoadOfLValue(tree_node *exp, const MemRef *DestLoc); Value *EmitOBJ_TYPE_REF(tree_node *exp, const MemRef *DestLoc); Value *EmitADDR_EXPR(tree_node *exp); Value *EmitOBJ_TYPE_REF(tree_node *exp); - Value *EmitCALL_EXPR(tree_node *exp, const MemRef *DestLoc); - Value *EmitCallOf(Value *Callee, tree_node *exp, const MemRef *DestLoc, + Value *EmitCallOf(Value *Callee, gimple stmt, const MemRef *DestLoc, const AttrListPtr &PAL); - Value *EmitMODIFY_EXPR(tree_node *exp, const MemRef *DestLoc); Value *EmitNOP_EXPR(tree_node *type, tree_node *op, const MemRef *DestLoc); Value *EmitCONVERT_EXPR(tree_node *type, tree_node *op); Value *EmitVIEW_CONVERT_EXPR(tree_node *exp, const MemRef *DestLoc); @@ -585,44 +588,44 @@ Value *BuildVector(const std::vector &Elts); Value *BuildVector(Value *Elt, ...); Value *BuildVectorShuffle(Value *InVec1, Value *InVec2, ...); - Value *BuildBinaryAtomicBuiltin(tree_node *exp, Intrinsic::ID id); - Value *BuildCmpAndSwapAtomicBuiltin(tree_node *exp, tree_node *type, + Value *BuildBinaryAtomicBuiltin(gimple stmt, Intrinsic::ID id); + Value *BuildCmpAndSwapAtomicBuiltin(gimple stmt, tree_node *type, bool isBool); // Builtin Function Expansion. - bool EmitBuiltinCall(tree_node *exp, tree_node *fndecl, + bool EmitBuiltinCall(gimple stmt, tree_node *fndecl, const MemRef *DestLoc, Value *&Result); - bool EmitFrontendExpandedBuiltinCall(tree_node *exp, tree_node *fndecl, + bool EmitFrontendExpandedBuiltinCall(gimple stmt, tree_node *fndecl, const MemRef *DestLoc, Value *&Result); bool EmitBuiltinUnaryOp(Value *InVal, Value *&Result, Intrinsic::ID Id); - Value *EmitBuiltinSQRT(tree_node *exp); - Value *EmitBuiltinPOWI(tree_node *exp); - Value *EmitBuiltinPOW(tree_node *exp); - - bool EmitBuiltinConstantP(tree_node *exp, Value *&Result); - bool EmitBuiltinAlloca(tree_node *exp, Value *&Result); - bool EmitBuiltinExpect(tree_node *exp, const MemRef *DestLoc, Value *&Result); - bool EmitBuiltinExtendPointer(tree_node *exp, Value *&Result); - bool EmitBuiltinVAStart(tree_node *exp); - bool EmitBuiltinVAEnd(tree_node *exp); - bool EmitBuiltinVACopy(tree_node *exp); - bool EmitBuiltinMemCopy(tree_node *exp, Value *&Result, + Value *EmitBuiltinSQRT(gimple stmt); + Value *EmitBuiltinPOWI(gimple stmt); + Value *EmitBuiltinPOW(gimple stmt); + + bool EmitBuiltinConstantP(gimple stmt, Value *&Result); + bool EmitBuiltinAlloca(gimple stmt, Value *&Result); + bool EmitBuiltinExpect(gimple stmt, const MemRef *DestLoc, Value *&Result); + bool EmitBuiltinExtendPointer(gimple stmt, Value *&Result); + bool EmitBuiltinVAStart(gimple stmt); + bool EmitBuiltinVAEnd(gimple stmt); + bool EmitBuiltinVACopy(gimple stmt); + bool EmitBuiltinMemCopy(gimple stmt, Value *&Result, bool isMemMove, bool SizeCheck); - bool EmitBuiltinMemSet(tree_node *exp, Value *&Result, bool SizeCheck); - bool EmitBuiltinBZero(tree_node *exp, Value *&Result); - bool EmitBuiltinPrefetch(tree_node *exp); - bool EmitBuiltinReturnAddr(tree_node *exp, Value *&Result, bool isFrame); - bool EmitBuiltinExtractReturnAddr(tree_node *exp, Value *&Result); - bool EmitBuiltinFrobReturnAddr(tree_node *exp, Value *&Result); - bool EmitBuiltinStackSave(tree_node *exp, Value *&Result); - bool EmitBuiltinStackRestore(tree_node *exp); - bool EmitBuiltinDwarfCFA(tree_node *exp, Value *&Result); - bool EmitBuiltinDwarfSPColumn(tree_node *exp, Value *&Result); - bool EmitBuiltinEHReturnDataRegno(tree_node *exp, Value *&Result); - bool EmitBuiltinEHReturn(tree_node *exp, Value *&Result); - bool EmitBuiltinInitDwarfRegSizes(tree_node *exp, Value *&Result); - bool EmitBuiltinUnwindInit(tree_node *exp, Value *&Result); - bool EmitBuiltinInitTrampoline(tree_node *exp, Value *&Result); + bool EmitBuiltinMemSet(gimple stmt, Value *&Result, bool SizeCheck); + bool EmitBuiltinBZero(gimple stmt, Value *&Result); + bool EmitBuiltinPrefetch(gimple stmt); + bool EmitBuiltinReturnAddr(gimple stmt, Value *&Result, bool isFrame); + bool EmitBuiltinExtractReturnAddr(gimple stmt, Value *&Result); + bool EmitBuiltinFrobReturnAddr(gimple stmt, Value *&Result); + bool EmitBuiltinStackSave(gimple stmt, Value *&Result); + bool EmitBuiltinStackRestore(gimple stmt); + bool EmitBuiltinDwarfCFA(gimple stmt, Value *&Result); + bool EmitBuiltinDwarfSPColumn(gimple stmt, Value *&Result); + bool EmitBuiltinEHReturnDataRegno(gimple stmt, Value *&Result); + bool EmitBuiltinEHReturn(gimple stmt, Value *&Result); + bool EmitBuiltinInitDwarfRegSizes(gimple stmt, Value *&Result); + bool EmitBuiltinUnwindInit(gimple stmt, Value *&Result); + bool EmitBuiltinInitTrampoline(gimple stmt, Value *&Result); // Complex Math Expressions. void EmitLoadFromComplex(Value *&Real, Value *&Imag, MemRef SrcComplex); @@ -650,7 +653,7 @@ Value *EmitCONSTRUCTOR(tree_node *exp, const MemRef *DestLoc); // Optional target defined builtin intrinsic expanding function. - bool TargetIntrinsicLower(tree_node *exp, + bool TargetIntrinsicLower(gimple stmt, unsigned FnCode, const MemRef *DestLoc, Value *&Result, From daniel at zuster.org Sat Sep 19 12:12:47 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Sat, 19 Sep 2009 10:12:47 -0700 Subject: [llvm-commits] Nightly Test Regressions Message-ID: <6a8523d60909191012y6fb7f512i8b1a02d9c5190f1b@mail.gmail.com> Hi All, There were a large number of regressions on the nightly tests last night. I'd appreciate some help in tracking down the failures. This is a summary of the important new failures: This is failing in many places: SingleSource/Regression/C++/EH/exception_spec_test [LLC, LLC-BETA, LLC compile, LLC_BETA compile] and these are failing in some places: SingleSource/Benchmarks/Shootout-C++/except [LLC, LLC-BETA, LLC compile, LLC_BETA compile] SingleSource/Regression/C++/EH/ctor_dtor_count-2 [LLC, LLC-BETA, LLC compile, LLC_BETA compile] SingleSource/Regression/C++/EH/throw_rethrow_test [LLC, LLC-BETA, LLC compile, LLC_BETA compile] and this is failing when built with clang: SingleSource/UnitTests/ObjC/exceptions [LLC, LLC-BETA, LLC compile, LLC_BETA compile] Bill, Chris, Eric, Duncan: Can you guys sort out someone to look at it? This is failing in a number of places: Externals/SPEC/CINT2006/483_xalancbmk/483_xalancbmk [JIT, JIT codegen, LLC, LLC-BETA, LLC compile, Bitcode, GCCAS, LLC_BETA compile] Externals/SPEC/CINT2006/483_xalancbmk/483_xalancbmk [JIT, CBE, JIT codegen, LLC, LLC-BETA, LLC compile, Bitcode, GCCAS, LLC_BETA compile] and these are failing in at least one place: Externals/SPEC/CINT2006/471_omnetpp/471_omnetpp [LLC, LLC-BETA, LLC compile, LLC_BETA compile] Externals/SPEC/CINT2000/252_eon/252_eon [JIT codegen] Evan or Dan, can you guys point a finger or take a look? Thanks, - Daniel From anton at korobeynikov.info Sat Sep 19 12:39:01 2009 From: anton at korobeynikov.info (Anton Korobeynikov) Date: Sat, 19 Sep 2009 21:39:01 +0400 Subject: [llvm-commits] Nightly Test Regressions In-Reply-To: <6a8523d60909191012y6fb7f512i8b1a02d9c5190f1b@mail.gmail.com> References: <6a8523d60909191012y6fb7f512i8b1a02d9c5190f1b@mail.gmail.com> Message-ID: Hello, Everyone > This is failing in a number of places: > ?Externals/SPEC/CINT2006/483_xalancbmk/483_xalancbmk [JIT, JIT > codegen, LLC, LLC-BETA, LLC compile, Bitcode, GCCAS, LLC_BETA compile] > ?Externals/SPEC/CINT2006/483_xalancbmk/483_xalancbmk [JIT, CBE, JIT > codegen, LLC, LLC-BETA, LLC compile, Bitcode, GCCAS, LLC_BETA compile] > and these are failing in at least one place: > ?Externals/SPEC/CINT2006/471_omnetpp/471_omnetpp [LLC, LLC-BETA, LLC > compile, LLC_BETA compile] These 2 definitely use EH during normal run, so the fails might be connected to EH ones. So far I'm seeing the only suspicious commit: Bill's changes in r82274. -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University From evan.cheng at apple.com Sat Sep 19 13:18:05 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Sat, 19 Sep 2009 11:18:05 -0700 Subject: [llvm-commits] Nightly Test Regressions In-Reply-To: References: <6a8523d60909191012y6fb7f512i8b1a02d9c5190f1b@mail.gmail.com> Message-ID: <1A83B82E-8A72-4649-8F27-A721A1ADDE41@apple.com> Yeah. It's likely Bill's change is responsible all of the failures. I'll already informed him last night. Evan On Sep 19, 2009, at 10:39 AM, Anton Korobeynikov wrote: > Hello, Everyone > >> This is failing in a number of places: >> Externals/SPEC/CINT2006/483_xalancbmk/483_xalancbmk [JIT, JIT >> codegen, LLC, LLC-BETA, LLC compile, Bitcode, GCCAS, LLC_BETA >> compile] >> Externals/SPEC/CINT2006/483_xalancbmk/483_xalancbmk [JIT, CBE, JIT >> codegen, LLC, LLC-BETA, LLC compile, Bitcode, GCCAS, LLC_BETA >> compile] >> and these are failing in at least one place: >> Externals/SPEC/CINT2006/471_omnetpp/471_omnetpp [LLC, LLC-BETA, LLC >> compile, LLC_BETA compile] > These 2 definitely use EH during normal run, so the fails might be > connected to EH ones. So far I'm seeing the only suspicious commit: > Bill's changes in r82274. > > -- > With best regards, Anton Korobeynikov > Faculty of Mathematics and Mechanics, Saint Petersburg State > University From clattner at apple.com Sat Sep 19 13:22:04 2009 From: clattner at apple.com (Chris Lattner) Date: Sat, 19 Sep 2009 11:22:04 -0700 Subject: [llvm-commits] [llvm] r82311 - in /llvm/trunk: lib/CodeGen/SelectionDAG/ lib/Target/ARM/ lib/Target/Alpha/ lib/Target/MSP430/ lib/Target/Mips/ lib/Target/PIC16/ lib/Target/PowerPC/ lib/Target/Sparc/ lib/Target/SystemZ/ lib/Target/X86/ lib/Target/XCore/ test/CodeGen/X86/ In-Reply-To: <200909190951.n8J9p5E7007710@zion.cs.uiuc.edu> References: <200909190951.n8J9p5E7007710@zion.cs.uiuc.edu> Message-ID: <0CDA083D-C7B8-4AE1-B45D-B39C157CD0DF@apple.com> On Sep 19, 2009, at 2:51 AM, Evan Cheng wrote: > Author: evancheng > Date: Sat Sep 19 04:51:03 2009 > New Revision: 82311 > > URL: http://llvm.org/viewvc/llvm-project?rev=82311&view=rev > Log: > Fix PR4926. When target hook EmitInstrWithCustomInserter() insert > new basic blocks and update CFG, it should also inform sdisel of the > changes so the phi source operands will come from the right basic > blocks. Would it be possible for the machine code verifier to catch bugs like this? -Chris From nicholas at mxc.ca Sat Sep 19 13:33:36 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Sat, 19 Sep 2009 18:33:36 -0000 Subject: [llvm-commits] [llvm] r82317 - in /llvm/trunk: include/llvm/Analysis/SparsePropagation.h lib/Analysis/SparsePropagation.cpp Message-ID: <200909191833.n8JIXaCE010318@zion.cs.uiuc.edu> Author: nicholas Date: Sat Sep 19 13:33:36 2009 New Revision: 82317 URL: http://llvm.org/viewvc/llvm-project?rev=82317&view=rev Log: Lett users of sparse propagation do their own thing with phi nodes if they want to. This can be combined with LCSSA or SSI form to store more information on a PHINode than can be computed by looking at its incoming values. Modified: llvm/trunk/include/llvm/Analysis/SparsePropagation.h llvm/trunk/lib/Analysis/SparsePropagation.cpp Modified: llvm/trunk/include/llvm/Analysis/SparsePropagation.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/SparsePropagation.h?rev=82317&r1=82316&r2=82317&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/SparsePropagation.h (original) +++ llvm/trunk/include/llvm/Analysis/SparsePropagation.h Sat Sep 19 13:33:36 2009 @@ -72,6 +72,12 @@ virtual LatticeVal ComputeConstant(Constant *C) { return getOverdefinedVal(); // always safe } + + /// IsSpecialCasedPHI - Given a PHI node, determine whether this PHI node is + /// one that the we want to handle through ComputeInstructionState. + virtual bool IsSpecialCasedPHI(PHINode *PN) { + return false; + } /// GetConstant - If the specified lattice value is representable as an LLVM /// constant value, return it. Otherwise return null. The returned value Modified: llvm/trunk/lib/Analysis/SparsePropagation.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/SparsePropagation.cpp?rev=82317&r1=82316&r2=82317&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/SparsePropagation.cpp (original) +++ llvm/trunk/lib/Analysis/SparsePropagation.cpp Sat Sep 19 13:33:36 2009 @@ -223,6 +223,13 @@ } void SparseSolver::visitPHINode(PHINode &PN) { + if (LatticeFunc->IsSpecialCasedPHI(&PN)) { + LatticeVal IV = LatticeFunc->ComputeInstructionState(PN, *this); + if (IV != LatticeFunc->getUntrackedVal()) + UpdateState(PN, IV); + return; + } + LatticeVal PNIV = getOrInitValueState(&PN); LatticeVal Overdefined = LatticeFunc->getOverdefinedVal(); From clattner at apple.com Sat Sep 19 13:53:17 2009 From: clattner at apple.com (Chris Lattner) Date: Sat, 19 Sep 2009 11:53:17 -0700 Subject: [llvm-commits] [llvm] r82312 - /llvm/trunk/lib/Support/CommandLine.cpp In-Reply-To: <200909191001.n8JA1jo2009237@zion.cs.uiuc.edu> References: <200909191001.n8JA1jo2009237@zion.cs.uiuc.edu> Message-ID: On Sep 19, 2009, at 3:01 AM, Benjamin Kramer wrote: > Author: d0k > Date: Sat Sep 19 05:01:45 2009 > New Revision: 82312 > > URL: http://llvm.org/viewvc/llvm-project?rev=82312&view=rev > Log: > Try to speed up the slowest parts of the CommandLine library > > - Replace std::map - Eliminate unnecessary std::string copies > - ~10% speed-up for clang's testsuite on my machine (debug build) Very nice!! -Chris From sabre at nondot.org Sat Sep 19 13:55:05 2009 From: sabre at nondot.org (Chris Lattner) Date: Sat, 19 Sep 2009 18:55:05 -0000 Subject: [llvm-commits] [llvm] r82318 - in /llvm/trunk: include/llvm/Support/CommandLine.h lib/Support/CommandLine.cpp Message-ID: <200909191855.n8JIt5sH013242@zion.cs.uiuc.edu> Author: lattner Date: Sat Sep 19 13:55:05 2009 New Revision: 82318 URL: http://llvm.org/viewvc/llvm-project?rev=82318&view=rev Log: convert a bunch of std::strings to use StringRef. This should eliminate a massive number of temporary strings created when parsing a command line. More still left to eliminate. Modified: llvm/trunk/include/llvm/Support/CommandLine.h llvm/trunk/lib/Support/CommandLine.cpp Modified: llvm/trunk/include/llvm/Support/CommandLine.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/CommandLine.h?rev=82318&r1=82317&r2=82318&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/CommandLine.h (original) +++ llvm/trunk/include/llvm/Support/CommandLine.h Sat Sep 19 13:55:05 2009 @@ -21,18 +21,17 @@ #define LLVM_SUPPORT_COMMANDLINE_H #include "llvm/Support/type_traits.h" -#include "llvm/Support/DataTypes.h" #include "llvm/Support/Compiler.h" #include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/Twine.h" #include #include #include -#include #include #include namespace llvm { - + /// cl Namespace - This namespace contains all of the command line option /// processing machinery. It is intentionally a short name to make qualified /// usage concise. @@ -144,7 +143,7 @@ // argument and the program should exit. // virtual bool handleOccurrence(unsigned pos, const char *ArgName, - const std::string &Arg) = 0; + StringRef Arg) = 0; virtual enum ValueExpected getValueExpectedFlagDefault() const { return ValueOptional; @@ -215,8 +214,7 @@ getOptionHiddenFlag() != 0 && "Not all default flags specified!"); } - inline void setNumAdditionalVals(unsigned n) - { AdditionalVals = n; } + inline void setNumAdditionalVals(unsigned n) { AdditionalVals = n; } public: // addArgument - Register this argument with the commandline system. // @@ -237,10 +235,10 @@ // addOccurrence - Wrapper around handleOccurrence that enforces Flags // bool addOccurrence(unsigned pos, const char *ArgName, - const std::string &Value, bool MultiArg = false); + StringRef Value, bool MultiArg = false); // Prints option name followed by message. Always returns true. - bool error(std::string Message, const char *ArgName = 0); + bool error(const Twine &Message, const char *ArgName = 0); public: inline int getNumOccurrences() const { return NumOccurrences; } @@ -458,9 +456,8 @@ } // parse - Return true on error. - bool parse(Option &O, const char *ArgName, const std::string &Arg, - DataType &V) { - std::string ArgVal; + bool parse(Option &O, const char *ArgName, StringRef Arg, DataType &V) { + StringRef ArgVal; if (hasArgStr) ArgVal = Arg; else @@ -468,7 +465,7 @@ for (unsigned i = 0, e = static_cast(Values.size()); i != e; ++i) - if (ArgVal == Values[i].first) { + if (Values[i].first == ArgVal) { V = Values[i].second.first; return false; } @@ -541,7 +538,7 @@ public: // parse - Return true on error. - bool parse(Option &O, const char *ArgName, const std::string &Arg, bool &Val); + bool parse(Option &O, const char *ArgName, StringRef Arg, bool &Val); template void initialize(Opt &O) { @@ -568,8 +565,7 @@ class parser : public basic_parser { public: // parse - Return true on error. - bool parse(Option &O, const char *ArgName, const std::string &Arg, - boolOrDefault &Val); + bool parse(Option &O, const char *ArgName, StringRef Arg, boolOrDefault &Val); enum ValueExpected getValueExpectedFlagDefault() const { return ValueOptional; @@ -591,7 +587,7 @@ class parser : public basic_parser { public: // parse - Return true on error. - bool parse(Option &O, const char *ArgName, const std::string &Arg, int &Val); + bool parse(Option &O, const char *ArgName, StringRef Arg, int &Val); // getValueName - Overload in subclass to provide a better default value. virtual const char *getValueName() const { return "int"; } @@ -610,7 +606,7 @@ class parser : public basic_parser { public: // parse - Return true on error. - bool parse(Option &O, const char *AN, const std::string &Arg, unsigned &Val); + bool parse(Option &O, const char *AN, StringRef Arg, unsigned &Val); // getValueName - Overload in subclass to provide a better default value. virtual const char *getValueName() const { return "uint"; } @@ -628,7 +624,7 @@ class parser : public basic_parser { public: // parse - Return true on error. - bool parse(Option &O, const char *AN, const std::string &Arg, double &Val); + bool parse(Option &O, const char *AN, StringRef Arg, double &Val); // getValueName - Overload in subclass to provide a better default value. virtual const char *getValueName() const { return "number"; } @@ -646,7 +642,7 @@ class parser : public basic_parser { public: // parse - Return true on error. - bool parse(Option &O, const char *AN, const std::string &Arg, float &Val); + bool parse(Option &O, const char *AN, StringRef Arg, float &Val); // getValueName - Overload in subclass to provide a better default value. virtual const char *getValueName() const { return "number"; } @@ -664,9 +660,8 @@ class parser : public basic_parser { public: // parse - Return true on error. - bool parse(Option &, const char *, const std::string &Arg, - std::string &Value) { - Value = Arg; + bool parse(Option &, const char *, StringRef Arg, std::string &Value) { + Value = Arg.str(); return false; } @@ -686,8 +681,7 @@ class parser : public basic_parser { public: // parse - Return true on error. - bool parse(Option &, const char *, const std::string &Arg, - char &Value) { + bool parse(Option &, const char *, StringRef Arg, char &Value) { Value = Arg[0]; return false; } @@ -834,7 +828,7 @@ ParserClass Parser; virtual bool handleOccurrence(unsigned pos, const char *ArgName, - const std::string &Arg) { + StringRef Arg) { typename ParserClass::parser_data_type Val = typename ParserClass::parser_data_type(); if (Parser.parse(*this, ArgName, Arg, Val)) @@ -1007,7 +1001,7 @@ } virtual bool handleOccurrence(unsigned pos, const char *ArgName, - const std::string &Arg) { + StringRef Arg) { typename ParserClass::parser_data_type Val = typename ParserClass::parser_data_type(); if (Parser.parse(*this, ArgName, Arg, Val)) @@ -1207,7 +1201,7 @@ } virtual bool handleOccurrence(unsigned pos, const char *ArgName, - const std::string &Arg) { + StringRef Arg) { typename ParserClass::parser_data_type Val = typename ParserClass::parser_data_type(); if (Parser.parse(*this, ArgName, Arg, Val)) @@ -1308,7 +1302,7 @@ class alias : public Option { Option *AliasFor; virtual bool handleOccurrence(unsigned pos, const char * /*ArgName*/, - const std::string &Arg) { + StringRef Arg) { return AliasFor->handleOccurrence(pos, AliasFor->ArgStr, Arg); } // Handle printing stuff... Modified: llvm/trunk/lib/Support/CommandLine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/CommandLine.cpp?rev=82318&r1=82317&r2=82318&view=diff ============================================================================== --- llvm/trunk/lib/Support/CommandLine.cpp (original) +++ llvm/trunk/lib/Support/CommandLine.cpp Sat Sep 19 13:55:05 2009 @@ -26,6 +26,7 @@ #include "llvm/System/Path.h" #include "llvm/ADT/OwningPtr.h" #include "llvm/ADT/StringMap.h" +#include "llvm/ADT/Twine.h" #include "llvm/Config/config.h" #include #include @@ -193,7 +194,7 @@ if (Value) return Handler->error("does not allow a value! '" + - std::string(Value) + "' specified."); + Twine(Value) + "' specified."); break; case ValueOptional: break; @@ -205,34 +206,31 @@ } // If this isn't a multi-arg option, just run the handler. - if (NumAdditionalVals == 0) { + if (NumAdditionalVals == 0) return Handler->addOccurrence(i, ArgName, Value ? Value : ""); - } - // If it is, run the handle several times. - else { - bool MultiArg = false; - - if (Value) { - if (Handler->addOccurrence(i, ArgName, Value, MultiArg)) - return true; - --NumAdditionalVals; - MultiArg = true; - } - while (NumAdditionalVals > 0) { + // If it is, run the handle several times. + bool MultiArg = false; - if (i+1 < argc) { - Value = argv[++i]; - } else { - return Handler->error("not enough values!"); - } - if (Handler->addOccurrence(i, ArgName, Value, MultiArg)) - return true; - MultiArg = true; - --NumAdditionalVals; - } - return false; + if (Value) { + if (Handler->addOccurrence(i, ArgName, Value, MultiArg)) + return true; + --NumAdditionalVals; + MultiArg = true; + } + + while (NumAdditionalVals > 0) { + + if (i+1 >= argc) + return Handler->error("not enough values!"); + Value = argv[++i]; + + if (Handler->addOccurrence(i, ArgName, Value, MultiArg)) + return true; + MultiArg = true; + --NumAdditionalVals; } + return false; } static bool ProvidePositionalOption(Option *Handler, const std::string &Arg, @@ -763,7 +761,7 @@ // Option Base class implementation // -bool Option::error(std::string Message, const char *ArgName) { +bool Option::error(const Twine &Message, const char *ArgName) { if (ArgName == 0) ArgName = ArgStr; if (ArgName[0] == 0) errs() << HelpStr; // Be nice for positional arguments @@ -775,8 +773,7 @@ } bool Option::addOccurrence(unsigned pos, const char *ArgName, - const std::string &Value, - bool MultiArg) { + StringRef Value, bool MultiArg) { if (!MultiArg) NumOccurrences++; // Increment the number of times we have been seen @@ -860,42 +857,47 @@ // parser implementation // bool parser::parse(Option &O, const char *ArgName, - const std::string &Arg, bool &Value) { + StringRef Arg, bool &Value) { if (Arg == "" || Arg == "true" || Arg == "TRUE" || Arg == "True" || Arg == "1") { Value = true; - } else if (Arg == "false" || Arg == "FALSE" || Arg == "False" || Arg == "0") { + return false; + } + + if (Arg == "false" || Arg == "FALSE" || Arg == "False" || Arg == "0") { Value = false; - } else { - return O.error("'" + Arg + - "' is invalid value for boolean argument! Try 0 or 1"); + return false; } - return false; + return O.error("'" + Arg + + "' is invalid value for boolean argument! Try 0 or 1"); } // parser implementation // bool parser::parse(Option &O, const char *ArgName, - const std::string &Arg, boolOrDefault &Value) { + StringRef Arg, boolOrDefault &Value) { if (Arg == "" || Arg == "true" || Arg == "TRUE" || Arg == "True" || Arg == "1") { Value = BOU_TRUE; - } else if (Arg == "false" || Arg == "FALSE" - || Arg == "False" || Arg == "0") { + return false; + } + if (Arg == "false" || Arg == "FALSE" || Arg == "False" || Arg == "0") { Value = BOU_FALSE; - } else { - return O.error("'" + Arg + - "' is invalid value for boolean argument! Try 0 or 1"); + return false; } - return false; + + return O.error("'" + Arg + + "' is invalid value for boolean argument! Try 0 or 1"); } // parser implementation // bool parser::parse(Option &O, const char *ArgName, - const std::string &Arg, int &Value) { + StringRef Arg, int &Value) { char *End; - Value = (int)strtol(Arg.c_str(), &End, 0); + // FIXME: Temporary. + std::string TMP = Arg.str(); + Value = (int)strtol(TMP.c_str(), &End, 0); if (*End != 0) return O.error("'" + Arg + "' value invalid for integer argument!"); return false; @@ -904,10 +906,13 @@ // parser implementation // bool parser::parse(Option &O, const char *ArgName, - const std::string &Arg, unsigned &Value) { + StringRef Arg, unsigned &Value) { char *End; errno = 0; - unsigned long V = strtoul(Arg.c_str(), &End, 0); + + // FIXME: Temporary. + std::string TMP = Arg.str(); + unsigned long V = strtoul(TMP.c_str(), &End, 0); Value = (unsigned)V; if (((V == ULONG_MAX) && (errno == ERANGE)) || (*End != 0) @@ -918,8 +923,11 @@ // parser/parser implementation // -static bool parseDouble(Option &O, const std::string &Arg, double &Value) { - const char *ArgStart = Arg.c_str(); +static bool parseDouble(Option &O, StringRef Arg, double &Value) { + // FIXME: Temporary. + std::string TMP = Arg.str(); + + const char *ArgStart = TMP.c_str(); char *End; Value = strtod(ArgStart, &End); if (*End != 0) @@ -928,12 +936,12 @@ } bool parser::parse(Option &O, const char *AN, - const std::string &Arg, double &Val) { + StringRef Arg, double &Val) { return parseDouble(O, Arg, Val); } bool parser::parse(Option &O, const char *AN, - const std::string &Arg, float &Val) { + StringRef Arg, float &Val) { double dVal; if (parseDouble(O, Arg, dVal)) return true; From nicholas at mxc.ca Sat Sep 19 14:00:06 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Sat, 19 Sep 2009 19:00:06 -0000 Subject: [llvm-commits] [llvm] r82319 - /llvm/trunk/lib/Analysis/SparsePropagation.cpp Message-ID: <200909191900.n8JJ07Rl013875@zion.cs.uiuc.edu> Author: nicholas Date: Sat Sep 19 14:00:06 2009 New Revision: 82319 URL: http://llvm.org/viewvc/llvm-project?rev=82319&view=rev Log: Add a comment explaining why you would ever want to do this. Modified: llvm/trunk/lib/Analysis/SparsePropagation.cpp Modified: llvm/trunk/lib/Analysis/SparsePropagation.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/SparsePropagation.cpp?rev=82319&r1=82318&r2=82319&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/SparsePropagation.cpp (original) +++ llvm/trunk/lib/Analysis/SparsePropagation.cpp Sat Sep 19 14:00:06 2009 @@ -223,6 +223,9 @@ } void SparseSolver::visitPHINode(PHINode &PN) { + // The lattice function may store more information on a PHINode than could be + // computed from its incoming values. For example, SSI form stores its sigma + // functions as PHINodes with a single incoming value. if (LatticeFunc->IsSpecialCasedPHI(&PN)) { LatticeVal IV = LatticeFunc->ComputeInstructionState(PN, *this); if (IV != LatticeFunc->getUntrackedVal()) From nicholas at mxc.ca Sat Sep 19 14:04:19 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Sat, 19 Sep 2009 12:04:19 -0700 Subject: [llvm-commits] patch 1: move 'integer type' from derived to primitive in langref Message-ID: <4AB52B33.5030601@mxc.ca> This is the first patch of a series of changes I have planned to clean up the LangRef. Firstly, I'd like to move the integer type out of 'derived' and into 'primitive'. This permits us to explain that derived types are all composed of other types, which primitive types aren't. Without moving integer out of derived, this wouldn't be true. I also perform a few trivial cleanups; 'i1' went from a link to #t_primitive to #t_integer (a holdover from when it was a bool type I suppose). Nick -------------- next part -------------- A non-text attachment was scrubbed... Name: langref-1.patch Type: text/x-patch Size: 6434 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090919/462db373/attachment.bin From daniel at zuster.org Sat Sep 19 14:32:50 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Sat, 19 Sep 2009 12:32:50 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r81586 - in /llvm-gcc-4.2/trunk/gcc: llvm-debug.cpp llvm-debug.h In-Reply-To: <200909112357.n8BNvRxX013435@zion.cs.uiuc.edu> References: <200909112357.n8BNvRxX013435@zion.cs.uiuc.edu> Message-ID: <6a8523d60909191232q23290c36lc2e85ced7ab3476a@mail.gmail.com> Hi Devang, On Fri, Sep 11, 2009 at 4:57 PM, Devang Patel wrote: > Author: dpatel > Date: Fri Sep 11 18:57:27 2009 > New Revision: 81586 > > URL: http://llvm.org/viewvc/llvm-project?rev=81586&view=rev > Log: > Use weak handle to keep track of MDNodes. Does clang need the same change? It's not clear to me yet that we should actually need a WeakVH... see below. > ============================================================================== > --- llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp (original) > +++ llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp Fri Sep 11 18:57:27 2009 > @@ -661,7 +661,7 @@ > ? ? return FwdDecl; > > ? // Insert into the TypeCache so that recursive uses will find it. > - ?TypeCache[type] = ?FwdDecl.getNode(); > + ?TypeCache[type] = ?WeakVH(FwdDecl.getNode()); > > ? // Convert all the elements. > ? llvm::SmallVector EltTys; > @@ -772,9 +772,10 @@ > > ? DIType Ty; > ? if (tree TyDef = TYPE_NAME(type)) { > - ? ? ?std::map::iterator I = TypeCache.find(TyDef); > + ? ? ?std::map::iterator I = TypeCache.find(TyDef); > ? ? ? if (I != TypeCache.end()) > - ? ? ? ?return DIType(I->second); Can you explain this line below? Its reconstructing a type in the case when something deleted the metadata which was in the type cache. Should that ever happen? Can we not maintain enough invariants to allow us to use an AssertingVH instead? I went ahead and moved clang over to an AssertingVH in r8232{0,1}, so that we will at least get asserts if we try something funny (which does, indeed, assert for PR4894). > + ? ? ? if (Value *M = I->second) > + ? ? ? ? return DIType(cast(M)); - Daniel From sabre at nondot.org Sat Sep 19 14:47:15 2009 From: sabre at nondot.org (Chris Lattner) Date: Sat, 19 Sep 2009 19:47:15 -0000 Subject: [llvm-commits] [llvm] r82322 - in /llvm/trunk: include/llvm/ADT/StringRef.h lib/Support/StringRef.cpp Message-ID: <200909191947.n8JJlFe0020048@zion.cs.uiuc.edu> Author: lattner Date: Sat Sep 19 14:47:14 2009 New Revision: 82322 URL: http://llvm.org/viewvc/llvm-project?rev=82322&view=rev Log: provide a "strtoull" operation that works on StringRef's. Modified: llvm/trunk/include/llvm/ADT/StringRef.h llvm/trunk/lib/Support/StringRef.cpp Modified: llvm/trunk/include/llvm/ADT/StringRef.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/StringRef.h?rev=82322&r1=82321&r2=82322&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/StringRef.h (original) +++ llvm/trunk/include/llvm/ADT/StringRef.h Sat Sep 19 14:47:14 2009 @@ -224,6 +224,23 @@ } /// @} + /// @name Helpful Algorithms + /// @{ + + /// getAsInteger - Parse the current string as an integer of the specified + /// radix. If Radix is specified as zero, this does radix autosensing using + /// extended C rules: 0 is octal, 0x is hex, 0b is binary. + /// + /// If the string is invalid or if only a subset of the string is valid, + /// this returns true to signify the error. The string is considered + /// erroneous if empty. + /// + //bool getAsInteger(unsigned Radix, long long &Result) const; + bool getAsInteger(unsigned Radix, unsigned long long &Result) const; + + // TODO: Provide overloads for int/unsigned that check for overflow. + + /// @} /// @name Substring Operations /// @{ Modified: llvm/trunk/lib/Support/StringRef.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/StringRef.cpp?rev=82322&r1=82321&r2=82322&view=diff ============================================================================== --- llvm/trunk/lib/Support/StringRef.cpp (original) +++ llvm/trunk/lib/Support/StringRef.cpp Sat Sep 19 14:47:14 2009 @@ -11,3 +11,66 @@ using namespace llvm; const size_t StringRef::npos; + +static bool GetAsUnsignedInteger(StringRef Str, unsigned Radix, + unsigned long long &Result) { + // Autosense radix if not specified. + if (Radix == 0) { + if (Str[0] != '0') { + Radix = 10; + } else { + if (Str.size() < 2) { + Radix = 8; + } else { + if (Str[1] == 'x') { + Str = Str.substr(2); + Radix = 16; + } else if (Str[1] == 'b') { + Str = Str.substr(2); + Radix = 2; + } else { + Radix = 8; + } + } + } + } + + // Empty strings (after the radix autosense) are invalid. + if (Str.empty()) return true; + + // Parse all the bytes of the string given this radix. Watch for overflow. + Result = 0; + while (!Str.empty()) { + unsigned CharVal; + if (Str[0] >= '0' && Str[0] <= '9') + CharVal = Str[0]-'0'; + else if (Str[0] >= 'a' && Str[0] <= 'z') + CharVal = Str[0]-'a'+10; + else if (Str[0] >= 'A' && Str[0] <= 'Z') + CharVal = Str[0]-'A'+10; + else + return true; + + // If the parsed value is larger than the integer radix, the string is + // invalid. + if (CharVal >= Radix) + return true; + + // Add in this character. + unsigned long long PrevResult = Result; + Result = Result*Radix+CharVal; + + // Check for overflow. + if (Result < PrevResult) + return true; + + Str = Str.substr(1); + } + + return false; +} + +bool StringRef::getAsInteger(unsigned Radix, unsigned long long &Result) const { + return GetAsUnsignedInteger(*this, Radix, Result); +} + From baldrick at free.fr Sat Sep 19 15:22:13 2009 From: baldrick at free.fr (Duncan Sands) Date: Sat, 19 Sep 2009 20:22:13 -0000 Subject: [llvm-commits] [gcc-plugin] r82325 - /gcc-plugin/trunk/llvm-convert.cpp Message-ID: <200909192022.n8JKMDJg024843@zion.cs.uiuc.edu> Author: baldrick Date: Sat Sep 19 15:22:13 2009 New Revision: 82325 URL: http://llvm.org/viewvc/llvm-project?rev=82325&view=rev Log: Exception handling just changed radically in gcc mainline. Get the plugin compiling again by commenting out a bunch of eh code. Since eh was already broken, this doesn't make things worse. Also, inline assembler just got "labels" as well as inputs, outputs and clobbers. I don't know what "labels" are yet, but in the meantime pass the labels to any GCC functions that want them. With these changes the plugin compiles (and works) against GCC top-of-tree. Modified: gcc-plugin/trunk/llvm-convert.cpp Modified: gcc-plugin/trunk/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-convert.cpp?rev=82325&r1=82324&r2=82325&view=diff ============================================================================== --- gcc-plugin/trunk/llvm-convert.cpp (original) +++ gcc-plugin/trunk/llvm-convert.cpp Sat Sep 19 15:22:13 2009 @@ -1046,8 +1046,8 @@ llvm_unreachable("Unhandled expression!"); // Exception handling. - case EXC_PTR_EXPR: Result = EmitEXC_PTR_EXPR(exp); break; - case FILTER_EXPR: Result = EmitFILTER_EXPR(exp); break; +//FIXME case EXC_PTR_EXPR: Result = EmitEXC_PTR_EXPR(exp); break; +//FIXME case FILTER_EXPR: Result = EmitFILTER_EXPR(exp); break; // Expressions case VAR_DECL: @@ -1165,12 +1165,12 @@ break; // Exception Handling. - case EXC_PTR_EXPR: - LV = EmitLV_EXC_PTR_EXPR(exp); - break; - case FILTER_EXPR: - LV = EmitLV_FILTER_EXPR(exp); - break; +//FIXME case EXC_PTR_EXPR: +//FIXME LV = EmitLV_EXC_PTR_EXPR(exp); +//FIXME break; +//FIXME case FILTER_EXPR: +//FIXME LV = EmitLV_FILTER_EXPR(exp); +//FIXME break; // Trivial Cases. case WITH_SIZE_EXPR: @@ -1824,9 +1824,9 @@ /// AddHandler - Append the given region to a vector of exception handlers. /// A callback passed to foreach_reachable_handler. -static void AddHandler (eh_region region, void *data) { - ((std::vector *)data)->push_back(region); -} +//FIXMEstatic void AddHandler (eh_region region, void *data) { +//FIXME ((std::vector *)data)->push_back(region); +//FIXME} /// EmitLandingPads - Emit EH landing pads. void TreeToLLVM::EmitLandingPads() { @@ -1856,18 +1856,17 @@ //FIXME && "no exception handling personality function!"); //FIXME Args.push_back(Builder.CreateBitCast(DECL_LLVM(llvm_eh_personality_libfunc), //FIXME PointerType::getUnqual(Type::getInt8Ty(Context)))); - - // Add selections for each handler. - foreach_reachable_handler(i, false, false, AddHandler, &Handlers); - - for (std::vector::iterator I = Handlers.begin(), - E = Handlers.end(); I != E; ++I) { - eh_region region = *I; - - // Create a post landing pad for the handler. - getPostPad(get_eh_region_number(region)); - -abort();//FIXME +//FIXME +//FIXME // Add selections for each handler. +//FIXME foreach_reachable_handler(i, false, false, AddHandler, &Handlers); +//FIXME +//FIXME for (std::vector::iterator I = Handlers.begin(), +//FIXME E = Handlers.end(); I != E; ++I) { +//FIXME eh_region region = *I; +//FIXME +//FIXME // Create a post landing pad for the handler. +//FIXME getPostPad(get_eh_region_number(region)); +//FIXME //FIXME int RegionKind = classify_eh_handler(region); //FIXME if (RegionKind < 0) { //FIXME // Filter - note the length. @@ -1898,16 +1897,15 @@ //FIXME } //FIXME } //FIXME } - } - - if (can_throw_external_1(i, false, false)) { - // Some exceptions from this region may not be caught by any handler. - // Since invokes are required to branch to the unwind label no matter - // what exception is being unwound, append a catch-all. - - // The representation of a catch-all is language specific. - Value *CatchAll; -abort();//FIXME +//FIXME } +//FIXME +//FIXME if (can_throw_external_1(i, false, false)) { +//FIXME // Some exceptions from this region may not be caught by any handler. +//FIXME // Since invokes are required to branch to the unwind label no matter +//FIXME // what exception is being unwound, append a catch-all. +//FIXME +//FIXME // The representation of a catch-all is language specific. +//FIXME Value *CatchAll; //FIXME if (USING_SJLJ_EXCEPTIONS || !lang_eh_catch_all) { //FIXME // Use a "cleanup" - this should be good enough for most languages. //FIXME CatchAll = ConstantInt::get(Type::getInt32Ty, 0); @@ -1921,19 +1919,19 @@ //FIXME // This language has a type that catches all others. //FIXME CatchAll = Emit(catch_all_type, 0); //FIXME } - Args.push_back(CatchAll); - } - - // Emit the selector call. - Value *Select = Builder.CreateCall(FuncEHSelector, Args.begin(), Args.end(), - "eh_select"); - Builder.CreateStore(Select, ExceptionSelectorValue); - // Branch to the post landing pad for the first reachable handler. - assert(!Handlers.empty() && "Landing pad but no handler?"); - Builder.CreateBr(getPostPad(get_eh_region_number(*Handlers.begin()))); - - Handlers.clear(); - Args.clear(); +//FIXME Args.push_back(CatchAll); +//FIXME } +//FIXME +//FIXME // Emit the selector call. +//FIXME Value *Select = Builder.CreateCall(FuncEHSelector, Args.begin(), Args.end(), +//FIXME "eh_select"); +//FIXME Builder.CreateStore(Select, ExceptionSelectorValue); +//FIXME // Branch to the post landing pad for the first reachable handler. +//FIXME assert(!Handlers.empty() && "Landing pad but no handler?"); +//FIXME Builder.CreateBr(getPostPad(get_eh_region_number(*Handlers.begin()))); +//FIXME +//FIXME Handlers.clear(); +//FIXME Args.clear(); } } @@ -2020,33 +2018,33 @@ //FIXME Builder.CreateCondBr(Cond, Dest, NoCatchBB); //FIXME EmitBlock(NoCatchBB); //FIXME } - - // Emit a RESX_EXPR which skips handlers with no post landing pad. - foreach_reachable_handler(i, true, false, AddHandler, &Handlers); - - BasicBlock *TargetBB = NULL; - - for (std::vector::iterator I = Handlers.begin(), - E = Handlers.end(); I != E; ++I) { - unsigned UnwindNo = get_eh_region_number(*I); - - if (UnwindNo < PostPads.size()) - TargetBB = PostPads[UnwindNo]; - - if (TargetBB) - break; - } - - if (TargetBB) { - Builder.CreateBr(TargetBB); - } else { - assert(can_throw_external_1(i, true, false) && - "Must-not-throw region handled by runtime?"); - // Unwinding continues in the caller. - if (!UnwindBB) - UnwindBB = BasicBlock::Create(Context, "Unwind"); - Builder.CreateBr(UnwindBB); - } +//FIXME +//FIXME // Emit a RESX_EXPR which skips handlers with no post landing pad. +//FIXME foreach_reachable_handler(i, true, false, AddHandler, &Handlers); +//FIXME +//FIXME BasicBlock *TargetBB = NULL; +//FIXME +//FIXME for (std::vector::iterator I = Handlers.begin(), +//FIXME E = Handlers.end(); I != E; ++I) { +//FIXME unsigned UnwindNo = get_eh_region_number(*I); +//FIXME +//FIXME if (UnwindNo < PostPads.size()) +//FIXME TargetBB = PostPads[UnwindNo]; +//FIXME +//FIXME if (TargetBB) +//FIXME break; +//FIXME } +//FIXME +//FIXME if (TargetBB) { +//FIXME Builder.CreateBr(TargetBB); +//FIXME } else { +//FIXME assert(can_throw_external_1(i, true, false) && +//FIXME "Must-not-throw region handled by runtime?"); +//FIXME // Unwinding continues in the caller. +//FIXME if (!UnwindBB) +//FIXME UnwindBB = BasicBlock::Create(Context, "Unwind"); +//FIXME Builder.CreateBr(UnwindBB); +//FIXME } Handlers.clear(); } @@ -2710,26 +2708,26 @@ if (!PAL.paramHasAttr(~0, Attribute::NoUnwind)) { // This call may throw. Determine if we need to generate // an invoke rather than a simple call. - int RegionNo = lookup_stmt_eh_region(stmt); - - // Is the call contained in an exception handling region? - if (RegionNo > 0) { - // Are there any exception handlers for this region? - if (can_throw_internal_1(RegionNo, false, false)) { - // There are - turn the call into an invoke. - LandingPads.grow(RegionNo); - BasicBlock *&ThisPad = LandingPads[RegionNo]; - - // Create a landing pad if one didn't exist already. - if (!ThisPad) - ThisPad = BasicBlock::Create(Context, "lpad"); - - LandingPad = ThisPad; - } else { - assert(can_throw_external_1(RegionNo, false, false) && - "Must-not-throw region handled by runtime?"); - } - } +//FIXME int RegionNo = lookup_stmt_eh_region(stmt); +//FIXME +//FIXME // Is the call contained in an exception handling region? +//FIXME if (RegionNo > 0) { +//FIXME // Are there any exception handlers for this region? +//FIXME if (can_throw_internal_1(RegionNo, false, false)) { +//FIXME // There are - turn the call into an invoke. +//FIXME LandingPads.grow(RegionNo); +//FIXME BasicBlock *&ThisPad = LandingPads[RegionNo]; +//FIXME +//FIXME // Create a landing pad if one didn't exist already. +//FIXME if (!ThisPad) +//FIXME ThisPad = BasicBlock::Create(Context, "lpad"); +//FIXME +//FIXME LandingPad = ThisPad; +//FIXME } else { +//FIXME assert(can_throw_external_1(RegionNo, false, false) && +//FIXME "Must-not-throw region handled by runtime?"); +//FIXME } +//FIXME } } tree fndecl = gimple_call_fndecl(stmt); @@ -3581,18 +3579,20 @@ /// EmitEXC_PTR_EXPR - Handle EXC_PTR_EXPR. Value *TreeToLLVM::EmitEXC_PTR_EXPR(tree exp) { - CreateExceptionValues(); - // Load exception address. - Value *V = Builder.CreateLoad(ExceptionValue, "eh_value"); - // Cast the address to the right pointer type. - return Builder.CreateBitCast(V, ConvertType(TREE_TYPE(exp))); +abort(); +//TODO CreateExceptionValues(); +//TODO // Load exception address. +//TODO Value *V = Builder.CreateLoad(ExceptionValue, "eh_value"); +//TODO // Cast the address to the right pointer type. +//TODO return Builder.CreateBitCast(V, ConvertType(TREE_TYPE(exp))); } /// EmitFILTER_EXPR - Handle FILTER_EXPR. Value *TreeToLLVM::EmitFILTER_EXPR(tree exp) { - CreateExceptionValues(); - // Load exception selector. - return Builder.CreateLoad(ExceptionSelectorValue, "eh_select"); +abort(); +//FIXME CreateExceptionValues(); +//FIXME // Load exception selector. +//FIXME return Builder.CreateLoad(ExceptionSelectorValue, "eh_select"); } //===----------------------------------------------------------------------===// @@ -3661,7 +3661,7 @@ /// Other %xN expressions are turned into LLVM ${N:x} operands. /// static std::string ConvertInlineAsmStr(gimple stmt, tree outputs, tree inputs, - unsigned NumOperands) { + tree labels, unsigned NumOperands) { const char *AsmStr = gimple_asm_string(stmt); // gimple_asm_input_p - This flag is set if this is a non-extended ASM, @@ -3681,7 +3681,7 @@ // Expand [name] symbolic operand names. tree str = resolve_asm_operand_names(build_string (strlen (AsmStr), AsmStr), - outputs, inputs); + outputs, inputs, labels); const char *InStr = TREE_STRING_POINTER(str); @@ -7550,6 +7550,17 @@ } } + // TODO: Understand what these labels are about, and handle them properly. + unsigned NumLabels = gimple_asm_nlabels (stmt); + tree labels = NULL_TREE; + if (NumLabels) { + tree t = labels = gimple_asm_label_op (stmt, 0); + for (unsigned i = 1; i < NumLabels; i++) { + TREE_CHAIN (t) = gimple_asm_label_op (stmt, i); + t = gimple_asm_label_op (stmt, i); + } + } + unsigned NumInOut = 0; // Look for multiple alternative constraints: multiple alternatives separated @@ -7622,7 +7633,7 @@ std::vector CallOps; std::vector CallArgTypes; - std::string NewAsmStr = ConvertInlineAsmStr(stmt, outputs, inputs, + std::string NewAsmStr = ConvertInlineAsmStr(stmt, outputs, inputs, labels, NumOutputs+NumInputs); std::string ConstraintStr; @@ -8004,26 +8015,27 @@ } void TreeToLLVM::RenderGIMPLE_RESX(gimple stmt) { - int RegionNo = gimple_resx_region(stmt); - std::vector Handlers; - - foreach_reachable_handler(RegionNo, true, false, AddHandler, &Handlers); - - if (!Handlers.empty()) { - for (std::vector::iterator I = Handlers.begin(), - E = Handlers.end(); I != E; ++I) - // Create a post landing pad for the handler. - getPostPad(get_eh_region_number(*I)); - - Builder.CreateBr(getPostPad(get_eh_region_number(*Handlers.begin()))); - } else { - assert(can_throw_external_1(RegionNo, true, false) && - "Must-not-throw region handled by runtime?"); - // Unwinding continues in the caller. - if (!UnwindBB) - UnwindBB = BasicBlock::Create(Context, "Unwind"); - Builder.CreateBr(UnwindBB); - } +abort(); +//FIXME int RegionNo = gimple_resx_region(stmt); +//FIXME std::vector Handlers; +//FIXME +//FIXME foreach_reachable_handler(RegionNo, true, false, AddHandler, &Handlers); +//FIXME +//FIXME if (!Handlers.empty()) { +//FIXME for (std::vector::iterator I = Handlers.begin(), +//FIXME E = Handlers.end(); I != E; ++I) +//FIXME // Create a post landing pad for the handler. +//FIXME getPostPad(get_eh_region_number(*I)); +//FIXME +//FIXME Builder.CreateBr(getPostPad(get_eh_region_number(*Handlers.begin()))); +//FIXME } else { +//FIXME assert(can_throw_external_1(RegionNo, true, false) && +//FIXME "Must-not-throw region handled by runtime?"); +//FIXME // Unwinding continues in the caller. +//FIXME if (!UnwindBB) +//FIXME UnwindBB = BasicBlock::Create(Context, "Unwind"); +//FIXME Builder.CreateBr(UnwindBB); +//FIXME } } void TreeToLLVM::RenderGIMPLE_RETURN(gimple stmt) { From baldrick at free.fr Sat Sep 19 15:26:06 2009 From: baldrick at free.fr (Duncan Sands) Date: Sat, 19 Sep 2009 20:26:06 -0000 Subject: [llvm-commits] [gcc-plugin] r82326 - /gcc-plugin/trunk/README Message-ID: <200909192026.n8JKQ6jr025333@zion.cs.uiuc.edu> Author: baldrick Date: Sat Sep 19 15:26:06 2009 New Revision: 82326 URL: http://llvm.org/viewvc/llvm-project?rev=82326&view=rev Log: Forget about the lto branch for the moment: mainline seems to work fine, and the two branches are sometimes out of sync, causing the plugin not to build against one of them. Since I have to choose one, I choose mainline. Modified: gcc-plugin/trunk/README Modified: gcc-plugin/trunk/README URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/README?rev=82326&r1=82325&r2=82326&view=diff ============================================================================== --- gcc-plugin/trunk/README (original) +++ gcc-plugin/trunk/README Sat Sep 19 15:26:06 2009 @@ -2,15 +2,17 @@ - BUILD INSTRUCTIONS - ---------------------- +Step 0: Build and install llvm +------------------------------ + +I'm assuming anyone reading this knows how to build and install llvm. +You need the latest llvm from the subversion repository. + Step 1: Build gcc ----------------- -Check out the gcc lto branch from the gcc subversion repository: - svn checkout svn://gcc.gnu.org/svn/gcc/branches/lto SomeLocalDir -It should be possible to check out gcc mainline instead: +Check out gcc from the gcc subversion repository: svn checkout svn://gcc.gnu.org/svn/gcc/trunk SomeLocalDir -However I only test with mainline from time to time (plugin development -is currently against the lto branch), so it's safer to use the lto branch. Apply the patches in the gcc-patches subdirectory, if any. Hopefully one day the plugin will work with an unpatched gcc, but for the moment a few small patches need to be applied. Configure gcc with your favorite options. From nicholas at mxc.ca Sat Sep 19 15:30:26 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Sat, 19 Sep 2009 20:30:26 -0000 Subject: [llvm-commits] [llvm] r82327 - in /llvm/trunk: include/llvm/Constants.h lib/CodeGen/ShadowStackGC.cpp lib/Transforms/IPO/GlobalOpt.cpp tools/bugpoint/ExtractFunction.cpp Message-ID: <200909192030.n8JKUQ3S025873@zion.cs.uiuc.edu> Author: nicholas Date: Sat Sep 19 15:30:26 2009 New Revision: 82327 URL: http://llvm.org/viewvc/llvm-project?rev=82327&view=rev Log: Remove the default value for ConstantStruct::get's isPacked parameter and update the code which was broken by this. Modified: llvm/trunk/include/llvm/Constants.h llvm/trunk/lib/CodeGen/ShadowStackGC.cpp llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp llvm/trunk/tools/bugpoint/ExtractFunction.cpp Modified: llvm/trunk/include/llvm/Constants.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Constants.h?rev=82327&r1=82326&r2=82327&view=diff ============================================================================== --- llvm/trunk/include/llvm/Constants.h (original) +++ llvm/trunk/include/llvm/Constants.h Sat Sep 19 15:30:26 2009 @@ -415,11 +415,11 @@ // ConstantStruct accessors static Constant* get(const StructType* T, const std::vector& V); static Constant* get(LLVMContext &Context, - const std::vector& V, bool Packed = false); + const std::vector& V, bool Packed); static Constant* get(LLVMContext &Context, Constant* const *Vals, unsigned NumVals, - bool Packed = false); - + bool Packed); + /// Transparently provide more efficient getOperand methods. DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Constant); Modified: llvm/trunk/lib/CodeGen/ShadowStackGC.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ShadowStackGC.cpp?rev=82327&r1=82326&r2=82327&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/ShadowStackGC.cpp (original) +++ llvm/trunk/lib/CodeGen/ShadowStackGC.cpp Sat Sep 19 15:30:26 2009 @@ -207,12 +207,13 @@ }; Constant *DescriptorElts[] = { - ConstantStruct::get(F.getContext(), BaseElts, 2), + ConstantStruct::get(F.getContext(), BaseElts, 2, false), ConstantArray::get(ArrayType::get(VoidPtr, NumMeta), Metadata.begin(), NumMeta) }; - Constant *FrameMap = ConstantStruct::get(F.getContext(), DescriptorElts, 2); + Constant *FrameMap = ConstantStruct::get(F.getContext(), DescriptorElts, 2, + false); std::string TypeName("gc_map."); TypeName += utostr(NumMeta); Modified: llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp?rev=82327&r1=82326&r2=82327&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp Sat Sep 19 15:30:26 2009 @@ -2393,14 +2393,14 @@ CSVals[1] = Constant::getNullValue(PFTy); CSVals[0] = ConstantInt::get(Type::getInt32Ty(Context), 2147483647); } - CAList.push_back(ConstantStruct::get(Context, CSVals)); + CAList.push_back(ConstantStruct::get(Context, CSVals, false)); } // Create the array initializer. const Type *StructTy = - cast(GCL->getType()->getElementType())->getElementType(); + cast(GCL->getType()->getElementType())->getElementType(); Constant *CA = ConstantArray::get(ArrayType::get(StructTy, - CAList.size()), CAList); + CAList.size()), CAList); // If we didn't change the number of elements, don't create a new GV. if (CA->getType() == GCL->getInitializer()->getType()) { Modified: llvm/trunk/tools/bugpoint/ExtractFunction.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/ExtractFunction.cpp?rev=82327&r1=82326&r2=82327&view=diff ============================================================================== --- llvm/trunk/tools/bugpoint/ExtractFunction.cpp (original) +++ llvm/trunk/tools/bugpoint/ExtractFunction.cpp Sat Sep 19 15:30:26 2009 @@ -189,8 +189,8 @@ Elts.push_back(ConstantInt::get( Type::getInt32Ty(TorList[i].first->getContext()), TorList[i].second)); Elts.push_back(TorList[i].first); - ArrayElts.push_back(ConstantStruct::get( - TorList[i].first->getContext(), Elts)); + ArrayElts.push_back(ConstantStruct::get(TorList[i].first->getContext(), + Elts, false)); } return ConstantArray::get(ArrayType::get(ArrayElts[0]->getType(), ArrayElts.size()), From isanbard at gmail.com Sat Sep 19 15:38:21 2009 From: isanbard at gmail.com (Bill Wendling) Date: Sat, 19 Sep 2009 20:38:21 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r82329 - /llvm-gcc-4.2/tags/Apple/llvmgcc42-2208.1/ Message-ID: <200909192038.n8JKcMNU026881@zion.cs.uiuc.edu> Author: void Date: Sat Sep 19 15:38:21 2009 New Revision: 82329 URL: http://llvm.org/viewvc/llvm-project?rev=82329&view=rev Log: Remove for retagging. Removed: llvm-gcc-4.2/tags/Apple/llvmgcc42-2208.1/ From isanbard at gmail.com Sat Sep 19 15:39:10 2009 From: isanbard at gmail.com (Bill Wendling) Date: Sat, 19 Sep 2009 20:39:10 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r82330 - /llvm-gcc-4.2/tags/Apple/llvmgcc42-2208.1/ Message-ID: <200909192039.n8JKdAfk027033@zion.cs.uiuc.edu> Author: void Date: Sat Sep 19 15:39:10 2009 New Revision: 82330 URL: http://llvm.org/viewvc/llvm-project?rev=82330&view=rev Log: Create llvmgcc42-2208.1 from Bender-SWB. Added: llvm-gcc-4.2/tags/Apple/llvmgcc42-2208.1/ - copied from r82329, llvm-gcc-4.2/branches/Apple/Bender-SWB/ From daniel at zuster.org Sat Sep 19 15:39:50 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Sat, 19 Sep 2009 20:39:50 -0000 Subject: [llvm-commits] [llvm] r82331 - /llvm/trunk/include/llvm/Support/ValueHandle.h Message-ID: <200909192039.n8JKdo8I027146@zion.cs.uiuc.edu> Author: ddunbar Date: Sat Sep 19 15:39:50 2009 New Revision: 82331 URL: http://llvm.org/viewvc/llvm-project?rev=82331&view=rev Log: RHS of assignment should be const reference. Modified: llvm/trunk/include/llvm/Support/ValueHandle.h Modified: llvm/trunk/include/llvm/Support/ValueHandle.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/ValueHandle.h?rev=82331&r1=82330&r2=82331&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/ValueHandle.h (original) +++ llvm/trunk/include/llvm/Support/ValueHandle.h Sat Sep 19 15:39:50 2009 @@ -202,7 +202,7 @@ setValPtr(RHS); return getValPtr(); } - ValueTy *operator=(AssertingVH &RHS) { + ValueTy *operator=(const AssertingVH &RHS) { setValPtr(RHS.getValPtr()); return getValPtr(); } From daniel at zuster.org Sat Sep 19 15:40:06 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Sat, 19 Sep 2009 20:40:06 -0000 Subject: [llvm-commits] [llvm] r82332 - in /llvm/trunk: include/llvm/Analysis/DebugInfo.h include/llvm/Support/ValueHandle.h lib/Analysis/DebugInfo.cpp lib/CodeGen/AsmPrinter/DwarfDebug.cpp Message-ID: <200909192040.n8JKe6W5027194@zion.cs.uiuc.edu> Author: ddunbar Date: Sat Sep 19 15:40:05 2009 New Revision: 82332 URL: http://llvm.org/viewvc/llvm-project?rev=82332&view=rev Log: Strip trailing whitespace. Modified: llvm/trunk/include/llvm/Analysis/DebugInfo.h llvm/trunk/include/llvm/Support/ValueHandle.h llvm/trunk/lib/Analysis/DebugInfo.cpp llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Modified: llvm/trunk/include/llvm/Analysis/DebugInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/DebugInfo.h?rev=82332&r1=82331&r2=82332&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/DebugInfo.h (original) +++ llvm/trunk/include/llvm/Analysis/DebugInfo.h Sat Sep 19 15:40:05 2009 @@ -44,7 +44,7 @@ class LLVMContext; class DIDescriptor { - protected: + protected: MDNode *DbgNode; /// DIDescriptor constructor. If the specified node is non-null, check @@ -112,7 +112,7 @@ /// DIArray - This descriptor holds an array of descriptors. class DIArray : public DIDescriptor { public: - explicit DIArray(MDNode *N = 0) + explicit DIArray(MDNode *N = 0) : DIDescriptor(N) {} unsigned getNumElements() const; @@ -158,14 +158,14 @@ const std::string &getProducer(std::string &F) const { return getStringField(5, F); } - + /// isMain - Each input file is encoded as a separate compile unit in LLVM /// debugging information output. However, many target specific tool chains - /// prefer to encode only one compile unit in an object file. In this + /// prefer to encode only one compile unit in an object file. In this /// situation, the LLVM code generator will include debugging information - /// entities in the compile unit that is marked as main compile unit. The + /// entities in the compile unit that is marked as main compile unit. The /// code generator accepts maximum one main compile unit per module. If a - /// module does not contain any main compile unit then the code generator + /// module does not contain any main compile unit then the code generator /// will emit multiple compile units in the output object file. bool isMain() const { return getUnsignedField(6); } @@ -210,7 +210,7 @@ }; protected: - DIType(MDNode *N, unsigned Tag) + DIType(MDNode *N, unsigned Tag) : DIDescriptor(N, Tag) {} // This ctor is used when the Tag has already been validated by a derived // ctor. @@ -238,17 +238,17 @@ uint64_t getOffsetInBits() const { return getUInt64Field(7); } unsigned getFlags() const { return getUnsignedField(8); } bool isPrivate() const { - return (getFlags() & FlagPrivate) != 0; + return (getFlags() & FlagPrivate) != 0; } bool isProtected() const { - return (getFlags() & FlagProtected) != 0; + return (getFlags() & FlagProtected) != 0; } bool isForwardDecl() const { - return (getFlags() & FlagFwdDecl) != 0; + return (getFlags() & FlagFwdDecl) != 0; } // isAppleBlock - Return true if this is the Apple Blocks extension. bool isAppleBlockExtension() const { - return (getFlags() & FlagAppleBlock) != 0; + return (getFlags() & FlagAppleBlock) != 0; } bool isBlockByrefStruct() const { return (getFlags() & FlagBlockByrefStruct) != 0; @@ -448,8 +448,8 @@ /// isBlockByrefVariable - Return true if the variable was declared as /// a "__block" variable (Apple Blocks). - bool isBlockByrefVariable() const { - return getType().isBlockByrefStruct(); + bool isBlockByrefVariable() const { + return getType().isBlockByrefStruct(); } /// dump - print variable. @@ -461,7 +461,7 @@ public: explicit DILexicalBlock(MDNode *N = 0) { DbgNode = N; - if (DbgNode && !isLexicalBlock()) + if (DbgNode && !isLexicalBlock()) DbgNode = 0; } DIScope getContext() const { return getFieldAs(1); } @@ -484,11 +484,11 @@ unsigned getColumnNumber() const { return getUnsignedField(1); } DIScope getScope() const { return getFieldAs(3); } DILocation getOrigLocation() const { return getFieldAs(4); } - std::string getFilename(std::string &F) const { - return getScope().getFilename(F); + std::string getFilename(std::string &F) const { + return getScope().getFilename(F); } - std::string getDirectory(std::string &D) const { - return getScope().getDirectory(D); + std::string getDirectory(std::string &D) const { + return getScope().getDirectory(D); } }; @@ -497,7 +497,7 @@ class DIFactory { Module &M; LLVMContext& VMContext; - + // Cached values for uniquing and faster lookups. const Type *EmptyStructPtr; // "{}*". Function *StopPointFn; // llvm.dbg.stoppoint @@ -513,7 +513,7 @@ public: explicit DIFactory(Module &m); - /// GetOrCreateArray - Create an descriptor for an array of descriptors. + /// GetOrCreateArray - Create an descriptor for an array of descriptors. /// This implicitly uniques the arrays created. DIArray GetOrCreateArray(DIDescriptor *Tys, unsigned NumTys); @@ -577,7 +577,7 @@ DIGlobalVariable CreateGlobalVariable(DIDescriptor Context, const std::string &Name, const std::string &DisplayName, - const std::string &LinkageName, + const std::string &LinkageName, DICompileUnit CompileUnit, unsigned LineNo, DIType Type, bool isLocalToUnit, bool isDefinition, llvm::GlobalVariable *GV); @@ -588,12 +588,12 @@ DICompileUnit CompileUnit, unsigned LineNo, DIType Type); - /// CreateLexicalBlock - This creates a descriptor for a lexical block + /// CreateLexicalBlock - This creates a descriptor for a lexical block /// with the specified parent context. DILexicalBlock CreateLexicalBlock(DIDescriptor Context); /// CreateLocation - Creates a debug info location. - DILocation CreateLocation(unsigned LineNo, unsigned ColumnNo, + DILocation CreateLocation(unsigned LineNo, unsigned ColumnNo, DIScope S, DILocation OrigLoc); /// InsertStopPoint - Create a new llvm.dbg.stoppoint intrinsic invocation, @@ -621,10 +621,10 @@ }; /// Finds the stoppoint coressponding to this instruction, that is the - /// stoppoint that dominates this instruction + /// stoppoint that dominates this instruction const DbgStopPointInst *findStopPoint(const Instruction *Inst); - /// Finds the stoppoint corresponding to first real (non-debug intrinsic) + /// Finds the stoppoint corresponding to first real (non-debug intrinsic) /// instruction in this Basic Block, and returns the stoppoint for it. const DbgStopPointInst *findBBStopPoint(const BasicBlock *BB); @@ -635,46 +635,46 @@ /// Find the debug info descriptor corresponding to this global variable. Value *findDbgGlobalDeclare(GlobalVariable *V); - bool getLocationInfo(const Value *V, std::string &DisplayName, + bool getLocationInfo(const Value *V, std::string &DisplayName, std::string &Type, unsigned &LineNo, std::string &File, - std::string &Dir); + std::string &Dir); - /// isValidDebugInfoIntrinsic - Return true if SPI is a valid debug + /// isValidDebugInfoIntrinsic - Return true if SPI is a valid debug /// info intrinsic. - bool isValidDebugInfoIntrinsic(DbgStopPointInst &SPI, + bool isValidDebugInfoIntrinsic(DbgStopPointInst &SPI, CodeGenOpt::Level OptLev); - /// isValidDebugInfoIntrinsic - Return true if FSI is a valid debug + /// isValidDebugInfoIntrinsic - Return true if FSI is a valid debug /// info intrinsic. bool isValidDebugInfoIntrinsic(DbgFuncStartInst &FSI, CodeGenOpt::Level OptLev); - /// isValidDebugInfoIntrinsic - Return true if RSI is a valid debug + /// isValidDebugInfoIntrinsic - Return true if RSI is a valid debug /// info intrinsic. bool isValidDebugInfoIntrinsic(DbgRegionStartInst &RSI, CodeGenOpt::Level OptLev); - /// isValidDebugInfoIntrinsic - Return true if REI is a valid debug + /// isValidDebugInfoIntrinsic - Return true if REI is a valid debug /// info intrinsic. bool isValidDebugInfoIntrinsic(DbgRegionEndInst &REI, CodeGenOpt::Level OptLev); - /// isValidDebugInfoIntrinsic - Return true if DI is a valid debug + /// isValidDebugInfoIntrinsic - Return true if DI is a valid debug /// info intrinsic. bool isValidDebugInfoIntrinsic(DbgDeclareInst &DI, CodeGenOpt::Level OptLev); - /// ExtractDebugLocation - Extract debug location information + /// ExtractDebugLocation - Extract debug location information /// from llvm.dbg.stoppoint intrinsic. DebugLoc ExtractDebugLocation(DbgStopPointInst &SPI, DebugLocTracker &DebugLocInfo); - /// ExtractDebugLocation - Extract debug location information + /// ExtractDebugLocation - Extract debug location information /// from DILocation. DebugLoc ExtractDebugLocation(DILocation &Loc, DebugLocTracker &DebugLocInfo); - /// ExtractDebugLocation - Extract debug location information + /// ExtractDebugLocation - Extract debug location information /// from llvm.dbg.func_start intrinsic. DebugLoc ExtractDebugLocation(DbgFuncStartInst &FSI, DebugLocTracker &DebugLocInfo); @@ -691,7 +691,7 @@ /// processModule - Process entire module and collect debug info /// anchors. void processModule(Module &M); - + private: /// processType - Process DIType. void processType(DIType DT); @@ -716,7 +716,7 @@ /// addCompileUnit - Add compile unit into CUs. bool addCompileUnit(DICompileUnit CU); - + /// addGlobalVariable - Add global variable into GVs. bool addGlobalVariable(DIGlobalVariable DIG); Modified: llvm/trunk/include/llvm/Support/ValueHandle.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/ValueHandle.h?rev=82332&r1=82331&r2=82332&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/ValueHandle.h (original) +++ llvm/trunk/include/llvm/Support/ValueHandle.h Sat Sep 19 15:40:05 2009 @@ -49,7 +49,7 @@ Callback }; private: - + PointerIntPair PrevPair; ValueHandleBase *Next; Value *VP; @@ -68,9 +68,9 @@ } ~ValueHandleBase() { if (isValid(VP)) - RemoveFromUseList(); + RemoveFromUseList(); } - + Value *operator=(Value *RHS) { if (VP == RHS) return RHS; if (isValid(VP)) RemoveFromUseList(); @@ -86,7 +86,7 @@ if (isValid(VP)) AddToExistingUseList(RHS.getPrevPtr()); return VP; } - + Value *operator->() const { return getValPtr(); } Value &operator*() const { return *getValPtr(); } @@ -102,22 +102,22 @@ // Callbacks made from Value. static void ValueIsDeleted(Value *V); static void ValueIsRAUWd(Value *Old, Value *New); - + // Internal implementation details. ValueHandleBase **getPrevPtr() const { return PrevPair.getPointer(); } HandleBaseKind getKind() const { return PrevPair.getInt(); } void setPrevPtr(ValueHandleBase **Ptr) { PrevPair.setPointer(Ptr); } - + /// AddToExistingUseList - Add this ValueHandle to the use list for VP, /// where List is known to point into the existing use list. void AddToExistingUseList(ValueHandleBase **List); - + /// AddToUseList - Add this ValueHandle to the use list for VP. void AddToUseList(); /// RemoveFromUseList - Remove this ValueHandle from its current use list. void RemoveFromUseList(); }; - + /// WeakVH - This is a value handle that tries hard to point to a Value, even /// across RAUW operations, but will null itself out if the value is destroyed. /// this is useful for advisory sorts of information, but should not be used as @@ -160,7 +160,7 @@ /// AssertingVH's as it moves. This is required because in non-assert mode this /// class turns into a trivial wrapper around a pointer. template -class AssertingVH +class AssertingVH #ifndef NDEBUG : public ValueHandleBase #endif Modified: llvm/trunk/lib/Analysis/DebugInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DebugInfo.cpp?rev=82332&r1=82331&r2=82332&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/DebugInfo.cpp (original) +++ llvm/trunk/lib/Analysis/DebugInfo.cpp Sat Sep 19 15:40:05 2009 @@ -71,7 +71,7 @@ DIDescriptor::DIDescriptor(MDNode *N, unsigned RequiredTag) { DbgNode = N; - + // If this is non-null, check to see if the Tag matches. If not, set to null. if (N && getTag() != RequiredTag) { DbgNode = 0; @@ -84,28 +84,28 @@ if (DbgNode == 0) return Result; - if (Elt < DbgNode->getNumElements()) + if (Elt < DbgNode->getNumElements()) if (MDString *MDS = dyn_cast_or_null(DbgNode->getElement(Elt))) { Result.assign(MDS->begin(), MDS->begin() + MDS->length()); return Result; } - + return Result; } uint64_t DIDescriptor::getUInt64Field(unsigned Elt) const { - if (DbgNode == 0) + if (DbgNode == 0) return 0; if (Elt < DbgNode->getNumElements()) if (ConstantInt *CI = dyn_cast(DbgNode->getElement(Elt))) return CI->getZExtValue(); - + return 0; } DIDescriptor DIDescriptor::getDescriptorField(unsigned Elt) const { - if (DbgNode == 0) + if (DbgNode == 0) return DIDescriptor(); if (Elt < DbgNode->getNumElements() && DbgNode->getElement(Elt)) @@ -115,7 +115,7 @@ } GlobalVariable *DIDescriptor::getGlobalVariableField(unsigned Elt) const { - if (DbgNode == 0) + if (DbgNode == 0) return 0; if (Elt < DbgNode->getNumElements()) @@ -132,7 +132,7 @@ bool DIDescriptor::isBasicType() const { assert (!isNull() && "Invalid descriptor!"); unsigned Tag = getTag(); - + return Tag == dwarf::DW_TAG_base_type; } @@ -197,7 +197,7 @@ bool DIDescriptor::isSubprogram() const { assert (!isNull() && "Invalid descriptor!"); unsigned Tag = getTag(); - + return Tag == dwarf::DW_TAG_subprogram; } @@ -210,7 +210,7 @@ return Tag == dwarf::DW_TAG_variable; } -/// isScope - Return true if the specified tag is one of the scope +/// isScope - Return true if the specified tag is one of the scope /// related tag. bool DIDescriptor::isScope() const { assert (!isNull() && "Invalid descriptor!"); @@ -273,10 +273,10 @@ /// Verify - Verify that a compile unit is well formed. bool DICompileUnit::Verify() const { - if (isNull()) + if (isNull()) return false; std::string Res; - if (getFilename(Res).empty()) + if (getFilename(Res).empty()) return false; // It is possible that directory and produce string is empty. return true; @@ -284,26 +284,26 @@ /// Verify - Verify that a type descriptor is well formed. bool DIType::Verify() const { - if (isNull()) + if (isNull()) return false; - if (getContext().isNull()) + if (getContext().isNull()) return false; DICompileUnit CU = getCompileUnit(); - if (!CU.isNull() && !CU.Verify()) + if (!CU.isNull() && !CU.Verify()) return false; return true; } /// Verify - Verify that a composite type descriptor is well formed. bool DICompositeType::Verify() const { - if (isNull()) + if (isNull()) return false; - if (getContext().isNull()) + if (getContext().isNull()) return false; DICompileUnit CU = getCompileUnit(); - if (!CU.isNull() && !CU.Verify()) + if (!CU.isNull() && !CU.Verify()) return false; return true; } @@ -312,12 +312,12 @@ bool DISubprogram::Verify() const { if (isNull()) return false; - + if (getContext().isNull()) return false; DICompileUnit CU = getCompileUnit(); - if (!CU.Verify()) + if (!CU.Verify()) return false; DICompositeType Ty = getType(); @@ -330,12 +330,12 @@ bool DIGlobalVariable::Verify() const { if (isNull()) return false; - + if (getContext().isNull()) return false; DICompileUnit CU = getCompileUnit(); - if (!CU.isNull() && !CU.Verify()) + if (!CU.isNull() && !CU.Verify()) return false; DIType Ty = getType(); @@ -352,7 +352,7 @@ bool DIVariable::Verify() const { if (isNull()) return false; - + if (getContext().isNull()) return false; @@ -420,14 +420,14 @@ // TODO : Print context getCompileUnit().dump(); - errs() << " [" - << getLineNumber() << ", " + errs() << " [" + << getLineNumber() << ", " << getSizeInBits() << ", " << getAlignInBits() << ", " - << getOffsetInBits() + << getOffsetInBits() << "] "; - if (isPrivate()) + if (isPrivate()) errs() << " [private] "; else if (isProtected()) errs() << " [protected] "; @@ -538,7 +538,7 @@ //===----------------------------------------------------------------------===// DIFactory::DIFactory(Module &m) - : M(m), VMContext(M.getContext()), StopPointFn(0), FuncStartFn(0), + : M(m), VMContext(M.getContext()), StopPointFn(0), FuncStartFn(0), RegionStartFn(0), RegionEndFn(0), DeclareFn(0) { EmptyStructPtr = PointerType::getUnqual(StructType::get(VMContext)); @@ -554,11 +554,11 @@ // DIFactory: Primary Constructors //===----------------------------------------------------------------------===// -/// GetOrCreateArray - Create an descriptor for an array of descriptors. +/// GetOrCreateArray - Create an descriptor for an array of descriptors. /// This implicitly uniques the arrays created. DIArray DIFactory::GetOrCreateArray(DIDescriptor *Tys, unsigned NumTys) { SmallVector Elts; - + if (NumTys == 0) Elts.push_back(llvm::Constant::getNullValue(Type::getInt32Ty(VMContext))); else @@ -576,7 +576,7 @@ ConstantInt::get(Type::getInt64Ty(VMContext), Lo), ConstantInt::get(Type::getInt64Ty(VMContext), Hi) }; - + return DISubrange(MDNode::get(VMContext, &Elts[0], 3)); } @@ -705,7 +705,7 @@ /// CreateSubprogram - Create a new descriptor for the specified subprogram. /// See comments in DISubprogram for descriptions of these fields. This /// method does not unique the generated descriptors. -DISubprogram DIFactory::CreateSubprogram(DIDescriptor Context, +DISubprogram DIFactory::CreateSubprogram(DIDescriptor Context, const std::string &Name, const std::string &DisplayName, const std::string &LinkageName, @@ -738,7 +738,7 @@ DICompileUnit CompileUnit, unsigned LineNo, DIType Type,bool isLocalToUnit, bool isDefinition, llvm::GlobalVariable *Val) { - Value *Elts[] = { + Value *Elts[] = { GetTagConstant(dwarf::DW_TAG_variable), llvm::Constant::getNullValue(Type::getInt32Ty(VMContext)), Context.getNode(), @@ -792,7 +792,7 @@ } /// CreateLocation - Creates a debug info location. -DILocation DIFactory::CreateLocation(unsigned LineNo, unsigned ColumnNo, +DILocation DIFactory::CreateLocation(unsigned LineNo, unsigned ColumnNo, DIScope S, DILocation OrigLoc) { Value *Elts[] = { ConstantInt::get(Type::getInt32Ty(VMContext), LineNo), @@ -812,12 +812,12 @@ /// inserting it at the end of the specified basic block. void DIFactory::InsertStopPoint(DICompileUnit CU, unsigned LineNo, unsigned ColNo, BasicBlock *BB) { - + // Lazily construct llvm.dbg.stoppoint function. if (!StopPointFn) - StopPointFn = llvm::Intrinsic::getDeclaration(&M, + StopPointFn = llvm::Intrinsic::getDeclaration(&M, llvm::Intrinsic::dbg_stoppoint); - + // Invoke llvm.dbg.stoppoint Value *Args[] = { ConstantInt::get(llvm::Type::getInt32Ty(VMContext), LineNo), @@ -833,7 +833,7 @@ // Lazily construct llvm.dbg.func.start. if (!FuncStartFn) FuncStartFn = Intrinsic::getDeclaration(&M, Intrinsic::dbg_func_start); - + // Call llvm.dbg.func.start which also implicitly sets a stoppoint. CallInst::Create(FuncStartFn, SP.getNode(), "", BB); } @@ -864,7 +864,7 @@ void DIFactory::InsertDeclare(Value *Storage, DIVariable D, BasicBlock *BB) { // Cast the storage to a {}* for the call to llvm.dbg.declare. Storage = new BitCastInst(Storage, EmptyStructPtr, "", BB); - + if (!DeclareFn) DeclareFn = Intrinsic::getDeclaration(&M, Intrinsic::dbg_declare); @@ -909,7 +909,7 @@ } } } - + /// processType - Process DIType. void DebugInfoFinder::processType(DIType DT) { if (!addType(DT)) @@ -926,12 +926,12 @@ DIType TypeE = DIType(D.getNode()); if (!TypeE.isNull()) processType(TypeE); - else + else processSubprogram(DISubprogram(D.getNode())); } } else if (DT.isDerivedType()) { DIDerivedType DDT(DT.getNode()); - if (!DDT.isNull()) + if (!DDT.isNull()) processType(DDT.getTypeDerivedFrom()); } } @@ -1006,7 +1006,7 @@ CUs.push_back(CU.getNode()); return true; } - + /// addGlobalVariable - Add global variable into GVs. bool DebugInfoFinder::addGlobalVariable(DIGlobalVariable DIG) { if (DIG.isNull()) @@ -1023,7 +1023,7 @@ bool DebugInfoFinder::addSubprogram(DISubprogram SP) { if (SP.isNull()) return false; - + if (!NodesSeen.insert(SP.getNode())) return false; @@ -1083,7 +1083,7 @@ NamedMDNode *NMD = M->getNamedMetadata("llvm.dbg.gv"); if (!NMD) return 0; - + for (unsigned i = 0, e = NMD->getNumElements(); i != e; ++i) { DIGlobalVariable DIG(cast_or_null(NMD->getElement(i))); if (DIG.isNull()) @@ -1150,28 +1150,28 @@ return true; } - /// isValidDebugInfoIntrinsic - Return true if SPI is a valid debug + /// isValidDebugInfoIntrinsic - Return true if SPI is a valid debug /// info intrinsic. - bool isValidDebugInfoIntrinsic(DbgStopPointInst &SPI, + bool isValidDebugInfoIntrinsic(DbgStopPointInst &SPI, CodeGenOpt::Level OptLev) { return DIDescriptor::ValidDebugInfo(SPI.getContext(), OptLev); } - /// isValidDebugInfoIntrinsic - Return true if FSI is a valid debug + /// isValidDebugInfoIntrinsic - Return true if FSI is a valid debug /// info intrinsic. bool isValidDebugInfoIntrinsic(DbgFuncStartInst &FSI, CodeGenOpt::Level OptLev) { return DIDescriptor::ValidDebugInfo(FSI.getSubprogram(), OptLev); } - /// isValidDebugInfoIntrinsic - Return true if RSI is a valid debug + /// isValidDebugInfoIntrinsic - Return true if RSI is a valid debug /// info intrinsic. bool isValidDebugInfoIntrinsic(DbgRegionStartInst &RSI, CodeGenOpt::Level OptLev) { return DIDescriptor::ValidDebugInfo(RSI.getContext(), OptLev); } - /// isValidDebugInfoIntrinsic - Return true if REI is a valid debug + /// isValidDebugInfoIntrinsic - Return true if REI is a valid debug /// info intrinsic. bool isValidDebugInfoIntrinsic(DbgRegionEndInst &REI, CodeGenOpt::Level OptLev) { @@ -1179,14 +1179,14 @@ } - /// isValidDebugInfoIntrinsic - Return true if DI is a valid debug + /// isValidDebugInfoIntrinsic - Return true if DI is a valid debug /// info intrinsic. bool isValidDebugInfoIntrinsic(DbgDeclareInst &DI, CodeGenOpt::Level OptLev) { return DIDescriptor::ValidDebugInfo(DI.getVariable(), OptLev); } - /// ExtractDebugLocation - Extract debug location information + /// ExtractDebugLocation - Extract debug location information /// from llvm.dbg.stoppoint intrinsic. DebugLoc ExtractDebugLocation(DbgStopPointInst &SPI, DebugLocTracker &DebugLocInfo) { @@ -1194,7 +1194,7 @@ Value *Context = SPI.getContext(); // If this location is already tracked then use it. - DebugLocTuple Tuple(cast(Context), SPI.getLine(), + DebugLocTuple Tuple(cast(Context), SPI.getLine(), SPI.getColumn()); DenseMap::iterator II = DebugLocInfo.DebugIdMap.find(Tuple); @@ -1205,11 +1205,11 @@ unsigned Id = DebugLocInfo.DebugLocations.size(); DebugLocInfo.DebugLocations.push_back(Tuple); DebugLocInfo.DebugIdMap[Tuple] = Id; - + return DebugLoc::get(Id); } - /// ExtractDebugLocation - Extract debug location information + /// ExtractDebugLocation - Extract debug location information /// from DILocation. DebugLoc ExtractDebugLocation(DILocation &Loc, DebugLocTracker &DebugLocInfo) { @@ -1228,11 +1228,11 @@ unsigned Id = DebugLocInfo.DebugLocations.size(); DebugLocInfo.DebugLocations.push_back(Tuple); DebugLocInfo.DebugIdMap[Tuple] = Id; - + return DebugLoc::get(Id); } - /// ExtractDebugLocation - Extract debug location information + /// ExtractDebugLocation - Extract debug location information /// from llvm.dbg.func_start intrinsic. DebugLoc ExtractDebugLocation(DbgFuncStartInst &FSI, DebugLocTracker &DebugLocInfo) { @@ -1254,7 +1254,7 @@ unsigned Id = DebugLocInfo.DebugLocations.size(); DebugLocInfo.DebugLocations.push_back(Tuple); DebugLocInfo.DebugIdMap[Tuple] = Id; - + return DebugLoc::get(Id); } Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=82332&r1=82331&r2=82332&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Sat Sep 19 15:40:05 2009 @@ -150,7 +150,7 @@ SmallVector Scopes; // Scopes defined in scope. SmallVector Variables;// Variables declared in scope. SmallVector ConcreteInsts;// Concrete insts of funcs. - + // Private state for dump() mutable unsigned IndentLevel; public: @@ -232,7 +232,7 @@ DwarfDebug::DwarfDebug(raw_ostream &OS, AsmPrinter *A, const MCAsmInfo *T) : Dwarf(OS, A, T, "dbg"), ModuleCU(0), AbbreviationsSet(InitAbbreviationsSetSize), Abbreviations(), - ValuesSet(InitValuesSetSize), Values(), StringPool(), + ValuesSet(InitValuesSetSize), Values(), StringPool(), SectionSourceLines(), didInitial(false), shouldEmit(false), FunctionDbgScope(0), DebugTimer(0) { if (TimePassesIsEnabled) @@ -593,7 +593,7 @@ the variable's Debug Information Entry as its real type. So far, so good. However now the debugger will expect the variable VarName to have the type SomeType. So we need the location attribute for the variable to be an - expression that explains to the debugger how to navigate through the + expression that explains to the debugger how to navigate through the pointers and struct to find the actual variable of type SomeType. The following function does just that. We start by getting @@ -639,7 +639,7 @@ /// starting location. Add the DWARF information to the die. For /// more information, read large comment just above here. /// -void DwarfDebug::AddBlockByrefAddress(DbgVariable *&DV, DIE *Die, +void DwarfDebug::AddBlockByrefAddress(DbgVariable *&DV, DIE *Die, unsigned Attribute, const MachineLocation &Location) { const DIVariable &VD = DV->getVariable(); @@ -667,7 +667,7 @@ // Find the __forwarding field and the variable field in the __Block_byref // struct. - + DIArray Fields = blockStruct.getTypeArray(); DIDescriptor varField = DIDescriptor(); DIDescriptor forwardingField = DIDescriptor(); @@ -683,19 +683,19 @@ else if (fieldName == varName) varField = Element; } - + assert (!varField.isNull() && "Can't find byref variable in Block struct"); - assert (!forwardingField.isNull() + assert (!forwardingField.isNull() && "Can't find forwarding field in Block struct"); // Get the offsets for the forwarding field and the variable field. - unsigned int forwardingFieldOffset = + unsigned int forwardingFieldOffset = DIDerivedType(forwardingField.getNode()).getOffsetInBits() >> 3; - unsigned int varFieldOffset = + unsigned int varFieldOffset = DIDerivedType(varField.getNode()).getOffsetInBits() >> 3; - // Decode the original location, and use that as the start of the + // Decode the original location, and use that as the start of the // byref variable's location. unsigned Reg = RI->getDwarfRegNum(Location.getReg(), false); @@ -1393,13 +1393,13 @@ StringMap::iterator GI = Globals.find(MF->getFunction()->getName()); if (GI != Globals.end()) { DIE *SPDie = GI->second; - + // Add the function bounds. AddLabel(SPDie, dwarf::DW_AT_low_pc, dwarf::DW_FORM_addr, DWLabel("func_begin", SubprogramCount)); AddLabel(SPDie, dwarf::DW_AT_high_pc, dwarf::DW_FORM_addr, DWLabel("func_end", SubprogramCount)); - + MachineLocation Location(RI->getFrameRegister(*MF)); AddAddress(SPDie, dwarf::DW_AT_frame_base, Location); } @@ -1487,7 +1487,7 @@ void DwarfDebug::ConstructGlobalVariableDIE(MDNode *N) { DIGlobalVariable DI_GV(N); - + // If debug information is malformed then ignore it. if (DI_GV.Verify() == false) return; @@ -1582,7 +1582,7 @@ DebugTimer->stopTimer(); return; } - + // Create DIEs for each of the externally visible global variables. for (DebugInfoFinder::iterator I = DbgFinder.global_variable_begin(), E = DbgFinder.global_variable_end(); I != E; ++I) @@ -1904,7 +1904,7 @@ Scope = I->second; } } - if (!InlinedVar) + if (!InlinedVar) Scope = getOrCreateScope(Context); } @@ -2109,7 +2109,7 @@ didInitial = true; const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering(); - + // Dwarf sections base addresses. if (MAI->doesDwarfRequireFrameSection()) { Asm->OutStreamer.SwitchSection(TLOF.getDwarfFrameSection()); @@ -2669,7 +2669,7 @@ /// EmitDebugMacInfo - Emit visible names into a debug macinfo section. /// void DwarfDebug::EmitDebugMacInfo() { - if (const MCSection *LineInfo = + if (const MCSection *LineInfo = Asm->getObjFileLowering().getDwarfMacroInfoSection()) { // Start the dwarf macinfo section. Asm->OutStreamer.SwitchSection(LineInfo); From daniel at zuster.org Sat Sep 19 15:40:14 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Sat, 19 Sep 2009 20:40:14 -0000 Subject: [llvm-commits] [llvm] r82333 - /llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Message-ID: <200909192040.n8JKeEMe027220@zion.cs.uiuc.edu> Author: ddunbar Date: Sat Sep 19 15:40:14 2009 New Revision: 82333 URL: http://llvm.org/viewvc/llvm-project?rev=82333&view=rev Log: Fix indentation. Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=82333&r1=82332&r2=82333&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Sat Sep 19 15:40:14 2009 @@ -640,8 +640,8 @@ /// more information, read large comment just above here. /// void DwarfDebug::AddBlockByrefAddress(DbgVariable *&DV, DIE *Die, - unsigned Attribute, - const MachineLocation &Location) { + unsigned Attribute, + const MachineLocation &Location) { const DIVariable &VD = DV->getVariable(); DIType Ty = VD.getType(); DIType TmpTy = Ty; @@ -662,96 +662,96 @@ std::string typeName; blockStruct.getName(typeName); - assert(typeName.find ("__Block_byref_") == 0 - && "Attempting to get Block location of non-Block variable!"); + assert(typeName.find ("__Block_byref_") == 0 + && "Attempting to get Block location of non-Block variable!"); - // Find the __forwarding field and the variable field in the __Block_byref - // struct. + // Find the __forwarding field and the variable field in the __Block_byref + // struct. - DIArray Fields = blockStruct.getTypeArray(); - DIDescriptor varField = DIDescriptor(); - DIDescriptor forwardingField = DIDescriptor(); - - - for (unsigned i = 0, N = Fields.getNumElements(); i < N; ++i) { - DIDescriptor Element = Fields.getElement(i); - DIDerivedType DT = DIDerivedType(Element.getNode()); - std::string fieldName; - DT.getName(fieldName); - if (fieldName == "__forwarding") - forwardingField = Element; - else if (fieldName == varName) - varField = Element; - } - - assert (!varField.isNull() && "Can't find byref variable in Block struct"); - assert (!forwardingField.isNull() - && "Can't find forwarding field in Block struct"); - - // Get the offsets for the forwarding field and the variable field. - - unsigned int forwardingFieldOffset = - DIDerivedType(forwardingField.getNode()).getOffsetInBits() >> 3; - unsigned int varFieldOffset = - DIDerivedType(varField.getNode()).getOffsetInBits() >> 3; - - // Decode the original location, and use that as the start of the - // byref variable's location. - - unsigned Reg = RI->getDwarfRegNum(Location.getReg(), false); - DIEBlock *Block = new DIEBlock(); - - if (Location.isReg()) { - if (Reg < 32) - AddUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_reg0 + Reg); - else { - Reg = Reg - dwarf::DW_OP_reg0; - AddUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_breg0 + Reg); - AddUInt(Block, 0, dwarf::DW_FORM_udata, Reg); - } - } else { - if (Reg < 32) - AddUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_breg0 + Reg); - else { - AddUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_bregx); - AddUInt(Block, 0, dwarf::DW_FORM_udata, Reg); - } - - AddUInt(Block, 0, dwarf::DW_FORM_sdata, Location.getOffset()); - } - - // If we started with a pointer to the__Block_byref... struct, then - // the first thing we need to do is dereference the pointer (DW_OP_deref). - - if (isPointer) - AddUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_deref); - - // Next add the offset for the '__forwarding' field: - // DW_OP_plus_uconst ForwardingFieldOffset. Note there's no point in - // adding the offset if it's 0. - - if (forwardingFieldOffset > 0) { - AddUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_plus_uconst); - AddUInt(Block, 0, dwarf::DW_FORM_udata, forwardingFieldOffset); - } - - // Now dereference the __forwarding field to get to the real __Block_byref - // struct: DW_OP_deref. - - AddUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_deref); - - // Now that we've got the real __Block_byref... struct, add the offset - // for the variable's field to get to the location of the actual variable: - // DW_OP_plus_uconst varFieldOffset. Again, don't add if it's 0. - - if (varFieldOffset > 0) { - AddUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_plus_uconst); - AddUInt(Block, 0, dwarf::DW_FORM_udata, varFieldOffset); - } + DIArray Fields = blockStruct.getTypeArray(); + DIDescriptor varField = DIDescriptor(); + DIDescriptor forwardingField = DIDescriptor(); - // Now attach the location information to the DIE. - AddBlock(Die, Attribute, 0, Block); + for (unsigned i = 0, N = Fields.getNumElements(); i < N; ++i) { + DIDescriptor Element = Fields.getElement(i); + DIDerivedType DT = DIDerivedType(Element.getNode()); + std::string fieldName; + DT.getName(fieldName); + if (fieldName == "__forwarding") + forwardingField = Element; + else if (fieldName == varName) + varField = Element; + } + + assert (!varField.isNull() && "Can't find byref variable in Block struct"); + assert (!forwardingField.isNull() + && "Can't find forwarding field in Block struct"); + + // Get the offsets for the forwarding field and the variable field. + + unsigned int forwardingFieldOffset = + DIDerivedType(forwardingField.getNode()).getOffsetInBits() >> 3; + unsigned int varFieldOffset = + DIDerivedType(varField.getNode()).getOffsetInBits() >> 3; + + // Decode the original location, and use that as the start of the + // byref variable's location. + + unsigned Reg = RI->getDwarfRegNum(Location.getReg(), false); + DIEBlock *Block = new DIEBlock(); + + if (Location.isReg()) { + if (Reg < 32) + AddUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_reg0 + Reg); + else { + Reg = Reg - dwarf::DW_OP_reg0; + AddUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_breg0 + Reg); + AddUInt(Block, 0, dwarf::DW_FORM_udata, Reg); + } + } else { + if (Reg < 32) + AddUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_breg0 + Reg); + else { + AddUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_bregx); + AddUInt(Block, 0, dwarf::DW_FORM_udata, Reg); + } + + AddUInt(Block, 0, dwarf::DW_FORM_sdata, Location.getOffset()); + } + + // If we started with a pointer to the__Block_byref... struct, then + // the first thing we need to do is dereference the pointer (DW_OP_deref). + + if (isPointer) + AddUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_deref); + + // Next add the offset for the '__forwarding' field: + // DW_OP_plus_uconst ForwardingFieldOffset. Note there's no point in + // adding the offset if it's 0. + + if (forwardingFieldOffset > 0) { + AddUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_plus_uconst); + AddUInt(Block, 0, dwarf::DW_FORM_udata, forwardingFieldOffset); + } + + // Now dereference the __forwarding field to get to the real __Block_byref + // struct: DW_OP_deref. + + AddUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_deref); + + // Now that we've got the real __Block_byref... struct, add the offset + // for the variable's field to get to the location of the actual variable: + // DW_OP_plus_uconst varFieldOffset. Again, don't add if it's 0. + + if (varFieldOffset > 0) { + AddUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_plus_uconst); + AddUInt(Block, 0, dwarf::DW_FORM_udata, varFieldOffset); + } + + // Now attach the location information to the DIE. + + AddBlock(Die, Attribute, 0, Block); } /// AddAddress - Add an address attribute to a die based on the location @@ -995,7 +995,7 @@ if (L) AddSInt(DW_Subrange, dwarf::DW_AT_lower_bound, 0, L); if (H) - AddSInt(DW_Subrange, dwarf::DW_AT_upper_bound, 0, H); + AddSInt(DW_Subrange, dwarf::DW_AT_upper_bound, 0, H); Buffer.AddChild(DW_Subrange); } @@ -1056,7 +1056,7 @@ AddString(GVDie, dwarf::DW_AT_MIPS_linkage_name, dwarf::DW_FORM_string, LinkageName); } - AddType(DW_Unit, GVDie, GV.getType()); + AddType(DW_Unit, GVDie, GV.getType()); if (!GV.isLocalToUnit()) AddUInt(GVDie, dwarf::DW_AT_external, dwarf::DW_FORM_flag, 1); AddSourceLine(GVDie, &GV); @@ -1545,9 +1545,9 @@ return; } - /// BeginModule - Emit all Dwarf sections that should come prior to the - /// content. Create global DIEs and emit initial debug info sections. - /// This is inovked by the target AsmPrinter. +/// BeginModule - Emit all Dwarf sections that should come prior to the +/// content. Create global DIEs and emit initial debug info sections. +/// This is inovked by the target AsmPrinter. void DwarfDebug::BeginModule(Module *M, MachineModuleInfo *mmi) { this->M = M; From daniel at zuster.org Sat Sep 19 15:40:21 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Sat, 19 Sep 2009 20:40:21 -0000 Subject: [llvm-commits] [llvm] r82334 - /llvm/trunk/include/llvm/Analysis/DebugInfo.h Message-ID: <200909192040.n8JKeLd1027253@zion.cs.uiuc.edu> Author: ddunbar Date: Sat Sep 19 15:40:21 2009 New Revision: 82334 URL: http://llvm.org/viewvc/llvm-project?rev=82334&view=rev Log: Tabs -> spaces (really?) Modified: llvm/trunk/include/llvm/Analysis/DebugInfo.h Modified: llvm/trunk/include/llvm/Analysis/DebugInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/DebugInfo.h?rev=82334&r1=82333&r2=82334&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/DebugInfo.h (original) +++ llvm/trunk/include/llvm/Analysis/DebugInfo.h Sat Sep 19 15:40:21 2009 @@ -145,7 +145,7 @@ explicit DICompileUnit(MDNode *N = 0) { DbgNode = N; if (DbgNode && !isCompileUnit()) - DbgNode = 0; + DbgNode = 0; } unsigned getLanguage() const { return getUnsignedField(2); } @@ -356,7 +356,7 @@ explicit DISubprogram(MDNode *N = 0) { DbgNode = N; if (DbgNode && !isSubprogram()) - DbgNode = 0; + DbgNode = 0; } DIDescriptor getContext() const { return getDescriptorField(2); } @@ -462,7 +462,7 @@ explicit DILexicalBlock(MDNode *N = 0) { DbgNode = N; if (DbgNode && !isLexicalBlock()) - DbgNode = 0; + DbgNode = 0; } DIScope getContext() const { return getFieldAs(1); } @@ -594,7 +594,7 @@ /// CreateLocation - Creates a debug info location. DILocation CreateLocation(unsigned LineNo, unsigned ColumnNo, - DIScope S, DILocation OrigLoc); + DIScope S, DILocation OrigLoc); /// InsertStopPoint - Create a new llvm.dbg.stoppoint intrinsic invocation, /// inserting it at the end of the specified basic block. From daniel at zuster.org Sat Sep 19 15:40:29 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Sat, 19 Sep 2009 20:40:29 -0000 Subject: [llvm-commits] [llvm] r82335 - /llvm/trunk/include/llvm/Analysis/DebugInfo.h Message-ID: <200909192040.n8JKeTH1027280@zion.cs.uiuc.edu> Author: ddunbar Date: Sat Sep 19 15:40:28 2009 New Revision: 82335 URL: http://llvm.org/viewvc/llvm-project?rev=82335&view=rev Log: Prefer super class constructor to explicit initialization. Modified: llvm/trunk/include/llvm/Analysis/DebugInfo.h Modified: llvm/trunk/include/llvm/Analysis/DebugInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/DebugInfo.h?rev=82335&r1=82334&r2=82335&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/DebugInfo.h (original) +++ llvm/trunk/include/llvm/Analysis/DebugInfo.h Sat Sep 19 15:40:28 2009 @@ -142,8 +142,7 @@ /// DICompileUnit - A wrapper for a compile unit. class DICompileUnit : public DIScope { public: - explicit DICompileUnit(MDNode *N = 0) { - DbgNode = N; + explicit DICompileUnit(MDNode *N = 0) : DIScope(N) { if (DbgNode && !isCompileUnit()) DbgNode = 0; } @@ -353,8 +352,7 @@ /// DISubprogram - This is a wrapper for a subprogram (e.g. a function). class DISubprogram : public DIScope { public: - explicit DISubprogram(MDNode *N = 0) { - DbgNode = N; + explicit DISubprogram(MDNode *N = 0) : DIScope(N) { if (DbgNode && !isSubprogram()) DbgNode = 0; } @@ -459,8 +457,7 @@ /// DILexicalBlock - This is a wrapper for a lexical block. class DILexicalBlock : public DIScope { public: - explicit DILexicalBlock(MDNode *N = 0) { - DbgNode = N; + explicit DILexicalBlock(MDNode *N = 0) : DIScope(N) { if (DbgNode && !isLexicalBlock()) DbgNode = 0; } @@ -478,7 +475,7 @@ /// is not associated with any DWARF tag. class DILocation : public DIDescriptor { public: - explicit DILocation(MDNode *L) { DbgNode = L; } + explicit DILocation(MDNode *N) : DIDescriptor(N) { ; } unsigned getLineNumber() const { return getUnsignedField(0); } unsigned getColumnNumber() const { return getUnsignedField(1); } From wendling at apple.com Sat Sep 19 15:41:22 2009 From: wendling at apple.com (Bill Wendling) Date: Sat, 19 Sep 2009 13:41:22 -0700 Subject: [llvm-commits] Nightly Test Regressions In-Reply-To: <1A83B82E-8A72-4649-8F27-A721A1ADDE41@apple.com> References: <6a8523d60909191012y6fb7f512i8b1a02d9c5190f1b@mail.gmail.com> <1A83B82E-8A72-4649-8F27-A721A1ADDE41@apple.com> Message-ID: A bug in my patch?!?! :-) -bw On Sep 19, 2009, at 11:18 AM, Evan Cheng wrote: > Yeah. It's likely Bill's change is responsible all of the failures. > I'll already informed him last night. > > Evan > > On Sep 19, 2009, at 10:39 AM, Anton Korobeynikov wrote: > >> Hello, Everyone >> >>> This is failing in a number of places: >>> Externals/SPEC/CINT2006/483_xalancbmk/483_xalancbmk [JIT, JIT >>> codegen, LLC, LLC-BETA, LLC compile, Bitcode, GCCAS, LLC_BETA >>> compile] >>> Externals/SPEC/CINT2006/483_xalancbmk/483_xalancbmk [JIT, CBE, JIT >>> codegen, LLC, LLC-BETA, LLC compile, Bitcode, GCCAS, LLC_BETA >>> compile] >>> and these are failing in at least one place: >>> Externals/SPEC/CINT2006/471_omnetpp/471_omnetpp [LLC, LLC-BETA, LLC >>> compile, LLC_BETA compile] >> These 2 definitely use EH during normal run, so the fails might be >> connected to EH ones. So far I'm seeing the only suspicious commit: >> Bill's changes in r82274. >> >> -- >> With best regards, Anton Korobeynikov >> Faculty of Mathematics and Mechanics, Saint Petersburg State >> University > From anton at korobeynikov.info Sat Sep 19 15:57:50 2009 From: anton at korobeynikov.info (Anton Korobeynikov) Date: Sun, 20 Sep 2009 00:57:50 +0400 Subject: [llvm-commits] Nightly Test Regressions In-Reply-To: References: <6a8523d60909191012y6fb7f512i8b1a02d9c5190f1b@mail.gmail.com> <1A83B82E-8A72-4649-8F27-A721A1ADDE41@apple.com> Message-ID: > A bug in my patch?!?! > > :-) Even more - it's still not reverted! :) -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University From isanbard at gmail.com Sat Sep 19 17:02:38 2009 From: isanbard at gmail.com (Bill Wendling) Date: Sat, 19 Sep 2009 22:02:38 -0000 Subject: [llvm-commits] [llvm] r82336 - /llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp Message-ID: <200909192202.n8JM2cbZ005751@zion.cs.uiuc.edu> Author: void Date: Sat Sep 19 17:02:37 2009 New Revision: 82336 URL: http://llvm.org/viewvc/llvm-project?rev=82336&view=rev Log: Revert r82274. It's causing failures in the CINT2006 benchmarks. Modified: llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp Modified: llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp?rev=82336&r1=82335&r2=82336&view=diff ============================================================================== --- llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp (original) +++ llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp Sat Sep 19 17:02:37 2009 @@ -782,8 +782,14 @@ } // Exception Handling. +#if 1 + LSDASection = getMachOSection("__DATA", "__gcc_except_tab", 0, + SectionKind::getDataRel()); +#else + // FIXME: This is causing failures in the CINT2006 SPEC benchmarks. LSDASection = getMachOSection("__TEXT", "__gcc_except_tab", 0, SectionKind::getReadOnly()); +#endif EHFrameSection = getMachOSection("__TEXT", "__eh_frame", MCSectionMachO::S_COALESCED | From wendling at apple.com Sat Sep 19 17:03:13 2009 From: wendling at apple.com (Bill Wendling) Date: Sat, 19 Sep 2009 15:03:13 -0700 Subject: [llvm-commits] Nightly Test Regressions In-Reply-To: References: <6a8523d60909191012y6fb7f512i8b1a02d9c5190f1b@mail.gmail.com> <1A83B82E-8A72-4649-8F27-A721A1ADDE41@apple.com> Message-ID: <964909EF-0036-4971-9B44-063A6AAF7F27@apple.com> On Sep 19, 2009, at 1:57 PM, Anton Korobeynikov wrote: >> A bug in my patch?!?! >> >> :-) > Even more - it's still not reverted! :) > I reverted the relevant section now. Anyone is welcome to revert broken patches, of course. :-) -bw From wendling at apple.com Sat Sep 19 17:59:14 2009 From: wendling at apple.com (Bill Wendling) Date: Sat, 19 Sep 2009 15:59:14 -0700 Subject: [llvm-commits] Nightly Test Regressions In-Reply-To: <964909EF-0036-4971-9B44-063A6AAF7F27@apple.com> References: <6a8523d60909191012y6fb7f512i8b1a02d9c5190f1b@mail.gmail.com> <1A83B82E-8A72-4649-8F27-A721A1ADDE41@apple.com> <964909EF-0036-4971-9B44-063A6AAF7F27@apple.com> Message-ID: <1CCD7AB6-1B93-4900-AA20-FFA0926A0B65@apple.com> Something is severely messed up with llvm-g++. It's not able to find any of the C++ header files... -bw From sabre at nondot.org Sat Sep 19 18:57:31 2009 From: sabre at nondot.org (Chris Lattner) Date: Sat, 19 Sep 2009 23:57:31 -0000 Subject: [llvm-commits] [llvm] r82337 - /llvm/trunk/include/llvm/ADT/SmallString.h Message-ID: <200909192357.n8JNvWKc020307@zion.cs.uiuc.edu> Author: lattner Date: Sat Sep 19 18:57:31 2009 New Revision: 82337 URL: http://llvm.org/viewvc/llvm-project?rev=82337&view=rev Log: add a simple c_str() method to SmallString. Modified: llvm/trunk/include/llvm/ADT/SmallString.h Modified: llvm/trunk/include/llvm/ADT/SmallString.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SmallString.h?rev=82337&r1=82336&r2=82337&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/SmallString.h (original) +++ llvm/trunk/include/llvm/ADT/SmallString.h Sat Sep 19 18:57:31 2009 @@ -38,6 +38,12 @@ // Extra methods. StringRef str() const { return StringRef(this->begin(), this->size()); } + const char *c_str() { + this->push_back(0); + this->pop_back(); + return this->data(); + } + // Extra operators. const SmallString &operator=(StringRef RHS) { this->clear(); From sabre at nondot.org Sat Sep 19 18:58:48 2009 From: sabre at nondot.org (Chris Lattner) Date: Sat, 19 Sep 2009 23:58:48 -0000 Subject: [llvm-commits] [llvm] r82338 - in /llvm/trunk: include/llvm/ADT/StringRef.h lib/Support/StringRef.cpp Message-ID: <200909192358.n8JNwnn8020480@zion.cs.uiuc.edu> Author: lattner Date: Sat Sep 19 18:58:48 2009 New Revision: 82338 URL: http://llvm.org/viewvc/llvm-project?rev=82338&view=rev Log: add some more overloads of StringRef::getAsInteger for common and useful integer types. Modified: llvm/trunk/include/llvm/ADT/StringRef.h llvm/trunk/lib/Support/StringRef.cpp Modified: llvm/trunk/include/llvm/ADT/StringRef.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/StringRef.h?rev=82338&r1=82337&r2=82338&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/StringRef.h (original) +++ llvm/trunk/include/llvm/ADT/StringRef.h Sat Sep 19 18:58:48 2009 @@ -235,8 +235,10 @@ /// this returns true to signify the error. The string is considered /// erroneous if empty. /// - //bool getAsInteger(unsigned Radix, long long &Result) const; + bool getAsInteger(unsigned Radix, long long &Result) const; bool getAsInteger(unsigned Radix, unsigned long long &Result) const; + bool getAsInteger(unsigned Radix, int &Result) const; + bool getAsInteger(unsigned Radix, unsigned &Result) const; // TODO: Provide overloads for int/unsigned that check for overflow. Modified: llvm/trunk/lib/Support/StringRef.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/StringRef.cpp?rev=82338&r1=82337&r2=82338&view=diff ============================================================================== --- llvm/trunk/lib/Support/StringRef.cpp (original) +++ llvm/trunk/lib/Support/StringRef.cpp Sat Sep 19 18:58:48 2009 @@ -12,6 +12,8 @@ const size_t StringRef::npos; +/// GetAsUnsignedInteger - Workhorse method that converts a integer character +/// sequence of radix up to 36 to an unsigned long long value. static bool GetAsUnsignedInteger(StringRef Str, unsigned Radix, unsigned long long &Result) { // Autosense radix if not specified. @@ -74,3 +76,46 @@ return GetAsUnsignedInteger(*this, Radix, Result); } + +bool StringRef::getAsInteger(unsigned Radix, long long &Result) const { + unsigned long long ULLVal; + + // Handle positive strings first. + if (empty() || front() != '-') { + if (GetAsUnsignedInteger(*this, Radix, ULLVal) || + // Check for value so large it overflows a signed value. + (long long)ULLVal < 0) + return true; + Result = ULLVal; + return false; + } + + // Get the positive part of the value. + if (GetAsUnsignedInteger(substr(1), Radix, ULLVal) || + // Reject values so large they'd overflow as negative signed, but allow + // "-0". This negates the unsigned so that the negative isn't undefined + // on signed overflow. + (long long)-ULLVal > 0) + return true; + + Result = -ULLVal; + return false; +} + +bool StringRef::getAsInteger(unsigned Radix, int &Result) const { + long long Val; + if (getAsInteger(Radix, Val) || + (int)Val != Val) + return true; + Result = Val; + return false; +} + +bool StringRef::getAsInteger(unsigned Radix, unsigned &Result) const { + unsigned long long Val; + if (getAsInteger(Radix, Val) || + (unsigned)Val != Val) + return true; + Result = Val; + return false; +} From sabre at nondot.org Sat Sep 19 18:59:03 2009 From: sabre at nondot.org (Chris Lattner) Date: Sat, 19 Sep 2009 23:59:03 -0000 Subject: [llvm-commits] [llvm] r82339 - /llvm/trunk/lib/Support/CommandLine.cpp Message-ID: <200909192359.n8JNx3Uu020526@zion.cs.uiuc.edu> Author: lattner Date: Sat Sep 19 18:59:02 2009 New Revision: 82339 URL: http://llvm.org/viewvc/llvm-project?rev=82339&view=rev Log: Avoid some temporary strings. Modified: llvm/trunk/lib/Support/CommandLine.cpp Modified: llvm/trunk/lib/Support/CommandLine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/CommandLine.cpp?rev=82339&r1=82338&r2=82339&view=diff ============================================================================== --- llvm/trunk/lib/Support/CommandLine.cpp (original) +++ llvm/trunk/lib/Support/CommandLine.cpp Sat Sep 19 18:59:02 2009 @@ -26,6 +26,7 @@ #include "llvm/System/Path.h" #include "llvm/ADT/OwningPtr.h" #include "llvm/ADT/StringMap.h" +#include "llvm/ADT/SmallString.h" #include "llvm/ADT/Twine.h" #include "llvm/Config/config.h" #include @@ -894,11 +895,7 @@ // bool parser::parse(Option &O, const char *ArgName, StringRef Arg, int &Value) { - char *End; - // FIXME: Temporary. - std::string TMP = Arg.str(); - Value = (int)strtol(TMP.c_str(), &End, 0); - if (*End != 0) + if (Arg.getAsInteger(0, Value)) return O.error("'" + Arg + "' value invalid for integer argument!"); return false; } @@ -907,16 +904,8 @@ // bool parser::parse(Option &O, const char *ArgName, StringRef Arg, unsigned &Value) { - char *End; - errno = 0; - - // FIXME: Temporary. - std::string TMP = Arg.str(); - unsigned long V = strtoul(TMP.c_str(), &End, 0); - Value = (unsigned)V; - if (((V == ULONG_MAX) && (errno == ERANGE)) - || (*End != 0) - || (Value != V)) + + if (Arg.getAsInteger(0, Value)) return O.error("'" + Arg + "' value invalid for uint argument!"); return false; } @@ -924,10 +913,8 @@ // parser/parser implementation // static bool parseDouble(Option &O, StringRef Arg, double &Value) { - // FIXME: Temporary. - std::string TMP = Arg.str(); - - const char *ArgStart = TMP.c_str(); + SmallString<32> TmpStr(Arg.begin(), Arg.end()); + const char *ArgStart = TmpStr.c_str(); char *End; Value = strtod(ArgStart, &End); if (*End != 0) From nicholas at mxc.ca Sat Sep 19 19:04:02 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Sun, 20 Sep 2009 00:04:02 -0000 Subject: [llvm-commits] [llvm] r82340 - in /llvm/trunk: lib/VMCore/ConstantFold.cpp test/Transforms/ConstProp/2009-09-19-ConstFold-i1-ConstExpr.ll Message-ID: <200909200004.n8K0436a021159@zion.cs.uiuc.edu> Author: nicholas Date: Sat Sep 19 19:04:02 2009 New Revision: 82340 URL: http://llvm.org/viewvc/llvm-project?rev=82340&view=rev Log: Teach the constant folder how to handle a few simple i1 cases. Added: llvm/trunk/test/Transforms/ConstProp/2009-09-19-ConstFold-i1-ConstExpr.ll Modified: llvm/trunk/lib/VMCore/ConstantFold.cpp Modified: llvm/trunk/lib/VMCore/ConstantFold.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/ConstantFold.cpp?rev=82340&r1=82339&r2=82340&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/ConstantFold.cpp (original) +++ llvm/trunk/lib/VMCore/ConstantFold.cpp Sat Sep 19 19:04:02 2009 @@ -1010,6 +1010,37 @@ } } + // i1 can be simplified in many cases. + if (C1->getType() == Type::getInt1Ty(Context)) { + switch (Opcode) { + case Instruction::Add: + case Instruction::Sub: + return ConstantExpr::getXor(const_cast(C1), + const_cast(C2)); + case Instruction::Mul: + return ConstantExpr::getAnd(const_cast(C1), + const_cast(C2)); + case Instruction::Shl: + case Instruction::LShr: + case Instruction::AShr: + // We can assume that C2 == 0. If it were one the result would be + // undefined because the shift value is as large as the bitwidth. + return const_cast(C1); + case Instruction::SDiv: + case Instruction::UDiv: + // We can assume that C2 == 1. If it were zero the result would be + // undefined through division by zero. + return const_cast(C1); + case Instruction::URem: + case Instruction::SRem: + // We can assume that C2 == 1. If it were zero the result would be + // undefined through division by zero. + return ConstantInt::getFalse(Context); + default: + break; + } + } + // We don't know how to fold this. return 0; } Added: llvm/trunk/test/Transforms/ConstProp/2009-09-19-ConstFold-i1-ConstExpr.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/ConstProp/2009-09-19-ConstFold-i1-ConstExpr.ll?rev=82340&view=auto ============================================================================== --- llvm/trunk/test/Transforms/ConstProp/2009-09-19-ConstFold-i1-ConstExpr.ll (added) +++ llvm/trunk/test/Transforms/ConstProp/2009-09-19-ConstFold-i1-ConstExpr.ll Sat Sep 19 19:04:02 2009 @@ -0,0 +1,25 @@ +; RUN: llvm-as < %s | llvm-dis | FileCheck %s + + at X = external global i8 + at Y = external global i8 + at Z = external global i8 + +global i1 add (i1 icmp ult (i8* @X, i8* @Y), i1 icmp ult (i8* @X, i8* @Z)) +; CHECK: xor +global i1 sub (i1 icmp ult (i8* @X, i8* @Y), i1 icmp ult (i8* @X, i8* @Z)) +; CHECK: xor +global i1 mul (i1 icmp ult (i8* @X, i8* @Y), i1 icmp ult (i8* @X, i8* @Z)) +; CHECK: and + +global i1 sdiv (i1 icmp ult (i8* @X, i8* @Y), i1 icmp ult (i8* @X, i8* @Z)) +; CHECK-NOT: @Z +; CHECK: i1 icmp ult (i8* @X, i8* @Y) +global i1 udiv (i1 icmp ult (i8* @X, i8* @Y), i1 icmp ult (i8* @X, i8* @Z)) +; CHECK-NOT: @Z +; CHECK: i1 icmp ult (i8* @X, i8* @Y) +global i1 srem (i1 icmp ult (i8* @X, i8* @Y), i1 icmp ult (i8* @X, i8* @Z)) +; CHECK-NOT: icmp +; CHECK: i1 false +global i1 urem (i1 icmp ult (i8* @X, i8* @Y), i1 icmp ult (i8* @X, i8* @Z)) +; CHECK-NOT: icmp +; CHECK: i1 false From sabre at nondot.org Sat Sep 19 19:07:40 2009 From: sabre at nondot.org (Chris Lattner) Date: Sun, 20 Sep 2009 00:07:40 -0000 Subject: [llvm-commits] [llvm] r82341 - /llvm/trunk/lib/Support/CommandLine.cpp Message-ID: <200909200007.n8K07evw021597@zion.cs.uiuc.edu> Author: lattner Date: Sat Sep 19 19:07:40 2009 New Revision: 82341 URL: http://llvm.org/viewvc/llvm-project?rev=82341&view=rev Log: avoid a bunch of malloc thrashing for PositinoalVals by eliminating a std::vector and a bunch of std::string temporaries. Modified: llvm/trunk/lib/Support/CommandLine.cpp Modified: llvm/trunk/lib/Support/CommandLine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/CommandLine.cpp?rev=82341&r1=82340&r2=82341&view=diff ============================================================================== --- llvm/trunk/lib/Support/CommandLine.cpp (original) +++ llvm/trunk/lib/Support/CommandLine.cpp Sat Sep 19 19:07:40 2009 @@ -181,17 +181,16 @@ switch (Handler->getValueExpectedFlag()) { case ValueRequired: if (Value == 0) { // No value specified? - if (i+1 < argc) { // Steal the next argument, like for '-o filename' - Value = argv[++i]; - } else { + if (i+1 >= argc) return Handler->error("requires a value!"); - } + // Steal the next argument, like for '-o filename' + Value = argv[++i]; } break; case ValueDisallowed: if (NumAdditionalVals > 0) return Handler->error("multi-valued option specified" - " with ValueDisallowed modifier!"); + " with ValueDisallowed modifier!"); if (Value) return Handler->error("does not allow a value! '" + @@ -199,6 +198,7 @@ break; case ValueOptional: break; + default: errs() << ProgramName << ": Bad ValueMask flag! CommandLine usage error:" @@ -221,7 +221,6 @@ } while (NumAdditionalVals > 0) { - if (i+1 >= argc) return Handler->error("not enough values!"); Value = argv[++i]; @@ -234,10 +233,9 @@ return false; } -static bool ProvidePositionalOption(Option *Handler, const std::string &Arg, - int i) { +static bool ProvidePositionalOption(Option *Handler, StringRef Arg, int i) { int Dummy = i; - return ProvideOption(Handler, Handler->ArgStr, Arg.c_str(), 0, 0, Dummy); + return ProvideOption(Handler, Handler->ArgStr, Arg.data(), 0, 0, Dummy); } @@ -483,9 +481,9 @@ } // PositionalVals - A vector of "positional" arguments we accumulate into - // the process at the end... + // the process at the end. // - std::vector > PositionalVals; + SmallVector, 4> PositionalVals; // If the program has named positional arguments, and the name has been run // across, keep track of which positional argument was named. Otherwise put From dalej at apple.com Sat Sep 19 19:36:42 2009 From: dalej at apple.com (Dale Johannesen) Date: Sun, 20 Sep 2009 00:36:42 -0000 Subject: [llvm-commits] [llvm] r82342 - in /llvm/trunk: lib/CodeGen/LiveIntervalAnalysis.cpp test/CodeGen/X86/2009-09-19-earlyclobber.ll Message-ID: <200909200036.n8K0agPc025107@zion.cs.uiuc.edu> Author: johannes Date: Sat Sep 19 19:36:41 2009 New Revision: 82342 URL: http://llvm.org/viewvc/llvm-project?rev=82342&view=rev Log: When computing live intervals for earlyclobber operands, we pushed the beginning of the interval back 1, so the interval would overlap with inputs that die. We were also pushing the end of the interval back 1, though, which means the earlyclobber didn't overlap with other output operands. Don't do this. PR 4964. Added: llvm/trunk/test/CodeGen/X86/2009-09-19-earlyclobber.ll Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=82342&r1=82341&r2=82342&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original) +++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Sat Sep 19 19:36:41 2009 @@ -665,7 +665,8 @@ if (interval.empty()) { // Get the Idx of the defining instructions. MachineInstrIndex defIndex = getDefIndex(MIIdx); - // Earlyclobbers move back one. + // Earlyclobbers move back one, so that they overlap the live range + // of inputs. if (MO.isEarlyClobber()) defIndex = getUseIndex(MIIdx); VNInfo *ValNo; @@ -690,6 +691,11 @@ MachineInstrIndex killIdx; if (vi.Kills[0] != mi) killIdx = getNextSlot(getUseIndex(getInstructionIndex(vi.Kills[0]))); + else if (MO.isEarlyClobber()) + // Earlyclobbers that die in this instruction move up one extra, to + // compensate for having the starting point moved back one. This + // gets them to overlap the live range of other outputs. + killIdx = getNextSlot(getNextSlot(defIndex)); else killIdx = getNextSlot(defIndex); @@ -791,7 +797,9 @@ // range covering the def slot. if (MO.isDead()) interval.addRange( - LiveRange(RedefIndex, getNextSlot(RedefIndex), OldValNo)); + LiveRange(RedefIndex, MO.isEarlyClobber() ? + getNextSlot(getNextSlot(RedefIndex)) : + getNextSlot(RedefIndex), OldValNo)); DEBUG({ errs() << " RESULT: "; @@ -892,9 +900,14 @@ // If it is not used after definition, it is considered dead at // the instruction defining it. Hence its interval is: // [defSlot(def), defSlot(def)+1) + // For earlyclobbers, the defSlot was pushed back one; the extra + // advance below compensates. if (MO.isDead()) { DEBUG(errs() << " dead"); - end = getNextSlot(start); + if (MO.isEarlyClobber()) + end = getNextSlot(getNextSlot(start)); + else + end = getNextSlot(start); goto exit; } Added: llvm/trunk/test/CodeGen/X86/2009-09-19-earlyclobber.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2009-09-19-earlyclobber.ll?rev=82342&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/2009-09-19-earlyclobber.ll (added) +++ llvm/trunk/test/CodeGen/X86/2009-09-19-earlyclobber.ll Sat Sep 19 19:36:41 2009 @@ -0,0 +1,15 @@ +; RUN: llc < %s | FileCheck %s +; ModuleID = '4964.c' +; PR 4964 +; Registers other than RAX, RCX are OK, but they must be different. +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128" +target triple = "x86_64-apple-darwin10.0" + type { i64, i64 } ; type %0 + +define i64 @flsst(i64 %find) nounwind ssp { +entry: +; CHECK: FOO %rax %rcx + %asmtmp = tail call %0 asm sideeffect "FOO $0 $1 $2", "=r,=&r,rm,~{dirflag},~{fpsr},~{flags},~{cc}"(i64 %find) nounwind ; <%0> [#uses=1] + %asmresult = extractvalue %0 %asmtmp, 0 ; [#uses=1] + ret i64 %asmresult +} From sabre at nondot.org Sat Sep 19 19:38:28 2009 From: sabre at nondot.org (Chris Lattner) Date: Sun, 20 Sep 2009 00:38:28 -0000 Subject: [llvm-commits] [llvm] r82343 - /llvm/trunk/include/llvm/ADT/StringRef.h Message-ID: <200909200038.n8K0cSZX025329@zion.cs.uiuc.edu> Author: lattner Date: Sat Sep 19 19:38:28 2009 New Revision: 82343 URL: http://llvm.org/viewvc/llvm-project?rev=82343&view=rev Log: add size_t and a version of rfind that allows specification of where to scan from. Modified: llvm/trunk/include/llvm/ADT/StringRef.h Modified: llvm/trunk/include/llvm/ADT/StringRef.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/StringRef.h?rev=82343&r1=82342&r2=82343&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/StringRef.h (original) +++ llvm/trunk/include/llvm/ADT/StringRef.h Sat Sep 19 19:38:28 2009 @@ -28,7 +28,8 @@ public: typedef const char *iterator; static const size_t npos = ~size_t(0); - + typedef size_t size_type; + private: /// The start of the string, in an external buffer. const char *Data; @@ -176,14 +177,19 @@ /// /// \return - The index of the last occurence of \arg C, or npos if not /// found. - size_t rfind(char C) const { - for (size_t i = Length, e = 0; i != e;) { + size_t rfind(char C, size_t From) const { + for (size_t i = From, e = 0; i != e;) { --i; if (Data[i] == C) return i; } return npos; } + + size_t rfind(char C) const { + return rfind(C, Length); + } + /// rfind - Search for the last string \arg Str in the string. /// From sabre at nondot.org Sat Sep 19 19:40:49 2009 From: sabre at nondot.org (Chris Lattner) Date: Sun, 20 Sep 2009 00:40:49 -0000 Subject: [llvm-commits] [llvm] r82345 - in /llvm/trunk: include/llvm/Support/CommandLine.h lib/Support/CommandLine.cpp Message-ID: <200909200040.n8K0enqu025676@zion.cs.uiuc.edu> Author: lattner Date: Sat Sep 19 19:40:49 2009 New Revision: 82345 URL: http://llvm.org/viewvc/llvm-project?rev=82345&view=rev Log: convert a bunch more stuff to use StringRef. The ArgName arguments are now stringref because they may not be nul terminated. For options like -Lfoo this now avoids a O(n) temporary std::strings where N is the length of the string after -L. Modified: llvm/trunk/include/llvm/Support/CommandLine.h llvm/trunk/lib/Support/CommandLine.cpp Modified: llvm/trunk/include/llvm/Support/CommandLine.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/CommandLine.h?rev=82345&r1=82344&r2=82345&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/CommandLine.h (original) +++ llvm/trunk/include/llvm/Support/CommandLine.h Sat Sep 19 19:40:49 2009 @@ -142,7 +142,7 @@ // an argument. Should return true if there was an error processing the // argument and the program should exit. // - virtual bool handleOccurrence(unsigned pos, const char *ArgName, + virtual bool handleOccurrence(unsigned pos, StringRef ArgName, StringRef Arg) = 0; virtual enum ValueExpected getValueExpectedFlagDefault() const { @@ -232,13 +232,13 @@ virtual void getExtraOptionNames(std::vector &) {} - // addOccurrence - Wrapper around handleOccurrence that enforces Flags + // addOccurrence - Wrapper around handleOccurrence that enforces Flags. // - bool addOccurrence(unsigned pos, const char *ArgName, + bool addOccurrence(unsigned pos, StringRef ArgName, StringRef Value, bool MultiArg = false); // Prints option name followed by message. Always returns true. - bool error(const Twine &Message, const char *ArgName = 0); + bool error(const Twine &Message, StringRef ArgName = StringRef()); public: inline int getNumOccurrences() const { return NumOccurrences; } @@ -456,7 +456,7 @@ } // parse - Return true on error. - bool parse(Option &O, const char *ArgName, StringRef Arg, DataType &V) { + bool parse(Option &O, StringRef ArgName, StringRef Arg, DataType &V) { StringRef ArgVal; if (hasArgStr) ArgVal = Arg; @@ -538,7 +538,7 @@ public: // parse - Return true on error. - bool parse(Option &O, const char *ArgName, StringRef Arg, bool &Val); + bool parse(Option &O, StringRef ArgName, StringRef Arg, bool &Val); template void initialize(Opt &O) { @@ -565,7 +565,7 @@ class parser : public basic_parser { public: // parse - Return true on error. - bool parse(Option &O, const char *ArgName, StringRef Arg, boolOrDefault &Val); + bool parse(Option &O, StringRef ArgName, StringRef Arg, boolOrDefault &Val); enum ValueExpected getValueExpectedFlagDefault() const { return ValueOptional; @@ -587,7 +587,7 @@ class parser : public basic_parser { public: // parse - Return true on error. - bool parse(Option &O, const char *ArgName, StringRef Arg, int &Val); + bool parse(Option &O, StringRef ArgName, StringRef Arg, int &Val); // getValueName - Overload in subclass to provide a better default value. virtual const char *getValueName() const { return "int"; } @@ -606,7 +606,7 @@ class parser : public basic_parser { public: // parse - Return true on error. - bool parse(Option &O, const char *AN, StringRef Arg, unsigned &Val); + bool parse(Option &O, StringRef ArgName, StringRef Arg, unsigned &Val); // getValueName - Overload in subclass to provide a better default value. virtual const char *getValueName() const { return "uint"; } @@ -624,7 +624,7 @@ class parser : public basic_parser { public: // parse - Return true on error. - bool parse(Option &O, const char *AN, StringRef Arg, double &Val); + bool parse(Option &O, StringRef ArgName, StringRef Arg, double &Val); // getValueName - Overload in subclass to provide a better default value. virtual const char *getValueName() const { return "number"; } @@ -642,7 +642,7 @@ class parser : public basic_parser { public: // parse - Return true on error. - bool parse(Option &O, const char *AN, StringRef Arg, float &Val); + bool parse(Option &O, StringRef ArgName, StringRef Arg, float &Val); // getValueName - Overload in subclass to provide a better default value. virtual const char *getValueName() const { return "number"; } @@ -660,7 +660,7 @@ class parser : public basic_parser { public: // parse - Return true on error. - bool parse(Option &, const char *, StringRef Arg, std::string &Value) { + bool parse(Option &, StringRef ArgName, StringRef Arg, std::string &Value) { Value = Arg.str(); return false; } @@ -681,7 +681,7 @@ class parser : public basic_parser { public: // parse - Return true on error. - bool parse(Option &, const char *, StringRef Arg, char &Value) { + bool parse(Option &, StringRef ArgName, StringRef Arg, char &Value) { Value = Arg[0]; return false; } @@ -827,7 +827,7 @@ is_class::value> { ParserClass Parser; - virtual bool handleOccurrence(unsigned pos, const char *ArgName, + virtual bool handleOccurrence(unsigned pos, StringRef ArgName, StringRef Arg) { typename ParserClass::parser_data_type Val = typename ParserClass::parser_data_type(); @@ -1000,8 +1000,7 @@ return Parser.getExtraOptionNames(OptionNames); } - virtual bool handleOccurrence(unsigned pos, const char *ArgName, - StringRef Arg) { + virtual bool handleOccurrence(unsigned pos, StringRef ArgName, StringRef Arg){ typename ParserClass::parser_data_type Val = typename ParserClass::parser_data_type(); if (Parser.parse(*this, ArgName, Arg, Val)) @@ -1200,8 +1199,7 @@ return Parser.getExtraOptionNames(OptionNames); } - virtual bool handleOccurrence(unsigned pos, const char *ArgName, - StringRef Arg) { + virtual bool handleOccurrence(unsigned pos, StringRef ArgName, StringRef Arg){ typename ParserClass::parser_data_type Val = typename ParserClass::parser_data_type(); if (Parser.parse(*this, ArgName, Arg, Val)) @@ -1301,7 +1299,7 @@ class alias : public Option { Option *AliasFor; - virtual bool handleOccurrence(unsigned pos, const char * /*ArgName*/, + virtual bool handleOccurrence(unsigned pos, StringRef /*ArgName*/, StringRef Arg) { return AliasFor->handleOccurrence(pos, AliasFor->ArgStr, Arg); } Modified: llvm/trunk/lib/Support/CommandLine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/CommandLine.cpp?rev=82345&r1=82344&r2=82345&view=diff ============================================================================== --- llvm/trunk/lib/Support/CommandLine.cpp (original) +++ llvm/trunk/lib/Support/CommandLine.cpp Sat Sep 19 19:40:49 2009 @@ -171,7 +171,7 @@ return I != OptionsMap.end() ? I->second : 0; } -static inline bool ProvideOption(Option *Handler, const char *ArgName, +static inline bool ProvideOption(Option *Handler, StringRef ArgName, const char *Value, int argc, char **argv, int &i) { // Is this a multi-argument option? @@ -253,28 +253,28 @@ // see if there options that satisfy the predicate. If we find one, return it, // otherwise return null. // -static Option *getOptionPred(std::string Name, size_t &Length, +static Option *getOptionPred(StringRef Name, size_t &Length, bool (*Pred)(const Option*), StringMap &OptionsMap) { StringMap::iterator OMI = OptionsMap.find(Name); if (OMI != OptionsMap.end() && Pred(OMI->second)) { - Length = Name.length(); + Length = Name.size(); return OMI->second; } if (Name.size() == 1) return 0; do { - Name.erase(Name.end()-1, Name.end()); // Chop off the last character... + Name = Name.substr(0, Name.size()-1); // Chop off the last character. OMI = OptionsMap.find(Name); // Loop while we haven't found an option and Name still has at least two // characters in it (so that the next iteration will not be the empty - // string... + // string. } while ((OMI == OptionsMap.end() || !Pred(OMI->second)) && Name.size() > 1); if (OMI != OptionsMap.end() && Pred(OMI->second)) { - Length = Name.length(); + Length = Name.size(); return OMI->second; // Found one! } return 0; // No option found! @@ -517,7 +517,9 @@ if (ActivePositionalArg) { ProvidePositionalOption(ActivePositionalArg, argv[i], i); continue; // We are done! - } else if (!PositionalOpts.empty()) { + } + + if (!PositionalOpts.empty()) { PositionalVals.push_back(std::make_pair(argv[i],i)); // All of the positional arguments have been fulfulled, give the rest to @@ -549,13 +551,13 @@ continue; // We are done! } - } else { // We start with a '-', must be an argument... + } else { // We start with a '-', must be an argument. ArgName = argv[i]+1; Handler = LookupOption(ArgName, Value, Opts); // Check to see if this "option" is really a prefixed or grouped argument. if (Handler == 0) { - std::string RealName(ArgName); + StringRef RealName(ArgName); if (RealName.size() > 1) { size_t Length = 0; Option *PGOpt = getOptionPred(RealName, Length, isPrefixedOrGrouping, @@ -567,29 +569,28 @@ // if (PGOpt && PGOpt->getFormattingFlag() == cl::Prefix) { Value = ArgName+Length; - assert(Opts.find(std::string(ArgName, Value)) != Opts.end() && - Opts.find(std::string(ArgName, Value))->second == PGOpt); + assert(Opts.count(StringRef(ArgName, Length)) && + Opts[StringRef(ArgName, Length)] == PGOpt); Handler = PGOpt; } else if (PGOpt) { // This must be a grouped option... handle them now. assert(isGrouping(PGOpt) && "Broken getOptionPred!"); do { - // Move current arg name out of RealName into RealArgName... - std::string RealArgName(RealName.begin(), - RealName.begin() + Length); - RealName.erase(RealName.begin(), RealName.begin() + Length); + // Move current arg name out of RealName into RealArgName. + StringRef RealArgName = RealName.substr(0, Length); + RealName = RealName.substr(Length); // Because ValueRequired is an invalid flag for grouped arguments, - // we don't need to pass argc/argv in... + // we don't need to pass argc/argv in. // assert(PGOpt->getValueExpectedFlag() != cl::ValueRequired && "Option can not be cl::Grouping AND cl::ValueRequired!"); int Dummy; - ErrorParsing |= ProvideOption(PGOpt, RealArgName.c_str(), + ErrorParsing |= ProvideOption(PGOpt, RealArgName, 0, 0, 0, Dummy); - // Get the next grouping option... + // Get the next grouping option. PGOpt = getOptionPred(RealName, Length, isGrouping, Opts); } while (PGOpt && Length != RealName.size()); @@ -760,9 +761,9 @@ // Option Base class implementation // -bool Option::error(const Twine &Message, const char *ArgName) { - if (ArgName == 0) ArgName = ArgStr; - if (ArgName[0] == 0) +bool Option::error(const Twine &Message, StringRef ArgName) { + if (ArgName.data() == 0) ArgName = ArgStr; + if (ArgName.empty()) errs() << HelpStr; // Be nice for positional arguments else errs() << ProgramName << ": for the -" << ArgName; @@ -771,7 +772,7 @@ return true; } -bool Option::addOccurrence(unsigned pos, const char *ArgName, +bool Option::addOccurrence(unsigned pos, StringRef ArgName, StringRef Value, bool MultiArg) { if (!MultiArg) NumOccurrences++; // Increment the number of times we have been seen @@ -855,7 +856,7 @@ // parser implementation // -bool parser::parse(Option &O, const char *ArgName, +bool parser::parse(Option &O, StringRef ArgName, StringRef Arg, bool &Value) { if (Arg == "" || Arg == "true" || Arg == "TRUE" || Arg == "True" || Arg == "1") { @@ -873,7 +874,7 @@ // parser implementation // -bool parser::parse(Option &O, const char *ArgName, +bool parser::parse(Option &O, StringRef ArgName, StringRef Arg, boolOrDefault &Value) { if (Arg == "" || Arg == "true" || Arg == "TRUE" || Arg == "True" || Arg == "1") { @@ -891,7 +892,7 @@ // parser implementation // -bool parser::parse(Option &O, const char *ArgName, +bool parser::parse(Option &O, StringRef ArgName, StringRef Arg, int &Value) { if (Arg.getAsInteger(0, Value)) return O.error("'" + Arg + "' value invalid for integer argument!"); @@ -900,7 +901,7 @@ // parser implementation // -bool parser::parse(Option &O, const char *ArgName, +bool parser::parse(Option &O, StringRef ArgName, StringRef Arg, unsigned &Value) { if (Arg.getAsInteger(0, Value)) @@ -920,12 +921,12 @@ return false; } -bool parser::parse(Option &O, const char *AN, +bool parser::parse(Option &O, StringRef ArgName, StringRef Arg, double &Val) { return parseDouble(O, Arg, Val); } -bool parser::parse(Option &O, const char *AN, +bool parser::parse(Option &O, StringRef ArgName, StringRef Arg, float &Val) { double dVal; if (parseDouble(O, Arg, dVal)) From sabre at nondot.org Sat Sep 19 20:11:23 2009 From: sabre at nondot.org (Chris Lattner) Date: Sun, 20 Sep 2009 01:11:23 -0000 Subject: [llvm-commits] [llvm] r82346 - /llvm/trunk/lib/Support/CommandLine.cpp Message-ID: <200909200111.n8K1BNhk029465@zion.cs.uiuc.edu> Author: lattner Date: Sat Sep 19 20:11:23 2009 New Revision: 82346 URL: http://llvm.org/viewvc/llvm-project?rev=82346&view=rev Log: coding style cleanup Modified: llvm/trunk/lib/Support/CommandLine.cpp Modified: llvm/trunk/lib/Support/CommandLine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/CommandLine.cpp?rev=82346&r1=82345&r2=82346&view=diff ============================================================================== --- llvm/trunk/lib/Support/CommandLine.cpp (original) +++ llvm/trunk/lib/Support/CommandLine.cpp Sat Sep 19 20:11:23 2009 @@ -293,7 +293,7 @@ /// ParseCStringVector - Break INPUT up wherever one or more /// whitespace characters are found, and store the resulting tokens in /// OUTPUT. The tokens stored in OUTPUT are dynamically allocated -/// using strdup (), so it is the caller's responsibility to free () +/// using strdup(), so it is the caller's responsibility to free() /// them later. /// static void ParseCStringVector(std::vector &output, @@ -301,26 +301,26 @@ // Characters which will be treated as token separators: static const char *const delims = " \v\f\t\r\n"; - std::string work (input); + std::string work(input); // Skip past any delims at head of input string. - size_t pos = work.find_first_not_of (delims); + size_t pos = work.find_first_not_of(delims); // If the string consists entirely of delims, then exit early. if (pos == std::string::npos) return; // Otherwise, jump forward to beginning of first word. - work = work.substr (pos); + work = work.substr(pos); // Find position of first delimiter. - pos = work.find_first_of (delims); + pos = work.find_first_of(delims); while (!work.empty() && pos != std::string::npos) { // Everything from 0 to POS is the next word to copy. - output.push_back (strdup (work.substr (0,pos).c_str ())); + output.push_back(strdup(work.substr(0,pos).c_str())); // Is there another word in the string? - size_t nextpos = work.find_first_not_of (delims, pos + 1); + size_t nextpos = work.find_first_not_of(delims, pos + 1); if (nextpos != std::string::npos) { // Yes? Then remove delims from beginning ... - work = work.substr (work.find_first_not_of (delims, pos + 1)); + work = work.substr(work.find_first_not_of(delims, pos + 1)); // and find the end of the word. - pos = work.find_first_of (delims); + pos = work.find_first_of(delims); } else { // No? (Remainder of string is delims.) End the loop. work = ""; @@ -330,9 +330,8 @@ // If `input' ended with non-delim char, then we'll get here with // the last word of `input' in `work'; copy it now. - if (!work.empty ()) { - output.push_back (strdup (work.c_str ())); - } + if (!work.empty()) + output.push_back(strdup(work.c_str())); } /// ParseEnvironmentOptions - An alternative entry point to the @@ -365,7 +364,7 @@ // Free all the strdup()ed strings. for (std::vector::iterator i = newArgv.begin(), e = newArgv.end(); i != e; ++i) - free (*i); + free(*i); } From sabre at nondot.org Sat Sep 19 20:22:16 2009 From: sabre at nondot.org (Chris Lattner) Date: Sun, 20 Sep 2009 01:22:16 -0000 Subject: [llvm-commits] [llvm] r82347 - in /llvm/trunk: include/llvm/ADT/StringRef.h lib/Support/StringRef.cpp Message-ID: <200909200122.n8K1MGIp030762@zion.cs.uiuc.edu> Author: lattner Date: Sat Sep 19 20:22:16 2009 New Revision: 82347 URL: http://llvm.org/viewvc/llvm-project?rev=82347&view=rev Log: move a couple non-trivial methods out of line, add new find_first_of/find_first_of methods. Modified: llvm/trunk/include/llvm/ADT/StringRef.h llvm/trunk/lib/Support/StringRef.cpp Modified: llvm/trunk/include/llvm/ADT/StringRef.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/StringRef.h?rev=82347&r1=82346&r2=82347&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/StringRef.h (original) +++ llvm/trunk/include/llvm/ADT/StringRef.h Sat Sep 19 20:22:16 2009 @@ -163,16 +163,8 @@ /// /// \return - The index of the first occurence of \arg Str, or npos if not /// found. - size_t find(const StringRef &Str) const { - size_t N = Str.size(); - if (N > Length) - return npos; - for (size_t i = 0, e = Length - N + 1; i != e; ++i) - if (substr(i, N).equals(Str)) - return i; - return npos; - } - + size_t find(const StringRef &Str) const; + /// rfind - Search for the last character \arg C in the string. /// /// \return - The index of the last occurence of \arg C, or npos if not @@ -189,24 +181,29 @@ size_t rfind(char C) const { return rfind(C, Length); } - - + /// rfind - Search for the last string \arg Str in the string. /// /// \return - The index of the last occurence of \arg Str, or npos if not /// found. - size_t rfind(const StringRef &Str) const { - size_t N = Str.size(); - if (N > Length) - return npos; - for (size_t i = Length - N + 1, e = 0; i != e;) { - --i; - if (substr(i, N).equals(Str)) - return i; - } - return npos; - } - + size_t rfind(const StringRef &Str) const; + + /// find_first_of - Find the first instance of the specified character or + /// return npos if not in string. Same as find. + size_type find_first_of(char C) const { return find(C); } + + /// find_first_of - Find the first character from the string 'Chars' in the + /// current string or return npos if not in string. + size_type find_first_of(StringRef Chars) const; + + /// find_first_not_of - Find the first character in the string that is not + /// in the string 'Chars' or return npos if all are in string. Same as find. + size_type find_first_not_of(StringRef Chars) const; + + /// @} + /// @name Helpful Algorithms + /// @{ + /// count - Return the number of occurrences of \arg C in the string. size_t count(char C) const { size_t Count = 0; @@ -215,23 +212,10 @@ ++Count; return Count; } - + /// count - Return the number of non-overlapped occurrences of \arg Str in /// the string. - size_t count(const StringRef &Str) const { - size_t Count = 0; - size_t N = Str.size(); - if (N > Length) - return 0; - for (size_t i = 0, e = Length - N + 1; i != e; ++i) - if (substr(i, N).equals(Str)) - ++Count; - return Count; - } - - /// @} - /// @name Helpful Algorithms - /// @{ + size_t count(const StringRef &Str) const; /// getAsInteger - Parse the current string as an integer of the specified /// radix. If Radix is specified as zero, this does radix autosensing using Modified: llvm/trunk/lib/Support/StringRef.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/StringRef.cpp?rev=82347&r1=82346&r2=82347&view=diff ============================================================================== --- llvm/trunk/lib/Support/StringRef.cpp (original) +++ llvm/trunk/lib/Support/StringRef.cpp Sat Sep 19 20:22:16 2009 @@ -12,6 +12,77 @@ const size_t StringRef::npos; +//===----------------------------------------------------------------------===// +// String Searching +//===----------------------------------------------------------------------===// + + +/// find - Search for the first string \arg Str in the string. +/// +/// \return - The index of the first occurence of \arg Str, or npos if not +/// found. +size_t StringRef::find(const StringRef &Str) const { + size_t N = Str.size(); + if (N > Length) + return npos; + for (size_t i = 0, e = Length - N + 1; i != e; ++i) + if (substr(i, N).equals(Str)) + return i; + return npos; +} + +/// rfind - Search for the last string \arg Str in the string. +/// +/// \return - The index of the last occurence of \arg Str, or npos if not +/// found. +size_t StringRef::rfind(const StringRef &Str) const { + size_t N = Str.size(); + if (N > Length) + return npos; + for (size_t i = Length - N + 1, e = 0; i != e;) { + --i; + if (substr(i, N).equals(Str)) + return i; + } + return npos; +} + +/// find_first_of - Find the first character from the string 'Chars' in the +/// current string or return npos if not in string. +StringRef::size_type StringRef::find_first_of(StringRef Chars) const { + for (size_type i = 0, e = Length; i != e; ++i) + if (Chars.find(Data[i]) != npos) + return i; + return npos; +} + +/// find_first_not_of - Find the first character in the string that is not +/// in the string 'Chars' or return npos if all are in string. Same as find. +StringRef::size_type StringRef::find_first_not_of(StringRef Chars) const { + for (size_type i = 0, e = Length; i != e; ++i) + if (Chars.find(Data[i]) == npos) + return i; + return npos; +} + + +//===----------------------------------------------------------------------===// +// Helpful Algorithms +//===----------------------------------------------------------------------===// + +/// count - Return the number of non-overlapped occurrences of \arg Str in +/// the string. +size_t StringRef::count(const StringRef &Str) const { + size_t Count = 0; + size_t N = Str.size(); + if (N > Length) + return 0; + for (size_t i = 0, e = Length - N + 1; i != e; ++i) + if (substr(i, N).equals(Str)) + ++Count; + return Count; +} + /// GetAsUnsignedInteger - Workhorse method that converts a integer character /// sequence of radix up to 36 to an unsigned long long value. static bool GetAsUnsignedInteger(StringRef Str, unsigned Radix, From sabre at nondot.org Sat Sep 19 20:33:47 2009 From: sabre at nondot.org (Chris Lattner) Date: Sun, 20 Sep 2009 01:33:47 -0000 Subject: [llvm-commits] [llvm] r82348 - /llvm/trunk/lib/Support/CommandLine.cpp Message-ID: <200909200133.n8K1XliV032206@zion.cs.uiuc.edu> Author: lattner Date: Sat Sep 19 20:33:46 2009 New Revision: 82348 URL: http://llvm.org/viewvc/llvm-project?rev=82348&view=rev Log: rewrite ParseCStringVector in terms of stringref. Modified: llvm/trunk/lib/Support/CommandLine.cpp Modified: llvm/trunk/lib/Support/CommandLine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/CommandLine.cpp?rev=82348&r1=82347&r2=82348&view=diff ============================================================================== --- llvm/trunk/lib/Support/CommandLine.cpp (original) +++ llvm/trunk/lib/Support/CommandLine.cpp Sat Sep 19 20:33:46 2009 @@ -296,42 +296,31 @@ /// using strdup(), so it is the caller's responsibility to free() /// them later. /// -static void ParseCStringVector(std::vector &output, - const char *input) { +static void ParseCStringVector(std::vector &OutputVector, + const char *Input) { // Characters which will be treated as token separators: - static const char *const delims = " \v\f\t\r\n"; + StringRef Delims = " \v\f\t\r\n"; - std::string work(input); - // Skip past any delims at head of input string. - size_t pos = work.find_first_not_of(delims); - // If the string consists entirely of delims, then exit early. - if (pos == std::string::npos) return; - // Otherwise, jump forward to beginning of first word. - work = work.substr(pos); - // Find position of first delimiter. - pos = work.find_first_of(delims); - - while (!work.empty() && pos != std::string::npos) { - // Everything from 0 to POS is the next word to copy. - output.push_back(strdup(work.substr(0,pos).c_str())); - // Is there another word in the string? - size_t nextpos = work.find_first_not_of(delims, pos + 1); - if (nextpos != std::string::npos) { - // Yes? Then remove delims from beginning ... - work = work.substr(work.find_first_not_of(delims, pos + 1)); - // and find the end of the word. - pos = work.find_first_of(delims); - } else { - // No? (Remainder of string is delims.) End the loop. - work = ""; - pos = std::string::npos; + StringRef WorkStr(Input); + while (!WorkStr.empty()) { + // If the first character is a delimiter, strip them off. + if (Delims.find(WorkStr[0]) != StringRef::npos) { + size_t Pos = WorkStr.find_first_not_of(Delims); + if (Pos == StringRef::npos) Pos = WorkStr.size(); + WorkStr = WorkStr.substr(Pos); + continue; } + + // Find position of first delimiter. + size_t Pos = WorkStr.find_first_of(Delims); + if (Pos == StringRef::npos) Pos = WorkStr.size(); + + // Everything from 0 to Pos is the next word to copy. + char *NewStr = (char*)malloc(Pos+1); + memcpy(NewStr, WorkStr.data(), Pos); + NewStr[Pos] = 0; + OutputVector.push_back(NewStr); } - - // If `input' ended with non-delim char, then we'll get here with - // the last word of `input' in `work'; copy it now. - if (!work.empty()) - output.push_back(strdup(work.c_str())); } /// ParseEnvironmentOptions - An alternative entry point to the From nicholas at mxc.ca Sat Sep 19 20:35:59 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Sun, 20 Sep 2009 01:35:59 -0000 Subject: [llvm-commits] [llvm] r82349 - in /llvm/trunk/lib/VMCore: ConstantFold.cpp ConstantFold.h Message-ID: <200909200135.n8K1Zxq1032494@zion.cs.uiuc.edu> Author: nicholas Date: Sat Sep 19 20:35:59 2009 New Revision: 82349 URL: http://llvm.org/viewvc/llvm-project?rev=82349&view=rev Log: Value* were never meant to be const. Removing constness from the constant folder removes a lot of const_casting and requires no changes to clang or llvm-gcc. Modified: llvm/trunk/lib/VMCore/ConstantFold.cpp llvm/trunk/lib/VMCore/ConstantFold.h Modified: llvm/trunk/lib/VMCore/ConstantFold.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/ConstantFold.cpp?rev=82349&r1=82348&r2=82349&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/ConstantFold.cpp (original) +++ llvm/trunk/lib/VMCore/ConstantFold.cpp Sat Sep 19 20:35:59 2009 @@ -73,7 +73,7 @@ static unsigned foldConstantCastPair( unsigned opc, ///< opcode of the second cast constant expression - const ConstantExpr*Op, ///< the first cast constant expression + ConstantExpr *Op, ///< the first cast constant expression const Type *DstTy ///< desintation type of the first cast ) { assert(Op && Op->isCast() && "Can't fold cast of cast without a cast!"); @@ -156,7 +156,7 @@ return ConstantPointerNull::get(cast(DestTy)); // Handle integral constant input. - if (const ConstantInt *CI = dyn_cast(V)) { + if (ConstantInt *CI = dyn_cast(V)) { if (DestTy->isInteger()) // Integral -> Integral. This is a no-op because the bit widths must // be the same. Consequently, we just fold to V. @@ -171,7 +171,7 @@ } // Handle ConstantFP input. - if (const ConstantFP *FP = dyn_cast(V)) + if (ConstantFP *FP = dyn_cast(V)) // FP -> Integral. return ConstantInt::get(Context, FP->getValueAPF().bitcastToAPInt()); @@ -180,7 +180,7 @@ Constant *llvm::ConstantFoldCastInstruction(LLVMContext &Context, - unsigned opc, const Constant *V, + unsigned opc, Constant *V, const Type *DestTy) { if (isa(V)) { // zext(undef) = 0, because the top bits will be zero. @@ -197,7 +197,7 @@ // If the cast operand is a constant expression, there's a few things we can // do to try to simplify it. - if (const ConstantExpr *CE = dyn_cast(V)) { + if (ConstantExpr *CE = dyn_cast(V)) { if (CE->isCast()) { // Try hard to fold cast of cast because they are often eliminable. if (unsigned newOpc = foldConstantCastPair(opc, CE, DestTy)) @@ -220,7 +220,7 @@ // If the cast operand is a constant vector, perform the cast by // operating on each element. In the cast of bitcasts, the element // count may be mismatched; don't attempt to handle that here. - if (const ConstantVector *CV = dyn_cast(V)) + if (ConstantVector *CV = dyn_cast(V)) if (isa(DestTy) && cast(DestTy)->getNumElements() == CV->getType()->getNumElements()) { @@ -238,7 +238,7 @@ switch (opc) { case Instruction::FPTrunc: case Instruction::FPExt: - if (const ConstantFP *FPC = dyn_cast(V)) { + if (ConstantFP *FPC = dyn_cast(V)) { bool ignored; APFloat Val = FPC->getValueAPF(); Val.convert(DestTy == Type::getFloatTy(Context) ? APFloat::IEEEsingle : @@ -252,7 +252,7 @@ return 0; // Can't fold. case Instruction::FPToUI: case Instruction::FPToSI: - if (const ConstantFP *FPC = dyn_cast(V)) { + if (ConstantFP *FPC = dyn_cast(V)) { const APFloat &V = FPC->getValueAPF(); bool ignored; uint64_t x[2]; @@ -273,7 +273,7 @@ return 0; // Other pointer types cannot be casted case Instruction::UIToFP: case Instruction::SIToFP: - if (const ConstantInt *CI = dyn_cast(V)) { + if (ConstantInt *CI = dyn_cast(V)) { APInt api = CI->getValue(); const uint64_t zero[] = {0, 0}; APFloat apf = APFloat(APInt(DestTy->getPrimitiveSizeInBits(), @@ -285,7 +285,7 @@ } return 0; case Instruction::ZExt: - if (const ConstantInt *CI = dyn_cast(V)) { + if (ConstantInt *CI = dyn_cast(V)) { uint32_t BitWidth = cast(DestTy)->getBitWidth(); APInt Result(CI->getValue()); Result.zext(BitWidth); @@ -293,7 +293,7 @@ } return 0; case Instruction::SExt: - if (const ConstantInt *CI = dyn_cast(V)) { + if (ConstantInt *CI = dyn_cast(V)) { uint32_t BitWidth = cast(DestTy)->getBitWidth(); APInt Result(CI->getValue()); Result.sext(BitWidth); @@ -301,7 +301,7 @@ } return 0; case Instruction::Trunc: - if (const ConstantInt *CI = dyn_cast(V)) { + if (ConstantInt *CI = dyn_cast(V)) { uint32_t BitWidth = cast(DestTy)->getBitWidth(); APInt Result(CI->getValue()); Result.trunc(BitWidth); @@ -309,7 +309,7 @@ } return 0; case Instruction::BitCast: - return FoldBitCast(Context, const_cast(V), DestTy); + return FoldBitCast(Context, V, DestTy); default: assert(!"Invalid CE CastInst opcode"); break; @@ -320,30 +320,29 @@ } Constant *llvm::ConstantFoldSelectInstruction(LLVMContext&, - const Constant *Cond, - const Constant *V1, - const Constant *V2) { - if (const ConstantInt *CB = dyn_cast(Cond)) - return const_cast(CB->getZExtValue() ? V1 : V2); - - if (isa(V1)) return const_cast(V2); - if (isa(V2)) return const_cast(V1); - if (isa(Cond)) return const_cast(V1); - if (V1 == V2) return const_cast(V1); + Constant *Cond, + Constant *V1, Constant *V2) { + if (ConstantInt *CB = dyn_cast(Cond)) + return CB->getZExtValue() ? V1 : V2; + + if (isa(V1)) return V2; + if (isa(V2)) return V1; + if (isa(Cond)) return V1; + if (V1 == V2) return V1; return 0; } Constant *llvm::ConstantFoldExtractElementInstruction(LLVMContext &Context, - const Constant *Val, - const Constant *Idx) { + Constant *Val, + Constant *Idx) { if (isa(Val)) // ee(undef, x) -> undef return UndefValue::get(cast(Val->getType())->getElementType()); if (Val->isNullValue()) // ee(zero, x) -> zero return Constant::getNullValue( cast(Val->getType())->getElementType()); - if (const ConstantVector *CVal = dyn_cast(Val)) { - if (const ConstantInt *CIdx = dyn_cast(Idx)) { + if (ConstantVector *CVal = dyn_cast(Val)) { + if (ConstantInt *CIdx = dyn_cast(Idx)) { re