From 63db9860cf4ef1bfdfe97bf7f276c27dc5d13eea Mon Sep 17 00:00:00 2001 From: Steve Reinhardt Date: Sat, 25 Feb 2006 22:57:46 -0500 Subject: [PATCH] Make sure cpu/static_inst_exec_sigs.hh get rebuilt when CPU_MODELS parameter changes. arch/SConscript: Fix typo in comment. cpu/SConscript: Convert exec signature generator to Action so we can add dependency on CPU_MODELS environment var. Print nicer string while we're at it. Also add some comments. --HG-- extra : convert_revision : bcb38a7941943cf071dac34cdbb2ece5456b8620 --- arch/SConscript | 2 +- cpu/SConscript | 32 +++++++++++++++++++++++++++++++- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/arch/SConscript b/arch/SConscript index d237b0b1f..142bd763b 100644 --- a/arch/SConscript +++ b/arch/SConscript @@ -70,7 +70,7 @@ def gen_switch_hdr_string(target, source, env): return "Generating ISA switch header " + str(target[0]) # Build SCons Action object. 'varlist' specifies env vars that this -# action depdnds on; when env['ALL_ISA_LIST'] changes these actions +# action depends on; when env['ALL_ISA_LIST'] changes these actions # should get re-executed. switch_hdr_action = Action(gen_switch_hdr, gen_switch_hdr_string, varlist=['ALL_ISA_LIST']) diff --git a/cpu/SConscript b/cpu/SConscript index dbe174660..af6bab4eb 100644 --- a/cpu/SConscript +++ b/cpu/SConscript @@ -32,13 +32,28 @@ import os.path # Import build environment variable from SConstruct. Import('env') +################################################################# +# +# Generate StaticInst execute() method signatures. +# +# There must be one signature for each CPU model compiled in. +# Since the set of compiled-in models is flexible, we generate a +# header containing the appropriate set of signatures on the fly. +# +################################################################# + +# CPU model-specific data is contained in cpu_models.py +# Convert to SCons File node to get path handling models_db = File('cpu_models.py') +# slurp in contents of file execfile(models_db.srcnode().abspath) +# Template for execute() signature. exec_sig_template = ''' virtual Fault execute(%s *xc, Trace::InstRecord *traceData) const = 0; ''' +# Generate header. def gen_cpu_exec_signatures(target, source, env): f = open(str(target[0]), 'w') print >> f, ''' @@ -52,7 +67,22 @@ def gen_cpu_exec_signatures(target, source, env): #endif // __CPU_STATIC_INST_EXEC_SIGS_HH__ ''' -env.Command('static_inst_exec_sigs.hh', models_db, gen_cpu_exec_signatures) +# Generate string that gets printed when header is rebuilt +def gen_sigs_string(target, source, env): + return "Generating static_inst_exec_sigs.hh: " \ + + ', '.join(env['CPU_MODELS']) + +# Add command to generate header to environment. +env.Command('static_inst_exec_sigs.hh', models_db, + Action(gen_cpu_exec_signatures, gen_sigs_string, + varlist = ['CPU_MODELS'])) + +################################################################# +# +# Include CPU-model-specific files based on set of models +# specified in CPU_MODELS build option. +# +################################################################# sources = []