Allow printing functions with an optional annotationwriter
authorDaniel Berlin <dberlin@dberlin.org>
Mon, 13 Apr 2015 22:36:38 +0000 (22:36 +0000)
committerDaniel Berlin <dberlin@dberlin.org>
Mon, 13 Apr 2015 22:36:38 +0000 (22:36 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234807 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/IR/Function.h
lib/IR/AsmWriter.cpp

index acbabdda79f15b187d897d828b38d9386c28ac12..e94bf1fbe004ae18a276b32c29e316ef5a3eb80f 100644 (file)
@@ -453,6 +453,10 @@ public:
   Constant *getPrologueData() const;
   void setPrologueData(Constant *PrologueData);
 
+  /// Print the function to an output stream with an optional
+  /// AssemblyAnnotationWriter.
+  void print(raw_ostream &OS, AssemblyAnnotationWriter *AAW = nullptr) const;
+
   /// viewCFG - This function is meant for use from the debugger.  You can just
   /// say 'call F->viewCFG()' and a ghostview window should pop up from the
   /// program, displaying the CFG of the current function with the code for each
index f3ca13db5dd444852caa0389cf4ee3cdab5d1ba9..fd09d47c745785b62b382c544a16078ac87fdc98 100644 (file)
@@ -3059,6 +3059,13 @@ void AssemblyWriter::printUseLists(const Function *F) {
 //                       External Interface declarations
 //===----------------------------------------------------------------------===//
 
+void Function::print(raw_ostream &ROS, AssemblyAnnotationWriter *AAW) const {
+  SlotTracker SlotTable(this->getParent());
+  formatted_raw_ostream OS(ROS);
+  AssemblyWriter W(OS, SlotTable, this->getParent(), AAW);
+  W.printFunction(this);
+}
+
 void Module::print(raw_ostream &ROS, AssemblyAnnotationWriter *AAW) const {
   SlotTracker SlotTable(this);
   formatted_raw_ostream OS(ROS);