summaryrefslogtreecommitdiff
path: root/src/mem/slicc/symbols/Func.py
diff options
context:
space:
mode:
authorNilay Vaish <nilay@cs.wisc.edu>2012-10-15 17:27:16 -0500
committerNilay Vaish <nilay@cs.wisc.edu>2012-10-15 17:27:16 -0500
commit3e607f146f4c8acac6b42e61a0e6295f52f408a4 (patch)
treee0274a4eab977e9662a9dc22126f726518d8213f /src/mem/slicc/symbols/Func.py
parentc7b0901b97a86eb2d61e4ddd96a73a9d777a57c1 (diff)
downloadgem5-3e607f146f4c8acac6b42e61a0e6295f52f408a4.tar.xz
ruby: allow function definition in slicc structs
This patch adds support for function definitions to appear in slicc structs. This is required for supporting functional accesses for different types of messages. Subsequent patches will use this to development.
Diffstat (limited to 'src/mem/slicc/symbols/Func.py')
-rw-r--r--src/mem/slicc/symbols/Func.py16
1 files changed, 3 insertions, 13 deletions
diff --git a/src/mem/slicc/symbols/Func.py b/src/mem/slicc/symbols/Func.py
index 8e137d044..a52b6bbcc 100644
--- a/src/mem/slicc/symbols/Func.py
+++ b/src/mem/slicc/symbols/Func.py
@@ -30,7 +30,7 @@ from slicc.symbols.Type import Type
class Func(Symbol):
def __init__(self, table, ident, location, return_type, param_types,
- param_strings, body, pairs, machine):
+ param_strings, body, pairs):
super(Func, self).__init__(table, ident, location, pairs)
self.return_type = return_type
self.param_types = param_types
@@ -38,12 +38,7 @@ class Func(Symbol):
self.body = body
self.isInternalMachineFunc = False
self.c_ident = ident
-
- if machine is None or "external" in self or "primitive" in self:
- pass
- else:
- self.machineStr = str(machine)
- self.isInternalMachineFunc = True
+ self.class_name = ""
def __repr__(self):
return ""
@@ -81,16 +76,11 @@ class Func(Symbol):
if "return_by_pointer" in self and self.return_type != void_type:
return_type += "*"
- if self.isInternalMachineFunc:
- klass = "%s_Controller" % self.machineStr
- else:
- self.error("No class found for the function %s" % self.ident)
-
params = ', '.join(self.param_strings)
code('''
$return_type
-${klass}::${{self.c_ident}}($params)
+${{self.class_name}}::${{self.c_ident}}($params)
{
${{self.body}}
}