[gem5-dev] Change in gem5/gem5[develop]: base: Add some error handling to compiler.hh.
Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/35275 ) Change subject: base: Add some error handling to compiler.hh. .. base: Add some error handling to compiler.hh. Rather than just leaving some macros undefined if none of the scenarios we checked for match, we should report an error so it's clear what happened. Otherwise the places the macros are used will just not compile properly, or worse will silently not work correctly. Change-Id: Ie010d6b6d1b6a1496a45d9ebc0d75d1c804df12f --- M src/base/compiler.hh 1 file changed, 4 insertions(+), 0 deletions(-) diff --git a/src/base/compiler.hh b/src/base/compiler.hh index ee9a224..ead1507 100644 --- a/src/base/compiler.hh +++ b/src/base/compiler.hh @@ -76,6 +76,8 @@ // gcc and clang support a custom attribute which is essentially the same // thing. # define M5_VAR_USED [[gnu::unused]] +#else +# error "Don't know what to do for your compiler." #endif @@ -106,6 +108,8 @@ // we can't do that with direct substitution. # define M5_LIKELY(cond) __builtin_expect(!!(cond), 1) # define M5_UNLIKELY(cond) __builtin_expect(!!(cond), 0) +#else +# error "Don't know what to do for your compiler." #endif // When a member variable may be unused, mark it with M5_CLASS_VAR_USED. This -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/35275 To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings Gerrit-Project: public/gem5 Gerrit-Branch: develop Gerrit-Change-Id: Ie010d6b6d1b6a1496a45d9ebc0d75d1c804df12f Gerrit-Change-Number: 35275 Gerrit-PatchSet: 1 Gerrit-Owner: Gabe Black Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[release-staging-v20.1.0.0]: mem: Fix some reference use in range loops
Nikos Nikoleris has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/34776 ) Change subject: mem: Fix some reference use in range loops .. mem: Fix some reference use in range loops This change fixes two cases of range loops, one where we can't use lvalue reference, and one more where we have to use an lvalue reference as we can't create a copy. In both cases clang would warn. Change-Id: I760aa094af66be32a150bad37acc21d6fd512a65 Signed-off-by: Nikos Nikoleris Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/34776 Reviewed-by: Jason Lowe-Power Maintainer: Jason Lowe-Power Tested-by: kokoro --- M src/mem/ruby/common/BoolVec.cc M src/mem/ruby/slicc_interface/RubySlicc_Util.hh M src/mem/ruby/system/Sequencer.cc 3 files changed, 5 insertions(+), 5 deletions(-) Approvals: Jason Lowe-Power: Looks good to me, approved; Looks good to me, approved kokoro: Regressions pass diff --git a/src/mem/ruby/common/BoolVec.cc b/src/mem/ruby/common/BoolVec.cc index 603f714..1c29532 100644 --- a/src/mem/ruby/common/BoolVec.cc +++ b/src/mem/ruby/common/BoolVec.cc @@ -41,8 +41,8 @@ #include std::ostream& operator<<(std::ostream& os, const BoolVec& myvector) { -for (const auto& it: myvector) { -os << " " << it; +for (const bool e: myvector) { +os << " " << e; } return os; } diff --git a/src/mem/ruby/slicc_interface/RubySlicc_Util.hh b/src/mem/ruby/slicc_interface/RubySlicc_Util.hh index 8ff8884..155d134 100644 --- a/src/mem/ruby/slicc_interface/RubySlicc_Util.hh +++ b/src/mem/ruby/slicc_interface/RubySlicc_Util.hh @@ -256,8 +256,8 @@ countBoolVec(BoolVec bVec) { int count = 0; -for (const auto &it: bVec) { -if (it) { +for (const bool e: bVec) { +if (e) { count++; } } diff --git a/src/mem/ruby/system/Sequencer.cc b/src/mem/ruby/system/Sequencer.cc index 75c58d6..dbc85c4 100644 --- a/src/mem/ruby/system/Sequencer.cc +++ b/src/mem/ruby/system/Sequencer.cc @@ -167,7 +167,7 @@ int total_outstanding = 0; for (const auto &table_entry : m_RequestTable) { -for (const auto seq_req : table_entry.second) { +for (const auto &seq_req : table_entry.second) { if (current_time - seq_req.issue_time < m_deadlock_threshold) continue; -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/34776 To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings Gerrit-Project: public/gem5 Gerrit-Branch: release-staging-v20.1.0.0 Gerrit-Change-Id: I760aa094af66be32a150bad37acc21d6fd512a65 Gerrit-Change-Number: 34776 Gerrit-PatchSet: 3 Gerrit-Owner: Nikos Nikoleris Gerrit-Reviewer: Gabe Black Gerrit-Reviewer: Giacomo Travaglini Gerrit-Reviewer: Jason Lowe-Power Gerrit-Reviewer: Nikos Nikoleris Gerrit-Reviewer: kokoro Gerrit-CC: Bobby R. Bruce Gerrit-MessageType: merged ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: base,mem: Use the standard [[deprecated]] attribute.
Gabe Black has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/35216 ) Change subject: base,mem: Use the standard [[deprecated]] attribute. .. base,mem: Use the standard [[deprecated]] attribute. The [[deprecated]] attribute is now standard, and so we don't need to wrap it in our own macro any more. Change-Id: I363df9a9c6b820dee8c21b1716335c0d15fbc62d Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/35216 Maintainer: Gabe Black Reviewed-by: Nikos Nikoleris Reviewed-by: Daniel Carvalho Tested-by: kokoro --- M src/base/compiler.hh M src/mem/mem_object.hh M src/mem/port.hh 3 files changed, 4 insertions(+), 6 deletions(-) Approvals: Nikos Nikoleris: Looks good to me, approved Daniel Carvalho: Looks good to me, approved Gabe Black: Looks good to me, approved kokoro: Regressions pass diff --git a/src/base/compiler.hh b/src/base/compiler.hh index c2eb5d9..e28d45e 100644 --- a/src/base/compiler.hh +++ b/src/base/compiler.hh @@ -49,8 +49,6 @@ # define M5_VAR_USED __attribute__((unused)) # define M5_ATTR_PACKED __attribute__ ((__packed__)) # define M5_NO_INLINE __attribute__ ((__noinline__)) -# define M5_DEPRECATED __attribute__((deprecated)) -# define M5_DEPRECATED_MSG(MSG) __attribute__((deprecated(MSG))) # define M5_UNREACHABLE __builtin_unreachable() # define M5_PUBLIC __attribute__ ((visibility ("default"))) # define M5_LOCAL __attribute__ ((visibility ("hidden"))) diff --git a/src/mem/mem_object.hh b/src/mem/mem_object.hh index 7cce0c9..5220836 100644 --- a/src/mem/mem_object.hh +++ b/src/mem/mem_object.hh @@ -55,8 +55,8 @@ class MemObject : public ClockedObject { public: -M5_DEPRECATED_MSG( -"MemObject is deprecated. Use ClockedObject or SimObject instead") +[[deprecated( +"MemObject is deprecated. Use ClockedObject or SimObject instead")]] MemObject(const MemObjectParams *params) : ClockedObject(params) {} }; diff --git a/src/mem/port.hh b/src/mem/port.hh index c933af62..357a10e 100644 --- a/src/mem/port.hh +++ b/src/mem/port.hh @@ -245,7 +245,7 @@ } }; -class M5_DEPRECATED MasterPort : public RequestPort +class [[deprecated]] MasterPort : public RequestPort { public: MasterPort(const std::string& name, SimObject* _owner, @@ -449,7 +449,7 @@ } }; -class M5_DEPRECATED SlavePort : public ResponsePort +class [[deprecated]] SlavePort : public ResponsePort { public: SlavePort(const std::string& name, SimObject* _owner, -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/35216 To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings Gerrit-Project: public/gem5 Gerrit-Branch: develop Gerrit-Change-Id: I363df9a9c6b820dee8c21b1716335c0d15fbc62d Gerrit-Change-Number: 35216 Gerrit-PatchSet: 2 Gerrit-Owner: Gabe Black Gerrit-Reviewer: Andreas Sandberg Gerrit-Reviewer: Bobby R. Bruce Gerrit-Reviewer: Daniel Carvalho Gerrit-Reviewer: Gabe Black Gerrit-Reviewer: Nikos Nikoleris Gerrit-Reviewer: kokoro Gerrit-MessageType: merged ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[release-staging-v20.1.0.0]: scons,python: Add warning for when python3-config is not used
Bobby R. Bruce has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/35256 ) Change subject: scons,python: Add warning for when python3-config is not used .. scons,python: Add warning for when python3-config is not used We cannot say for certain whether 'python-config' is python2 or python3, but this patch will produce a warning if 'python3-config' is not used, stating that support for python2 will be dropped in future releases of gem5. Change-Id: I114da359c8768071bf7dd7f2701aae85e3459678 --- M SConstruct 1 file changed, 4 insertions(+), 0 deletions(-) diff --git a/SConstruct b/SConstruct index 667a0e6..621f923 100755 --- a/SConstruct +++ b/SConstruct @@ -637,6 +637,10 @@ main['PYTHON_CONFIG']) print("Info: Using Python config: %s" % (python_config, )) +if python_config != 'python3-config': +warning('python3-config could not be found.\n' +'Future releases of gem5 will drop support for python2.') + py_includes = readCommand([python_config, '--includes'], exception='').split() py_includes = list(filter( -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/35256 To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings Gerrit-Project: public/gem5 Gerrit-Branch: release-staging-v20.1.0.0 Gerrit-Change-Id: I114da359c8768071bf7dd7f2701aae85e3459678 Gerrit-Change-Number: 35256 Gerrit-PatchSet: 1 Gerrit-Owner: Bobby R. Bruce Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[release-staging-v20.1.0.0]: scons,python: Add python2-config to PYTHON_CONFIG
Bobby R. Bruce has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/35255 ) Change subject: scons,python: Add python2-config to PYTHON_CONFIG .. scons,python: Add python2-config to PYTHON_CONFIG PYTHON_CONFIG can be python2-config as well as python2.7-config. Change-Id: I482cb922fcf26b37f67f2aca392e04968ca144bd --- M SConstruct 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/SConstruct b/SConstruct index 316c10b..667a0e6 100755 --- a/SConstruct +++ b/SConstruct @@ -238,7 +238,8 @@ ('MARSHAL_CCFLAGS_EXTRA', 'Extra C and C++ marshal compiler flags', ''), ('MARSHAL_LDFLAGS_EXTRA', 'Extra marshal linker flags', ''), ('PYTHON_CONFIG', 'Python config binary to use', - [ 'python3-config', 'python-config', 'python2.7-config' ]), + [ 'python3-config', 'python-config', 'python2.7-config', 'python2-config'] +), ('PROTOC', 'protoc tool', environ.get('PROTOC', 'protoc')), ('BATCH', 'Use batch pool for build and tests', False), ('BATCH_CMD', 'Batch pool submission command name', 'qdo'), -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/35255 To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings Gerrit-Project: public/gem5 Gerrit-Branch: release-staging-v20.1.0.0 Gerrit-Change-Id: I482cb922fcf26b37f67f2aca392e04968ca144bd Gerrit-Change-Number: 35255 Gerrit-PatchSet: 1 Gerrit-Owner: Bobby R. Bruce Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: cpu: make ExecSymbol show the symbol in addition to address
Ciro Santilli has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/35077 ) Change subject: cpu: make ExecSymbol show the symbol in addition to address .. cpu: make ExecSymbol show the symbol in addition to address Before this commit, ExecSymbol would show only the symbol and no address: 0: system.cpu: A0 T0 : @_kernel_flags_le_lo32+6: mrs x0, currentel After this commit, it shows the symbol in addition to the address: 0: system.cpu: A0 T0 : 0x10 @_kernel_flags_le_lo32+6: mrs x0, currentel Change-Id: I665802f50ce9aeac6bb9e174b5dd06196e757c60 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/35077 Reviewed-by: Richard Cooper Reviewed-by: Jason Lowe-Power Maintainer: Jason Lowe-Power Tested-by: kokoro --- M src/cpu/exetrace.cc 1 file changed, 3 insertions(+), 4 deletions(-) Approvals: Jason Lowe-Power: Looks good to me, approved; Looks good to me, approved Richard Cooper: Looks good to me, but someone else must approve kokoro: Regressions pass diff --git a/src/cpu/exetrace.cc b/src/cpu/exetrace.cc index ca05041..69ee5cc 100644 --- a/src/cpu/exetrace.cc +++ b/src/cpu/exetrace.cc @@ -77,16 +77,15 @@ Addr cur_pc = pc.instAddr(); Loader::SymbolTable::const_iterator it; +ccprintf(outs, "%#x", cur_pc); if (Debug::ExecSymbol && (!FullSystem || !inUserMode(thread)) && (it = Loader::debugSymbolTable.findNearest(cur_pc)) != Loader::debugSymbolTable.end()) { Addr delta = cur_pc - it->address; if (delta) -ccprintf(outs, "@%s+%d", it->name, delta); +ccprintf(outs, " @%s+%d", it->name, delta); else -ccprintf(outs, "@%s", it->name); -} else { -ccprintf(outs, "%#x", cur_pc); +ccprintf(outs, " @%s", it->name); } if (inst->isMicroop()) { -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/35077 To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings Gerrit-Project: public/gem5 Gerrit-Branch: develop Gerrit-Change-Id: I665802f50ce9aeac6bb9e174b5dd06196e757c60 Gerrit-Change-Number: 35077 Gerrit-PatchSet: 2 Gerrit-Owner: Ciro Santilli Gerrit-Reviewer: Bobby R. Bruce Gerrit-Reviewer: Ciro Santilli Gerrit-Reviewer: Gabe Black Gerrit-Reviewer: Giacomo Travaglini Gerrit-Reviewer: Jason Lowe-Power Gerrit-Reviewer: Jason Lowe-Power Gerrit-Reviewer: Matthew Poremba Gerrit-Reviewer: Richard Cooper Gerrit-Reviewer: kokoro Gerrit-MessageType: merged ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: sparc: Simplify the IntOp format slightly.
Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/35236 ) Change subject: sparc: Simplify the IntOp format slightly. .. sparc: Simplify the IntOp format slightly. Change-Id: I693e56a04827287712e001cf99620085ab09b8ac --- M src/arch/sparc/isa/formats/integerop.isa 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/arch/sparc/isa/formats/integerop.isa b/src/arch/sparc/isa/formats/integerop.isa index a8e0374..aa67b7c 100644 --- a/src/arch/sparc/isa/formats/integerop.isa +++ b/src/arch/sparc/isa/formats/integerop.isa @@ -128,26 +128,20 @@ xc=default_xc, xv=default_xv, sub=False, *opt_flags) {{ -if sub == "False": -(def_ic, def_iv, def_xc, def_xv) = \ -(default_ic, default_iv, default_xc, default_xv) -else: -(def_ic, def_iv, def_xc, def_xv) = \ -(default_sub_ic, default_sub_iv, default_sub_xc, default_sub_xv) +sub = sub != 'False' if ic == "default_ic": -ic = def_ic +ic = default_sub_ic if sub else default_ic if iv == "default_iv": -iv = def_iv +iv = default_sub_iv if sub else default_iv if xc == "default_xc": -xc = def_xc +xc = default_sub_xc if sub else default_xc if xv == "default_xv": -xv = def_xv +xv = default_sub_xv if sub else default_xv ccCode = calcCcCode % vars() (header_output, decoder_output, exec_output, - decode_block) = doIntFormat(code, ccCode, - name, Name, opt_flags) + decode_block) = doIntFormat(code, ccCode, name, Name, opt_flags) }}; // Primary format for integer operate instructions: -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/35236 To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings Gerrit-Project: public/gem5 Gerrit-Branch: develop Gerrit-Change-Id: I693e56a04827287712e001cf99620085ab09b8ac Gerrit-Change-Number: 35236 Gerrit-PatchSet: 1 Gerrit-Owner: Gabe Black Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: sparc: Clean up some code in base.isa.
Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/35235 ) Change subject: sparc: Clean up some code in base.isa. .. sparc: Clean up some code in base.isa. This includes the filterDoubles function which adds code to combine 32 bit values into doubles or 64 bit values for floating point, and the splitOutImm function which detects if the code that implements an instruction has a register and immediate variant, and generates code for each. Change-Id: I5524b9acd6e610b51fd91fe70276c34c23be9f85 --- M src/arch/sparc/isa/base.isa M src/arch/sparc/isa/formats/branch.isa M src/arch/sparc/isa/formats/integerop.isa M src/arch/sparc/isa/formats/priv.isa 4 files changed, 62 insertions(+), 64 deletions(-) diff --git a/src/arch/sparc/isa/base.isa b/src/arch/sparc/isa/base.isa index 4c9bd25..5be3940 100644 --- a/src/arch/sparc/isa/base.isa +++ b/src/arch/sparc/isa/base.isa @@ -52,69 +52,69 @@ let {{ def filterDoubles(code): assignRE = re.compile(r'\s*=(?!=)', re.MULTILINE) -for opName in ("Frd", "Frs1", "Frs2", "Frd_N"): -next_pos = 0 -operandsREString = (r''' -(?partial matches -((%s)(?:_([^\W_]+))?) # match: operand with optional '.' then suffix -(?!\w) # neg. lookahead assertion: prevent partial matches -''' % opName) -operandsRE = re.compile(operandsREString, re.MULTILINE| re.VERBOSE) -is_src = False -is_dest = False -extension = None -foundOne = False -while 1: -match = operandsRE.search(code, next_pos) -if not match: -break -foundOne = True -op = match.groups() -(op_full, op_base, op_ext) = op -is_dest_local = (assignRE.match(code, match.end()) != None) -is_dest = is_dest or is_dest_local -is_src = is_src or not is_dest_local -if extension and extension != op_ext: -raise Exception("Inconsistent extensions in double filter") -extension = op_ext -next_pos = match.end() -if foundOne: -# Get rid of any unwanted extension -code = operandsRE.sub(op_base, code) -is_int = False -member = "d" -if extension in ("sb", "ub", "shw", "uhw", "sw", "uw", "sdw", "udw"): -is_int = True -member = "ui" -if is_src: -code = ("%s = DoubleSingle(%s_high, %s_low).%s;" % \ -(opName, opName, opName, member)) + code -if is_dest: -code += ''' -%s_low = DoubleSingle(%s).s[1]; -%s_high = DoubleSingle(%s).s[0];''' % \ - (opName, opName, opName, opName) -if is_int: -code = ("uint64_t %s;" % opName) + code -else: -code = ("double %s;" % opName) + code + +int_extensions = ("sb", "ub", "shw", "uhw", "sw", "uw", "sdw", "udw") +operand_names = ("Frd", "Frs1", "Frs2", "Frd_N") + +class Operand(object): +def __init__(self, name, ext): +self.name = name +self.ext = ext +self.src = False +self.dest = False + +operands = {} + +operandsREString = (r''' +# neg. lookbehind assertion: prevent partial matches +(?%s)(_(?P[^\W_]+))?) +# neg. lookahead assertion: prevent partial matches +(?!\w) +''' % '|'.join(operand_names)) +operandsRE = re.compile(operandsREString, re.MULTILINE | re.VERBOSE) + +for match in operandsRE.finditer(code): +name = match.group('name') +ext = match.group('ext') +operand = operands.setdefault(name, Operand(name, ext)) +if assignRE.match(code, match.end()): +operand.dest = True +else: +operand.src = True +if operand.ext != ext: +raise Exception("Inconsistent extensions in double filter") + +# Get rid of any unwanted extension +code = operandsRE.sub('\g', code) + +for op in operands.values(): +is_int = op.ext in int_extensions +member, type = ('ui', 'uint64_t') if is_int else ('d', 'double') +if op.src: +code = ("%s = DoubleSingle(%s_high, %s_low).%s;" % \ +(op.name, op.name, op.name, member)) + code +if op.dest: +code += ''' +%s_low = DoubleSingle(%s).s[1]; +%s_high = DoubleSingle(%s).
[gem5-dev] Change in gem5/gem5[develop]: arch: Build the operand REs in the isa_parser on demand.
Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/35237 ) Change subject: arch: Build the operand REs in the isa_parser on demand. .. arch: Build the operand REs in the isa_parser on demand. These regular expressions search code snippets to find places where operands are used. Rather than build them explicitly at the end of processing the operands{{}} construct, wait until they're first going to be used. That way, we'll be able to define operands in as many places as we want, as long as we've done all we're going to do before the first instructions are defined. This will pave the way to defining operands in regular python in let blocks, and then possibly outside of the parser altogether, perhaps into scons where having lots of output files for individual instructions will be easier to manage. For now, this just lets you define multiple operands blocks which is not all that exciting on its own :) Change-Id: I1179092316c1c0ac2613810bfd236a32235502fb --- M src/arch/isa_parser.py 1 file changed, 30 insertions(+), 11 deletions(-) diff --git a/src/arch/isa_parser.py b/src/arch/isa_parser.py index 7d8bffd..d9e4cc4 100755 --- a/src/arch/isa_parser.py +++ b/src/arch/isa_parser.py @@ -1133,7 +1133,7 @@ # search for operands next_pos = 0 while 1: -match = parser.operandsRE.search(code, next_pos) +match = parser.operandsRE().search(code, next_pos) if not match: # no more matches: we're done break @@ -1303,7 +1303,7 @@ # search for operands next_pos = 0 while 1: -match = parser.operandsRE.search(code, next_pos) +match = parser.operandsRE().search(code, next_pos) if not match: # no more matches: we're done break @@ -1558,6 +1558,13 @@ # variable to hold templates self.templateMap = {} +# variable to hold operands +self.operandNameMap = {} + +# Regular expressions for working with operands +self._operandsRE = None +self._operandsWithExtRE = None + # This dictionary maps format name strings to Format objects. self.formatMap = {} @@ -1590,6 +1597,16 @@ self.maxInstDestRegs = 0 self.maxMiscDestRegs = 0 +def operandsRE(self): +if not self._operandsRE: +self.buildOperandREs() +return self._operandsRE + +def operandsWithExtRE(self): +if not self._operandsWithExtRE: +self.buildOperandREs() +return self._operandsWithExtRE + def __getitem__(self, i):# Allow object (self) to be return getattr(self, i) # passed to %-substitutions @@ -2580,18 +2597,19 @@ # in tmp_dict, just as if we evaluated a class declaration. operand_name[op_name] = type(cls_name, (base_cls,), tmp_dict) -self.operandNameMap = operand_name +self.operandNameMap.update(operand_name) +def buildOperandREs(self): # Define operand variables. -operands = list(user_dict.keys()) +operands = list(self.operandNameMap.keys()) # Add the elems defined in the vector operands and # build a map elem -> vector (used in OperandList) elem_to_vec = {} -for op in user_dict.keys(): -if hasattr(self.operandNameMap[op], 'elems'): -for elem in self.operandNameMap[op].elems.keys(): +for op_name, op in self.operandNameMap.items(): +if hasattr(op, 'elems'): +for elem in op.elems.keys(): operands.append(elem) -elem_to_vec[elem] = op +elem_to_vec[elem] = op_name self.elemToVector = elem_to_vec extensions = self.operandTypeMap.keys() @@ -2601,7 +2619,8 @@ (?!\w) # neg. lookahead assertion: prevent partial matches ''' % ('|'.join(operands), '|'.join(extensions)) -self.operandsRE = re.compile(operandsREString, re.MULTILINE| re.VERBOSE) +self._operandsRE = re.compile(operandsREString, + re.MULTILINE | re.VERBOSE) # Same as operandsREString, but extension is mandatory, and only two # groups are returned (base and ext, not full name as above). @@ -2609,14 +2628,14 @@ operandsWithExtREString = r'(?https://gem5-review.googlesource.com/c/public/gem5/+/35237 To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings Gerrit-Project: public/gem5 Gerrit-Branch: develop Gerrit-Change-Id: I1179092316c1c0ac2613810bfd236a32235502fb Gerrit-Change-Number: 35237 Gerrit-PatchSet: 1 Gerrit-Owner: Gabe Black Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem