Added glabels that are written to.

This commit is contained in:
Antonio Castelli
2021-05-28 12:35:50 -07:00
parent d2c9e706c8
commit 2455eb42b8
22 changed files with 49 additions and 48 deletions
+2 -2
View File
@@ -5,7 +5,7 @@ from file_util import FileUtil
LINE_START_REGEX = r'\n(/\* ([0-9A-F]{6}) [0-9A-F]{8} [0-9A-F]{8} \*/\s+|\.L80[0-9A-F]{6}:)'
REG_REGEX = r'(\$(at|v[0-1]|a[0-3]|t[0-9]|s[0-7]|k[0-1]|gp|sp|fp|ra))'
GLABEL_UPPER_REGEX = '(' + LINE_START_REGEX + r'lui\s+' + REG_REGEX + r',\s+(0x80[0-9a-f]{2}))'
GLABEL_LOWER_REGEX = '(' + LINE_START_REGEX + r'l[bhw]\s+' + REG_REGEX + r',\s+(0x[0-9a-f]{4})\(\4\))'
GLABEL_LOWER_REGEX = '(' + LINE_START_REGEX + r'[sl][bhw]\s+' + REG_REGEX + r',\s+(0x[0-9a-f]{4})\(\4\))'
GLABEL_REGEX = GLABEL_UPPER_REGEX + '(' + LINE_START_REGEX + '[^\n]*){0,10}' + GLABEL_LOWER_REGEX
def _find_glabels(asm):
@@ -13,7 +13,7 @@ def _find_glabels(asm):
for file in FileUtil.get_filenames_from_directory_recursive('.', '.s'):
matches = re.findall(GLABEL_REGEX, FileUtil.get_text_from_file(file))
for match in matches:
offsets = (match[2], match[11]) # ROM offsets of the lu and lw
offsets = (match[2], match[11]) # ROM offsets of the lui and [sl][bhw]
glabel_upper = int(match[5], 16) # upper immediate of glabel
glabel_lower = int(match[14], 16) # lower immediate of the glabel
if glabel_lower & 0x8000: