[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp
Chris Lattner
lattner at cs.uiuc.edu
Fri Nov 18 23:44:21 PST 2005
Changes in directory llvm/lib/CodeGen/SelectionDAG:
SelectionDAGPrinter.cpp updated: 1.26 -> 1.27
---
Log message:
Improve Selection DAG printer portability. Patch by Owen Anderson!
---
Diffs of the changes: (+6 -4)
SelectionDAGPrinter.cpp | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp:1.26 llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp:1.27
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp:1.26 Sat Nov 19 00:58:46 2005
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp Sat Nov 19 01:44:09 2005
@@ -18,6 +18,7 @@
#include "llvm/Target/MRegisterInfo.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Support/GraphWriter.h"
+#include "llvm/System/Path.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Config/config.h"
#include <fstream>
@@ -108,7 +109,8 @@
void SelectionDAG::viewGraph() {
// This code is only for debugging!
#ifndef NDEBUG
- std::string Filename = "/tmp/dag." +
+ std::string TempDir = sys::Path::GetTemporaryDirectory().toString();
+ std::string Filename = TempDir + "dag." +
getMachineFunction().getFunction()->getName() + ".dot";
std::cerr << "Writing '" << Filename << "'... ";
std::ofstream F(Filename.c_str());
@@ -135,13 +137,13 @@
#ifdef HAVE_GV
std::cerr << "Running 'dot' program... " << std::flush;
if (system(("dot -Tps -Nfontname=Courier -Gsize=7.5,10 " + Filename
- + " > /tmp/dag.tempgraph.ps").c_str())) {
+ + " > " + TempDir +"dag.tempgraph.ps").c_str())) {
std::cerr << "Error viewing graph: 'dot' not in path?\n";
} else {
std::cerr << "\n";
- system(LLVM_PATH_GV " /tmp/dag.tempgraph.ps");
+ system(LLVM_PATH_GV " " + TempDir + "dag.tempgraph.ps");
}
- system(("rm " + Filename + " /tmp/dag.tempgraph.ps").c_str());
+ system(("rm " + Filename + " "+ TempDir + "dag.tempgraph.ps").c_str());
return;
#endif // HAVE_GV
#endif // NDEBUG
More information about the llvm-commits
mailing list