aboutsummaryrefslogtreecommitdiff
path: root/backend/utils/TableGen/AsmWriterEmitter.cpp
blob: f8452c5c4e798de166e478c4ac2696b43fdbc119 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// SPDX-License-Identifier: GPL-3.0-or-later

#include "TableGenBackends.h"

#include <sstream>
#include <string>

namespace rcc::targetgen {

std::string emitAssemblyWriter(const NormalizedTargetModel &Model) {
  std::ostringstream Output;
  Output << "constexpr std::array<AssemblyFormatInfo, " << Model.AssemblyFormats.size()
         << "> GeneratedAssemblyFormats = {{\n";
  for (const NormalizedAssemblyFormat &Format : Model.AssemblyFormats) {
    Output << "    {AssemblyFormatID::fromValue(" << Format.ID << "), ";
    appendQuoted(Output, Format.Name);
    Output << "},\n";
  }
  Output << "}};\n\n";
  return Output.str();
}

} // namespace rcc::targetgen