@@ -20,23 +20,28 @@ class Predicate; // Forward def
2020// Register file description - These classes are used to fill in the target
2121// description classes.
2222
23- class HwMode<string FS, list<Predicate> Ps> {
24- // A string representing subtarget features that turn on this HW mode.
25- // For example, "+feat1,-feat2" will indicate that the mode is active
26- // when "feat1" is enabled and "feat2" is disabled at the same time.
27- // Any other features are not checked.
28- // When multiple modes are used, they should be mutually exclusive,
29- // otherwise the results are unpredictable.
30- string Features = FS;
23+ // Code that will be inserted at the start of the generated
24+ // `*GenSubtargetInfo::getHwModeSet()` method. It is expected to define
25+ // variables used in Predicate::CondString. If this class is never instantiated,
26+ // the default
27+ //
28+ // [[maybe_unused]] const auto *Subtarget =
29+ // static_cast<const <TargetName>Subtarget *>(this);
30+ //
31+ // will be inserted, where <TargetName> is the name of the Target record.
32+ class HwModePredicateProlog<code c> {
33+ code Code = c;
34+ }
3135
36+ class HwMode<list<Predicate> Ps> {
3237 // A list of predicates that turn on this HW mode.
3338 list<Predicate> Predicates = Ps;
3439}
3540
3641// A special mode recognized by tablegen. This mode is considered active
3742// when no other mode is active. For targets that do not use specific hw
3843// modes, this is the only mode.
39- def DefaultMode : HwMode<"", []>;
44+ def DefaultMode : HwMode<[]>;
4045
4146// A class used to associate objects with HW modes. It is only intended to
4247// be used as a base class, where the derived class should contain a member
0 commit comments