xref: /freebsd/contrib/llvm-project/llvm/lib/TableGen/TableGenBackendSkeleton.cpp (revision b3e7694832e81d7a904a10f525f8797b753bf0d3)
1 //===- SkeletonEmitter.cpp - Skeleton TableGen backend          -*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This Tablegen backend emits ...
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #include "llvm/ADT/DenseMapInfo.h"
14 #include "llvm/ADT/StringRef.h"
15 #include "llvm/TableGen/TableGenBackend.h"
16 
17 #define DEBUG_TYPE "skeleton-emitter"
18 
19 namespace llvm {
20 class RecordKeeper;
21 class raw_ostream;
22 } // namespace llvm
23 
24 using namespace llvm;
25 
26 namespace {
27 
28 // Any helper data structures can be defined here. Some backends use
29 // structs to collect information from the records.
30 
31 class SkeletonEmitter {
32 private:
33   RecordKeeper &Records;
34 
35 public:
36   SkeletonEmitter(RecordKeeper &RK) : Records(RK) {}
37 
38   void run(raw_ostream &OS);
39 }; // emitter class
40 
41 } // anonymous namespace
42 
43 void SkeletonEmitter::run(raw_ostream &OS) {
44   emitSourceFileHeader("Skeleton data structures", OS);
45 
46   (void)Records; // To suppress unused variable warning; remove on use.
47 }
48 
49 namespace llvm {
50 
51 // The only thing that should be in the llvm namespace is the
52 // emitter entry point function.
53 
54 void EmitSkeleton(RecordKeeper &RK, raw_ostream &OS) {
55   // Instantiate the emitter class and invoke run().
56   SkeletonEmitter(RK).run(OS);
57 }
58 
59 } // namespace llvm
60