diff options
author | Andrea Di Biagio <Andrea_DiBiagio@sn.scee.net> | 2018-04-09 16:39:52 +0000 |
---|---|---|
committer | Andrea Di Biagio <Andrea_DiBiagio@sn.scee.net> | 2018-04-09 16:39:52 +0000 |
commit | c65901282b22f92b34f933005f8b409d2e3651d3 (patch) | |
tree | 7de9813e350c7aabc477a13603e8b524ed78a8ca /llvm/docs/CommandGuide/llvm-mca.rst | |
parent | e753c52227306a4563e9d4dbd24136c3c7c7e922 (diff) | |
download | bcm5719-llvm-c65901282b22f92b34f933005f8b409d2e3651d3.tar.gz bcm5719-llvm-c65901282b22f92b34f933005f8b409d2e3651d3.zip |
[llvm-mca] Add the ability to mark regions of code for analysis (PR36875)
This patch teaches llvm-mca how to parse code comments in search for special
"markers" used to select regions of code.
Example:
# LLVM-MCA-BEGIN My Code Region
....
# LLVM-MCA-END
The MCAsmLexer now delegates to an object of class MCACommentParser (i.e. an
AsmCommentConsumer) the parsing of code comments to search for begin/end code
region markers.
A comment starting with substring "LLVM-MCA-BEGIN" marks the beginning of a new
region of code. A comment starting with substring "LLVM-MCA-END" marks the end
of the last region.
This implementation doesn't allow regions to overlap. Each region can have a
optional description; internally, each region is identified by a range of source
code locations (SMLoc).
MCInst objects are added to a region R only if the source location for the
MCInst is in the range of locations specified by R.
By default, the tool allocates an implicit "Default" code region which contains
every source location. See new tests llvm-mca-marker-*.s for a few examples.
A new Backend object is created for every region. So, the analysis is conducted
on every parsed code region. The final report is the union of the reports
generated for every code region. Note that empty regions are skipped.
Special "[#] Code Region - ..." strings are used in the report to mark the
portion which is specific to a code region only. For example, see
llvm-mca-markers-5.s.
Differential Revision: https://reviews.llvm.org/D45433
llvm-svn: 329590
Diffstat (limited to 'llvm/docs/CommandGuide/llvm-mca.rst')
-rw-r--r-- | llvm/docs/CommandGuide/llvm-mca.rst | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/llvm/docs/CommandGuide/llvm-mca.rst b/llvm/docs/CommandGuide/llvm-mca.rst index b6efd4ec2dc..d669b37013d 100644 --- a/llvm/docs/CommandGuide/llvm-mca.rst +++ b/llvm/docs/CommandGuide/llvm-mca.rst @@ -25,6 +25,24 @@ Given an assembly code sequence, llvm-mca estimates the IPC (Instructions Per Cycle), as well as hardware resource pressure. The analysis and reporting style were inspired by the IACA tool from Intel. +:program:`llvm-mca` allows the usage of special code comments to mark regions of +the assembly code to be analyzed. A comment starting with substring +``LLVM-MCA-BEGIN`` marks the beginning of a code region. A comment starting with +substring ``LLVM-MCA-END`` marks the end of a code region. For example: + +.. code-block:: none + + # LLVM-MCA-BEGIN My Code Region + ... + # LLVM-MCA-END + +Multiple regions can be specified provided that they do not overlap. A code +region can have an optional description. If no user defined region is specified, +then :program:`llvm-mca` assumes a default region which contains every +instruction in the input file. Every region is analyzed in isolation, and the +final performance report is the union of all the reports generated for every +code region. + OPTIONS ------- |