================
@@ -626,3 +626,28 @@ static void emitDxilOperation(const RecordKeeper &Records,
raw_ostream &OS) {
static TableGen::Emitter::Opt X("gen-dxil-operation", emitDxilOperation,
"Generate DXIL operation information");
+
+static void emitDXILIntrinsicStages(const RecordKeeper &Records,
+ raw_ostream &OS) {
+ OS << "// Generated code, do not edit.\n\n";
+ auto Rules = Records.getAllDerivedDefinitions("DXILIntrinsicStages");
+ for (const Record *R : Rules) {
+ auto Stages = R->getValueAsListOfDefs("Stages");
+ if (Stages.empty())
+ PrintFatalError(R, "expected at least one shader stage");
+ OS << "static constexpr StringRef " << R->getName() << "[] = {\n";
+ for (const Record *Stage : Stages)
+ OS << " \"" << Stage->getName() << "\",\n";
----------------
Icohedron wrote:
See:
https://llvm.org/docs/CodingStandards.html#avoid-pointers-in-global-static-constants
```c++
// Avoid: StringRef stores pointers to string; this array needs to be touched
// on every startup (typically 32 bytes).
static constexpr StringRef Bad1[] = {"abc", "def"};
```
Instead follow the `SequenceToOffsetTable` approach already used by
`emitDXILOperationTable`:
https://github.com/bob80905/llvm-project/blob/bcb977a90dce9d08cc4c5303127ec7502b8a6531/llvm/utils/TableGen/DXILEmitter.cpp#L479-L483
https://github.com/llvm/llvm-project/pull/244046
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits