AddrRange: Simplify AddrRange params Python hierarchy
[gem5.git] / SConstruct
index c832fa1b86fd3fea3c4944aea0c6360dedb54aad..d2e6b1233e5be0a6527ad2ee5836b244437fb883 100755 (executable)
@@ -116,7 +116,7 @@ extra_python_paths = [
     Dir('src/python').srcnode().abspath, # gem5 includes
     Dir('ext/ply').srcnode().abspath, # ply is used by several files
     ]
-    
+
 sys.path[1:1] = extra_python_paths
 
 from m5.util import compareVersions, readCommand
@@ -165,6 +165,8 @@ AddLocalOption('--default', dest='default', type='string', action='store',
                help='Override which build_opts file to use for defaults')
 AddLocalOption('--ignore-style', dest='ignore_style', action='store_true',
                help='Disable style checking hooks')
+AddLocalOption('--no-lto', dest='no_lto', action='store_true',
+               help='Disable Link-Time Optimization for fast')
 AddLocalOption('--update-ref', dest='update_ref', action='store_true',
                help='Update test reference outputs')
 AddLocalOption('--verbose', dest='verbose', action='store_true',
@@ -477,6 +479,10 @@ else:
     main['SHCXXCOMSTR']     = Transform("SHCXX")
 Export('MakeAction')
 
+# Initialize the Link-Time Optimization (LTO) flags
+main['LTO_CCFLAGS'] = []
+main['LTO_LDFLAGS'] = []
+
 CXX_version = readCommand([main['CXX'],'--version'], exception=False)
 CXX_V = readCommand([main['CXX'],'-V'], exception=False)
 
@@ -502,8 +508,28 @@ if main['GCC']:
        not compareVersions(gcc_version, '4.4.2'):
         print 'Info: Tree vectorizer in GCC 4.4.1 & 4.4.2 is buggy, disabling.'
         main.Append(CCFLAGS=['-fno-tree-vectorize'])
-    if compareVersions(gcc_version, '4.6') >= 0:
+    # c++0x support in gcc is useful already from 4.4, see
+    # http://gcc.gnu.org/projects/cxx0x.html for details
+    if compareVersions(gcc_version, '4.4') >= 0:
         main.Append(CXXFLAGS=['-std=c++0x'])
+
+    # LTO support is only really working properly from 4.6 and beyond
+    if compareVersions(gcc_version, '4.6') >= 0:
+        # Add the appropriate Link-Time Optimization (LTO) flags
+        # unless LTO is explicitly turned off. Note that these flags
+        # are only used by the fast target.
+        if not GetOption('no_lto'):
+            # Pass the LTO flag when compiling to produce GIMPLE
+            # output, we merely create the flags here and only append
+            # them later/
+            main['LTO_CCFLAGS'] = ['-flto=%d' % GetOption('num_jobs')]
+
+            # Use the same amount of jobs for LTO as we are running
+            # scons with, we hardcode the use of the linker plugin
+            # which requires either gold or GNU ld >= 2.21
+            main['LTO_LDFLAGS'] = ['-flto=%d' % GetOption('num_jobs'),
+                                   '-fuse-linker-plugin']
+
 elif main['ICC']:
     pass #Fix me... add warning flags once we clean up icc warnings
 elif main['SUNCC']:
@@ -535,6 +561,8 @@ elif main['CLANG']:
     # of if-statements
     main.Append(CCFLAGS=['-Wno-parentheses'])
 
+    # clang 2.9 does not play well with c++0x as it ships with C++
+    # headers that produce errors, this was fixed in 3.0
     if compareVersions(clang_version, "3") >= 0:
         main.Append(CXXFLAGS=['-std=c++0x'])
 else:
@@ -835,6 +863,14 @@ Export('sticky_vars')
 export_vars = []
 Export('export_vars')
 
+# For Ruby
+all_protocols = []
+Export('all_protocols')
+protocol_dirs = []
+Export('protocol_dirs')
+slicc_includes = []
+Export('slicc_includes')
+
 # Walk the tree and execute all SConsopts scripts that wil add to the
 # above variables
 if not GetOption('verbose'):
@@ -867,11 +903,14 @@ sticky_vars.AddVariables(
     BoolVariable('USE_POSIX_CLOCK', 'Use POSIX Clocks', have_posix_clock),
     BoolVariable('USE_FENV', 'Use <fenv.h> IEEE mode control', have_fenv),
     BoolVariable('CP_ANNOTATE', 'Enable critical path annotation capability', False),
+    EnumVariable('PROTOCOL', 'Coherence protocol for Ruby', 'None',
+                  all_protocols),
     )
 
 # These variables get exported to #defines in config/*.hh (see src/SConscript).
 export_vars += ['USE_FENV', 'SS_COMPATIBLE_FP',
-                'TARGET_ISA', 'CP_ANNOTATE', 'USE_POSIX_CLOCK' ]
+                'TARGET_ISA', 'CP_ANNOTATE', 'USE_POSIX_CLOCK', 'PROTOCOL',
+               ]
 
 ###################################################
 #