mem: Record the request master ID in the PacketInfo structure.
[gem5.git] / src / SConscript
index 6cb497695168b2ec534852f936da69e12a6216cf..519a0a98656c7c6103e55666127e5e9cb04d5a7c 100755 (executable)
@@ -610,7 +610,7 @@ PySource('m5', 'python/m5/info.py')
 def createSimObjectParamStruct(target, source, env):
     assert len(target) == 1 and len(source) == 1
 
-    name = str(source[0].get_contents())
+    name = source[0].get_text_contents()
     obj = sim_objects[name]
 
     code = code_formatter()
@@ -630,21 +630,22 @@ def createSimObjectCxxConfig(is_header):
     return body
 
 def createEnumStrings(target, source, env):
-    assert len(target) == 1 and len(source) == 1
+    assert len(target) == 1 and len(source) == 2
 
-    name = str(source[0].get_contents())
+    name = source[0].get_text_contents()
+    use_python = source[1].read()
     obj = all_enums[name]
 
     code = code_formatter()
     obj.cxx_def(code)
-    if env['USE_PYTHON']:
+    if use_python:
         obj.pybind_def(code)
     code.write(target[0].abspath)
 
 def createEnumDecls(target, source, env):
     assert len(target) == 1 and len(source) == 1
 
-    name = str(source[0].get_contents())
+    name = source[0].get_text_contents()
     obj = all_enums[name]
 
     code = code_formatter()
@@ -652,7 +653,7 @@ def createEnumDecls(target, source, env):
     code.write(target[0].abspath)
 
 def createSimObjectPyBindWrapper(target, source, env):
-    name = source[0].get_contents()
+    name = source[0].get_text_contents()
     obj = sim_objects[name]
 
     code = code_formatter()
@@ -732,7 +733,7 @@ for name,enum in sorted(all_enums.iteritems()):
     extra_deps = [ py_source.tnode ]
 
     cc_file = File('enums/%s.cc' % name)
-    env.Command(cc_file, Value(name),
+    env.Command(cc_file, [Value(name), Value(env['USE_PYTHON'])],
                 MakeAction(createEnumStrings, Transform("ENUM STR")))
     env.Depends(cc_file, depends + extra_deps)
     Source(cc_file)
@@ -956,7 +957,7 @@ def variantd(*path):
 # environment 'env' with modified object suffix and optional stripped
 # binary.  Additional keyword arguments are appended to corresponding
 # build environment vars.
-def makeEnv(env, label, objsfx, strip = False, **kwargs):
+def makeEnv(env, label, objsfx, strip=False, disable_partial=False, **kwargs):
     # SCons doesn't know to append a library suffix when there is a '.' in the
     # name.  Use '_' instead.
     libname = variant('gem5_' + label)
@@ -1058,6 +1059,14 @@ def makeEnv(env, label, objsfx, strip = False, **kwargs):
         if not srcs:
             continue
 
+        # If partial linking is disabled, add these sources to the build
+        # directly, and short circuit this loop.
+        if disable_partial:
+            for s in srcs:
+                static_objs.append(make_obj(s, True))
+                shared_objs.append(make_obj(s, False))
+            continue
+
         # Set up the static partially linked objects.
         source_objs = [ make_obj(s, True) for s in srcs ]
         file_name = new_env.subst("${OBJPREFIX}lib${OBJSUFFIX}.partial")
@@ -1113,7 +1122,11 @@ def makeEnv(env, label, objsfx, strip = False, **kwargs):
             MakeAction('ln $SOURCE $TARGET', Transform("HARDLINK")))
 
     new_env.M5Binary = targets[0]
-    return new_env
+
+    # Set up regression tests.
+    SConscript(os.path.join(env.root.abspath, 'tests', 'SConscript'),
+               variant_dir=variantd('tests', new_env.Label),
+               exports={ 'env' : new_env }, duplicate=False)
 
 # Start out with the compiler flags common to all compilers,
 # i.e. they all use -g for opt and -g -pg for prof
@@ -1183,53 +1196,44 @@ def makeEnvirons(target, source, env):
     # cause any later Source() calls to be fatal, as a diagnostic.
     Source.done()
 
-    envList = []
-
     # Debug binary
     if 'debug' in needed_envs:
