blob: 927de9b4a4e1849283296b356952fd17cf75eb14 [file] [log] [blame]
Andrea Di Biagio3a6b0922018-03-08 13:05:02 +00001llvm-mca - LLVM Machine Code Analyzer
2=====================================
3
4SYNOPSIS
5--------
6
7:program:`llvm-mca` [*options*] [input]
8
9DESCRIPTION
10-----------
11
12:program:`llvm-mca` is a performance analysis tool that uses information
13available in LLVM (e.g. scheduling models) to statically measure the performance
14of machine code in a specific CPU.
15
16Performance is measured in terms of throughput as well as processor resource
17consumption. The tool currently works for processors with an out-of-order
18backend, for which there is a scheduling model available in LLVM.
19
20The main goal of this tool is not just to predict the performance of the code
21when run on the target, but also help with diagnosing potential performance
22issues.
23
24Given an assembly code sequence, llvm-mca estimates the IPC (Instructions Per
25Cycle), as well as hardware resource pressure. The analysis and reporting style
26were inspired by the IACA tool from Intel.
27
28OPTIONS
29-------
30
31If ``input`` is "``-``" or omitted, :program:`llvm-mca` reads from standard
32input. Otherwise, it will read from the specified filename.
33
34If the :option:`-o` option is omitted, then :program:`llvm-mca` will send its output
35to standard output if the input is from standard input. If the :option:`-o`
36option specifies "``-``", then the output will also be sent to standard output.
37
38
39.. option:: -help
40
41 Print a summary of command line options.
42
43.. option:: -mtriple=<target triple>
44
45 Specify a target triple string.
46
47.. option:: -march=<arch>
48
49 Specify the architecture for which to analyze the code. It defaults to the
50 host default target.
51
52.. option:: -mcpu=<cpuname>
53
54 Specify the processor for whic to run the analysis.
55 By default this defaults to a "generic" processor. It is not autodetected to
56 the current architecture.
57
58.. option:: -output-asm-variant=<variant id>
59
60 Specify the output assembly variant for the report generated by the tool.
61 On x86, possible values are [0, 1]. A value of 0 (vic. 1) for this flag enables
62 the AT&T (vic. Intel) assembly format for the code printed out by the tool in
63 the analysis report.
64
65.. option:: -dispatch=<width>
66
67 Specify a different dispatch width for the processor. The dispatch width
68 defaults to the 'IssueWidth' specified by the processor scheduling model.
69 If width is zero, then the default dispatch width is used.
70
Andrea Di Biagio3a6b0922018-03-08 13:05:02 +000071.. option:: -register-file-size=<size>
72
73 Specify the size of the register file. When specified, this flag limits
74 how many temporary registers are available for register renaming purposes. By
75 default, the number of temporary registers is unlimited. A value of zero for
76 this flag means "unlimited number of temporary registers".
77
78.. option:: -iterations=<number of iterations>
79
80 Specify the number of iterations to run. If this flag is set to 0, then the
81 tool sets the number of iterations to a default value (i.e. 70).
82
83.. option:: -noalias=<bool>
84
85 If set, the tool assumes that loads and stores don't alias. This is the
86 default behavior.
87
88.. option:: -lqueue=<load queue size>
89
90 Specify the size of the load queue in the load/store unit emulated by the tool.
91 By default, the tool assumes an unbound number of entries in the load queue.
92 A value of zero for this flag is ignored, and the default load queue size is
93 used instead.
94
95.. option:: -squeue=<store queue size>
96
97 Specify the size of the store queue in the load/store unit emulated by the
98 tool. By default, the tool assumes an unbound number of entries in the store
99 queue. A value of zero for this flag is ignored, and the default store queue
100 size is used instead.
101
102.. option:: -verbose
103
104 Enable verbose output. In particular, this flag enables a number of extra
105 statistics and performance counters for the dispatch logic, the reorder
106 buffer, the retire control unit and the register file.
107
108.. option:: -timeline
109
110 Enable the timeline view.
111
112.. option:: -timeline-max-iterations=<iterations>
113
114 Limit the number of iterations to print in the timeline view. By default, the
115 timeline view prints information for up to 10 iterations.
116
117.. option:: -timeline-max-cycles=<cycles>
118
119 Limit the number of cycles in the timeline view. By default, the number of
120 cycles is set to 80.
121
Andrea Di Biagio1feccc22018-03-26 13:21:48 +0000122.. option:: -resource-pressure
123
124 Enable the resource pressure view. This is enabled by default.
125
Andrea Di Biagio8dabf4f2018-04-03 16:46:23 +0000126.. option:: -register-file-stats
127
128 Enable register file usage statistics.
129
Andrea Di Biagioff9c1092018-03-26 13:44:54 +0000130.. option:: -instruction-info
131
132 Enable the instruction info view. This is enabled by default.
133
Andrea Di Biagiod1569292018-03-26 12:04:53 +0000134.. option:: -instruction-tables
135
136 Prints resource pressure information based on the static information
137 available from the processor model. This differs from the resource pressure
138 view because it doesn't require that the code is simulated. It instead prints
139 the theoretical uniform distribution of resource pressure for every
140 instruction in sequence.
141
Andrea Di Biagio3a6b0922018-03-08 13:05:02 +0000142
143EXIT STATUS
144-----------
145
146:program:`llvm-mca` returns 0 on success. Otherwise, an error message is printed
147to standard error, and the tool returns 1.
148