MCPcopy Create free account
hub / github.com/NVIDIA/cuda-tile / generateAttrBytecode

Function generateAttrBytecode

tools/cuda-tile-tblgen/BytecodeGen.cpp:990–1046  ·  view source on GitHub ↗

Generate attribute bytecode definitions including: - AttributeTag enum - Runtime version checking function

Source from the content-addressed store, hash-verified

988/// - AttributeTag enum
989/// - Runtime version checking function
990static bool generateAttrBytecode(const RecordKeeper &records, raw_ostream &os) {
991 BytecodeAttrStructure structure = analyzeBytecodeAttrs(records);
992
993 if (failed(validateAttrTagAssignments(records, structure)))
994 return true;
995
996 // Generate the AttributeTag enum.
997 os << "//===-- Begin Attribute Tag Enum --===//\n";
998 os << "#ifdef GEN_ATTR_TAG_ENUM\n\n";
999 generateAttrTagEnum(structure, os);
1000 os << "\n#undef GEN_ATTR_TAG_ENUM\n";
1001 os << "#endif // GEN_ATTR_TAG_ENUM\n";
1002 os << "//===-- End Attribute Tag Enum --===//\n\n";
1003
1004 // Generate the runtime version checking function.
1005 os << "//===-- Begin Attribute Version Check --===//\n";
1006 os << "#ifdef GEN_ATTR_VERSION_CHECK\n";
1007 generateAttrVersionCheck(structure, os);
1008 os << "\n#undef GEN_ATTR_VERSION_CHECK\n";
1009 os << "#endif // GEN_ATTR_VERSION_CHECK\n";
1010 os << "//===-- End Attribute Version Check --===//\n\n";
1011
1012 // Generate is_cuda_tile_enum type trait for BytecodeWriter.
1013 os << "//===-- Begin Enum Type Trait --===//\n";
1014 os << "#ifdef GEN_ENUM_TYPE_TRAIT\n";
1015 generateEnumTypeTrait(structure, os);
1016 os << "\n#undef GEN_ENUM_TYPE_TRAIT\n";
1017 os << "#endif // GEN_ENUM_TYPE_TRAIT\n";
1018 os << "//===-- End Enum Type Trait --===//\n\n";
1019
1020 // Generate is_cuda_tile_enum_attr type trait + symbolizeEnum for
1021 // BytecodeReader.
1022 os << "//===-- Begin Enum Attr Type Trait --===//\n";
1023 os << "#ifdef GEN_ENUM_ATTR_TYPE_TRAIT\n";
1024 generateEnumAttrTypeTrait(structure, os);
1025 os << "\n#undef GEN_ENUM_ATTR_TYPE_TRAIT\n";
1026 os << "#endif // GEN_ENUM_ATTR_TYPE_TRAIT\n";
1027 os << "//===-- End Enum Attr Type Trait --===//\n\n";
1028
1029 // Generate enum attr version checking for BytecodeReader.
1030 os << "//===-- Begin Enum Attr Version Check --===//\n";
1031 os << "#ifdef GEN_ENUM_ATTR_VERSION_CHECK\n";
1032 generateEnumAttrVersionCheck(structure, os);
1033 os << "\n#undef GEN_ENUM_ATTR_VERSION_CHECK\n";
1034 os << "#endif // GEN_ENUM_ATTR_VERSION_CHECK\n";
1035 os << "//===-- End Enum Attr Version Check --===//\n\n";
1036
1037 // Generate per-value version checking for BytecodeWriter.
1038 os << "//===-- Begin Enum Value Version Check --===//\n";
1039 os << "#ifdef GEN_ENUM_VALUE_VERSION_CHECK\n";
1040 generateEnumValueVersionCheck(structure, os);
1041 os << "\n#undef GEN_ENUM_VALUE_VERSION_CHECK\n";
1042 os << "#endif // GEN_ENUM_VALUE_VERSION_CHECK\n";
1043 os << "//===-- End Enum Value Version Check --===//\n";
1044
1045 return false;
1046}
1047

Callers 1

BytecodeGen.cppFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected