Index: llvm/utils/llvm-mca-compare-multiple-files.py =================================================================== --- llvm/utils/llvm-mca-compare-multiple-files.py +++ llvm/utils/llvm-mca-compare-multiple-files.py @@ -26,23 +26,26 @@ # Parse the program arguments. def parse_program_args(parser): parser.add_argument('file_names', nargs = '+', type = str, help = 'Names of files which tool process.') - parser.add_argument('-mtriple', nargs = 1, type = str, action = 'store', default = ['x86_64-unknown-linux-gnu'], help = 'Target triple.') - parser.add_argument('-mcpu', nargs = 1, type = str, action = 'store', default = ['skylake'], help = 'Target a specific cpu type .') + parser.add_argument('-mtriple', nargs = 1, type = str, action = 'store', metavar='[=]', default = ['x86_64-unknown-linux-gnu'], help = 'Target triple.') + parser.add_argument('-mcpu', nargs = 1, type = str, action = 'store', metavar='[=]', default = ['skylake'], help = 'Target a specific cpu type.') parser.add_argument('-diff', action = 'store_true', default = False, help = 'Prints the difference of statistics for multiple input assembler files.') - parser.add_argument('-iterations', type = int, nargs = 1, action = 'store', default = [100], help = 'Number of iterations to run.') - parser.add_argument('-useMca', nargs = 1, type = str, action = 'store', help = 'Specified relative path to llvm-mca.') + parser.add_argument('-iterations', type = int, nargs = 1, action = 'store', metavar='[=N]', default = [100], help = 'Number of iterations to run.') + parser.add_argument('--llvm-mca-binary', nargs = 1, type = str, action = 'store', metavar='[=]', help = 'Specified relative path to binary of llvm-mca.') return parser.parse_args() # Verify that the program inputs meet the requirements. def verify_program_inputs(opts): if len(sys.argv) < 2 : - print ('error: Wrong number of arguments.') + print ('error: Wrong number of arguments. At least ' \ + 'you must specify the script name and an attached file.') return False if opts.diff and len(opts.file_names) < 2: - print ('error: Wrong number of input files.') + print ('error: Wrong number of input files. At least you ' \ + 'must specify two input files with the given diff option.') return False if not opts.diff and len(opts.file_names) > 1: - print ('error: Wrong number of input files.') + print ('error: Wrong number of input files. Without diff ' \ + 'option, you can attach only one file.') return False return True @@ -55,10 +58,10 @@ def llvmMcaStats (opts, FileName): # Get the directory of the LLVM tools. - if not opts.useMca: - llvm_mca_cmd = os.path.normpath(os.path.join(os.path.dirname(__file__), "../../../../build/bin/llvm-mca")) + if not opts.llvm_mca_binary: + llvm_mca_cmd = os.path.normpath(os.path.join(os.path.dirname(__file__), "../../../build/bin/llvm-mca")) else: - llvm_mca_cmd = opts.useMca[0] + llvm_mca_cmd = opts.llvm_mca_binary[0] # The statistics llvm-mca options. llvm_mca_stats_opt1 = "-mtriple=" + opts.mtriple[0] @@ -114,7 +117,7 @@ matrix[3][0] = "Dispatch Width: " matrix[4][0] = "uOps Per Cycle: " matrix[5][0] = "IPC: " - matrix[6][0] = "Block RThroughp: " + matrix[6][0] = "Block RThroughput: " for j in range (len(arrayOneFileStats)): matrix[0][j + 1] = str(arrayOneFileStats[j].Instructions)