diff options
Diffstat (limited to 'src/mem/slicc/ast')
-rw-r--r-- | src/mem/slicc/ast/AST.py | 4 | ||||
-rw-r--r-- | src/mem/slicc/ast/ActionDeclAST.py | 4 | ||||
-rw-r--r-- | src/mem/slicc/ast/AssignStatementAST.py | 6 | ||||
-rw-r--r-- | src/mem/slicc/ast/CheckStopSlotsStatementAST.py | 2 | ||||
-rw-r--r-- | src/mem/slicc/ast/ExprAST.py | 4 | ||||
-rw-r--r-- | src/mem/slicc/ast/ExprStatementAST.py | 2 | ||||
-rw-r--r-- | src/mem/slicc/ast/FuncDeclAST.py | 4 | ||||
-rw-r--r-- | src/mem/slicc/ast/IfStatementAST.py | 4 | ||||
-rw-r--r-- | src/mem/slicc/ast/InPortDeclAST.py | 6 | ||||
-rw-r--r-- | src/mem/slicc/ast/InfixOperatorExprAST.py | 6 | ||||
-rw-r--r-- | src/mem/slicc/ast/MemberExprAST.py | 2 | ||||
-rw-r--r-- | src/mem/slicc/ast/MethodCallExprAST.py | 6 | ||||
-rw-r--r-- | src/mem/slicc/ast/OutPortDeclAST.py | 4 |
13 files changed, 15 insertions, 39 deletions
diff --git a/src/mem/slicc/ast/AST.py b/src/mem/slicc/ast/AST.py index 5b1b124cd..5818448ca 100644 --- a/src/mem/slicc/ast/AST.py +++ b/src/mem/slicc/ast/AST.py @@ -25,8 +25,6 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -from m5.util import code_formatter - from slicc.util import PairContainer, Location class AST(PairContainer): @@ -54,7 +52,7 @@ class AST(PairContainer): def embedError(self, message, *args): if args: message = message % args - code = code_formatter() + code = self.slicc.codeFormatter() code(''' cerr << "Runtime Error at ${{self.location}}, Ruby Time: " << g_eventQueue_ptr->getTime() << ": "<< $message << ", PID: " << getpid() << endl; char c; cerr << "press return to continue." << endl; cin.get(c); abort(); diff --git a/src/mem/slicc/ast/ActionDeclAST.py b/src/mem/slicc/ast/ActionDeclAST.py index 18bf443b9..e85aa25b8 100644 --- a/src/mem/slicc/ast/ActionDeclAST.py +++ b/src/mem/slicc/ast/ActionDeclAST.py @@ -25,8 +25,6 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -from m5.util import code_formatter - from slicc.ast.DeclAST import DeclAST from slicc.symbols import Action, Type, Var @@ -55,7 +53,7 @@ class ActionDeclAST(DeclAST): self.symtab.newSymbol(var) # Do not allows returns in actions - code = code_formatter() + code = self.slicc.codeFormatter() self.statement_list.generate(code, None) self.pairs["c_code"] = str(code) diff --git a/src/mem/slicc/ast/AssignStatementAST.py b/src/mem/slicc/ast/AssignStatementAST.py index f8e77b03b..3c3426f5b 100644 --- a/src/mem/slicc/ast/AssignStatementAST.py +++ b/src/mem/slicc/ast/AssignStatementAST.py @@ -25,8 +25,6 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -from m5.util import code_formatter - from slicc.ast.StatementAST import StatementAST class AssignStatementAST(StatementAST): @@ -39,8 +37,8 @@ class AssignStatementAST(StatementAST): return "[AssignStatementAST: %r := %r]" % (self.lvalue, self.rvalue) def generate(self, code, return_type): - lcode = code_formatter() - rcode = code_formatter() + lcode = self.slicc.codeFormatter() + rcode = self.slicc.codeFormatter() ltype = self.lvalue.generate(lcode) rtype = self.rvalue.generate(rcode) diff --git a/src/mem/slicc/ast/CheckStopSlotsStatementAST.py b/src/mem/slicc/ast/CheckStopSlotsStatementAST.py index 307fbd6a1..9320aebac 100644 --- a/src/mem/slicc/ast/CheckStopSlotsStatementAST.py +++ b/src/mem/slicc/ast/CheckStopSlotsStatementAST.py @@ -45,7 +45,7 @@ class CheckStopSlotsStatementAST(StatementAST): var = self.variable.var assert var not in self.resources - check_code = code_formatter() + check_code = self.slicc.codeFormatter() if self.condStr == "((*in_msg_ptr)).m_isOnChipSearch": check_code(''' const Response9Msg* in_msg_ptr = diff --git a/src/mem/slicc/ast/ExprAST.py b/src/mem/slicc/ast/ExprAST.py index 70a0aa0b5..393101112 100644 --- a/src/mem/slicc/ast/ExprAST.py +++ b/src/mem/slicc/ast/ExprAST.py @@ -24,8 +24,6 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -from m5.util import code_formatter - from slicc.ast.AST import AST class ExprAST(AST): @@ -37,7 +35,7 @@ class ExprAST(AST): pass def inline(self, get_type=False): - code = code_formatter(fix_newlines=False) + code = self.slicc.codeFormatter(fix_newlines=False) return_type = self.generate(code) if get_type: return return_type, code diff --git a/src/mem/slicc/ast/ExprStatementAST.py b/src/mem/slicc/ast/ExprStatementAST.py index b16d1d072..898fccf3d 100644 --- a/src/mem/slicc/ast/ExprStatementAST.py +++ b/src/mem/slicc/ast/ExprStatementAST.py @@ -25,8 +25,6 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -from m5.util import code_formatter - from slicc.ast.StatementAST import StatementAST from slicc.symbols import Type diff --git a/src/mem/slicc/ast/FuncDeclAST.py b/src/mem/slicc/ast/FuncDeclAST.py index 980804c2a..a87d61119 100644 --- a/src/mem/slicc/ast/FuncDeclAST.py +++ b/src/mem/slicc/ast/FuncDeclAST.py @@ -25,8 +25,6 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -from m5.util.code_formatter import code_formatter - from slicc.ast.DeclAST import DeclAST from slicc.symbols import Func, Type @@ -70,7 +68,7 @@ class FuncDeclAST(DeclAST): types.append(type) params.append(ident) - body = code_formatter() + body = self.slicc.codeFormatter() if self.statements is None: self["external"] = "yes" else: diff --git a/src/mem/slicc/ast/IfStatementAST.py b/src/mem/slicc/ast/IfStatementAST.py index 788876fd1..359173203 100644 --- a/src/mem/slicc/ast/IfStatementAST.py +++ b/src/mem/slicc/ast/IfStatementAST.py @@ -25,8 +25,6 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -from m5.util import code_formatter - from slicc.ast.StatementAST import StatementAST from slicc.symbols import Type @@ -45,7 +43,7 @@ class IfStatementAST(StatementAST): return "[IfStatement: %r%r%r]" % (self.cond, self.then, self.else_) def generate(self, code, return_type): - cond_code = code_formatter() + cond_code = self.slicc.codeFormatter() cond_type = self.cond.generate(cond_code) if cond_type != self.symtab.find("bool", Type): diff --git a/src/mem/slicc/ast/InPortDeclAST.py b/src/mem/slicc/ast/InPortDeclAST.py index 3dde24557..ad48ea4b8 100644 --- a/src/mem/slicc/ast/InPortDeclAST.py +++ b/src/mem/slicc/ast/InPortDeclAST.py @@ -25,8 +25,6 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -from m5.util import code_formatter - from slicc.ast.DeclAST import DeclAST from slicc.ast.TypeAST import TypeAST from slicc.symbols import Func, Type, Var @@ -48,7 +46,7 @@ class InPortDeclAST(DeclAST): symtab = self.symtab void_type = symtab.find("void", Type) - code = code_formatter() + code = self.slicc.codeFormatter() queue_type = self.var_expr.generate(code) if not queue_type.isInPort: self.error("The inport queue's type must have the 'inport' " + \ @@ -115,7 +113,7 @@ class InPortDeclAST(DeclAST): symtab.newSymbol(func) if self.statements is not None: - rcode = code_formatter() + rcode = self.slicc.codeFormatter() rcode.indent() rcode.indent() self.statements.generate(rcode, None) diff --git a/src/mem/slicc/ast/InfixOperatorExprAST.py b/src/mem/slicc/ast/InfixOperatorExprAST.py index c4fb4a4db..c5f384c4b 100644 --- a/src/mem/slicc/ast/InfixOperatorExprAST.py +++ b/src/mem/slicc/ast/InfixOperatorExprAST.py @@ -25,8 +25,6 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -from m5.util import code_formatter - from slicc.ast.ExprAST import ExprAST from slicc.symbols import Type @@ -42,8 +40,8 @@ class InfixOperatorExprAST(ExprAST): return "[InfixExpr: %r %s %r]" % (self.left, self.op, self.right) def generate(self, code): - lcode = code_formatter() - rcode = code_formatter() + lcode = self.slicc.codeFormatter() + rcode = self.slicc.codeFormatter() ltype = self.left.generate(lcode) rtype = self.right.generate(rcode) diff --git a/src/mem/slicc/ast/MemberExprAST.py b/src/mem/slicc/ast/MemberExprAST.py index c62e28741..8f6b4a55c 100644 --- a/src/mem/slicc/ast/MemberExprAST.py +++ b/src/mem/slicc/ast/MemberExprAST.py @@ -25,8 +25,6 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -from m5.util import code_formatter - from slicc.ast.ExprAST import ExprAST class MemberExprAST(ExprAST): diff --git a/src/mem/slicc/ast/MethodCallExprAST.py b/src/mem/slicc/ast/MethodCallExprAST.py index 150f391bc..84009c076 100644 --- a/src/mem/slicc/ast/MethodCallExprAST.py +++ b/src/mem/slicc/ast/MethodCallExprAST.py @@ -25,8 +25,6 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -from m5.util import code_formatter - from slicc.ast.ExprAST import ExprAST class MethodCallExprAST(ExprAST): @@ -36,7 +34,7 @@ class MethodCallExprAST(ExprAST): self.expr_ast_vec = expr_ast_vec def generate(self, code): - tmp = code_formatter() + tmp = self.slicc.codeFormatter() paramTypes = [] for expr_ast in self.expr_ast_vec: return_type = expr_ast.generate(tmp) @@ -91,7 +89,7 @@ class MemberMethodCallExprAST(MethodCallExprAST): self.obj_expr_ast, self.expr_ast_vec) def generate_prefix(self, paramTypes): - code = code_formatter() + code = self.slicc.codeFormatter() # member method call obj_type = self.obj_expr_ast.generate(code) diff --git a/src/mem/slicc/ast/OutPortDeclAST.py b/src/mem/slicc/ast/OutPortDeclAST.py index a387f6d91..39795ef7e 100644 --- a/src/mem/slicc/ast/OutPortDeclAST.py +++ b/src/mem/slicc/ast/OutPortDeclAST.py @@ -25,8 +25,6 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -from m5.util import code_formatter - from slicc.ast.DeclAST import DeclAST from slicc.ast.TypeAST import TypeAST from slicc.symbols import Var @@ -45,7 +43,7 @@ class OutPortDeclAST(DeclAST): return "[OutPortDecl: %r]" % self.ident def generate(self): - code = code_formatter(newlines=False) + code = self.slicc.codeFormatter(newlines=False) queue_type = self.var_expr.generate(code) if not queue_type.isOutPort: |