summaryrefslogtreecommitdiff
path: root/src/mem/slicc/ast/FormalParamAST.py
diff options
context:
space:
mode:
authorLisa Hsu <Lisa.Hsu@amd.com>2011-03-31 17:18:00 -0700
committerLisa Hsu <Lisa.Hsu@amd.com>2011-03-31 17:18:00 -0700
commitd857105b5a56bf08f00f17f62a023d8ee3bbcc14 (patch)
tree0a7db41f49a1d4bab4a7770193495181d9e5a866 /src/mem/slicc/ast/FormalParamAST.py
parent322b9ca2c5b0465db7086abdc6eadca061932575 (diff)
downloadgem5-d857105b5a56bf08f00f17f62a023d8ee3bbcc14.tar.xz
Ruby: Simplify SLICC and Entry/TBE handling.
Before this changeset, all local variables of type Entry and TBE were considered to be pointers, but an immediate use of said variables would not be automatically deferenced in SLICC-generated code. Instead, deferences occurred when such variables were passed to functions, and were automatically dereferenced in the bodies of the functions (e.g. the implicitly passed cache_entry). This is a more general way to do it, which leaves in place the assumption that parameters to functions and local variables of type AbstractCacheEntry and TBE are always pointers, but instead of dereferencing to access member variables on a contextual basis, the dereferencing automatically occurs on a type basis at the moment a member is being accessed. So, now, things you can do that you couldn't before include: Entry foo := getCacheEntry(address); cache_entry.DataBlk := foo.DataBlk; or cache_entry.DataBlk := getCacheEntry(address).DataBlk; or even cache_entry.DataBlk := static_cast(Entry, pointer, cache.lookup(address)).DataBlk;
Diffstat (limited to 'src/mem/slicc/ast/FormalParamAST.py')
-rw-r--r--src/mem/slicc/ast/FormalParamAST.py13
1 files changed, 4 insertions, 9 deletions
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)