| # Copyright 2023 The IREE Authors |
| # Licensed under the Apache License v2.0 with LLVM Exceptions. |
| # See https://llvm.org/LICENSE.txt for license information. |
| # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| """Strip LLVM IR of target triple and target-specific attributes |
| sys.stdout.write(f"; Processed by {os.path.basename(__file__)}\n") |
| target_triple_regex = re.compile(r'^\s*target triple\s*=\s*"[^"]*"') |
| target_cpu_regex = re.compile(r'"target-cpu"="[^"]*"') |
| target_features_regex = re.compile(r'"target-features"="[^"]*"') |
| tune_cpu_regex = re.compile(r'"tune-cpu"="[^"]*"') |
| if re.match(target_triple_regex, line): |
| line = re.sub(target_cpu_regex, '', line) |
| line = re.sub(target_features_regex, '', line) |
| line = re.sub(tune_cpu_regex, '', line) |
| if __name__ == "__main__": |