-        envList.append(
-            makeEnv(env, 'debug', '.do',
-                    CCFLAGS = Split(ccflags['debug']),
-                    CPPDEFINES = ['DEBUG', 'TRACING_ON=1'],
-                    LINKFLAGS = Split(ldflags['debug'])))
+        makeEnv(env, 'debug', '.do',
+                CCFLAGS = Split(ccflags['debug']),
+                CPPDEFINES = ['DEBUG', 'TRACING_ON=1'],
+                LINKFLAGS = Split(ldflags['debug']))
 
     # Optimized binary
     if 'opt' in needed_envs:
-        envList.append(
-            makeEnv(env, 'opt', '.o',
-                    CCFLAGS = Split(ccflags['opt']),
-                    CPPDEFINES = ['TRACING_ON=1'],
-                    LINKFLAGS = Split(ldflags['opt'])))
+        makeEnv(env, 'opt', '.o',
+                CCFLAGS = Split(ccflags['opt']),
+                CPPDEFINES = ['TRACING_ON=1'],
+                LINKFLAGS = Split(ldflags['opt']))
 
     # "Fast" binary
     if 'fast' in needed_envs:
-        envList.append(
-            makeEnv(env, 'fast', '.fo', strip = True,
-                    CCFLAGS = Split(ccflags['fast']),
-                    CPPDEFINES = ['NDEBUG', 'TRACING_ON=0'],
-                    LINKFLAGS = Split(ldflags['fast'])))
+        disable_partial = \
+                env.get('BROKEN_INCREMENTAL_LTO', False) and \
+                GetOption('force_lto')
+        makeEnv(env, 'fast', '.fo', strip = True,
+                CCFLAGS = Split(ccflags['fast']),
+                CPPDEFINES = ['NDEBUG', 'TRACING_ON=0'],
+                LINKFLAGS = Split(ldflags['fast']),
+                disable_partial=disable_partial)
 
     # Profiled binary using gprof
     if 'prof' in needed_envs:
-        envList.append(
-            makeEnv(env, 'prof', '.po',
-                    CCFLAGS = Split(ccflags['prof']),
-                    CPPDEFINES = ['NDEBUG', 'TRACING_ON=0'],
-                    LINKFLAGS = Split(ldflags['prof'])))
+        makeEnv(env, 'prof', '.po',
+                CCFLAGS = Split(ccflags['prof']),
+                CPPDEFINES = ['NDEBUG', 'TRACING_ON=0'],
+                LINKFLAGS = Split(ldflags['prof']))
 
     # Profiled binary using google-pprof
     if 'perf' in needed_envs:
-        envList.append(
-            makeEnv(env, 'perf', '.gpo',
-                    CCFLAGS = Split(ccflags['perf']),
-                    CPPDEFINES = ['NDEBUG', 'TRACING_ON=0'],
-                    LINKFLAGS = Split(ldflags['perf'])))
-
-    # Set up the regression tests for each build.
-    for e in envList:
-        SConscript(os.path.join(env.root.abspath, 'tests', 'SConscript'),
-                   variant_dir = variantd('tests', e.Label),
-                   exports = { 'env' : e }, duplicate = False)
+        makeEnv(env, 'perf', '.gpo',
+                CCFLAGS = Split(ccflags['perf']),
+                CPPDEFINES = ['NDEBUG', 'TRACING_ON=0'],
+                LINKFLAGS = Split(ldflags['perf']))
 
 # The MakeEnvirons Builder defers the full dependency collection until
 # after processing the ISA definition (due to dynamically generated
@@ -1241,9 +1245,9 @@ env.Append(BUILDERS = {'MakeEnvirons' :
                         Builder(action=MakeAction(makeEnvirons,
                                                   Transform("ENVIRONS", 1)))})
 
-isa_target = env['PHONY_BASE'] + '-deps'
-environs   = env['PHONY_BASE'] + '-environs'
-env.Depends('#all-deps',     isa_target)
+isa_target = '#${VARIANT_NAME}-deps'
+environs = '#${VARIANT_NAME}-environs'
+env.Depends('#all-deps', isa_target)
 env.Depends('#all-environs', environs)
 env.ScanISA(isa_target, File('arch/%s/generated/inc.d' % env['TARGET_ISA']))
 envSetup = env.MakeEnvirons(environs, isa_target)