diff options
Diffstat (limited to 'llvm/utils/UpdateTestChecks/common.py')
-rw-r--r-- | llvm/utils/UpdateTestChecks/common.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/llvm/utils/UpdateTestChecks/common.py b/llvm/utils/UpdateTestChecks/common.py index e1cc02e..1a875c2 100644 --- a/llvm/utils/UpdateTestChecks/common.py +++ b/llvm/utils/UpdateTestChecks/common.py @@ -557,6 +557,10 @@ UTC_ADVERT = "NOTE: Assertions have been autogenerated by " UTC_AVOID = "NOTE: Do not autogenerate" UNUSED_NOTE = "NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:" +DATA_LAYOUT_RE = re.compile( + r"target\s+datalayout\s+=\s+\"(?P<layout>.+)\"$", flags=(re.M | re.S) +) + OPT_FUNCTION_RE = re.compile( r"^(\s*;\s*Function\sAttrs:\s(?P<attrs>[\w\s():,]+?))?\s*define\s+(?P<funcdef_attrs_and_ret>[^@]*)@(?P<func>[\w.$-]+?)\s*" r"(?P<args_and_sig>\((\)|(.*?[\w.-]+?)\))[^{]*\{)\n(?P<body>.*?)^\}$", @@ -651,6 +655,18 @@ def get_triple_from_march(march): return "x86" +def get_globals_name_prefix(raw_tool_output): + m = DATA_LAYOUT_RE.search(raw_tool_output) + if not m: + return None + data_layout = m.group("layout") + idx = data_layout.find("m:") + if idx < 0: + return None + ch = data_layout[idx + 2] + return "_" if ch == "o" or ch == "x" else None + + def apply_filters(line, filters): has_filter = False for f in filters: |