11dbb3879e81c414733ee38ef6a5e657d7ed47e68Chris Lattner//===-- AssemblyAnnotationWriter.h - Annotation .ll files -------*- C++ -*-===//
29769ab22265b313171d201b5928688524a01bd87Misha Brukman//
30836bf7bcf5d62393eb6c01f775368d43e3d45cbChris Lattner//                     The LLVM Compiler Infrastructure
40836bf7bcf5d62393eb6c01f775368d43e3d45cbChris Lattner//
57ed47a13356daed2a34cd2209a31f92552e3bdd8Chris Lattner// This file is distributed under the University of Illinois Open Source
67ed47a13356daed2a34cd2209a31f92552e3bdd8Chris Lattner// License. See LICENSE.TXT for details.
79769ab22265b313171d201b5928688524a01bd87Misha Brukman//
80836bf7bcf5d62393eb6c01f775368d43e3d45cbChris Lattner//===----------------------------------------------------------------------===//
90836bf7bcf5d62393eb6c01f775368d43e3d45cbChris Lattner//
100836bf7bcf5d62393eb6c01f775368d43e3d45cbChris Lattner// Clients of the assembly writer can use this interface to add their own
110836bf7bcf5d62393eb6c01f775368d43e3d45cbChris Lattner// special-purpose annotations to LLVM assembly language printouts.  Note that
120836bf7bcf5d62393eb6c01f775368d43e3d45cbChris Lattner// the assembly parser won't be able to parse these, in general, so
130836bf7bcf5d62393eb6c01f775368d43e3d45cbChris Lattner// implementations are advised to print stuff as LLVM comments.
140836bf7bcf5d62393eb6c01f775368d43e3d45cbChris Lattner//
150836bf7bcf5d62393eb6c01f775368d43e3d45cbChris Lattner//===----------------------------------------------------------------------===//
160836bf7bcf5d62393eb6c01f775368d43e3d45cbChris Lattner
1737ed9c199ca639565f6ce88105f9e39e898d82d0Stephen Hines#ifndef LLVM_IR_ASSEMBLYANNOTATIONWRITER_H
1837ed9c199ca639565f6ce88105f9e39e898d82d0Stephen Hines#define LLVM_IR_ASSEMBLYANNOTATIONWRITER_H
190836bf7bcf5d62393eb6c01f775368d43e3d45cbChris Lattner
20d0fde30ce850b78371fd1386338350591f9ff494Brian Gaekenamespace llvm {
21d0fde30ce850b78371fd1386338350591f9ff494Brian Gaeke
220836bf7bcf5d62393eb6c01f775368d43e3d45cbChris Lattnerclass Function;
230836bf7bcf5d62393eb6c01f775368d43e3d45cbChris Lattnerclass BasicBlock;
240836bf7bcf5d62393eb6c01f775368d43e3d45cbChris Lattnerclass Instruction;
25066b5d8403483bf3a8bb033b690da318fbc68e79Benjamin Kramerclass Value;
267a5666e7f3ba5d7825e5d65d601f9679d10a56bbDan Gohmanclass formatted_raw_ostream;
270836bf7bcf5d62393eb6c01f775368d43e3d45cbChris Lattner
2842387462303a8eb917569305d5390c8da64ac82fChris Lattnerclass AssemblyAnnotationWriter {
2942387462303a8eb917569305d5390c8da64ac82fChris Lattnerpublic:
309769ab22265b313171d201b5928688524a01bd87Misha Brukman
31edd5d9ece15f73ec1a31423a4ae39774aa6c521cReid Spencer  virtual ~AssemblyAnnotationWriter();
32edd5d9ece15f73ec1a31423a4ae39774aa6c521cReid Spencer
337c1dfb9df29f03c218296db51963fe9c37c471d2Dan Gohman  /// emitFunctionAnnot - This may be implemented to emit a string right before
347c1dfb9df29f03c218296db51963fe9c37c471d2Dan Gohman  /// the start of a function.
35b39e25ef2c8d8c840ec4155e57c737ac7bd4f167Eli Friedman  virtual void emitFunctionAnnot(const Function *,
36b39e25ef2c8d8c840ec4155e57c737ac7bd4f167Eli Friedman                                 formatted_raw_ostream &) {}
370836bf7bcf5d62393eb6c01f775368d43e3d45cbChris Lattner
387c1dfb9df29f03c218296db51963fe9c37c471d2Dan Gohman  /// emitBasicBlockStartAnnot - This may be implemented to emit a string right
39a11a6a0abb0f09c5a381a7bb49901710a7b260f1Chris Lattner  /// after the basic block label, but before the first instruction in the
40a11a6a0abb0f09c5a381a7bb49901710a7b260f1Chris Lattner  /// block.
41b39e25ef2c8d8c840ec4155e57c737ac7bd4f167Eli Friedman  virtual void emitBasicBlockStartAnnot(const BasicBlock *,
42b39e25ef2c8d8c840ec4155e57c737ac7bd4f167Eli Friedman                                        formatted_raw_ostream &) {
430b6af79e627ca1222b1bf67dd555e41a3252ba77Chris Lattner  }
440b6af79e627ca1222b1bf67dd555e41a3252ba77Chris Lattner
457c1dfb9df29f03c218296db51963fe9c37c471d2Dan Gohman  /// emitBasicBlockEndAnnot - This may be implemented to emit a string right
467c1dfb9df29f03c218296db51963fe9c37c471d2Dan Gohman  /// after the basic block.
47b39e25ef2c8d8c840ec4155e57c737ac7bd4f167Eli Friedman  virtual void emitBasicBlockEndAnnot(const BasicBlock *,
48b39e25ef2c8d8c840ec4155e57c737ac7bd4f167Eli Friedman                                      formatted_raw_ostream &) {
490b6af79e627ca1222b1bf67dd555e41a3252ba77Chris Lattner  }
500836bf7bcf5d62393eb6c01f775368d43e3d45cbChris Lattner
517c1dfb9df29f03c218296db51963fe9c37c471d2Dan Gohman  /// emitInstructionAnnot - This may be implemented to emit a string right
527c1dfb9df29f03c218296db51963fe9c37c471d2Dan Gohman  /// before an instruction is emitted.
53b39e25ef2c8d8c840ec4155e57c737ac7bd4f167Eli Friedman  virtual void emitInstructionAnnot(const Instruction *,
54b39e25ef2c8d8c840ec4155e57c737ac7bd4f167Eli Friedman                                    formatted_raw_ostream &) {}
557a5666e7f3ba5d7825e5d65d601f9679d10a56bbDan Gohman
567a5666e7f3ba5d7825e5d65d601f9679d10a56bbDan Gohman  /// printInfoComment - This may be implemented to emit a comment to the
577a5666e7f3ba5d7825e5d65d601f9679d10a56bbDan Gohman  /// right of an instruction or global value.
58b39e25ef2c8d8c840ec4155e57c737ac7bd4f167Eli Friedman  virtual void printInfoComment(const Value &, formatted_raw_ostream &) {}
590836bf7bcf5d62393eb6c01f775368d43e3d45cbChris Lattner};
600836bf7bcf5d62393eb6c01f775368d43e3d45cbChris Lattner
61d0fde30ce850b78371fd1386338350591f9ff494Brian Gaeke} // End llvm namespace
62d0fde30ce850b78371fd1386338350591f9ff494Brian Gaeke
630836bf7bcf5d62393eb6c01f775368d43e3d45cbChris Lattner#endif
64