Gabe Black has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/56327 )

 (

9 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
 )Change subject: arch-x86: Use push_state in the microcode assembler.
......................................................................

arch-x86: Use push_state in the microcode assembler.

Use push_state and pop_state in the microcode assembler to enter/exit
the params state. That will make that state usable in other contexts,
rather than forcing the lexer into the asm state afterwards.

Change-Id: Id80747db6e52a6f6f15ebe36ec54524fa3405581
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/56327
Reviewed-by: Matt Sinclair <mattdsincl...@gmail.com>
Maintainer: Gabe Black <gabe.bl...@gmail.com>
Tested-by: kokoro <noreply+kok...@google.com>
---
M src/arch/micro_asm.py
1 file changed, 24 insertions(+), 7 deletions(-)

Approvals:
  Matt Sinclair: Looks good to me, approved
  Gabe Black: Looks good to me, approved
  kokoro: Regressions pass




diff --git a/src/arch/micro_asm.py b/src/arch/micro_asm.py
index 448bf17..60d7216 100644
--- a/src/arch/micro_asm.py
+++ b/src/arch/micro_asm.py
@@ -215,7 +215,7 @@
 # in the "asm" state since it knows it saw a label and not a mnemonic.
 def t_params_COLON(t):
     r':'
-    t.lexer.begin('asm')
+    t.lexer.pop_state()
     return t

# Parameters are a string of text which don't contain an unescaped statement
@@ -228,7 +228,7 @@
         val = mo.group(0)
         return val[1]
     t.value = unescapeParamsRE.sub(unescapeParams, t.value)
-    t.lexer.begin('asm')
+    t.lexer.pop_state()
     return t

 # An "ID" in the micro assembler is either a label, directive, or mnemonic
@@ -241,7 +241,7 @@
# If the ID is really "extern", we shouldn't start looking for parameters
     # yet. The real ID, the label itself, is coming up.
     if t.type != 'EXTERN':
-        t.lexer.begin('params')
+        t.lexer.push_state('params')
     return t

# If there is a label and you're -not- in the assembler (which would be caught
@@ -254,12 +254,12 @@
 # Braces enter and exit micro assembly
 def t_INITIAL_LBRACE(t):
     r'\{'
-    t.lexer.begin('asm')
+    t.lexer.push_state('asm')
     return t

 def t_asm_RBRACE(t):
     r'\}'
-    t.lexer.begin('INITIAL')
+    t.lexer.pop_state()
     return t

 # At the top level, keep track of newlines only for line counting.
@@ -279,12 +279,12 @@
 def t_params_NEWLINE(t):
     r'\n+'
     t.lineno += t.value.count('\n')
-    t.lexer.begin('asm')
+    t.lexer.pop_state()
     return t

 def t_params_SEMI(t):
     r';'
-    t.lexer.begin('asm')
+    t.lexer.pop_state()
     return t

 # Basic regular expressions to pick out simple tokens

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/56327
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: Id80747db6e52a6f6f15ebe36ec54524fa3405581
Gerrit-Change-Number: 56327
Gerrit-PatchSet: 11
Gerrit-Owner: Gabe Black <gabe.bl...@gmail.com>
Gerrit-Reviewer: Gabe Black <gabe.bl...@gmail.com>
Gerrit-Reviewer: Matt Sinclair <mattdsincl...@gmail.com>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
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

Reply via email to