1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 04:02:41 +01:00
llvm-mirror/include/llvm/Target
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
..
GlobalISel Revert "Revert rr340111 "[GISel]: Add Legalization/lowering code for bit counting operations"" 2018-08-21 17:30:31 +00:00
CodeGenCWrappers.h [AArch64] Add Tiny Code Model for AArch64 2018-08-22 11:31:39 +00:00
GenericOpcodes.td [GISel]: Add missing opcodes for overflow intrinsics 2018-08-28 18:54:10 +00:00
Target.td [WebAssembly] Add isEHScopeReturn instruction property 2018-08-21 19:44:11 +00:00
TargetCallingConv.td Remove trailing space 2018-07-30 19:41:25 +00:00
TargetInstrPredicate.td [TableGen][SubtargetEmitter] Add the ability for processor models to describe dependency breaking instructions. 2018-09-19 15:57:45 +00:00
TargetIntrinsicInfo.h
TargetItinerary.td
TargetLoweringObjectFile.h [MC] Move EH DWARF encodings from MC to CodeGen, NFC 2018-08-09 22:24:04 +00:00
TargetMachine.h [CodeGen] Fix inconsistent declaration parameter name 2018-07-16 18:51:40 +00:00
TargetOptions.h CodeGen: Add a target option for emitting .addrsig directives for all address-significant symbols. 2018-07-17 22:40:08 +00:00
TargetSchedule.td [Tablegen][SubtargetEmitter] Improve expansion of predicates of a variant scheduling class. 2018-08-13 11:09:04 +00:00
TargetSelectionDAG.td [SelectionDAG] Remove masked_gather/scatter from TargetSelectionDAG.td. 2018-08-29 04:45:33 +00:00