()
| 435 | # in sublime to merge lines |
| 436 | |
| 437 | def main(): |
| 438 | src = open('GCNInstructions.cpp') |
| 439 | |
| 440 | op_list = [] |
| 441 | pat = re.compile('\{.*\}') |
| 442 | for line in src.readlines(): |
| 443 | line = line.rstrip('\n') |
| 444 | if not line: |
| 445 | continue |
| 446 | m = pat.search(line) |
| 447 | if not m: |
| 448 | continue |
| 449 | |
| 450 | line = line.replace('{', '').replace('}', '') |
| 451 | parts = line.split(',') |
| 452 | parts = [x.strip() for x in parts if x] |
| 453 | |
| 454 | opcode = parts[0].replace('"', '').upper() |
| 455 | encoding = parts[1] |
| 456 | |
| 457 | if encoding == 'GCNENC_VOP3A' or encoding == 'GCNENC_VOP3B': |
| 458 | encoding = 'GCNENC_VOP3' |
| 459 | |
| 460 | mode = parts[2] |
| 461 | value_str = parts[3] |
| 462 | if 'x' in value_str: |
| 463 | op_value = int(parts[3], 16) |
| 464 | else: |
| 465 | op_value = int(parts[3]) |
| 466 | |
| 467 | arch = parts[4] |
| 468 | arch_mask = ArchDic[arch] |
| 469 | if not (arch_mask & ARCH_SEA_ISLANDS): |
| 470 | continue |
| 471 | |
| 472 | op_list.append((opcode.upper(), encoding, mode, op_value)) |
| 473 | |
| 474 | src.close() |
| 475 | |
| 476 | ParseInstDefs('GCNInstructionDefs.cpp') |
| 477 | ProcessOpcodes(op_list) |
| 478 | |
| 479 | |
| 480 | if __name__ == '__main__': |
no test coverage detected