Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(56)

Side by Side Diff: src/trusted/validator_arm/generate_decoder.py

Issue 12095039: Add testing of generated (ARM) baseline decoders using hand-written decoders. (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client/
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # 2 #
3 # Copyright 2012 The Native Client Authors. All rights reserved. 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 4 # Use of this source code is governed by a BSD-style license that can
5 # be found in the LICENSE file. 5 # be found in the LICENSE file.
6 # 6 #
7 7
8 """Decoder Generator script. 8 """Decoder Generator script.
9 9
10 Usage: generate-decoder.py <table-file> <output-cc-file> <decoder-name> \ 10 Usage: generate-decoder.py <table-file> <output-cc-file> <decoder-name> \
11 <options> 11 <options>
12 12
13 Options include: 13 Options include:
14 14
15 --add_rule_patterns=bool - If bool='True', rule patterns are added (default). 15 --add_rule_patterns=bool - If bool='True', rule patterns are added (default).
16 If =bool is omitted, 'True' is assumped. Legal values for bool is 16 If =bool is omitted, 'True' is assumped. Legal values for bool is
17 'True' and 'False'. 17 'True' and 'False'.
18 --table_remove=name - Remove table 'name' from decoder. May be repeated. 18 --table_remove=name - Remove table 'name' from decoder. May be repeated.
19 --auto-actual=name - Install automatically generated actuals into the 19 --auto-actual=name - Install automatically generated actuals into the
20 decoder table with the given name. May be repeated. 20 decoder table with the given name. May be repeated.
21 --auto-actual-sep=name - Use as separator to split up automatically 21 --auto-actual-sep=name - Use as separator to split up automatically
22 generated actual classes. 22 generated actual classes.
23 --auto-baseline-sep=name - Use as separator to split up automatically 23 --auto-baseline-sep=name - Use as separator to split up automatically
24 generated baseline classes. 24 generated baseline classes.
25 --test-base=name - Test automatically genererated baseline for the
26 decoder table with the given name. May be repeated.
25 27
26 name - Only generate tests for table 'name'. May be repeated. 28 name - Only generate tests for table 'name'. May be repeated.
27 29
28 Note: If the file ends with named.{h,cc}, it is assumed that one should 30 Note: If the file ends with named.{h,cc}, it is assumed that one should
29 build the corresponding source file for named classes, so that testing 31 build the corresponding source file for named classes, so that testing
30 is easier to perform. In either case, the .h file will declare a decoder 32 is easier to perform. In either case, the .h file will declare a decoder
31 state (with the given decoder name) to decode instructions, while the 33 state (with the given decoder name) to decode instructions, while the
32 .cc file will define the methods for the declared decoder state. 34 .cc file will define the methods for the declared decoder state.
33 """ 35 """
34 36
(...skipping 21 matching lines...) Expand all
56 table_filename = argv[1] 58 table_filename = argv[1]
57 output_filename = argv[2] 59 output_filename = argv[2]
58 decoder_name = argv[3] 60 decoder_name = argv[3]
59 tables = None 61 tables = None
60 62
61 # Define default command line arguments. 63 # Define default command line arguments.
62 cl_args = {'add-rule-patterns': 'True', 64 cl_args = {'add-rule-patterns': 'True',
63 'auto-actual': [], 65 'auto-actual': [],
64 'auto-actual-sep': [], 66 'auto-actual-sep': [],
65 'auto-baseline-sep': [], 67 'auto-baseline-sep': [],
68 'test-base': [],
66 'table_remove': [], 69 'table_remove': [],
67 'table': [], 70 'table': [],
68 } 71 }
69 72
70 # Strip off remaining command line arguments and add. 73 # Strip off remaining command line arguments and add.
71 remaining_args = argv[4:] 74 remaining_args = argv[4:]
72 while remaining_args and remaining_args[0].startswith('--'): 75 while remaining_args and remaining_args[0].startswith('--'):
73 arg = remaining_args[0][len('--'):] 76 arg = remaining_args[0][len('--'):]
74 remaining_args.pop(0) 77 remaining_args.pop(0)
75 index = arg.find('=') 78 index = arg.find('=')
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 return False 194 return False
192 195
193 def _actual_suffix_in(name, format, cl_args): 196 def _actual_suffix_in(name, format, cl_args):
194 return _cl_arg_suffix_in(name, format, cl_args['auto-actual-sep']) 197 return _cl_arg_suffix_in(name, format, cl_args['auto-actual-sep'])
195 198
196 def _baseline_suffix_in(name, format, cl_args): 199 def _baseline_suffix_in(name, format, cl_args):
197 return _cl_arg_suffix_in(name, format, cl_args['auto-baseline-sep']) 200 return _cl_arg_suffix_in(name, format, cl_args['auto-baseline-sep'])
198 201
199 if __name__ == '__main__': 202 if __name__ == '__main__':
200 sys.exit(main(sys.argv)) 203 sys.exit(main(sys.argv))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698