1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 19:12:56 +02:00
llvm-mirror/tools
Andrea Di Biagio db9fd3fc9a [TableGen][SubtargetEmitter] Add the ability for processor models to describe dependency breaking instructions.
This patch adds the ability for processor models to describe dependency breaking
instructions.

Different processors may specify a different set of dependency-breaking
instructions.
That means, we cannot assume that all processors of the same target would use
the same rules to classify dependency breaking instructions.

The main goal of this patch is to provide the means to describe dependency
breaking instructions directly via tablegen, and have the following
TargetSubtargetInfo hooks redefined in overrides by tabegen'd
XXXGenSubtargetInfo classes (here, XXX is a Target name).

```
virtual bool isZeroIdiom(const MachineInstr *MI, APInt &Mask) const {
  return false;
}

virtual bool isDependencyBreaking(const MachineInstr *MI, APInt &Mask) const {
  return isZeroIdiom(MI);
}
```

An instruction MI is a dependency-breaking instruction if a call to method
isDependencyBreaking(MI) on the STI (TargetSubtargetInfo object) evaluates to
true. Similarly, an instruction MI is a special case of zero-idiom dependency
breaking instruction if a call to STI.isZeroIdiom(MI) returns true.
The extra APInt is used for those targets that may want to select which machine
operands have their dependency broken (see comments in code).
Note that by default, subtargets don't know about the existence of
dependency-breaking. In the absence of external information, those method calls
would always return false.

A new tablegen class named STIPredicate has been added by this patch to let
processor models classify instructions that have properties in common. The idea
is that, a MCInstrPredicate definition can be used to "generate" an instruction
equivalence class, with the idea that instructions of a same class all have a
property in common.

STIPredicate definitions are essentially a collection of instruction equivalence
classes.
Also, different processor models can specify a different variant of the same
STIPredicate with different rules (i.e. predicates) to classify instructions.
Tablegen backends (in this particular case, the SubtargetEmitter) will be able
to process STIPredicate definitions, and automatically generate functions in
XXXGenSubtargetInfo.

This patch introduces two special kind of STIPredicate classes named
IsZeroIdiomFunction and IsDepBreakingFunction in tablegen. It also adds a
definition for those in the BtVer2 scheduling model only.

This patch supersedes the one committed at r338372 (phabricator review: D49310).

The main advantages are:
 - We can describe subtarget predicates via tablegen using STIPredicates.
 - We can describe zero-idioms / dep-breaking instructions directly via
   tablegen in the scheduling models.

In future, the STIPredicates framework can be used for solving other problems.
Examples of future developments are:
 - Teach how to identify optimizable register-register moves
 - Teach how to identify slow LEA instructions (each subtarget defining its own
   concept of "slow" LEA).
 - Teach how to identify instructions that have undocumented false dependencies
   on the output registers on some processors only.

It is also (in my opinion) an elegant way to expose knowledge to both external
tools like llvm-mca, and codegen passes.
For example, machine schedulers in LLVM could reuse that information when
internally constructing the data dependency graph for a code region.

This new design feature is also an "opt-in" feature. Processor models don't have
to use the new STIPredicates. It has all been designed to be as unintrusive as
possible.

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

