DeclListAST.py revision 6657
16019Shines@cs.fsu.edu# Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
210037SARM gem5 Developers# Copyright (c) 2009 The Hewlett-Packard Development Company
37414SAli.Saidi@ARM.com# All rights reserved.
47414SAli.Saidi@ARM.com#
57414SAli.Saidi@ARM.com# Redistribution and use in source and binary forms, with or without
67414SAli.Saidi@ARM.com# modification, are permitted provided that the following conditions are
77414SAli.Saidi@ARM.com# met: redistributions of source code must retain the above copyright
87414SAli.Saidi@ARM.com# notice, this list of conditions and the following disclaimer;
97414SAli.Saidi@ARM.com# redistributions in binary form must reproduce the above copyright
107414SAli.Saidi@ARM.com# notice, this list of conditions and the following disclaimer in the
117414SAli.Saidi@ARM.com# documentation and/or other materials provided with the distribution;
127414SAli.Saidi@ARM.com# neither the name of the copyright holders nor the names of its
137414SAli.Saidi@ARM.com# contributors may be used to endorse or promote products derived from
146019Shines@cs.fsu.edu# this software without specific prior written permission.
156019Shines@cs.fsu.edu#
166019Shines@cs.fsu.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
176019Shines@cs.fsu.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
186019Shines@cs.fsu.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
196019Shines@cs.fsu.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
206019Shines@cs.fsu.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
216019Shines@cs.fsu.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
226019Shines@cs.fsu.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
236019Shines@cs.fsu.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
246019Shines@cs.fsu.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
256019Shines@cs.fsu.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
266019Shines@cs.fsu.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
276019Shines@cs.fsu.edu
286019Shines@cs.fsu.edufrom slicc.ast.AST import AST
296019Shines@cs.fsu.edu
306019Shines@cs.fsu.educlass DeclListAST(AST):
316019Shines@cs.fsu.edu    def __init__(self, slicc, decls):
326019Shines@cs.fsu.edu        super(DeclListAST, self).__init__(slicc)
336019Shines@cs.fsu.edu
346019Shines@cs.fsu.edu        if not isinstance(decls, (list, tuple)):
356019Shines@cs.fsu.edu            decls = [ decls ]
366019Shines@cs.fsu.edu        self.decls = decls
376019Shines@cs.fsu.edu
386019Shines@cs.fsu.edu    def __repr__(self):
396019Shines@cs.fsu.edu        return "[DeclListAST: %s]" % (', '.join(repr(d) for d in self.decls))
406019Shines@cs.fsu.edu
417414SAli.Saidi@ARM.com    def files(self, hh, cc, parent=None):
426019Shines@cs.fsu.edu        for decl in self.decls:
436019Shines@cs.fsu.edu            decl.files(hh, cc, parent)
4411793Sbrandon.potter@amd.com
4511793Sbrandon.potter@amd.com    def generate(self):
466019Shines@cs.fsu.edu        for decl in self.decls:
476019Shines@cs.fsu.edu            decl.generate()
486019Shines@cs.fsu.edu
496019Shines@cs.fsu.edu    def findMachines(self):
5012334Sgabeblack@google.com        for decl in self.decls:
516019Shines@cs.fsu.edu            decl.findMachines()
528232Snate@binkert.org