| 106 | print("Usage: {} <path-to-spirv-diff>".format(sys.argv[0])) |
| 107 | |
| 108 | def remove_debug_info(in_path): |
| 109 | tmp_dir = '.no_dbg' |
| 110 | |
| 111 | if not os.path.exists(tmp_dir): |
| 112 | os.makedirs(tmp_dir) |
| 113 | |
| 114 | (in_basename, in_ext) = os.path.splitext(in_path) |
| 115 | out_name = in_basename + '_no_dbg' + in_ext |
| 116 | out_path = os.path.join(tmp_dir, out_name) |
| 117 | |
| 118 | with open(in_path, 'r') as fin: |
| 119 | with open(out_path, 'w') as fout: |
| 120 | for line in fin: |
| 121 | ops = line.strip().split() |
| 122 | op = ops[0] if len(ops) > 0 else '' |
| 123 | if (op != ';;' and op != 'OpName' and op != 'OpMemberName' and op != 'OpString' and |
| 124 | op != 'OpLine' and op != 'OpNoLine' and op != 'OpModuleProcessed'): |
| 125 | fout.write(line) |
| 126 | |
| 127 | return out_path |
| 128 | |
| 129 | def make_src_file(test_name): |
| 130 | return '{}_src.spvasm'.format(test_name) |