Skip to content

Commit e32d021

Browse files
committed
target_help_parser.py: Support lines "-misel=no" and "-misel=yes"
1 parent f7c5d08 commit e32d021

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

resolve_march_native/target_help_parser.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@
1919
# " -mno-align-stringops \t\t[disabled]"
2020
_disabled_m_line_pattern = re.compile(r'^\s+(?P<flag>-m[^ ]+)\s+\[disabled\]$')
2121

22+
# Exmample lines:
23+
# " -misel=no \t\t"
24+
_assign_no_line_pattern = re.compile(r'^\s+(?P<flag>-m[^ ]+)=no\s+$')
25+
26+
# Exmample lines:
27+
# " -misel=yes \t\t"
28+
_assign_yes_line_pattern = re.compile(r'^\s+(?P<flag>-m[^ ]+)=yes\s+$')
29+
2230
# Example lines:
2331
# " -mgen-cell-microcode \t\t[ignored]"
2432
_ignore_marked_line_pattern = re.compile(r'^\s+(?P<flag>-[^ ]+)\s+\[ignored\]$')
@@ -121,6 +129,19 @@ def _parse_gcc_output(gcc_output: str) -> List[str]:
121129
flags.append('-mno-' + flag[len('-m'):])
122130
continue
123131

132+
if '=no' in line:
133+
m = _assign_no_line_pattern.match(line)
134+
if m is not None:
135+
flag = m.group('flag')
136+
flags.append('-mno-' + flag[len('-m'):])
137+
continue
138+
139+
if '=yes' in line:
140+
m = _assign_yes_line_pattern.match(line)
141+
if m is not None:
142+
flags.append(m.group('flag'))
143+
continue
144+
124145
if line.endswith('[ignored]'):
125146
flag = _ignore_marked_line_pattern.match(line).group('flag')
126147
flags.append(flag)

resolve_march_native/test/test_target_help_parser.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,14 @@ def test_disabled_m_lines(self):
487487
self.assertEqual(_parse_gcc_output(' -mavx [disabled]'),
488488
['-mno-avx'])
489489

490+
def test_assign_no_lines(self):
491+
self.assertEqual(_parse_gcc_output(' -misel=no \t\t'),
492+
['-mno-isel'])
493+
494+
def test_assign_yes_lines(self):
495+
self.assertEqual(_parse_gcc_output(' -misel=yes \t\t'),
496+
['-misel'])
497+
490498
def test_upper_value_lines(self):
491499
self.assertEqual(_parse_gcc_output(' -mipsN \t\t1'),
492500
['-mips1'])

0 commit comments

Comments
 (0)