llvm-project/llvm/test/tools
Andrea Di Biagio 6eebbe0a97 [tblgen][llvm-mca] Add the ability to describe move elimination candidates via tablegen.
This patch adds the ability to identify instructions that are "move elimination
candidates". It also allows scheduling models to describe processor register
files that allow move elimination.

A move elimination candidate is an instruction that can be eliminated at
register renaming stage.
Each subtarget can specify which instructions are move elimination candidates
with the help of tablegen class "IsOptimizableRegisterMove" (see
llvm/Target/TargetInstrPredicate.td).

For example, on X86, BtVer2 allows both GPR and MMX/SSE moves to be eliminated.
The definition of 'IsOptimizableRegisterMove' for BtVer2 looks like this:

```
def : IsOptimizableRegisterMove<[
  InstructionEquivalenceClass<[
    // GPR variants.
    MOV32rr, MOV64rr,

    // MMX variants.
    MMX_MOVQ64rr,

    // SSE variants.
    MOVAPSrr, MOVUPSrr,
    MOVAPDrr, MOVUPDrr,
    MOVDQArr, MOVDQUrr,

    // AVX variants.
    VMOVAPSrr, VMOVUPSrr,
    VMOVAPDrr, VMOVUPDrr,
    VMOVDQArr, VMOVDQUrr
  ], CheckNot<CheckSameRegOperand<0, 1>> >
]>;
```

Definitions of IsOptimizableRegisterMove from processor models of a same
Target are processed by the SubtargetEmitter to auto-generate a target-specific
override for each of the following predicate methods:

```
bool TargetSubtargetInfo::isOptimizableRegisterMove(const MachineInstr *MI)
const;
bool MCInstrAnalysis::isOptimizableRegisterMove(const MCInst &MI, unsigned
CPUID) const;
```

By default, those methods return false (i.e. conservatively assume that there
are no move elimination candidates).

Tablegen class RegisterFile has been extended with the following information:
 - The set of register classes that allow move elimination.
 - Maxium number of moves that can be eliminated every cycle.
 - Whether move elimination is restricted to moves from registers that are
   known to be zero.

This patch is structured in three part:

A first part (which is mostly boilerplate) adds the new
'isOptimizableRegisterMove' target hooks, and extends existing register file
descriptors in MC by introducing new fields to describe properties related to
move elimination.

A second part, uses the new tablegen constructs to describe move elimination in
the BtVer2 scheduling model.

A third part, teaches llm-mca how to query the new 'isOptimizableRegisterMove'
hook to mark instructions that are candidates for move elimination. It also
teaches class RegisterFile how to describe constraints on move elimination at
PRF granularity.

llvm-mca tests for btver2 show differences before/after this patch.

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

llvm-svn: 344334
2018-10-12 11:23:04 +00:00
..
dsymutil [dsymutil] Set LSan blacklist whenever sanitizers are enabled. 2018-09-24 13:56:36 +00:00
gold Change the timestamp of llvmcache-foo file to meet the thinLTO prune policy 2018-10-10 17:37:32 +00:00
llvm-ar [llvm-ar] Use POSIX-specified timestamps for 'tv'. 2018-10-05 23:25:39 +00:00
llvm-cfi-verify [cfi-verify] Support cross-DSO 2018-08-24 15:21:58 +00:00
llvm-config llvm-config: Add advapi32 to --system-libs on Windows (PR36372) 2018-02-23 12:20:26 +00:00
llvm-cov [gcov] Fix wrong line hit counts when multiple blocks are on the same line 2018-09-20 16:09:30 +00:00
llvm-cvtres [opt] Change the parameter of OptTable::PrintHelp from Name to Usage and don't append "[options] <inputs>" 2018-10-10 00:15:31 +00:00
llvm-cxxdump
llvm-cxxfilt Add test for demangling GNU ABI tags. 2018-03-22 22:04:32 +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-diff llvm-diff: Fix crash on anonymous functions 2018-09-24 04:42:13 +00:00
llvm-dlltool [COFF] Adjust how we flag weak externals 2018-07-20 20:48:29 +00:00
llvm-dwarfdump llvm-dwarfdump: Extend --name to also search DW_AT_linkage_name. 2018-10-09 20:51:33 +00:00
llvm-dwp [llvm-dwp] Clean up tests X86/*.test 2018-09-07 18:29:20 +00:00
llvm-exegesis [llvm-exegesis] Fix function return generation so it doesn't return register 0 2018-10-10 13:03:23 +00:00
llvm-extract BlockExtractor: Don’t delete functions directly 2018-03-12 22:28:18 +00:00
llvm-isel-fuzzer Revert r326710 "Fuzzer: remove temporary files after we're done with them." 2018-03-12 13:22:12 +00:00
llvm-lib Attempt to get test/tools/llvm-lib/help.test passing on sanitizer-x86_64-linux-fast 2018-07-14 11:33:33 +00:00
llvm-lit
llvm-lto [ThinLTO] Serialize WithGlobalValueDeadStripping index flag for distributed backends 2018-02-07 04:05:59 +00:00
llvm-lto2 Fix test by allowing it to accept an upper or lower case letter as the first character. 2018-04-20 15:23:57 +00:00
llvm-mc Replace unused output filenames with /dev/null in tests 2018-07-02 18:16:44 +00:00
llvm-mca [tblgen][llvm-mca] Add the ability to describe move elimination candidates via tablegen. 2018-10-12 11:23:04 +00:00
llvm-modextract
llvm-mt [llvm-mt] Use WithColor for printing errors. 2018-06-23 16:49:07 +00:00
llvm-nm [llvm-nm] Include the text "@FILE" in the output of --help 2018-10-11 06:53:38 +00:00
llvm-objcopy [llvm-objcopy] Add -F|--target compatibility 2018-10-12 00:36:01 +00:00
llvm-objdump Make malformed-machos.test pass on my Mac. 2018-09-11 14:10:33 +00:00
llvm-opt-fuzzer Revert r326710 "Fuzzer: remove temporary files after we're done with them." 2018-03-12 13:22:12 +00:00
llvm-opt-report
llvm-pdbdump [llvm-pdbutil] Add missing pdb for test 2018-10-11 22:25:55 +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 [opt] Change the parameter of OptTable::PrintHelp from Name to Usage and don't append "[options] <inputs>" 2018-10-10 00:15:31 +00:00
llvm-readobj [DebugInfo] Common behavior for error types 2018-08-31 17:41:58 +00:00
llvm-size [llvm-size] Berkeley formatting: use tabs instead of spaces as field delimeters. 2018-09-21 23:48:12 +00:00
llvm-split Make GlobalValues with non-default visibilility dso_local. 2018-01-18 02:08:23 +00:00
llvm-strings [llvm-strings] Add support for the -a/--all options 2017-11-14 19:58:36 +00:00
llvm-symbolizer [DebugInfo] Common behavior for error types 2018-08-31 17:41:58 +00:00
llvm-xray/X86 [XRay] Add TSC to NewCPUId Records 2018-09-11 06:36:51 +00:00
lto Move `REQUIRES:` line to the top 2018-06-26 17:44:23 +00:00
obj2yaml
opt-viewer [opt-viewer] Set title for the source pages 2018-02-26 21:15:50 +00:00
sancov
sanstats
yaml2obj [yaml2obj] - Allow to use numeric sh_link (Link) value for sections. 2018-08-16 12:44:17 +00:00