summaryrefslogtreecommitdiff
path: root/tools/asm_processor/asm_processor.py
diff options
context:
space:
mode:
authorPikalaxALT <pikalaxalt@gmail.com>2021-05-23 16:45:58 -0400
committerPikalaxALT <pikalaxalt@gmail.com>2021-05-23 16:45:58 -0400
commit45561e5267602adc91847a3de3378e29a215e697 (patch)
tree90cefd995fafa90ebd20f85014768b5dfea7cb8c /tools/asm_processor/asm_processor.py
parent57b9d8fd35548901ccd4ffcdfa7bca7140065036 (diff)
parent8ffb7a0c637d74d2140fefc7e20e10288b43e286 (diff)
Merge remote-tracking branch 'origin/master' into pikalax_work
Diffstat (limited to 'tools/asm_processor/asm_processor.py')
-rwxr-xr-xtools/asm_processor/asm_processor.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/tools/asm_processor/asm_processor.py b/tools/asm_processor/asm_processor.py
index ec01c68e..5c909388 100755
--- a/tools/asm_processor/asm_processor.py
+++ b/tools/asm_processor/asm_processor.py
@@ -9,7 +9,7 @@ import os
from collections import namedtuple, defaultdict
from io import StringIO
-MAX_FN_SIZE = 100
+MAX_FN_SIZE = 3000
SLOW_CHECKS = False
EI_NIDENT = 16
@@ -375,14 +375,14 @@ def is_temp_name(name):
# https://stackoverflow.com/a/241506
def re_comment_replacer(match):
s = match.group(0)
- if s[0] in "/#":
+ if s[0] in "/#;":
return " "
else:
return s
re_comment_or_string = re.compile(
- r'#.*|/\*.*?\*/|"(?:\\.|[^\\"])*"'
+ r';.*|#.*|/\*.*?\*/|"(?:\\.|[^\\"])*"'
)
@@ -584,8 +584,12 @@ class GlobalAsmBlock:
elif line.startswith('.byte'):
self.add_sized(len(line.split(',')), real_line)
# Branches are 4 bytes long
- elif line.startswith('bl'):
+ elif line.startswith('bl') and not line.startswith('bls'):
self.add_sized(4, real_line)
+ elif line.startswith('.word'):
+ self.add_sized(4, real_line)
+ elif line.startswith('.extern'):
+ pass
else:
# Unfortunately, macros are hard to support for .rodata --
# we don't know how how space they will expand to before
@@ -820,7 +824,7 @@ def repl_float_hex(m):
def parse_source(f, opt, framepointer, input_enc, output_enc, print_source=None):
opt = "O4"
min_instr_count = 3 # idk
- skip_instr_count = 2 # idk
+ skip_instr_count = 3 # mandatory instructions: push, pop and mov r0, 0
use_jtbl_for_rodata = False
if opt in ['O2', 'g3'] and not framepointer: