AssemblyAnnotationWriter.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===-- AssemblyAnnotationWriter.h - Annotation .ll files -------*- C++ -*-===//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. //
  14. // Clients of the assembly writer can use this interface to add their own
  15. // special-purpose annotations to LLVM assembly language printouts. Note that
  16. // the assembly parser won't be able to parse these, in general, so
  17. // implementations are advised to print stuff as LLVM comments.
  18. //
  19. //===----------------------------------------------------------------------===//
  20. #ifndef LLVM_IR_ASSEMBLYANNOTATIONWRITER_H
  21. #define LLVM_IR_ASSEMBLYANNOTATIONWRITER_H
  22. namespace llvm {
  23. class Function;
  24. class BasicBlock;
  25. class Instruction;
  26. class Value;
  27. class formatted_raw_ostream;
  28. class AssemblyAnnotationWriter {
  29. public:
  30. virtual ~AssemblyAnnotationWriter();
  31. /// emitFunctionAnnot - This may be implemented to emit a string right before
  32. /// the start of a function.
  33. virtual void emitFunctionAnnot(const Function *,
  34. formatted_raw_ostream &) {}
  35. /// emitBasicBlockStartAnnot - This may be implemented to emit a string right
  36. /// after the basic block label, but before the first instruction in the
  37. /// block.
  38. virtual void emitBasicBlockStartAnnot(const BasicBlock *,
  39. formatted_raw_ostream &) {
  40. }
  41. /// emitBasicBlockEndAnnot - This may be implemented to emit a string right
  42. /// after the basic block.
  43. virtual void emitBasicBlockEndAnnot(const BasicBlock *,
  44. formatted_raw_ostream &) {
  45. }
  46. /// emitInstructionAnnot - This may be implemented to emit a string right
  47. /// before an instruction is emitted.
  48. virtual void emitInstructionAnnot(const Instruction *,
  49. formatted_raw_ostream &) {}
  50. /// printInfoComment - This may be implemented to emit a comment to the
  51. /// right of an instruction or global value.
  52. virtual void printInfoComment(const Value &, formatted_raw_ostream &) {}
  53. };
  54. } // End llvm namespace
  55. #endif
  56. #ifdef __GNUC__
  57. #pragma GCC diagnostic pop
  58. #endif