File tree Expand file tree Collapse file tree 9 files changed +50
-3
lines changed
Docs/sphinx_documentation/source Expand file tree Collapse file tree 9 files changed +50
-3
lines changed Original file line number Diff line number Diff line change @@ -535,6 +535,12 @@ The list of available options is reported in the :ref:`table <tab:cmakevar>` bel
535535 | AMReX_FLATTEN_FOR | Enable flattening of ParallelFor and similar | NO | YES, NO |
536536 | | functions for host code | | |
537537 +------------------------------+-------------------------------------------------+-------------------------+-----------------------+
538+ | AMReX_COMPILER_DEFAULT_INLINE| Use default inline behavior of compiler, | NO for GCC | YES, NO |
539+ | | so far relevant for GCC Only | YES otherwise | |
540+ +------------------------------+-------------------------------------------------+-------------------------+-----------------------+
541+ | AMReX_INLINE_LIMIT | Inline limit. Relevant only when | 43210 | Non-negative number |
542+ | | AMReX_COMPILER_DEFAULT_INLINE is NO. | | |
543+ +------------------------------+-------------------------------------------------+-------------------------+-----------------------+
538544.. raw:: latex
539545
540546 \end {center }
Original file line number Diff line number Diff line change @@ -86,6 +86,14 @@ foreach(D IN LISTS AMReX_SPACEDIM)
8686 $<BUILD_INTERFACE:Flags_FPE>
8787 )
8888 endif ()
89+
90+ if (NOT AMReX_COMPILER_DEFULT_INLINE)
91+ target_link_libraries (amrex_${D} d
92+ PUBLIC
93+ $<BUILD_INTERFACE:Flags_INLINE>
94+ )
95+ endif ()
96+
8997endforeach ()
9098
9199# General configuration
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ macro(setup_clang_tidy)
1717
1818 # Need --extra-arg to suppress warnings like clang-diagnostic-unknown-warning-option
1919 # when GCC is used.
20- set (AMReX_CLANG_TIDY_COMMAND "${AMReX_CLANG_TIDY_EXE} ;--extra-arg=-Wno-unknown-warning-option" )
20+ set (AMReX_CLANG_TIDY_COMMAND "${AMReX_CLANG_TIDY_EXE} ;--extra-arg=-Wno-unknown-warning-option;--extra-arg=-Wno-ignored-optimization-argument " )
2121 if (AMReX_CLANG_TIDY_CONFIG_FILE_NAME)
2222 set (AMReX_CLANG_TIDY_COMMAND "${AMReX_CLANG_TIDY_COMMAND} "
2323 "--config-file=${AMReX_CLANG_TIDY_CONFIG_FILE_NAME} " )
Original file line number Diff line number Diff line change @@ -91,6 +91,8 @@ set(AMReX_FPE_FOUND @AMReX_FPE@)
9191set (AMReX_PIC_FOUND @AMReX_PIC@)
9292set (AMReX_ASSERTIONS_FOUND @AMReX_ASSERTIONS@)
9393set (AMReX_FLATTEN_FOR_FOUND @AMReX_FLATTEN_FOR@)
94+ set (AMReX_COMPILER_DEFAULT_INLINE_FOUND @AMReX_COMPILER_DEFAULT_INLINE@)
95+ set (AMReX_INLINE_LIMIT_FOUND @AMReX_INLINE_LIMIT@)
9496
9597# Profiling options
9698set (AMReX_BASEP_FOUND @AMReX_BASE_PROFILE@)
Original file line number Diff line number Diff line change 55# Flags_CXX --> Optional flags for C++ code
66# Flags_Fortran --> Optional flags for Fortran code
77# Flags_FPE --> Floating-Point Exception flags for both C++ and Fortran
8+ # Flags_INLINE --> Optional flags for inlining
89#
910# These INTERFACE targets can be added to the AMReX export set.
1011#
@@ -93,6 +94,17 @@ target_compile_options( Flags_CXX
9394 $<${_cxx_intelllvm_rel} :>
9495 )
9596
97+ add_library (Flags_INLINE INTERFACE )
98+ add_library (AMReX::Flags_INLINE ALIAS Flags_INLINE)
99+
100+ if (NOT AMReX_COMPILER_DEFAULT_INLINE)
101+ target_compile_options ( Flags_INLINE
102+ INTERFACE
103+ $<${_cxx_gnu_rwdbg} :-finline-limit=${AMReX_INLINE_LIMIT} >
104+ $<${_cxx_gnu_rel} :-finline-limit=${AMReX_INLINE_LIMIT} >
105+ )
106+ endif ()
107+
96108#
97109# Fortran flags
98110#
Original file line number Diff line number Diff line change @@ -369,6 +369,20 @@ print_option( AMReX_IPO )
369369option (AMReX_FPE "Enable Floating Point Exceptions checks" OFF )
370370print_option( AMReX_FPE )
371371
372+ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" )
373+ option (AMReX_COMPILER_DEFAULT_INLINE "Use compiler default inline behavior" OFF )
374+ set (AMReX_INLINE_LIMIT 43210 CACHE STRING "Inline limit" )
375+ if (NOT AMReX_COMPILER_DEFAULT_INLINE)
376+ if (AMReX_INLINE_LIMIT LESS 0)
377+ message (FATAL_ERROR "AMReX_INLINE_LIMIT, if set, must be non-negative" )
378+ endif ()
379+ message (STATUS " AMReX_INLINE_LIMIT = ${AMReX_INLINE_LIMIT} " )
380+ endif ()
381+ else ()
382+ set (AMReX_COMPILER_DEFAULT_INLINE ON )
383+ endif ()
384+
385+
372386if ( "${CMAKE_BUILD_TYPE} " MATCHES "Debug" )
373387 option ( AMReX_ASSERTIONS "Enable assertions" ON )
374388else ()
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ def mmclt(argv):
2828 fout = open (args .output , "w" )
2929
3030 fout .write ("CLANG_TIDY ?= clang-tidy\n " )
31- fout .write ("override CLANG_TIDY_ARGS += --extra-arg=-Wno-unknown-warning-option --extra-arg-before=--driver-mode=g++\n " )
31+ fout .write ("override CLANG_TIDY_ARGS += --extra-arg=-Wno-unknown-warning-option --extra-arg=-Wno-ignored-optimization-argument --extra-arg -before=--driver-mode=g++\n " )
3232 fout .write ("\n " )
3333
3434 fout .write (".SECONDEXPANSION:\n " )
Original file line number Diff line number Diff line change @@ -44,6 +44,8 @@ gcc_major_ge_10 = $(shell expr $(gcc_major_version) \>= 10)
4444gcc_major_ge_11 = $(shell expr $(gcc_major_version ) \>= 11)
4545gcc_major_ge_12 = $(shell expr $(gcc_major_version ) \>= 12)
4646
47+ INLINE_LIMIT ?= 43210
48+
4749ifneq ($(NO_CONFIG_CHECKING ) ,TRUE)
4850ifneq ($(gcc_major_ge_8 ) ,1)
4951 $(error GCC < 8 not supported)
9698 CXXFLAGS += -g -O3
9799 CFLAGS += -g -O3
98100 endif
101+ ifneq ($(USE_COMPILER_DEFAULT_INLINE),TRUE)
102+ CXXFLAGS += -finline-limit=$(INLINE_LIMIT )
103+ endif
99104endif
100105
101106ifeq ($(WARN_ALL ) ,TRUE)
Original file line number Diff line number Diff line change 11
22CLANG_TIDY = clang-tidy
3- CLANG_TIDY_ARGS = --extra-arg=-Wno-unknown-warning-option --extra-arg-before=--driver-mode=g++
3+ CLANG_TIDY_ARGS = --extra-arg=-Wno-unknown-warning-option --extra-arg=-Wno-ignored-optimization-argument --extra-arg -before=--driver-mode=g++
44# space-separated list of paths to skip, matched against the absolute path of each source file
55CLANG_TIDY_IGNORE_SOURCES ?=
66
You can’t perform that action at this time.
0 commit comments