OLD | NEW |
(Empty) | |
| 1 #!/usr/bin/python |
| 2 # |
| 3 # Copyright 2012 The Native Client Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can |
| 5 # be found in the LICENSE file. |
| 6 # Copyright 2012, Google Inc. |
| 7 # |
| 8 |
| 9 """Decoder Generator script. |
| 10 |
| 11 Usage: generate-decoder.py <table-file> <output-cc-file> |
| 12 """ |
| 13 |
| 14 # TODO(petarj): This was copied from the old ARM decoder tablegen. |
| 15 # Once the changes on that tablegen are stable, this will be rewritten to use |
| 16 # the new tablegen. |
| 17 |
| 18 import sys |
| 19 import dgen_input |
| 20 import dgen_output |
| 21 |
| 22 def main(argv): |
| 23 table_filename, output_filename = argv[1], argv[2] |
| 24 |
| 25 print "Decoder Generator reading ", table_filename |
| 26 f = open(table_filename, 'r') |
| 27 tables = dgen_input.parse_tables(f) |
| 28 f.close() |
| 29 |
| 30 print "Successful - got %d tables." % len(tables) |
| 31 |
| 32 print "Generating output to %s..." % output_filename |
| 33 f = open(output_filename, 'w') |
| 34 dgen_output.generate_decoder(tables, |
| 35 dgen_output.COutput(f)) |
| 36 f.close() |
| 37 print "Completed." |
| 38 |
| 39 return 0 |
| 40 |
| 41 if __name__ == '__main__': |
| 42 sys.exit(main(sys.argv)) |
OLD | NEW |