mem-ruby: enable DPRINTFN calls in slicc for temporary debug printing
authorJohn Alsop <johnathan.alsop@amd.com>
Mon, 16 Apr 2018 23:37:53 +0000 (19:37 -0400)
committerAnthony Gutierrez <anthony.gutierrez@amd.com>
Tue, 17 Apr 2018 17:31:22 +0000 (17:31 +0000)
Change-Id: Ib92f8bb4ab7b61ebc96b935cb8abc42cf5ec6ac8
Reviewed-on: https://gem5-review.googlesource.com/9921
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>

src/mem/slicc/ast/FuncCallExprAST.py

index 0c9880d6dd1bfb4407d5493458492b135e318c42..b3cc9f1ec872ba0797e3de5a61deb8e5664c317a 100644 (file)
@@ -74,6 +74,24 @@ class FuncCallExprAST(ExprAST):
 
             return self.symtab.find("void", Type)
 
+        if self.proc_name == "DPRINTFN":
+            format = "%s" % (self.exprs[0].inline())
+            format_length = len(format)
+            str_list = []
+
+            for i in range(1, len(self.exprs)):
+                str_list.append("%s" % self.exprs[i].inline())
+
+            if len(str_list) == 0:
+                code('DPRINTFN("$0: $1")',
+                     self.exprs[0].location, format[2:format_length-2])
+            else:
+                code('DPRINTFN("$0: $1", $2)',
+                     self.exprs[0].location, format[2:format_length-2],
+                     ', '.join(str_list))
+
+            return self.symtab.find("void", Type)
+
         # hack for adding comments to profileTransition
         if self.proc_name == "APPEND_TRANSITION_COMMENT":
             # FIXME - check for number of parameters