mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-11 09:29:20 +00:00
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7465 91177308-0d34-0410-b5e6-96231b3b80d8
41 lines
1.5 KiB
C++
41 lines
1.5 KiB
C++
//===- RegisterInfoEmitter.cpp - Generate a Register File Desc. -*- C++ -*-===//
|
|
//
|
|
// This tablegen backend is responsible for emitting a description of a target
|
|
// register file for a code generator. It uses instances of the Register,
|
|
// RegisterAliases, and RegisterClass classes to gather this information.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "RegisterInfoEmitter.h"
|
|
#include "Record.h"
|
|
|
|
static void EmitSourceHeader(const std::string &Desc, std::ostream &o) {
|
|
o << "//===- TableGen'erated file -------------------------------------*-"
|
|
" C++ -*-===//\n//\n// " << Desc << "\n//\n// Automatically generate"
|
|
"d file, do not edit!\n//\n//===------------------------------------"
|
|
"----------------------------------===//\n\n";
|
|
}
|
|
|
|
void RegisterInfoEmitter::runHeader(std::ostream &OS) {
|
|
std::vector<Record*> RegisterInfos =
|
|
Records.getAllDerivedDefinitions("RegisterInfo");
|
|
|
|
if (RegisterInfos.size() != 1)
|
|
throw std::string("ERROR: Multiple subclasses of RegisterInfo defined!");
|
|
|
|
EmitSourceHeader("Register Information Header Fragment", OS);
|
|
|
|
std::string ClassName = RegisterInfos[0]->getValueAsString("ClassName");
|
|
|
|
OS << "#include \"llvm/CodeGen/MRegisterInfo.h\"\n\n";
|
|
|
|
OS << "struct " << ClassName << ": public MRegisterInfo {\n"
|
|
<< " " << ClassName << "();\n"
|
|
<< " const unsigned* getCalleeSaveRegs() const;\n"
|
|
<< "};\n\n";
|
|
}
|
|
|
|
void RegisterInfoEmitter::run(std::ostream &o) {
|
|
|
|
}
|