[RISCV] Fix mgather -> riscv.masked.strided.load combine not extending indices (...
[llvm-project.git] / llvm / lib / TableGen / TableGenBackendSkeleton.cpp
blob8e65b7a5b300fdeae4a0abe1a50802decfe06012
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 ...
11 //===----------------------------------------------------------------------===//
13 #include "llvm/ADT/StringRef.h"
14 #include "llvm/TableGen/TableGenBackend.h"
16 #define DEBUG_TYPE "skeleton-emitter"
18 namespace llvm {
19 class RecordKeeper;
20 class raw_ostream;
21 } // namespace llvm
23 using namespace llvm;
25 namespace {
27 // Any helper data structures can be defined here. Some backends use
28 // structs to collect information from the records.
30 class SkeletonEmitter {
31 private:
32 RecordKeeper &Records;
34 public:
35 SkeletonEmitter(RecordKeeper &RK) : Records(RK) {}
37 void run(raw_ostream &OS);
38 }; // emitter class
40 } // anonymous namespace
42 void SkeletonEmitter::run(raw_ostream &OS) {
43 emitSourceFileHeader("Skeleton data structures", OS);
45 (void)Records; // To suppress unused variable warning; remove on use.
48 // Choose either option A or B.
50 //===----------------------------------------------------------------------===//
51 // Option A: Register the backed as class <SkeletonEmitter>
52 static TableGen::Emitter::OptClass<SkeletonEmitter>
53 X("gen-skeleton-class", "Generate example skeleton class");
55 //===----------------------------------------------------------------------===//
56 // Option B: Register "EmitSkeleton" directly
57 // The emitter entry may be private scope.
58 static void EmitSkeleton(RecordKeeper &RK, raw_ostream &OS) {
59 // Instantiate the emitter class and invoke run().
60 SkeletonEmitter(RK).run(OS);
63 static TableGen::Emitter::Opt Y("gen-skeleton-entry", EmitSkeleton,
64 "Generate example skeleton entry");