[PATCH] D54777: [AArch64] Refactor the scheduling predicates (NFC)

Andrea Di Biagio via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 21 13:43:47 PST 2018


andreadb added a comment.

In https://reviews.llvm.org/D54777#1305675, @evandro wrote:

> Question: the code beginning at `MCOpcodeSwitchStatement` above cannot be used as a regular `MCSchedPredicate` too.  If so, how can I avoid writing the same statement twice, since this condition is used both in `AArch64InstrInfo.cpp` and in `AArch64Sched*.td`?


You can use a `TIIPredicate` definition to model an MCSchedPredicate.
The `MCOpcodeSwitchStatement` used by the `ScaledIdxPred` definition from my previous comment is effectively defining the body of method "isScaledAddr".
`ScaledIdxPred` can be used in MCSchedPredicate definitions.

Example. In AArch64SchedExynosM1 you could have:

  -def M1ReadAdrBase : SchedReadVariant<[SchedVar<ScaledIdxPred, [ReadDefault]>,
  -                                      SchedVar<NoSchedPred,   [ReadDefault]>]>;
  +def M1ReadAdrBase : SchedReadVariant<[
  +    SchedVar<MCSchedPredicate<ScaledIdxPred>, [ReadDefault]>,
  +    SchedVar<NoSchedPred,                     [ReadDefault]>
  +]>;

A TIIPredicate used in a MCSchedPredicate definition is always expanded into a TII method call.

That being said, I am not sure if we are talking about the same thing...


Repository:
  rL LLVM

https://reviews.llvm.org/D54777





More information about the llvm-commits mailing list