diff options
author | Curtis Dunham <Curtis.Dunham@arm.com> | 2014-04-23 05:17:57 -0400 |
---|---|---|
committer | Curtis Dunham <Curtis.Dunham@arm.com> | 2014-04-23 05:17:57 -0400 |
commit | e651188f75ffff5a1091691e787209d3b53d5bb8 (patch) | |
tree | 823e88d9b485d195ea2ce5690d0816cda8fd0ae2 /src/arch/isa_parser.py | |
parent | fa4a262204953071be1ca34672f25b5de9af19ef (diff) | |
download | gem5-e651188f75ffff5a1091691e787209d3b53d5bb8.tar.xz |
arch: remove 'null update' check in isa-parser
SCons already does this for all build steps.
Diffstat (limited to 'src/arch/isa_parser.py')
-rwxr-xr-x | src/arch/isa_parser.py | 37 |
1 files changed, 11 insertions, 26 deletions
diff --git a/src/arch/isa_parser.py b/src/arch/isa_parser.py index dd9f2e873..d810e1c5f 100755 --- a/src/arch/isa_parser.py +++ b/src/arch/isa_parser.py @@ -2089,28 +2089,13 @@ StaticInstPtr else: return s - def update_if_needed(self, file, contents): - '''Update the output file only if the new contents are - different from the current contents. Minimizes the files that - need to be rebuilt after minor changes.''' - + def update(self, file, contents): + '''Update the output file. If the contents are unchanged, + the scons hash feature will avoid recompilation.''' file = os.path.join(self.output_dir, file) - update = False - if os.access(file, os.R_OK): - f = open(file, 'r') - old_contents = f.read() - f.close() - if contents != old_contents: - os.remove(file) # in case it's write-protected - update = True - else: - print 'File', file, 'is unchanged' - else: - update = True - if update: - f = open(file, 'w') - f.write(contents) - f.close() + f = open(file, 'w') + f.write(contents) + f.close() # This regular expression matches '##include' directives includeRE = re.compile(r'^\s*##include\s+"(?P<filename>[^"]*)".*$', @@ -2172,7 +2157,7 @@ StaticInstPtr global_output = global_code.header_output namespace_output = namespace_code.header_output decode_function = '' - self.update_if_needed('decoder.hh', file_template % vars()) + self.update('decoder.hh', file_template % vars()) # generate decoder.cc includes = '#include "decoder.hh"' @@ -2180,7 +2165,7 @@ StaticInstPtr namespace_output = namespace_code.decoder_output # namespace_output += namespace_code.decode_block decode_function = namespace_code.decode_block - self.update_if_needed('decoder.cc', file_template % vars()) + self.update('decoder.cc', file_template % vars()) # generate per-cpu exec files for cpu in self.cpuModels: @@ -2189,7 +2174,7 @@ StaticInstPtr global_output = global_code.exec_output[cpu.name] namespace_output = namespace_code.exec_output[cpu.name] decode_function = '' - self.update_if_needed(cpu.filename, file_template % vars()) + self.update(cpu.filename, file_template % vars()) # The variable names here are hacky, but this will creat local # variables which will be referenced in vars() which have the @@ -2198,8 +2183,8 @@ StaticInstPtr MaxInstDestRegs = self.maxInstDestRegs MaxMiscDestRegs = self.maxMiscDestRegs # max_inst_regs.hh - self.update_if_needed('max_inst_regs.hh', - max_inst_regs_template % vars()) + self.update('max_inst_regs.hh', + max_inst_regs_template % vars()) def parse_isa_desc(self, *args, **kwargs): try: |