1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00
llvm-mirror/utils
Quentin Colombet f669347b0d [TableGen][GlobalISel] Optimize MatchTable for faster instruction selection
*** Context ***

Prior to this patchw, the table generated for matching instruction was
straight forward but highly inefficient.

Basically, each pattern generates its own set of self contained checks
and actions.
E.g., TableGen generated:
// First pattern
CheckNumOperand 3
CheckOpcode G_ADD
...
Build ADDrr
// Second pattern
CheckNumOperand 3
CheckOpcode G_ADD
...
Build ADDri
// Third pattern
CheckNumOperand 3
CheckOpcode G_SUB
...
Build SUBrr

*** Problem ***

Because of that generation, a *lot* of check were redundant between each
pattern and were checked every single time until we reach the pattern
that matches.
E.g., Taking the previous table, let say we are matching a G_SUB, that
means we were going to check all the rules for G_ADD before looking at
the G_SUB rule. In particular we are going to do:
check 3 operands; PASS
check G_ADD; FAIL
; Next rule
check 3 operands; PASS (but we already knew that!)
check G_ADD; FAIL (well it is still not true)
; Next rule
check 3 operands; PASS (really!!)
check G_SUB; PASS (at last :P)

*** Proposed Solution ***

This patch introduces a concept of group of rules (GroupMatcher) that
share some predicates and only get checked once for the whole group.

This patch only creates groups with one nesting level. Conceptually
there is nothing preventing us for having deeper nest level. However,
the current implementation is not smart enough to share the recording
(aka capturing) of values. That limits its ability to do more sharing.

For the given example the current patch will generate:
// First group
CheckOpcode G_ADD

 // First pattern
 CheckNumOperand 3
 ...
 Build ADDrr
 // Second pattern
 CheckNumOperand 3
 ...
 Build ADDri

// Second group
CheckOpcode G_SUB

 // Third pattern
 CheckNumOperand 3
 ...
 Build SUBrr

But if we allowed several nesting level, it could create a sub group
for the checknumoperand 3.
(We would need to call optimizeRules on the rules within a group.)

*** Result ***

With only one level of nesting, the instruction selection pass is up
to 4x faster. For instance, one instruction now takes 500 checks,
instead of 24k! With more nesting we could get in the tens I believe.

Differential Revision: https://reviews.llvm.org/D39034

rdar://problem/34670699

llvm-svn: 321017
2017-12-18 19:47:41 +00:00
..
bugpoint
count Remove autoconf support 2016-01-26 21:29:08 +00:00
crosstool
docker Added optional validation of svn sources to Dockerfiles. 2017-09-15 13:35:54 +00:00
emacs Cleaning up LLVM IR mode for Emacs. 2015-09-10 13:44:28 +00:00
FileCheck [CMake] Use PRIVATE in target_link_libraries for executables 2017-12-05 21:49:56 +00:00
fpcmp Remove autoconf support 2016-01-26 21:29:08 +00:00
gdb-scripts Make the Twine pretty-printer work with GDB 7.11 2017-06-04 03:27:12 +00:00
git
git-svn [git] Update the llvm git helper script to work correctly with the 2017-09-16 02:13:35 +00:00
jedit Rename all references to old mailing lists to new lists.llvm.org address. 2015-08-05 03:51:17 +00:00
kate Rename all references to old mailing lists to new lists.llvm.org address. 2015-08-05 03:51:17 +00:00
KillTheDoctor KillTheDoctor.cpp: Appease cases on case-senstitive host, like mingw on linux. 2016-12-23 01:39:26 +00:00
lint
lit Disable detect_leaks in the ASanified build of LLVM when using Apple LLVM. The released Apple LLVM versions don't support LSan. 2017-12-05 05:22:02 +00:00
llvm-build llvm-config: Add preliminary Windows support 2016-02-09 19:41:14 +00:00
llvm-lit [lit] Actually do normalize the case of files in the config map. 2017-09-21 21:27:11 +00:00
LLVMVisualizers Improve natvis for llvm::SmallString so that it correctly displays only the valid portion of the string 2016-12-21 01:05:29 +00:00
Misc Delete mergefunctions.clang.svn.patch 2016-04-12 19:44:40 +00:00
not [CMake] Use PRIVATE in target_link_libraries for executables 2017-12-05 21:49:56 +00:00
PerfectShuffle Remove autoconf support 2016-01-26 21:29:08 +00:00
release merge-request.sh: Update to use new "Fixed by Commit(s)" field 2017-09-15 02:25:22 +00:00
sanitizers Add libstd++-4.8 exceptions to ubsan_blacklist.txt 2017-11-29 20:10:14 +00:00
TableGen [TableGen][GlobalISel] Optimize MatchTable for faster instruction selection 2017-12-18 19:47:41 +00:00
Target/ARM
testgen
textmate
unittest Force #define GTEST_LANG_CXX11. 2017-10-27 21:12:28 +00:00
valgrind
vim Add strictfp attribute to prevent unwanted optimizations of libm calls 2017-08-14 21:15:13 +00:00
vscode Adding VSCode syntax colorizer to utils (generated from textmate colorizer). 2017-05-09 17:13:37 +00:00
yaml-bench [CMake] Use PRIVATE in target_link_libraries for executables 2017-12-05 21:49:56 +00:00
abtest.py AsmPrinter: mark the beginning and the end of a function in verbose mode 2017-05-23 21:22:16 +00:00
bisect
bisect-skip-count Fix bug in bisect-skip-count not using passed-in arguments 2017-03-04 03:23:41 +00:00
check-each-file
clang-parse-diagnostics-file
codegen-diff
countloc.sh
create_ladder_graph.py
DSAclean.py
DSAextract.py
extract_symbols.py Handle non-inlined clang::Type::getAs specializations in extract_symbols.py 2016-11-14 17:07:09 +00:00
findmisopt
findoptdiff Remove the ScalarReplAggregates pass 2016-06-15 00:19:09 +00:00
findsym.pl
GenLibDeps.pl Remove bit-rotten CppBackend. 2016-05-05 14:35:40 +00:00
GetRepositoryPath
GetSourceVersion
getsrcs.sh
lldbDataFormatters.py utils: Teach lldbDataFormatters about llvm::Optional 2015-02-20 02:55:22 +00:00
llvm-compilers-check
llvm-gisel-cov.py [globalisel][tablegen] Generate rule coverage and use it to identify untested rules 2017-11-16 00:46:35 +00:00
llvm-native-gxx
llvm.grm
LLVMBuild.txt
llvmdo Remove CVS artifacts. 2010-08-04 16:11:24 +00:00
llvmgrep
makellvm
prepare-code-coverage-artifact.py [utils] coverage: Add help text about the --restrict flag (NFC) 2017-02-09 19:37:18 +00:00
schedcover.py [MISched] Python script to check coverage of misched info 2015-10-12 08:50:47 +00:00
shuffle_fuzz.py [Utils] Updated shuffle fuzz script to generate more modern (valid) IR. 2015-11-22 16:04:32 +00:00
shuffle_select_fuzz_tester.py Adding a shufflevector and select LLVM IR instructions fuzz tool 2017-10-31 11:39:31 +00:00
sort_includes.py
update_llc_test_checks.py Add more triples to llc_test_checks.py 2017-12-01 14:27:11 +00:00
update_mir_test_checks.py update_mir_test_checks: Be careful about replacing entire vregs 2017-11-06 21:06:09 +00:00
update_test_checks.py [utils] remove ability to generate llc check lines from update_test_checks.py 2017-06-12 17:44:30 +00:00
UpdateCMakeLists.pl
wciia.py