-
Notifications
You must be signed in to change notification settings - Fork 133
Expand file tree
/
Copy pathCompilationTargetEmitter.cpp
More file actions
28 lines (22 loc) · 1023 Bytes
/
CompilationTargetEmitter.cpp
File metadata and controls
28 lines (22 loc) · 1023 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include "lib/Tablegen/CompilationTargetEmitter.h"
#include "llvm/include/llvm/Support/raw_ostream.h" // from @llvm-project
#include "llvm/include/llvm/TableGen/Record.h" // from @llvm-project
#include "llvm/include/llvm/TableGen/TableGenBackend.h" // from @llvm-project
namespace mlir {
namespace heir {
bool emitCompilationTargetRegistration(const llvm::RecordKeeper& records,
llvm::raw_ostream& os) {
auto targets = records.getAllDerivedDefinitions("CompilationTarget");
os << "CompilationTargetRegistry::CompilationTargetRegistry() {\n";
for (auto* target : targets) {
auto backendName = target->getValueAsString("backendName");
auto bootstrapLevelsConsumed =
target->getValueAsInt("bootstrapLevelsConsumed");
os << " targets[\"" << backendName << "\"] = CompilationTarget{\""
<< backendName << "\", " << (int)bootstrapLevelsConsumed << "};\n";
}
os << "}\n";
return false;
}
} // namespace heir
} // namespace mlir