TableGenBackendSkeleton.cpp 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. #include "llvm/ADT/DenseMapInfo.h"
  13. #include "llvm/ADT/StringRef.h"
  14. #include "llvm/TableGen/TableGenBackend.h"
  15. #define DEBUG_TYPE "skeleton-emitter"
  16. namespace llvm {
  17. class RecordKeeper;
  18. class raw_ostream;
  19. } // namespace llvm
  20. using namespace llvm;
  21. namespace {
  22. // Any helper data structures can be defined here. Some backends use
  23. // structs to collect information from the records.
  24. class SkeletonEmitter {
  25. private:
  26. RecordKeeper &Records;
  27. public:
  28. SkeletonEmitter(RecordKeeper &RK) : Records(RK) {}
  29. void run(raw_ostream &OS);
  30. }; // emitter class
  31. } // anonymous namespace
  32. void SkeletonEmitter::run(raw_ostream &OS) {
  33. emitSourceFileHeader("Skeleton data structures", OS);
  34. (void)Records; // To suppress unused variable warning; remove on use.
  35. }
  36. namespace llvm {
  37. // The only thing that should be in the llvm namespace is the
  38. // emitter entry point function.
  39. void EmitSkeleton(RecordKeeper &RK, raw_ostream &OS) {
  40. // Instantiate the emitter class and invoke run().
  41. SkeletonEmitter(RK).run(OS);
  42. }
  43. } // namespace llvm