Gabe Black has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/56503 )
Change subject: arch-x86: Get rid of env.useStackSize and env.memoryInst.
......................................................................
arch-x86: Get rid of env.useStackSize and env.memoryInst.
env.useStackSize was initialized to False and then never changed, and
env.memoryInst can be tracked within the macroops themselves. This
removes any dependence on the emulation environment in the Macroop
getDefinition method.
Change-Id: I88dc084ffd17abcdc59eb838168c0ed3d16f6721
---
M src/arch/x86/isa/macroop.isa
M src/arch/x86/isa/specialize.isa
M src/arch/x86/ucasmlib/arch/x86/macroop.py
3 files changed, 22 insertions(+), 15 deletions(-)
diff --git a/src/arch/x86/isa/macroop.isa b/src/arch/x86/isa/macroop.isa
index 631cd4d..115c274 100644
--- a/src/arch/x86/isa/macroop.isa
+++ b/src/arch/x86/isa/macroop.isa
@@ -48,8 +48,6 @@
self.dataSize = "OPSIZE"
self.stackSize = "STACKSIZE"
self.firstArgument = True
- self.useStackSize = False
- self.memoryInst = False
def getAllocator(self):
if self.size == 'b':
@@ -105,7 +103,7 @@
macroop = macroopDict[Name]
if not macroop.declared:
blocks.header_output = macroop.getDeclaration()
- blocks.decoder_output = macroop.getDefinition(env)
+ blocks.decoder_output = macroop.getDefinition()
macroop.declared = True
blocks.decode_block = "return %s;\n" % macroop.getAllocator(env)
return blocks
diff --git a/src/arch/x86/isa/specialize.isa
b/src/arch/x86/isa/specialize.isa
index bf4331a..cc5f833 100644
--- a/src/arch/x86/isa/specialize.isa
+++ b/src/arch/x86/isa/specialize.isa
@@ -65,7 +65,6 @@
import itertools
def doRipRelativeDecode(Name, op_type_iter, env):
- env.memoryInst = True
norm_iter, rip_iter = itertools.tee(op_type_iter)
norm_env = copy.copy(env)
norm_blocks = specializeInst(Name + "_M", norm_iter, norm_env)
diff --git a/src/arch/x86/ucasmlib/arch/x86/macroop.py
b/src/arch/x86/ucasmlib/arch/x86/macroop.py
index 779ad3b..6f99349 100644
--- a/src/arch/x86/ucasmlib/arch/x86/macroop.py
+++ b/src/arch/x86/ucasmlib/arch/x86/macroop.py
@@ -160,6 +160,7 @@
if arg in ('M', 'P'):
self.init_env = "env.doModRM(machInst);"
+ self.memory_inst = True
self.name += f'_{arg}'
@@ -179,6 +180,7 @@
"control_indirect" : self.control_indirect,
"args" : self.set_args
}
+ self.memory_inst = False
self.disassembly = []
self.declared = False
self.adjust_env = ""
@@ -206,7 +208,7 @@
mnemonic = self.getMnemonic(),
declare_labels = declare_labels
)
- def getDefinition(self, env):
+ def getDefinition(self):
num_microops = len(self.microops)
alloc_microops = ''
micropc = 0
@@ -242,17 +244,11 @@
alloc_microops += \
f"microops[{micropc}] = {op.getAllocator(flags)};\n"
micropc += 1
- if env.useStackSize:
- use_stack_size = "true"
+ if self.memory_inst:
+ reg_size = \
+ '(env.base == INTREG_RSP ? env.stackSize :
env.dataSize)'
else:
- use_stack_size = "false"
- if env.memoryInst:
- memory_inst = "true"
- else:
- memory_inst = "false"
- reg_size = f'''({use_stack_size} ||
- (env.base == INTREG_RSP && {memory_inst}) ?
- env.stackSize : env.dataSize)'''
+ reg_size = 'env.dataSize'
subst = {
'class_name': self.name,
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/56503
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: I88dc084ffd17abcdc59eb838168c0ed3d16f6721
Gerrit-Change-Number: 56503
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <gabe.bl...@gmail.com>
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