summaryrefslogtreecommitdiff
path: root/src/arch/isa_parser.py
diff options
context:
space:
mode:
authorNathan Binkert <nate@binkert.org>2010-02-26 18:14:48 -0800
committerNathan Binkert <nate@binkert.org>2010-02-26 18:14:48 -0800
commit5ad139375ee65782e4c71212af526bc3d339348d (patch)
tree164714657690cb9e122500455e4c4be87454c500 /src/arch/isa_parser.py
parent4ef6e129d6e9fcf3c038cedfc8b2e81308a09c39 (diff)
downloadgem5-5ad139375ee65782e4c71212af526bc3d339348d.tar.xz
isa_parser: move more stuff into the ISAParser class
Diffstat (limited to 'src/arch/isa_parser.py')
-rwxr-xr-xsrc/arch/isa_parser.py22
1 files changed, 9 insertions, 13 deletions
diff --git a/src/arch/isa_parser.py b/src/arch/isa_parser.py
index d39dca5d8..96fa4ea3c 100755
--- a/src/arch/isa_parser.py
+++ b/src/arch/isa_parser.py
@@ -893,9 +893,6 @@ def buildOperandNameMap(user_dict, lineno):
global operandsWithExtRE
operandsWithExtRE = re.compile(operandsWithExtREString, re.MULTILINE)
-maxInstSrcRegs = 0
-maxInstDestRegs = 0
-
class OperandList(object):
'''Find all the operands in the given code block. Returns an operand
descriptor list (instance of class OperandList).'''
@@ -957,12 +954,10 @@ class OperandList(object):
if self.memOperand:
error("Code block has more than one memory operand.")
self.memOperand = op_desc
- global maxInstSrcRegs
- global maxInstDestRegs
- if maxInstSrcRegs < self.numSrcRegs:
- maxInstSrcRegs = self.numSrcRegs
- if maxInstDestRegs < self.numDestRegs:
- maxInstDestRegs = self.numDestRegs
+ if parser.maxInstSrcRegs < self.numSrcRegs:
+ parser.maxInstSrcRegs = self.numSrcRegs
+ if parser.maxInstDestRegs < self.numDestRegs:
+ parser.maxInstDestRegs = self.numDestRegs
# now make a final pass to finalize op_desc fields that may depend
# on the register enumeration
for op_desc in self.items:
@@ -1237,6 +1232,9 @@ class ISAParser(Grammar):
self.exportContext = {}
+ self.maxInstSrcRegs = 0
+ self.maxInstDestRegs = 0
+
#####################################################################
#
# Lexer
@@ -2049,10 +2047,8 @@ StaticInstPtr
# The variable names here are hacky, but this will creat local
# variables which will be referenced in vars() which have the
# value of the globals.
- global maxInstSrcRegs
- MaxInstSrcRegs = maxInstSrcRegs
- global maxInstDestRegs
- MaxInstDestRegs = maxInstDestRegs
+ MaxInstSrcRegs = self.maxInstSrcRegs
+ MaxInstDestRegs = self.maxInstDestRegs
# max_inst_regs.hh
self.update_if_needed('max_inst_regs.hh',
max_inst_regs_template % vars())