| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
import sys |
| 6 |
|
| 7 |
if len(sys.argv) == 1: |
| 8 |
print("Syntax: %s <GenInstrInfo.inc>" %sys.argv[0]) |
| 9 |
sys.exit(1) |
| 10 |
|
| 11 |
|
| 12 |
count = 0 |
| 13 |
last_line = None |
| 14 |
|
| 15 |
f = open(sys.argv[1]) |
| 16 |
lines = f.readlines() |
| 17 |
f.close() |
| 18 |
|
| 19 |
|
| 20 |
for line in lines: |
| 21 |
line = line.rstrip() |
| 22 |
|
| 23 |
|
| 24 |
if 'static const MCPhysReg ' in line: |
| 25 |
continue |
| 26 |
|
| 27 |
|
| 28 |
if 'static const MCOperandInfo ' in line: |
| 29 |
continue |
| 30 |
|
| 31 |
|
| 32 |
if 'static inline void InitX86MCInstrInfo' in line: |
| 33 |
continue |
| 34 |
|
| 35 |
if 'II->InitMCInstrInfo' in line: |
| 36 |
last_line = line |
| 37 |
continue |
| 38 |
|
| 39 |
|
| 40 |
if last_line: |
| 41 |
last_line = None |
| 42 |
continue |
| 43 |
|
| 44 |
|
| 45 |
if 'extern const MCInstrDesc ' in line: |
| 46 |
count += 1 |
| 47 |
continue |
| 48 |
|
| 49 |
if count == 1: |
| 50 |
if line == '};': |
| 51 |
|
| 52 |
count += 1 |
| 53 |
continue |
| 54 |
else: |
| 55 |
print(line) |