Skip to content

Commit 206667d

Browse files
committed
review comments: remove properties codegen
- as noted, the codegen was not going to be used until a future pr - it is now removed and we restructure the properties to be a struct of bools, with the intention to remove any codegen and follow a similar pattern to the attributes in the future
1 parent 66989ec commit 206667d

File tree

3 files changed

+3
-54
lines changed

3 files changed

+3
-54
lines changed

llvm/lib/Target/DirectX/DXILConstants.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,8 @@ inline Attributes &operator|=(Attributes &a, Attributes &b) {
4747
return a;
4848
}
4949

50-
51-
enum class Property : unsigned {
52-
#define DXIL_PROPERTY(Name) Name,
50+
struct Properties {
51+
#define DXIL_PROPERTY(Name) bool Name = false;
5352
#include "DXILOperation.inc"
5453
};
5554

llvm/lib/Target/DirectX/DXILOpBuilder.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ struct OpCodeProperty {
153153
unsigned OpCodeClassNameOffset;
154154
llvm::SmallVector<OpOverload> Overloads;
155155
llvm::SmallVector<OpStage> Stages;
156-
llvm::SmallVector<dxil::Property> Properties;
157156
int OverloadParamIndex; // parameter index which control the overload.
158157
// When < 0, should be only 1 overload type.
159158
};

llvm/utils/TableGen/DXILEmitter.cpp

Lines changed: 1 addition & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -319,28 +319,6 @@ static std::string getStageMaskString(ArrayRef<const Record *> Recs) {
319319
return MaskString;
320320
}
321321

322-
/// Return a string representation of valid property information denoted
323-
// by input records
324-
//
325-
/// \param Recs A vector of records of TableGen Property records
326-
/// \return std::string string representation of properties list string
327-
// {Attr1, Attr2, ...}
328-
static std::string getPropertyListString(ArrayRef<const Record *> Recs) {
329-
std::string ListString = "";
330-
std::string Prefix = "";
331-
ListString.append("{");
332-
333-
std::string CommaPrefix = "";
334-
for (const auto *Rec : Recs) {
335-
ListString.append(CommaPrefix)
336-
.append("dxil::Property::")
337-
.append(Rec->getName());
338-
CommaPrefix = ", ";
339-
}
340-
ListString.append("}");
341-
return ListString;
342-
}
343-
344322
/// Emit a list valid DXIL Version records
345323
static void emitDXILVersions(const RecordKeeper &Records, raw_ostream &OS) {
346324
OS << "#ifdef DXIL_VERSION\n";
@@ -429,36 +407,13 @@ static void emitDXILOpAttributes(const RecordKeeper &Records,
429407

430408
/// Emit a list of DXIL op properties and their query functions
431409
static void emitDXILProperties(const RecordKeeper &Records, raw_ostream &OS) {
432-
// Generate their definitions
433410
OS << "#ifdef DXIL_PROPERTY\n";
434411
for (const Record *Prop : Records.getAllDerivedDefinitions("DXILProperty"))
435412
OS << "DXIL_PROPERTY(" << Prop->getName() << ")\n";
436413
OS << "#undef DXIL_PROPERTY\n";
437414
OS << "#endif\n\n";
438415
}
439416

440-
static void emitDXILPropertyHelper(ArrayRef<DXILOperationDesc> Ops,
441-
raw_ostream &OS) {
442-
// Generate helper function to query all the functions
443-
OS << "static llvm::SmallVector<dxil::Property> getProperties(dxil::OpCode "
444-
"Op) {\n";
445-
OS << " switch (Op) {\n";
446-
for (const auto &Op : Ops) {
447-
OS << " case dxil::OpCode::" << Op.OpName << ": return "
448-
<< getPropertyListString(Op.PropRecs) << ";\n";
449-
}
450-
OS << " }\n";
451-
OS << " return {};\n";
452-
OS << "}\n\n";
453-
OS << "static bool hasProperty(dxil::OpCode Op, dxil::Property Prop) {\n";
454-
OS << " auto Properties = getProperties(Op);\n";
455-
OS << " for (auto CurProp : Properties)\n";
456-
OS << " if (CurProp == Prop)\n";
457-
OS << " return true;\n";
458-
OS << " return false;\n";
459-
OS << "}\n\n";
460-
}
461-
462417
/// Emit a list of DXIL op function types
463418
static void emitDXILOpFunctionTypes(ArrayRef<DXILOperationDesc> Ops,
464419
raw_ostream &OS) {
@@ -555,7 +510,7 @@ static void emitDXILOperationTable(ArrayRef<DXILOperationDesc> Ops,
555510
<< OpClassStrings.get(Op.OpClass.data()) << ", "
556511
<< getOverloadMaskString(Op.OverloadRecs) << ", "
557512
<< getStageMaskString(Op.StageRecs) << ", "
558-
<< getPropertyListString(Op.PropRecs) << ", " << Op.OverloadParamIndex
513+
<< Op.OverloadParamIndex
559514
<< " }";
560515
Prefix = ",\n";
561516
}
@@ -672,10 +627,6 @@ static void emitDxilOperation(const RecordKeeper &Records, raw_ostream &OS) {
672627
emitDXILOperationTable(DXILOps, OS);
673628
OS << "#undef DXIL_OP_OPERATION_TABLE\n";
674629
OS << "#endif\n\n";
675-
OS << "#ifdef DXIL_OP_PROPERTY_HELPER\n";
676-
emitDXILPropertyHelper(DXILOps, OS);
677-
OS << "#undef DXIL_OP_PROPERTY_HELPER\n";
678-
OS << "#endif\n\n";
679630
}
680631

681632
static TableGen::Emitter::Opt X("gen-dxil-operation", emitDxilOperation,

0 commit comments

Comments
 (0)