summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Reinhardt <steve.reinhardt@amd.com>2009-11-05 11:11:06 -0800
committerSteve Reinhardt <steve.reinhardt@amd.com>2009-11-05 11:11:06 -0800
commit9098010e3fccf779786c7f0e1dfab9d522f72eb5 (patch)
tree688b989cf6d6d0fd081143835c3b5ba55b469c8d
parent058ccfc7fe7be1b7b7124ecdd0d9d79fe4d6a86f (diff)
downloadgem5-9098010e3fccf779786c7f0e1dfab9d522f72eb5.tar.xz
slicc: tweak file enumeration for scons
Right now .cc and .hh files are handled separately, but then they're just munged together at the end by scons, so it doesn't buy us anything. Might as well munge from the start since we'll eventually be adding generated Python files to the list too.
-rw-r--r--src/mem/protocol/SConscript4
-rw-r--r--src/mem/slicc/ast/DeclAST.py4
-rw-r--r--src/mem/slicc/ast/DeclListAST.py6
-rw-r--r--src/mem/slicc/ast/EnumDeclAST.py8
-rw-r--r--src/mem/slicc/ast/FuncDeclAST.py6
-rw-r--r--src/mem/slicc/ast/MachineAST.py18
-rw-r--r--src/mem/slicc/ast/TypeDeclAST.py7
-rw-r--r--src/mem/slicc/main.py10
-rw-r--r--src/mem/slicc/parser.py10
9 files changed, 31 insertions, 42 deletions
diff --git a/src/mem/protocol/SConscript b/src/mem/protocol/SConscript
index 948fd6c1a..cd9920d22 100644
--- a/src/mem/protocol/SConscript
+++ b/src/mem/protocol/SConscript
@@ -69,9 +69,7 @@ def slicc_emitter(target, source, env):
for name in slicc.load(files, verbose=True):
print " %s" % name
- hh,cc = slicc.files()
- target.extend(sorted(hh))
- target.extend(sorted(cc))
+ target.extend(sorted(slicc.files()))
return target, source
def slicc_action(target, source, env):
diff --git a/src/mem/slicc/ast/DeclAST.py b/src/mem/slicc/ast/DeclAST.py
index 2303725a3..1adb31321 100644
--- a/src/mem/slicc/ast/DeclAST.py
+++ b/src/mem/slicc/ast/DeclAST.py
@@ -31,8 +31,8 @@ class DeclAST(AST):
def __init__(self, slicc, pairs):
super(DeclAST, self).__init__(slicc, pairs)
- def files(self, hh, cc, parent=None):
- pass
+ def files(self, parent=None):
+ return set()
def findMachines(self):
return
diff --git a/src/mem/slicc/ast/DeclListAST.py b/src/mem/slicc/ast/DeclListAST.py
index 42f98afc7..36c520070 100644
--- a/src/mem/slicc/ast/DeclListAST.py
+++ b/src/mem/slicc/ast/DeclListAST.py
@@ -38,9 +38,11 @@ class DeclListAST(AST):
def __repr__(self):
return "[DeclListAST: %s]" % (', '.join(repr(d) for d in self.decls))
- def files(self, hh, cc, parent=None):
+ def files(self, parent=None):
+ s = set()
for decl in self.decls:
- decl.files(hh, cc, parent)
+ s |= decl.files(parent)
+ return s
def generate(self):
for decl in self.decls:
diff --git a/src/mem/slicc/ast/EnumDeclAST.py b/src/mem/slicc/ast/EnumDeclAST.py
index c16fc8a75..a20f4b749 100644
--- a/src/mem/slicc/ast/EnumDeclAST.py
+++ b/src/mem/slicc/ast/EnumDeclAST.py
@@ -38,16 +38,16 @@ class EnumDeclAST(DeclAST):
def __repr__(self):
return "[EnumDecl: %s]" % (self.type_ast)
- def files(self, hh, cc, parent=None):
+ def files(self, parent=None):
if "external" in self:
- return
+ return set()
if parent:
ident = "%s_%s" % (parent, self.type_ast.ident)
else:
ident = self.type_ast.ident
- hh.add("%s.hh" % ident)
- cc.add("%s.cc" % ident)
+ s = set(("%s.hh" % ident, "%s.cc" % ident))
+ return s
def generate(self):
ident = str(self.type_ast)
diff --git a/src/mem/slicc/ast/FuncDeclAST.py b/src/mem/slicc/ast/FuncDeclAST.py
index 7ff3bf8a7..980804c2a 100644
--- a/src/mem/slicc/ast/FuncDeclAST.py
+++ b/src/mem/slicc/ast/FuncDeclAST.py
@@ -42,15 +42,15 @@ class FuncDeclAST(DeclAST):
def __repr__(self):
return "[FuncDecl: %s]" % self.ident
- def files(self, hh, cc, parent=None):
+ def files(self, parent=None):
if "external" in self or self.statements is None:
- return
+ return set()
if parent:
ident = "%s_%s" % (parent, self.ident)
else:
ident = self.ident
- cc.add("%s.cc" % ident)
+ return set(("%s.cc" % ident,))
def generate(self):
types = []
diff --git a/src/mem/slicc/ast/MachineAST.py b/src/mem/slicc/ast/MachineAST.py
index 8d48ccbf5..ee75b6d6a 100644
--- a/src/mem/slicc/ast/MachineAST.py
+++ b/src/mem/slicc/ast/MachineAST.py
@@ -40,16 +40,16 @@ class MachineAST(DeclAST):
def __repr__(self):
return "[Machine: %r]" % self.ident
- def files(self, hh, cc, parent=None):
- hh.add('%s_Controller.hh' % self.ident)
- hh.add('%s_Profiler.hh' % self.ident)
+ def files(self, parent=None):
+ s = set(('%s_Controller.cc' % self.ident,
+ '%s_Controller.hh' % self.ident,
+ '%s_Profiler.cc' % self.ident,
+ '%s_Profiler.hh' % self.ident,
+ '%s_Transitions.cc' % self.ident,
+ '%s_Wakeup.cc' % self.ident))
- cc.add('%s_Controller.cc' % self.ident)
- cc.add('%s_Profiler.cc' % self.ident)
- cc.add('%s_Transitions.cc' % self.ident)
- cc.add('%s_Wakeup.cc' % self.ident)
-
- self.decls.files(hh, cc, self.ident)
+ s |= self.decls.files(self.ident)
+ return s
def generate(self):
# Make a new frame
diff --git a/src/mem/slicc/ast/TypeDeclAST.py b/src/mem/slicc/ast/TypeDeclAST.py
index d2cc04eff..ecdb5949b 100644
--- a/src/mem/slicc/ast/TypeDeclAST.py
+++ b/src/mem/slicc/ast/TypeDeclAST.py
@@ -38,16 +38,15 @@ class TypeDeclAST(DeclAST):
def __repr__(self):
return "[TypeDecl: %r]" % (self.type_ast)
- def files(self, hh, cc, parent=None):
+ def files(self, parent=None):
if "external" in self:
- return
+ return set()
if parent:
ident = "%s_%s" % (parent, self.type_ast.ident)
else:
ident = self.type_ast.ident
- hh.add("%s.hh" % ident)
- cc.add("%s.cc" % ident)
+ return set(("%s.hh" % ident, "%s.cc" % ident))
def generate(self):
ident = str(self.type_ast)
diff --git a/src/mem/slicc/main.py b/src/mem/slicc/main.py
index 0bc2ef37a..f8efcc323 100644
--- a/src/mem/slicc/main.py
+++ b/src/mem/slicc/main.py
@@ -78,15 +78,7 @@ def main(args=None):
output(" %s", filename)
if opts.print_files:
- hh, cc = slicc.files()
- hh = sorted(hh)
- cc = sorted(cc)
- print 'Headers:'
- for i in hh:
- print ' %s' % i
-
- print 'Sources:'
- for i in cc:
+ for i in sorted(slicc.files()):
print ' %s' % i
else:
output("Generator pass 1...")
diff --git a/src/mem/slicc/parser.py b/src/mem/slicc/parser.py
index 0e5ccc885..6c3f45629 100644
--- a/src/mem/slicc/parser.py
+++ b/src/mem/slicc/parser.py
@@ -114,19 +114,17 @@ class SLICC(Grammar):
self.symtab.writeHTMLFiles(code_path)
def files(self):
- cc = set([
+ f = set([
'ControllerFactory.cc',
- 'MachineType.cc'])
-
- hh = set([
'ControllerFactory.hh',
+ 'MachineType.cc',
'MachineType.hh',
'Types.hh' ])
for decl_list in self.decl_list_vec:
- decl_list.files(hh, cc)
+ f |= decl_list.files()
- return hh, cc
+ return f
t_ignore = '\t '