llvm.org GIT mirror llvm / 9eb6db1
Revert r300964 + r300970 - [globalisel][tablegen] Import SelectionDAG's rule predicates and support the equivalent in GIRule. It's causing llvm-clang-x86_64-expensive-checks-win to fail to compile and I haven't worked out why. Reverting to make it green while I figure it out. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300978 91177308-0d34-0410-b5e6-96231b3b80d8 Daniel Sanders 3 years ago
12 changed file(s) with 40 addition(s) and 258 deletion(s). Raw diff Collapse all Expand all
1717
1818 #include "llvm/ADT/Optional.h"
1919 #include
20 #include
2120
2221 namespace llvm {
2322 class MachineInstr;
24 class MachineFunction;
2523 class MachineOperand;
2624 class MachineRegisterInfo;
2725 class RegisterBankInfo;
2826 class TargetInstrInfo;
2927 class TargetRegisterInfo;
3028
31 /// Container class for CodeGen predicate results.
32 /// This is convenient because std::bitset does not have a constructor
33 /// with an initializer list of set bits.
34 ///
35 /// Each InstructionSelector subclass should define a PredicateBitset class with:
36 /// const unsigned MAX_SUBTARGET_PREDICATES = 192;
37 /// using PredicateBitset = PredicateBitsetImpl;
38 /// and updating the constant to suit the target. Tablegen provides a suitable
39 /// definition for the predicates in use in GenGlobalISel.inc when
40 /// GET_GLOBALISEL_PREDICATE_BITSET is defined.
41 template
42 class PredicateBitsetImpl : public std::bitset {
43 public:
44 // Cannot inherit constructors because it's not supported by VC++..
45 PredicateBitsetImpl() = default;
46
47 PredicateBitsetImpl(const std::bitset &B)
48 : std::bitset(B) {}
49
50 PredicateBitsetImpl(std::initializer_list Init) {
51 for (auto I : Init)
52 std::bitset::set(I);
53 }
54 };
55
5629 /// Provides the logic to select generic machine instructions.
5730 class InstructionSelector {
5831 public:
5932 virtual ~InstructionSelector() {}
60
61 /// This is executed before selecting a function.
62 virtual void beginFunction(const MachineFunction &MF) {}
6333
6434 /// Select the (possibly generic) instruction \p I to only use target-specific
6535 /// opcodes. It is OK to insert multiple instructions, but they cannot be
4040
4141 namespace {
4242
43 #define GET_GLOBALISEL_PREDICATE_BITSET
44 #include "AArch64GenGlobalISel.inc"
45 #undef GET_GLOBALISEL_PREDICATE_BITSET
46
4743 class AArch64InstructionSelector : public InstructionSelector {
4844 public:
4945 AArch64InstructionSelector(const AArch64TargetMachine &TM,
5046 const AArch64Subtarget &STI,
5147 const AArch64RegisterBankInfo &RBI);
5248
53 void beginFunction(const MachineFunction &MF) override;
5449 bool select(MachineInstr &I) const override;
5550
5651 private:
7469 const AArch64InstrInfo &TII;
7570 const AArch64RegisterInfo &TRI;
7671 const AArch64RegisterBankInfo &RBI;
77 bool ForCodeSize;
78
79 PredicateBitset AvailableFeatures;
80 PredicateBitset
81 computeAvailableFeatures(const MachineFunction *MF,
82 const AArch64Subtarget *Subtarget) const;
8372
8473 // We declare the temporaries used by selectImpl() in the class to minimize the
8574 // cost of constructing placeholder values.
9887 const AArch64TargetMachine &TM, const AArch64Subtarget &STI,
9988 const AArch64RegisterBankInfo &RBI)
10089 : InstructionSelector(), TM(TM), STI(STI), TII(*STI.getInstrInfo()),
101 TRI(*STI.getRegisterInfo()), RBI(RBI), ForCodeSize(), AvailableFeatures()
90 TRI(*STI.getRegisterInfo()), RBI(RBI)
10291 #define GET_GLOBALISEL_TEMPORARIES_INIT
10392 #include "AArch64GenGlobalISel.inc"
10493 #undef GET_GLOBALISEL_TEMPORARIES_INIT
577566 return true;
578567 }
579568
580 void AArch64InstructionSelector::beginFunction(
581 const MachineFunction &MF) {
582 ForCodeSize = MF.getFunction()->optForSize();
583 AvailableFeatures = computeAvailableFeatures(&MF, &STI);
584 }
585
586569 bool AArch64InstructionSelector::select(MachineInstr &I) const {
587570 assert(I.getParent() && "Instruction should be in a basic block!");
588571 assert(I.getParent()->getParent() && "Instruction should be in a function!");
9494 /// encoding when possible in order to reduce code size.
9595 FunctionPass *createX86EvexToVexInsts();
9696
97 InstructionSelector *createX86InstructionSelector(const X86TargetMachine &TM,
98 X86Subtarget &,
97 InstructionSelector *createX86InstructionSelector(X86Subtarget &,
9998 X86RegisterBankInfo &);
10099
101100 void initializeEvexToVexInstPassPass(PassRegistry &);
3838
3939 namespace {
4040
41 #define GET_GLOBALISEL_PREDICATE_BITSET
42 #include "X86GenGlobalISel.inc"
43 #undef GET_GLOBALISEL_PREDICATE_BITSET
44
4541 class X86InstructionSelector : public InstructionSelector {
4642 public:
47 X86InstructionSelector(const X86TargetMachine &TM, const X86Subtarget &STI,
43 X86InstructionSelector(const X86Subtarget &STI,
4844 const X86RegisterBankInfo &RBI);
4945
50 void beginFunction(const MachineFunction &MF) override;
5146 bool select(MachineInstr &I) const override;
5247
5348 private:
7469 bool selectTrunc(MachineInstr &I, MachineRegisterInfo &MRI,
7570 MachineFunction &MF) const;
7671
77 const X86TargetMachine &TM;
7872 const X86Subtarget &STI;
7973 const X86InstrInfo &TII;
8074 const X86RegisterInfo &TRI;
8175 const X86RegisterBankInfo &RBI;
82 bool OptForSize;
83 bool OptForMinSize;
84
85 PredicateBitset AvailableFeatures;
86 PredicateBitset computeAvailableFeatures(const MachineFunction *MF,
87 const X86Subtarget *Subtarget) const;
8876
8977 #define GET_GLOBALISEL_TEMPORARIES_DECL
9078 #include "X86GenGlobalISel.inc"
9785 #include "X86GenGlobalISel.inc"
9886 #undef GET_GLOBALISEL_IMPL
9987
100 X86InstructionSelector::X86InstructionSelector(const X86TargetMachine &TM,
101 const X86Subtarget &STI,
88 X86InstructionSelector::X86InstructionSelector(const X86Subtarget &STI,
10289 const X86RegisterBankInfo &RBI)
103 : InstructionSelector(), TM(TM), STI(STI), TII(*STI.getInstrInfo()),
104 TRI(*STI.getRegisterInfo()), RBI(RBI), OptForSize(false),
105 OptForMinSize(false), AvailableFeatures()
90 : InstructionSelector(), STI(STI), TII(*STI.getInstrInfo()),
91 TRI(*STI.getRegisterInfo()), RBI(RBI)
10692 #define GET_GLOBALISEL_TEMPORARIES_INIT
10793 #include "X86GenGlobalISel.inc"
10894 #undef GET_GLOBALISEL_TEMPORARIES_INIT
192178 }
193179 I.setDesc(TII.get(X86::COPY));
194180 return true;
195 }
196
197 void X86InstructionSelector::beginFunction(const MachineFunction &MF) {
198 OptForSize = MF.getFunction()->optForSize();
199 OptForMinSize = MF.getFunction()->optForMinSize();
200 AvailableFeatures = computeAvailableFeatures(&MF, &STI);
201181 }
202182
203183 bool X86InstructionSelector::select(MachineInstr &I) const {
590570 }
591571
592572 InstructionSelector *
593 llvm::createX86InstructionSelector(const X86TargetMachine &TM,
594 X86Subtarget &Subtarget,
573 llvm::createX86InstructionSelector(X86Subtarget &Subtarget,
595574 X86RegisterBankInfo &RBI) {
596 return new X86InstructionSelector(TM, Subtarget, RBI);
597 }
575 return new X86InstructionSelector(Subtarget, RBI);
576 }
285285
286286 auto *RBI = new X86RegisterBankInfo(*I->getRegisterInfo());
287287 GISel->RegBankInfo.reset(RBI);
288 GISel->InstSelector.reset(createX86InstructionSelector(*this, *I, *RBI));
288 GISel->InstSelector.reset(createX86InstructionSelector(*I, *RBI));
289289 #endif
290290 I->setGISelAccessor(*GISel);
291291 }
2828 def Z : OperandWithDefaultOps ;
2929 def m1Z : OperandWithDefaultOps ;
3030
31 def HasA : Predicate<"Subtarget->hasA()">;
32 def HasB : Predicate<"Subtarget->hasB()">;
33
34 //===- Test the function boilerplate. -------------------------------------===//
35
36 // CHECK-LABEL: enum SubtargetFeatureBits : uint8_t {
37 // CHECK-NEXT: Feature_HasABit = 0,
38 // CHECK-NEXT: Feature_HasBBit = 1,
39 // CHECK-NEXT: };
40
41 // CHECK-LABEL: static const char *SubtargetFeatureNames[] = {
42 // CHECK-NEXT: "Feature_HasA",
43 // CHECK-NEXT: "Feature_HasB",
44 // CHECK-NEXT: nullptr
45 // CHECK-NEXT: };
46
47 // CHECK-LABEL: PredicateBitset MyTargetInstructionSelector::
48 // CHECK-NEXT: computeAvailableFeatures(const MachineFunction *MF, const MyTargetSubtarget *Subtarget) const {
49 // CHECK-NEXT: PredicateBitset Features;
50 // CHECK-NEXT: if (Subtarget->hasA())
51 // CHECK-NEXT: Features[Feature_HasABit] = 1;
52 // CHECK-NEXT: if (Subtarget->hasB())
53 // CHECK-NEXT: Features[Feature_HasBBit] = 1;
54 // CHECK-NEXT: return Features;
55 // CHECK-NEXT: }
31 //===- Test the function definition boilerplate. --------------------------===//
5632
5733 // CHECK: bool MyTargetInstructionSelector::selectImpl(MachineInstr &I) const {
5834 // CHECK: MachineFunction &MF = *I.getParent()->getParent();
126102 //===- Test a nested instruction match. -----------------------------------===//
127103
128104 // CHECK-LABEL: if ([&]() {
129 // CHECK-NEXT: PredicateBitset ExpectedFeatures = {Feature_HasABit};
130 // CHECK-NEXT: if ((AvailableFeatures & ExpectedFeatures) != ExpectedFeatures)
131 // CHECK-NEXT: return false;
132105 // CHECK-NEXT: MachineInstr &MI0 = I;
133106 // CHECK-NEXT: if (MI0.getNumOperands() < 3)
134107 // CHECK-NEXT: return false;
168141
169142 // We also get a second rule by commutativity.
170143 // CHECK-LABEL: if ([&]() {
171 // CHECK-NEXT: PredicateBitset ExpectedFeatures = {Feature_HasABit};
172 // CHECK-NEXT: if ((AvailableFeatures & ExpectedFeatures) != ExpectedFeatures)
173 // CHECK-NEXT: return false;
174144 // CHECK-NEXT: MachineInstr &MI0 = I;
175145 // CHECK-NEXT: if (MI0.getNumOperands() < 3)
176146 // CHECK-NEXT: return false;
210180
211181 def MULADD : I<(outs GPR32:$dst), (ins GPR32:$src1, GPR32:$src2, GPR32:$src3),
212182 [(set GPR32:$dst,
213 (mul (add GPR32:$src1, GPR32:$src2), GPR32:$src3))]>,
214 Requires<[HasA]>;
183 (mul (add GPR32:$src1, GPR32:$src2), GPR32:$src3))]>;
215184
216185 //===- Test another simple pattern with regclass operands. ----------------===//
217186
218187 // CHECK-LABEL: if ([&]() {
219 // CHECK-NEXT: PredicateBitset ExpectedFeatures = {Feature_HasABit, Feature_HasBBit};
220 // CHECK-NEXT: if ((AvailableFeatures & ExpectedFeatures) != ExpectedFeatures)
221 // CHECK-NEXT: return false;
222188 // CHECK-NEXT: MachineInstr &MI0 = I;
223189 // CHECK-NEXT: if (MI0.getNumOperands() < 3)
224190 // CHECK-NEXT: return false;
246212 // CHECK-NEXT: }()) { return true; }
247213
248214 def MUL : I<(outs GPR32:$dst), (ins GPR32:$src2, GPR32:$src1),
249 [(set GPR32:$dst, (mul GPR32:$src1, GPR32:$src2))]>,
250 Requires<[HasA, HasB]>;
215 [(set GPR32:$dst, (mul GPR32:$src1, GPR32:$src2))]>;
251216
252217 //===- Test a pattern with ComplexPattern operands. -----------------------===//
253218 //
28602860 emitValidateOperandClass(Info, OS);
28612861
28622862 // Emit the available features compute function.
2863 SubtargetFeatureInfo::emitComputeAssemblerAvailableFeatures(
2863 SubtargetFeatureInfo::emitComputeAvailableFeatures(
28642864 Info.Target.getName(), ClassName, "ComputeAvailableFeatures",
28652865 Info.SubtargetFeatures, OS);
28662866
335335 o << "#endif // NDEBUG\n";
336336
337337 // Emit the available features compute function.
338 SubtargetFeatureInfo::emitComputeAssemblerAvailableFeatures(
338 SubtargetFeatureInfo::emitComputeAvailableFeatures(
339339 Target.getName(), "MCCodeEmitter", "computeAvailableFeatures",
340340 SubtargetFeatures, o);
341341
3030 //===----------------------------------------------------------------------===//
3131
3232 #include "CodeGenDAGPatterns.h"
33 #include "SubtargetFeatureInfo.h"
3433 #include "llvm/ADT/Optional.h"
3534 #include "llvm/ADT/SmallSet.h"
3635 #include "llvm/ADT/Statistic.h"
161160 return Explanation;
162161 }
163162
163 static std::string explainRulePredicates(const ArrayRef Predicates) {
164 std::string Explanation = "";
165 StringRef Separator = "";
166 for (const auto *P : Predicates) {
167 Explanation += Separator;
168
169 if (const DefInit *PDef = dyn_cast(P)) {
170 Explanation += PDef->getDef()->getName();
171 } else
172 Explanation += "";
173 }
174 return Explanation;
175 }
176
164177 std::string explainOperator(Record *Operator) {
165178 if (Operator->isSubClassOf("SDNode"))
166179 return " (" + Operator->getValueAsString("Opcode") + ")";
224237 /// ID for the next instruction variable defined with defineInsnVar()
225238 unsigned NextInsnVarID;
226239
227 std::vector RequiredFeatures;
228
229240 public:
230241 RuleMatcher()
231242 : Matchers(), Actions(), InsnVariableNames(), NextInsnVarID(0) {}
233244 RuleMatcher &operator=(RuleMatcher &&Other) = default;
234245
235246 InstructionMatcher &addInstructionMatcher();
236 void addRequiredFeature(Record *Feature);
237247
238248 template Kind &addAction(Args &&... args);
239249
244254 void emitCxxCapturedInsnList(raw_ostream &OS);
245255 void emitCxxCaptureStmts(raw_ostream &OS, StringRef Expr);
246256
247 void emit(raw_ostream &OS,
248 std::map
249 SubtargetFeatures);
257 void emit(raw_ostream &OS);
250258
251259 /// Compare the priority of this object and B.
252260 ///
10831091 return *Matchers.back();
10841092 }
10851093
1086 void RuleMatcher::addRequiredFeature(Record *Feature) {
1087 RequiredFeatures.push_back(Feature);
1088 }
1089
10901094 template
10911095 Kind &RuleMatcher::addAction(Args &&... args) {
10921096 Actions.emplace_back(llvm::make_unique(std::forward(args)...));
11301134 Matchers.front()->emitCxxCaptureStmts(OS, *this, InsnVarName);
11311135 }
11321136
1133 void RuleMatcher::emit(raw_ostream &OS,
1134 std::map
1135 SubtargetFeatures) {
1137 void RuleMatcher::emit(raw_ostream &OS) {
11361138 if (Matchers.empty())
11371139 llvm_unreachable("Unexpected empty matcher!");
11381140
11461148 // %elt0(s32), %elt1(s32) = TGT_LOAD_PAIR %ptr
11471149 // on some targets but we don't need to make use of that yet.
11481150 assert(Matchers.size() == 1 && "Cannot handle multi-root matchers yet");
1149
1150 OS << "if (";
1151 OS << "[&]() {\n";
1152 if (!RequiredFeatures.empty()) {
1153 OS << " PredicateBitset ExpectedFeatures = {";
1154 StringRef Separator = "";
1155 for (const auto &Predicate : RequiredFeatures) {
1156 const auto &I = SubtargetFeatures.find(Predicate);
1157 assert(I != SubtargetFeatures.end() && "Didn't import predicate?");
1158 OS << Separator << I->second.getEnumBitName();
1159 Separator = ", ";
1160 }
1161 OS << "};\n";
1162 OS << "if ((AvailableFeatures & ExpectedFeatures) != ExpectedFeatures)\n"
1163 << " return false;\n";
1164 }
1151 OS << "if ([&]() {\n";
11651152
11661153 emitCxxCaptureStmts(OS, "I");
11671154
12761263 /// GIComplexPatternEquiv.
12771264 DenseMap ComplexPatternEquivs;
12781265
1279 // Map of predicates to their subtarget features.
1280 std::map SubtargetFeatures;
1281
12821266 void gatherNodeEquivs();
12831267 const CodeGenInstruction *findNodeEquiv(Record *N) const;
12841268
1285 Error importRulePredicates(RuleMatcher &M, ArrayRef Predicates);
1269 Error importRulePredicates(RuleMatcher &M, ArrayRef Predicates) const;
12861270 Expected
12871271 createAndImportSelDAGMatcher(InstructionMatcher &InsnMatcher,
12881272 const TreePatternNode *Src) const;
13021286 /// Analyze pattern \p P, returning a matcher for it if possible.
13031287 /// Otherwise, return an Error explaining why we don't support it.
13041288 Expected runOnPattern(const PatternToMatch &P);
1305
1306 void declareSubtargetFeature(Record *Predicate);
13071289 };
13081290
13091291 void GlobalISelEmitter::gatherNodeEquivs() {
13321314
13331315 Error
13341316 GlobalISelEmitter::importRulePredicates(RuleMatcher &M,
1335 ArrayRef Predicates) {
1336 for (const Init *Predicate : Predicates) {
1337 const DefInit *PredicateDef = static_cast(Predicate);
1338 declareSubtargetFeature(PredicateDef->getDef());
1339 M.addRequiredFeature(PredicateDef->getDef());
1340 }
1341
1317 ArrayRef Predicates) const {
1318 if (!Predicates.empty())
1319 return failedImport("Pattern has a rule predicate (" +
1320 explainRulePredicates(Predicates) + ")");
13421321 return Error::success();
13431322 }
13441323
17451724 for (const auto &Rule : Rules)
17461725 MaxTemporaries = std::max(MaxTemporaries, Rule.countTemporaryOperands());
17471726
1748 OS << "#ifdef GET_GLOBALISEL_PREDICATE_BITSET\n"
1749 << "const unsigned MAX_SUBTARGET_PREDICATES = " << SubtargetFeatures.size()
1750 << ";\n"
1751 << "using PredicateBitset = "
1752 "llvm::PredicateBitsetImpl;\n"
1753 << "#endif // ifdef GET_GLOBALISEL_PREDICATE_BITSET\n\n";
1754
17551727 OS << "#ifdef GET_GLOBALISEL_TEMPORARIES_DECL\n";
17561728 for (unsigned I = 0; I < MaxTemporaries; ++I)
17571729 OS << " mutable MachineOperand TempOp" << I << ";\n";
17621734 OS << ", TempOp" << I << "(MachineOperand::CreatePlaceholder())\n";
17631735 OS << "#endif // ifdef GET_GLOBALISEL_TEMPORARIES_INIT\n\n";
17641736
1765 OS << "#ifdef GET_GLOBALISEL_IMPL\n";
1766 SubtargetFeatureInfo::emitSubtargetFeatureBitEnumeration(SubtargetFeatures,
1767 OS);
1768 SubtargetFeatureInfo::emitNameTable(SubtargetFeatures, OS);
1769 SubtargetFeatureInfo::emitComputeAvailableFeatures(
1770 Target.getName(), "InstructionSelector", "computeAvailableFeatures",
1771 SubtargetFeatures, OS);
1772
1773 OS << "bool " << Target.getName()
1737 OS << "#ifdef GET_GLOBALISEL_IMPL\n"
1738 << "bool " << Target.getName()
17741739 << "InstructionSelector::selectImpl(MachineInstr &I) const {\n"
17751740 << " MachineFunction &MF = *I.getParent()->getParent();\n"
17761741 << " const MachineRegisterInfo &MRI = MF.getRegInfo();\n";
17771742
17781743 for (auto &Rule : Rules) {
1779 Rule.emit(OS, SubtargetFeatures);
1744 Rule.emit(OS);
17801745 ++NumPatternEmitted;
17811746 }
17821747
17851750 << "#endif // ifdef GET_GLOBALISEL_IMPL\n";
17861751 }
17871752
1788 void GlobalISelEmitter::declareSubtargetFeature(Record *Predicate) {
1789 if (SubtargetFeatures.count(Predicate) == 0)
1790 SubtargetFeatures.emplace(
1791 Predicate, SubtargetFeatureInfo(Predicate, SubtargetFeatures.size()));
1792 }
1793
17941753 } // end anonymous namespace
17951754
17961755 //===----------------------------------------------------------------------===//
5858 OS << "};\n\n";
5959 }
6060
61 void SubtargetFeatureInfo::emitSubtargetFeatureBitEnumeration(
62 std::map &SubtargetFeatures,
63 raw_ostream &OS) {
64 OS << "// Bits for subtarget features that participate in "
65 << "instruction matching.\n";
66 OS << "enum SubtargetFeatureBits : "
67 << getMinimalTypeForRange(SubtargetFeatures.size()) << " {\n";
68 for (const auto &SF : SubtargetFeatures) {
69 const SubtargetFeatureInfo &SFI = SF.second;
70 OS << " " << SFI.getEnumBitName() << " = " << SFI.Index << ",\n";
71 }
72 OS << "};\n\n";
73 }
74
7561 void SubtargetFeatureInfo::emitNameTable(
7662 std::map &SubtargetFeatures,
7763 raw_ostream &OS) {
10086 }
10187
10288 void SubtargetFeatureInfo::emitComputeAvailableFeatures(
103 StringRef TargetName, StringRef ClassName, StringRef FuncName,
104 std::map &SubtargetFeatures,
105 raw_ostream &OS) {
106 OS << "PredicateBitset " << TargetName << ClassName << "::\n"
107 << FuncName << "(const MachineFunction *MF, const " << TargetName
108 << "Subtarget *Subtarget) const {\n";
109 OS << " PredicateBitset Features;\n";
110 for (const auto &SF : SubtargetFeatures) {
111 const SubtargetFeatureInfo &SFI = SF.second;
112
113 OS << " if (" << SFI.TheDef->getValueAsString("CondString") << ")\n";
114 OS << " Features[" << SFI.getEnumBitName() << "] = 1;\n";
115 }
116 OS << " return Features;\n";
117 OS << "}\n\n";
118 }
119
120 void SubtargetFeatureInfo::emitComputeAssemblerAvailableFeatures(
12189 StringRef TargetName, StringRef ClassName, StringRef FuncName,
12290 std::map &SubtargetFeatures,
12391 raw_ostream &OS) {
3636 return "Feature_" + TheDef->getName().str();
3737 }
3838
39 /// \brief The name of the enumerated constant identifying the bitnumber for
40 /// this feature.
41 std::string getEnumBitName() const {
42 return "Feature_" + TheDef->getName().str() + "Bit";
43 }
44
4539 void dump() const;
4640 static std::vector>
4741 getAll(const RecordKeeper &Records);
4842
4943 /// Emit the subtarget feature flag definitions.
50 ///
51 /// This version emits the bit value for the feature and is therefore limited
52 /// to 64 feature bits.
5344 static void emitSubtargetFeatureFlagEnumeration(
54 std::map
55 &SubtargetFeatures,
56 raw_ostream &OS);
57
58 /// Emit the subtarget feature flag definitions.
59 ///
60 /// This version emits the bit index for the feature and can therefore support
61 /// more than 64 feature bits.
62 static void emitSubtargetFeatureBitEnumeration(
6345 std::map
6446 &SubtargetFeatures,
6547 raw_ostream &OS);
7052
7153 /// Emit the function to compute the list of available features given a
7254 /// subtarget.
73 ///
74 /// This version is used for subtarget features defined using Predicate<>
75 /// and supports more than 64 feature bits.
7655 ///
7756 /// \param TargetName The name of the target as used in class prefixes (e.g.
7857 /// Subtarget)
8665 std::map
8766 &SubtargetFeatures,
8867 raw_ostream &OS);
89
90 /// Emit the function to compute the list of available features given a
91 /// subtarget.
92 ///
93 /// This version is used for subtarget features defined using
94 /// AssemblerPredicate<> and supports up to 64 feature bits.
95 ///
96 /// \param TargetName The name of the target as used in class prefixes (e.g.
97 /// Subtarget)
98 /// \param ClassName The name of the class (without the prefix)
99 /// that will contain the generated functions.
100 /// \param FuncName The name of the function to emit.
101 /// \param SubtargetFeatures A map of TableGen records to the
102 /// SubtargetFeatureInfo equivalent.
103 static void emitComputeAssemblerAvailableFeatures(
104 StringRef TargetName, StringRef ClassName, StringRef FuncName,
105 std::map
106 &SubtargetFeatures,
107 raw_ostream &OS);
10868 };
10969 } // end namespace llvm
11070
3939 uint64_t MaxIndex = Size;
4040 if (MaxIndex > 0)
4141 MaxIndex--;
42 assert(MaxIndex <= 64 && "Too many bits");
4342 return getMinimalTypeForRange(1ULL << MaxIndex);
4443 }