summaryrefslogtreecommitdiffstats
path: root/llvm/utils/TableGen/SubtargetFeatureInfo.h
diff options
context:
space:
mode:
authorDaniel Sanders <daniel_l_sanders@apple.com>2017-04-21 15:59:56 +0000
committerDaniel Sanders <daniel_l_sanders@apple.com>2017-04-21 15:59:56 +0000
commite7b0d660808ef8a68a90da4c1b1234568f133219 (patch)
treef4509077e0deecb74bab70f011d11d5b3b58457e /llvm/utils/TableGen/SubtargetFeatureInfo.h
parent7af078847cd287256213b2db061a4e14eae6bb5d (diff)
downloadbcm5719-llvm-e7b0d660808ef8a68a90da4c1b1234568f133219.tar.gz
bcm5719-llvm-e7b0d660808ef8a68a90da4c1b1234568f133219.zip
[globalisel][tablegen] Import SelectionDAG's rule predicates and support the equivalent in GIRule.
Summary: The SelectionDAG importer now imports rules with Predicate's attached via Requires, PredicateControl, etc. These predicates are implemented as bitset's to allow multiple predicates to be tested together. However, unlike the MC layer subtarget features, each target only pays for it's own predicates (e.g. AArch64 doesn't have 192 feature bits just because X86 needs a lot). Both AArch64 and X86 derive at least one predicate from the MachineFunction or Function so they must re-initialize AvailableFeatures before each function. They also declare locals in <Target>InstructionSelector so that computeAvailableFeatures() can use the code from SelectionDAG without modification. Reviewers: rovka, qcolombet, aditya_nandakumar, t.p.northover, ab Reviewed By: rovka Subscribers: aemerson, rengolin, dberris, kristof.beyls, llvm-commits, igorb Differential Revision: https://reviews.llvm.org/D31418 llvm-svn: 300993
Diffstat (limited to 'llvm/utils/TableGen/SubtargetFeatureInfo.h')
-rw-r--r--llvm/utils/TableGen/SubtargetFeatureInfo.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/llvm/utils/TableGen/SubtargetFeatureInfo.h b/llvm/utils/TableGen/SubtargetFeatureInfo.h
index 99f380f2a1d..bbaf4525960 100644
--- a/llvm/utils/TableGen/SubtargetFeatureInfo.h
+++ b/llvm/utils/TableGen/SubtargetFeatureInfo.h
@@ -37,16 +37,34 @@ struct SubtargetFeatureInfo {
return "Feature_" + TheDef->getName().str();
}
+ /// \brief The name of the enumerated constant identifying the bitnumber for
+ /// this feature.
+ std::string getEnumBitName() const {
+ return "Feature_" + TheDef->getName().str() + "Bit";
+ }
+
void dump() const;
static std::vector<std::pair<Record *, SubtargetFeatureInfo>>
getAll(const RecordKeeper &Records);
/// Emit the subtarget feature flag definitions.
+ ///
+ /// This version emits the bit value for the feature and is therefore limited
+ /// to 64 feature bits.
static void emitSubtargetFeatureFlagEnumeration(
std::map<Record *, SubtargetFeatureInfo, LessRecordByID>
&SubtargetFeatures,
raw_ostream &OS);
+ /// Emit the subtarget feature flag definitions.
+ ///
+ /// This version emits the bit index for the feature and can therefore support
+ /// more than 64 feature bits.
+ static void emitSubtargetFeatureBitEnumeration(
+ std::map<Record *, SubtargetFeatureInfo, LessRecordByID>
+ &SubtargetFeatures,
+ raw_ostream &OS);
+
static void emitNameTable(std::map<Record *, SubtargetFeatureInfo,
LessRecordByID> &SubtargetFeatures,
raw_ostream &OS);
@@ -54,6 +72,9 @@ struct SubtargetFeatureInfo {
/// Emit the function to compute the list of available features given a
/// subtarget.
///
+ /// This version is used for subtarget features defined using Predicate<>
+ /// and supports more than 64 feature bits.
+ ///
/// \param TargetName The name of the target as used in class prefixes (e.g.
/// <TargetName>Subtarget)
/// \param ClassName The name of the class (without the <Target> prefix)
@@ -66,6 +87,25 @@ struct SubtargetFeatureInfo {
std::map<Record *, SubtargetFeatureInfo, LessRecordByID>
&SubtargetFeatures,
raw_ostream &OS);
+
+ /// Emit the function to compute the list of available features given a
+ /// subtarget.
+ ///
+ /// This version is used for subtarget features defined using
+ /// AssemblerPredicate<> and supports up to 64 feature bits.
+ ///
+ /// \param TargetName The name of the target as used in class prefixes (e.g.
+ /// <TargetName>Subtarget)
+ /// \param ClassName The name of the class (without the <Target> prefix)
+ /// that will contain the generated functions.
+ /// \param FuncName The name of the function to emit.
+ /// \param SubtargetFeatures A map of TableGen records to the
+ /// SubtargetFeatureInfo equivalent.
+ static void emitComputeAssemblerAvailableFeatures(
+ StringRef TargetName, StringRef ClassName, StringRef FuncName,
+ std::map<Record *, SubtargetFeatureInfo, LessRecordByID>
+ &SubtargetFeatures,
+ raw_ostream &OS);
};
} // end namespace llvm
OpenPOWER on IntegriCloud