summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-11-19 07:44:09 +0000
committerChris Lattner <sabre@nondot.org>2005-11-19 07:44:09 +0000
commit377bdbff919d4bdb0244c3f577c4225abd6086c4 (patch)
tree162d37fbd50387c9ade08edfe5f6b9e740e083db /llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp
parent6bc0304c9144e01eaf008d3826f136c73002c026 (diff)
downloadbcm5719-llvm-377bdbff919d4bdb0244c3f577c4225abd6086c4.tar.gz
bcm5719-llvm-377bdbff919d4bdb0244c3f577c4225abd6086c4.zip
Improve Selection DAG printer portability. Patch by Owen Anderson!
llvm-svn: 24425
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp
index 73535809333..1782587c3e4 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp
@@ -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 @@ std::string DOTGraphTraits<SelectionDAG*>::getNodeLabel(const SDNode *Node,
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 @@ void SelectionDAG::viewGraph() {
#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
OpenPOWER on IntegriCloud