5 if sys
.version_info
[0] > 2:
8 expandtabs
= str.expandtabs
13 # Support of isel debug checks
14 # RegEx: this is where the magic happens.
18 # TODO: add function prefix
19 ISEL_FUNCTION_DEFAULT_RE
= re
.compile(
20 r
"Selected[\s]*selection[\s]*DAG:[\s]*%bb.0[\s]*\'(?P<func>.*?):[^\']*\'*\n"
22 r
"Total[\s]*amount[\s]*of[\s]*phi[\s]*nodes[\s]*to[\s]*update:[\s]*[0-9]+",
27 def scrub_isel_default(isel
, args
):
28 # Scrub runs of whitespace out of the iSel debug output, but leave the leading
29 # whitespace in place.
30 isel
= common
.SCRUB_WHITESPACE_RE
.sub(r
" ", isel
)
31 # Expand the tabs used for indentation.
32 isel
= string
.expandtabs(isel
, 2)
33 # Strip trailing whitespace.
34 isel
= common
.SCRUB_TRAILING_WHITESPACE_RE
.sub(r
"", isel
)
38 def get_run_handler(triple
):
42 for prefix
, s
in target_handlers
.items():
43 if triple
.startswith(prefix
) and len(prefix
) > len(best_prefix
):
48 common
.debug("Using default handler.")
49 handler
= (scrub_isel_default
, ISEL_FUNCTION_DEFAULT_RE
)
54 ##### Generator of iSel CHECK lines
63 global_vars_seen_dict
,
66 # Label format is based on iSel string.
67 check_label_format
= "{} %s-LABEL: %s%s%s%s".format(comment_marker
)
68 return common
.add_checks(
78 global_vars_seen_dict
,
79 is_filtered
=is_filtered
,