1//===- TableGenBackend.cpp - Base class for TableGen Backends ---*- C++ -*-===//
| 1//===- TableGenBackend.cpp - Utilities for TableGen Backends ----*- C++ -*-===//
|
2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9// 10// This file provides useful services for TableGen backends... 11// 12//===----------------------------------------------------------------------===// 13
| 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9// 10// This file provides useful services for TableGen backends... 11// 12//===----------------------------------------------------------------------===// 13
|
| 14#include "llvm/ADT/Twine.h" 15#include "llvm/Support/raw_ostream.h"
|
14#include "llvm/TableGen/TableGenBackend.h"
| 16#include "llvm/TableGen/TableGenBackend.h"
|
15#include "llvm/TableGen/Record.h"
| |
16using namespace llvm; 17
| 17using namespace llvm; 18
|
18void TableGenBackend::anchor() { } 19 20void TableGenBackend::EmitSourceFileHeader(StringRef Desc, 21 raw_ostream &OS) const { 22 OS << "//===- TableGen'erated file -------------------------------------*-" 23 " C++ -*-===//\n//\n// " << Desc << "\n//\n// Automatically generate" 24 "d file, do not edit!\n//\n//===------------------------------------" 25 "----------------------------------===//\n\n";
| 19static void printLine(raw_ostream &OS, const Twine &Prefix, char Fill, 20 StringRef Suffix) { 21 uint64_t Pos = OS.tell(); 22 OS << Prefix; 23 for (unsigned i = OS.tell() - Pos, e = 80 - Suffix.size(); i != e; ++i) 24 OS << Fill; 25 OS << Suffix << '\n';
|
26} 27
| 26} 27
|
| 28void llvm::emitSourceFileHeader(StringRef Desc, raw_ostream &OS) { 29 printLine(OS, "/*===- TableGen'erated file ", '-', "*- C++ -*-===*\\"); 30 printLine(OS, "|*", ' ', "*|"); 31 printLine(OS, "|* " + Desc, ' ', "*|"); 32 printLine(OS, "|*", ' ', "*|"); 33 printLine(OS, "|* Automatically generated file, do not edit!", ' ', "*|"); 34 printLine(OS, "|*", ' ', "*|"); 35 printLine(OS, "\\*===", '-', "===*/"); 36 OS << '\n'; 37}
|
| |