summaryrefslogtreecommitdiff
path: root/src/mem/slicc/symbols/Func.py
diff options
context:
space:
mode:
authorBrad Beckmann <Brad.Beckmann@amd.com>2015-07-20 09:15:18 -0500
committerBrad Beckmann <Brad.Beckmann@amd.com>2015-07-20 09:15:18 -0500
commit8a54adc2a55c9858cb536fac3a9cd92bc47ce778 (patch)
treead482d891914407192f8aa568711baecfe92e83c /src/mem/slicc/symbols/Func.py
parent0d00cbc97b47344e12e9eb943efb9ca29db66898 (diff)
downloadgem5-8a54adc2a55c9858cb536fac3a9cd92bc47ce778.tar.xz
slicc: enable overloading in functions not in classes
For many years the slicc symbol table has supported overloaded functions in external classes. This patch extends that support to functions that are not part of classes (a.k.a. no parent). For example, this support allows slicc to understand that mapAddressToRange is overloaded and the NodeID is an optional parameter.
Diffstat (limited to 'src/mem/slicc/symbols/Func.py')
-rw-r--r--src/mem/slicc/symbols/Func.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/mem/slicc/symbols/Func.py b/src/mem/slicc/symbols/Func.py
index a52b6bbcc..d50d0309f 100644
--- a/src/mem/slicc/symbols/Func.py
+++ b/src/mem/slicc/symbols/Func.py
@@ -29,7 +29,7 @@ from slicc.symbols.Symbol import Symbol
from slicc.symbols.Type import Type
class Func(Symbol):
- def __init__(self, table, ident, location, return_type, param_types,
+ def __init__(self, table, ident, name, location, return_type, param_types,
param_strings, body, pairs):
super(Func, self).__init__(table, ident, location, pairs)
self.return_type = return_type
@@ -38,6 +38,7 @@ class Func(Symbol):
self.body = body
self.isInternalMachineFunc = False
self.c_ident = ident
+ self.c_name = name
self.class_name = ""
def __repr__(self):
@@ -55,7 +56,7 @@ class Func(Symbol):
elif "return_by_pointer" in self and self.return_type != void_type:
return_type += "*"
- return "%s %s(%s);" % (return_type, self.c_ident,
+ return "%s %s(%s);" % (return_type, self.c_name,
", ".join(self.param_strings))
def writeCodeFiles(self, path, includes):
@@ -80,7 +81,7 @@ class Func(Symbol):
code('''
$return_type
-${{self.class_name}}::${{self.c_ident}}($params)
+${{self.class_name}}::${{self.c_name}}($params)
{
${{self.body}}
}