[llvm] r234807 - Allow printing functions with an optional annotationwriter
Daniel Berlin
dberlin at dberlin.org
Mon Apr 13 15:36:38 PDT 2015
Author: dannyb
Date: Mon Apr 13 17:36:38 2015
New Revision: 234807
URL: http://llvm.org/viewvc/llvm-project?rev=234807&view=rev
Log:
Allow printing functions with an optional annotationwriter
Modified:
llvm/trunk/include/llvm/IR/Function.h
llvm/trunk/lib/IR/AsmWriter.cpp
Modified: llvm/trunk/include/llvm/IR/Function.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Function.h?rev=234807&r1=234806&r2=234807&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/Function.h (original)
+++ llvm/trunk/include/llvm/IR/Function.h Mon Apr 13 17:36:38 2015
@@ -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
Modified: llvm/trunk/lib/IR/AsmWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/AsmWriter.cpp?rev=234807&r1=234806&r2=234807&view=diff
==============================================================================
--- llvm/trunk/lib/IR/AsmWriter.cpp (original)
+++ llvm/trunk/lib/IR/AsmWriter.cpp Mon Apr 13 17:36:38 2015
@@ -3059,6 +3059,13 @@ void AssemblyWriter::printUseLists(const
// 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);
More information about the llvm-commits
mailing list