[PATCH] D29678: [Tablegen/DAG Debug] - Instrumenting table gen DAGGenISelDAG to allow printing selected patterns(and their sources) during ISEL
Aditya Nandakumar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 7 13:07:29 PST 2017
aditya_nandakumar created this revision.
Herald added subscribers: igorb, mgorny, aemerson.
To help assist in debugging ISEL or to prioritize GlobalISel backend work, this patch adds two more tables to <Target>GenISelDAGISel.inc - one which contains the patterns that are used during selection (The text comment //Src and //Dst comment you see in MatcherTable for each of the MorphNode and EmitNode cases.
It adds another Tablegen OpcodeType called OPC_Coverage. We encode the offset of the pattern (in the table) with OPC_Coverage.
It also modifies the CheckComplexPattern to also print the ComplexPattern that returned true.
Sometimes, due to several layers of defm instantiations, to make it easier to identify where a particular pattern came from, the source locations have also been encoded in another table. This would get printed as
COMPLEX_PATTERN: SelectNegArithImmed
MORPHTO: (add:i32 GPR32:i32:$Rn, neg_addsub_shifted_imm32:i32:$imm) -> (SUBSWri:i32:i32 GPR32:i32:$Rn, neg_addsub_shifted_imm32:i32:$imm)
INCLUDED: /Volumes/Data/workspace/gpu/compiler_checkouts/open_source/llvm/lib/Target/AArch64/AArch64InstrInfo.td:659
.....
It's currently enabled through CMAKE variable DAG_PRINT_USED_ISEL_PATTERNS which passes a -instrument-coverage flag to table gen for emitting the *GenDAGISel.inc file.
This information can also be used (with a python script which greps/counts patterns) for building a test-suite(such as llvm-test-suite) and see which instructions/patterns need to be selected (say for global isel work prioritization) and can also print the tablegen emitted patterns that are unused during the compilation of the llvm-test-suite.
Looking forward to feedback.
Repository:
rL LLVM
https://reviews.llvm.org/D29678
Files:
CMakeLists.txt
include/llvm/CodeGen/SelectionDAGISel.h
lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
lib/Target/AArch64/CMakeLists.txt
utils/TableGen/DAGISelMatcherEmitter.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29678.87504.patch
Type: text/x-patch
Size: 11249 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170207/c7c1b2ed/attachment.bin>
More information about the llvm-commits
mailing list