llvm-svn: 342555
2018-09-19 15:57:45 +00:00
..
bugpoint [bugpoint] Revert r318459 2018-09-18 18:39:27 +00:00
bugpoint-passes
dsymutil Revert "[DWARF] reposting r342048, which was reverted in r342056 due to buildbot errors. Adjusted 2 test cases for ARM and darwin and fixed a bug with the original change in dsymutil." 2018-09-17 15:40:01 +00:00
gold [gold] -thinlto-object-suffix-replace: don't append new suffix if path does not end with old suffix 2018-08-22 02:11:36 +00:00
llc [llc] Fix sanitizer failure. 2018-06-23 19:04:10 +00:00
lli [ORC] Simplify LLJIT::Create by removing the ExecutionSession parameter. 2018-09-10 22:08:57 +00:00
llvm-ar [llvm-ar] Move a variable declaration closer to where it is needed. NFC. 2018-09-06 19:03:24 +00:00
llvm-as [ThinLTO] Parse module summary index from assembly 2018-06-26 13:56:49 +00:00
llvm-as-fuzzer make add_llvm_fuzzer calls slightly more consisten with other cmake 2018-05-11 17:58:52 +00:00
llvm-bcanalyzer [ADT] Replace std::isprint by llvm::isPrint. 2018-07-26 15:31:41 +00:00
llvm-c-test [LLVM-C] Add Bindings For Named Metadata 2018-08-30 17:09:43 +00:00
llvm-cat
llvm-cfi-verify Revert r342148 (and follow-on fix attempts r342154, r342180, r342182, r342193) 2018-09-15 19:04:27 +00:00
llvm-config [llvm-config] Use WithColor for printing errors. 2018-06-23 16:50:09 +00:00
llvm-cov [llvm-cov] Delete custom JSON serialization code (NFC) 2018-09-12 21:59:38 +00:00
llvm-cvtres [llvm-cvtres] Allow parameters preceded by '-' in addition to '/' 2018-05-02 21:15:13 +00:00
llvm-cxxdump Fixing a typo; NFC. 2018-07-23 18:09:43 +00:00
llvm-cxxfilt Define InitLLVM to do common initialization all at once. 2018-04-13 18:26:06 +00:00
llvm-cxxmap Add flag to llvm-profdata to allow symbols in profile data to be remapped, and 2018-09-13 20:22:02 +00:00
llvm-demangle-fuzzer make add_llvm_fuzzer calls slightly more consisten with other cmake 2018-05-11 17:58:52 +00:00
llvm-diff Let llvm-diff correctly deal with Undef/ConstantAggregateZero/ConstantVector/IndirectBr 2018-04-12 21:28:04 +00:00
llvm-dis [ThinLTO] Print module summary index to assembly 2018-05-26 02:34:13 +00:00
llvm-dwarfdump [DebugInfo/DWARF] Remove redundant iterator type. NFC 2018-08-02 19:29:38 +00:00
llvm-dwp Reland rL341509: "[llvm-dwp] Use buffer_stream if output file is not seekable (e.g. "-")" 2018-09-06 20:26:54 +00:00
llvm-exegesis Revert rL342465: Added function to set a register to a particular value + tests. 2018-09-18 15:38:16 +00:00
llvm-extract Define InitLLVM to do common initialization all at once. 2018-04-13 18:26:06 +00:00
llvm-go [bindings/go] Add coroutine passes 2018-08-19 23:40:05 +00:00
llvm-isel-fuzzer CodeGen: Add a dwo output file argument to addPassesToEmitFile and hook it up to dwo output. 2018-05-21 20:16:41 +00:00
llvm-jitlistener Define InitLLVM to do common initialization all at once. 2018-04-13 18:26:06 +00:00
llvm-link Restore "[ThinLTO] Ensure we always select the same function copy to import" 2018-07-16 15:30:27 +00:00
llvm-lto Reland r342233: [ThinLTO] Allow setting of maximum cache size with 64-bit number 2018-09-17 10:21:26 +00:00
llvm-lto2 [LTO] Allow pass remarks with hotness to be set when emitting to stderr 2018-05-04 23:59:34 +00:00
llvm-mc [ADT] Normalize empty triple components 2018-08-08 22:23:57 +00:00
llvm-mc-assemble-fuzzer [llvm-mc-assemble-fuzzer] Update API - Pass MCObjectWriter instead of a stream 2018-08-17 04:38:41 +00:00
llvm-mc-disassemble-fuzzer make add_llvm_fuzzer calls slightly more consisten with other cmake 2018-05-11 17:58:52 +00:00
llvm-mca [TableGen][SubtargetEmitter] Add the ability for processor models to describe dependency breaking instructions. 2018-09-19 15:57:45 +00:00
llvm-modextract
llvm-mt [llvm-mt] Use WithColor for printing errors. 2018-06-23 16:49:07 +00:00
llvm-nm nm: Add -no-weak flag for hiding weak symbols 2018-07-02 17:24:37 +00:00
llvm-objcopy [llvm-objcopy] Add missing alias for --strip-all-gnu 2018-09-17 09:45:12 +00:00
llvm-objdump [llvm-objdump] Keep the memory buffer from the dSYM alive when using -g -dsym 2018-08-31 13:10:54 +00:00
llvm-opt-fuzzer make add_llvm_fuzzer calls slightly more consisten with other cmake 2018-05-11 17:58:52 +00:00
llvm-opt-report Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
llvm-pdbutil [PDB] Better support for enumerating pointer types. 2018-09-18 16:35:05 +00:00
llvm-profdata Add flag to llvm-profdata to allow symbols in profile data to be remapped, and 2018-09-13 20:22:02 +00:00
llvm-rc [FileSystem] Split up the OpenFlags enumeration. 2018-06-07 19:58:58 +00:00
llvm-readobj [llvm-readobj] Make some commonly used short options visibile in -help 2018-09-15 21:27:46 +00:00
llvm-rtdyld Define InitLLVM to do common initialization all at once. 2018-04-13 18:26:06 +00:00
llvm-shlib [RFC] Build LLVM-C.dll on MSVC that exports only the C API 2018-08-07 15:54:50 +00:00
llvm-size [llvm-size] Make global variables static 2018-06-22 22:20:10 +00:00
llvm-special-case-list-fuzzer make add_llvm_fuzzer calls slightly more consisten with other cmake 2018-05-11 17:58:52 +00:00
llvm-split
llvm-stress
llvm-strings Define InitLLVM to do common initialization all at once. 2018-04-13 18:26:06 +00:00
llvm-symbolizer [llvm-symbolizer] Simplify 2018-05-26 02:29:14 +00:00
llvm-undname [llvm-undname Add an option to dump back references. 2018-08-01 18:33:04 +00:00
llvm-xray [Xray] llvm-xray fix possible segfault 2018-09-18 10:31:10 +00:00
llvm-yaml-numeric-parser-fuzzer Use LLVM_BUILTIN_TRAP not __builtin_trap to appease windows builds. NFCI. 2018-08-20 09:49:20 +00:00
lto Reland r342233: [ThinLTO] Allow setting of maximum cache size with 64-bit number 2018-09-17 10:21:26 +00:00
msbuild Update Visual Studio Integration version number. 2018-08-29 16:57:37 +00:00
obj2yaml [WebAssembly] clang-format (NFC) 2018-09-05 01:27:38 +00:00
opt [Debugify] Export per-pass debug info loss statistics 2018-07-24 00:41:29 +00:00
opt-viewer [opt-viewer] Kill parser processes before moving onto rendering 2018-02-26 21:15:51 +00:00
sancov Rename sancov.cc to sancov.cpp 2018-04-25 18:06:23 +00:00
sanstats
verify-uselistorder Rename DEBUG macro to LLVM_DEBUG. 2018-05-14 12:53:11 +00:00
xcode-toolchain Revert "[CMake] Use LLVM_ENABLE_IDE instead of CMAKE_CONFIGURATION_TYPES" 2018-08-30 09:32:09 +00:00
yaml2obj [WebAssembly] clang-format (NFC) 2018-09-05 01:27:38 +00:00
CMakeLists.txt [RFC] Build LLVM-C.dll on MSVC that exports only the C API 2018-08-07 15:54:50 +00:00
LLVMBuild.txt Add a Microsoft Demangler. 2018-07-20 17:27:48 +00:00