Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/56749 )

Change subject: scons: Work around a SCons bug in Glob.
......................................................................

scons: Work around a SCons bug in Glob.

The recent change to add an "exclude" pattern to Glob in SCons also
seems to have triggered a bug where SCons has decided directories that
don't exist are files, and then gets upset later when we try to treat
them as directories.

To avoid that bug, and to also make recursive searching for isa parser
.py files work, we can replace the call to Glob with a loop based on
os.walk.

Also, tell the microcode assembler not to generate the parsetab.py file
in the first place. This comes with a minor performance overhead, but
shouldn't matter for us since there are *much* bigger overheads when
processing ISA descriptions.

Change-Id: Ia84e97dab72723ad3f4350798ad70178e231144c
---
M src/arch/SConscript
M src/arch/micro_asm.py
2 files changed, 32 insertions(+), 5 deletions(-)



diff --git a/src/arch/SConscript b/src/arch/SConscript
index 0178750..2321b9a 100644
--- a/src/arch/SConscript
+++ b/src/arch/SConscript
@@ -40,6 +40,7 @@

 import sys
 import os
+import os.path
 import re

 from gem5_scons import Transform
@@ -103,9 +104,12 @@
 # Now create a Builder object that uses isa_parser.py to generate C++
 # output from the ISA description (*.isa) files.
 #
-
-# parsetab.py is a file generated by PLY which we don't want to add as a dep.
-parser_files = Glob('isa_parser/*.py', exclude=['*/parsetab.py'])
+parser_files = []
+for root, dirnames, filenames in os.walk(Dir("isa_parser").srcnode().abspath):
+    for name in filenames:
+        _, ext = os.path.splitext(name)
+        if ext == '.py':
+            parser_files.append(os.path.join(root, name))
 micro_asm_py = File('micro_asm.py')

# import ply here because SCons screws with sys.path when performing actions.
@@ -115,7 +119,7 @@

 def run_parser(target, source, env):
     # Add the current directory to the system path so we can import files.
-    sys.path[0:0] = [ arch_dir.abspath ]
+    sys.path[0:0] = [ arch_dir.srcnode().abspath ]
     import isa_parser

     parser = isa_parser.ISAParser(target[0].dir.abspath)
diff --git a/src/arch/micro_asm.py b/src/arch/micro_asm.py
index 5eac33d..448bf17 100644
--- a/src/arch/micro_asm.py
+++ b/src/arch/micro_asm.py
@@ -486,7 +486,7 @@
     def __init__(self, macro_type, microops,
             rom = None, rom_macroop_type = None):
         self.lexer = lex.lex()
-        self.parser = yacc.yacc()
+        self.parser = yacc.yacc(write_tables=False)
         self.parser.macro_type = macro_type
         self.parser.macroops = {}
         self.parser.microops = microops

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/56749
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Ia84e97dab72723ad3f4350798ad70178e231144c
Gerrit-Change-Number: 56749
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <gabe.bl...@gmail.com>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to