AssemblyAnnotationWriter.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. //===-- AssemblyAnnotationWriter.h - Annotation .ll files -------*- 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. // Clients of the assembly writer can use this interface to add their own
  10. // special-purpose annotations to LLVM assembly language printouts. Note that
  11. // the assembly parser won't be able to parse these, in general, so
  12. // implementations are advised to print stuff as LLVM comments.
  13. //
  14. //===----------------------------------------------------------------------===//
  15. #ifndef LLVM_IR_ASSEMBLYANNOTATIONWRITER_H
  16. #define LLVM_IR_ASSEMBLYANNOTATIONWRITER_H
  17. namespace llvm {
  18. class Function;
  19. class BasicBlock;
  20. class Instruction;
  21. class Value;
  22. class formatted_raw_ostream;
  23. class AssemblyAnnotationWriter {
  24. public:
  25. virtual ~AssemblyAnnotationWriter();
  26. /// emitFunctionAnnot - This may be implemented to emit a string right before
  27. /// the start of a function.
  28. virtual void emitFunctionAnnot(const Function *,
  29. formatted_raw_ostream &) {}
  30. /// emitBasicBlockStartAnnot - This may be implemented to emit a string right
  31. /// after the basic block label, but before the first instruction in the
  32. /// block.
  33. virtual void emitBasicBlockStartAnnot(const BasicBlock *,
  34. formatted_raw_ostream &) {
  35. }
  36. /// emitBasicBlockEndAnnot - This may be implemented to emit a string right
  37. /// after the basic block.
  38. virtual void emitBasicBlockEndAnnot(const BasicBlock *,
  39. formatted_raw_ostream &) {
  40. }
  41. /// emitInstructionAnnot - This may be implemented to emit a string right
  42. /// before an instruction is emitted.
  43. virtual void emitInstructionAnnot(const Instruction *,
  44. formatted_raw_ostream &) {}
  45. /// printInfoComment - This may be implemented to emit a comment to the
  46. /// right of an instruction or global value.
  47. virtual void printInfoComment(const Value &, formatted_raw_ostream &) {}
  48. };
  49. } // End llvm namespace
  50. #endif