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

Function generateOpReaderDispatch

tools/cuda-tile-tblgen/BytecodeReaderGen.cpp:689–705  ·  view source on GitHub ↗

Generates the C++ switch statement to dispatch based on opcode.

Source from the content-addressed store, hash-verified

687
688/// Generates the C++ switch statement to dispatch based on opcode.
689static void generateOpReaderDispatch(const RecordKeeper &records,
690 raw_ostream &os) {
691 emitSourceFileHeader("Generated Bytecode Opcode Dispatcher", os);
692 auto opDefs = records.getAllDerivedDefinitions("Op");
693 os << R"(switch (static_cast<Opcode>(opcode)) {)";
694 for (const Record *opDef : opDefs) {
695 Operator op(opDef);
696 StringRef opClassName = op.getCppClassName();
697 os << llvm::formatv(dispatchCaseTemplate, opClassName);
698 }
699 os << R"( default:
700 return reader.emitError() << "unknown or unimplemented opcode: " << static_cast<int>(opcode);})";
701 os << R"(//===-------------------------------------------------------------------//
702// End of generated dispatcher.
703//===-------------------------------------------------------------------//
704)";
705}
706
707/// The main entry point for the TableGen backend.
708static bool generateBytecodeReader(const RecordKeeper &records,

Callers 1

generateBytecodeReaderFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected