misc: Replace THE_ISA macro with IS_NULL_ISA.

Now all occurances of the THE_ISA macro which were being used to check
for anything other than the NULL_ISA have been eliminated. We still need
to be able to check whether the current ISA is the null ISA, but we
don't want to let any preprocessor checks back in which are based on
what the current ISA is.

This change removes the THE_ISA macro, and replaces it with IS_NULL_ISA
which evaluates to 1 if the ISA is null, and 0 if it isn't.

Jira Issue: https://gem5.atlassian.net/browse/GEM5-1060

Change-Id: Iec146b40d8cab846dae03e15191390f754f2b71b
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/48709
Reviewed-by: Hoa Nguyen <hoanguyen@ucdavis.edu>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Gabe Black
2021-07-28 01:41:34 -07:00
parent b71029f02b
commit 91e24ba776
7 changed files with 19 additions and 25 deletions

View File

@@ -739,8 +739,7 @@ for opt in export_vars:
def makeTheISA(source, target, env):
isas = [ src.get_contents().decode('utf-8') for src in source ]
target_isa = env['TARGET_ISA']
def define(isa):
return str(isa.upper()) + '_ISA'
is_null_isa = '1' if (target_isa.lower() == 'null') else '0'
def namespace(isa):
return isa[0].upper() + isa[1:].lower() + 'ISA'
@@ -753,21 +752,16 @@ def makeTheISA(source, target, env):
''')
# create defines for the preprocessing and compile-time determination
for i,isa in enumerate(isas):
code('#define $0 $1', define(isa), i + 1)
code()
# create an enum for any run-time determination of the ISA, we
# reuse the same name as the namespaces
code('enum class Arch {')
for isa in isas:
code(' $0 = $1,', namespace(isa), define(isa))
code(' $0,', namespace(isa))
code('};')
code('''
#define THE_ISA ${{define(target_isa)}}
#define IS_NULL_ISA ${{is_null_isa}}
#define TheISA ${{namespace(target_isa)}}
#endif // __CONFIG_THE_ISA_HH__''')