diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mem/slicc/ast/ActionDeclAST.py | 4 | ||||
-rw-r--r-- | src/mem/slicc/ast/FormalParamAST.py | 13 | ||||
-rw-r--r-- | src/mem/slicc/ast/FuncCallExprAST.py | 22 | ||||
-rw-r--r-- | src/mem/slicc/ast/IsValidPtrExprAST.py | 5 | ||||
-rw-r--r-- | src/mem/slicc/ast/MemberExprAST.py | 7 |
5 files changed, 20 insertions, 31 deletions
diff --git a/src/mem/slicc/ast/ActionDeclAST.py b/src/mem/slicc/ast/ActionDeclAST.py index 2a8fb0639..8015523ab 100644 --- a/src/mem/slicc/ast/ActionDeclAST.py +++ b/src/mem/slicc/ast/ActionDeclAST.py @@ -59,12 +59,12 @@ class ActionDeclAST(DeclAST): if machine.TBEType != None: var = Var(self.symtab, "tbe", self.location, machine.TBEType, - "(*m_tbe_ptr)", self.pairs) + "m_tbe_ptr", self.pairs) self.symtab.newSymbol(var) if machine.EntryType != None: var = Var(self.symtab, "cache_entry", self.location, - machine.EntryType, "(*m_cache_entry_ptr)", self.pairs) + machine.EntryType, "m_cache_entry_ptr", self.pairs) self.symtab.newSymbol(var) # Do not allows returns in actions diff --git a/src/mem/slicc/ast/FormalParamAST.py b/src/mem/slicc/ast/FormalParamAST.py index 142e837cc..783607f43 100644 --- a/src/mem/slicc/ast/FormalParamAST.py +++ b/src/mem/slicc/ast/FormalParamAST.py @@ -48,17 +48,12 @@ class FormalParamAST(AST): param = "param_%s" % self.ident # Add to symbol table + v = Var(self.symtab, self.ident, self.location, type, param, + self.pairs) + self.symtab.newSymbol(v) if self.pointer or str(type) == "TBE" or ( "interface" in type and type["interface"] == "AbstractCacheEntry"): - v = Var(self.symtab, self.ident, self.location, type, - "(*%s)" % param, self.pairs) - self.symtab.newSymbol(v) return type, "%s* %s" % (type.c_ident, param) - else: - v = Var(self.symtab, self.ident, self.location, type, param, - self.pairs) - self.symtab.newSymbol(v) - - return type, "%s %s" % (type.c_ident, param) + return type, "%s %s" % (type.c_ident, param) diff --git a/src/mem/slicc/ast/FuncCallExprAST.py b/src/mem/slicc/ast/FuncCallExprAST.py index 2c5e9ea4d..75ec12344 100644 --- a/src/mem/slicc/ast/FuncCallExprAST.py +++ b/src/mem/slicc/ast/FuncCallExprAST.py @@ -217,22 +217,12 @@ if (!(${{cvec[0]}})) { first_param = True for (param_code, type) in zip(cvec, type_vec): - if str(type) == "TBE" or ("interface" in type and - type["interface"] == "AbstractCacheEntry"): - - if first_param: - params = str(param_code).replace('*','') - first_param = False - else: - params += ', ' - params += str(param_code).replace('*',''); - else: - if first_param: - params = str(param_code) - first_param = False - else: - params += ', ' - params += str(param_code); + if first_param: + params = str(param_code) + first_param = False + else: + params += ', ' + params += str(param_code); fix = code.nofix() code('(${internal}${{func.c_ident}}($params))') diff --git a/src/mem/slicc/ast/IsValidPtrExprAST.py b/src/mem/slicc/ast/IsValidPtrExprAST.py index 850f45e96..e68e084c0 100644 --- a/src/mem/slicc/ast/IsValidPtrExprAST.py +++ b/src/mem/slicc/ast/IsValidPtrExprAST.py @@ -43,11 +43,10 @@ class IsValidPtrExprAST(ExprAST): fix = code.nofix() code("(") var_type, var_code = self.variable.inline(True); - var_code_str = str(var_code).replace('*','') if self.flag: - code("${var_code_str} != NULL)") + code("${var_code} != NULL)") else: - code("${var_code_str} == NULL)") + code("${var_code} == NULL)") code.fix(fix) type = self.symtab.find("bool", Type) return type diff --git a/src/mem/slicc/ast/MemberExprAST.py b/src/mem/slicc/ast/MemberExprAST.py index 8f6b4a55c..a13205252 100644 --- a/src/mem/slicc/ast/MemberExprAST.py +++ b/src/mem/slicc/ast/MemberExprAST.py @@ -40,7 +40,12 @@ class MemberExprAST(ExprAST): def generate(self, code): return_type, gcode = self.expr_ast.inline(True) fix = code.nofix() - code("($gcode).m_${{self.field}}") + + if str(return_type) == "TBE" or ("interface" in return_type and return_type["interface"] == "AbstractCacheEntry"): + code("(*$gcode).m_${{self.field}}") + else: + code("($gcode).m_${{self.field}}") + code.fix(fix) # Verify that this is a valid field name for this type |