diff options
author | dim <dim@FreeBSD.org> | 2014-03-21 17:53:59 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2014-03-21 17:53:59 +0000 |
commit | 9cedb8bb69b89b0f0c529937247a6a80cabdbaec (patch) | |
tree | c978f0e9ec1ab92dc8123783f30b08a7fd1e2a39 /contrib/llvm/lib/Support/GraphWriter.cpp | |
parent | 03fdc2934eb61c44c049a02b02aa974cfdd8a0eb (diff) | |
download | FreeBSD-src-9cedb8bb69b89b0f0c529937247a6a80cabdbaec.zip FreeBSD-src-9cedb8bb69b89b0f0c529937247a6a80cabdbaec.tar.gz |
MFC 261991:
Upgrade our copy of llvm/clang to 3.4 release. This version supports
all of the features in the current working draft of the upcoming C++
standard, provisionally named C++1y.
The code generator's performance is greatly increased, and the loop
auto-vectorizer is now enabled at -Os and -O2 in addition to -O3. The
PowerPC backend has made several major improvements to code generation
quality and compile time, and the X86, SPARC, ARM32, Aarch64 and SystemZ
backends have all seen major feature work.
Release notes for llvm and clang can be found here:
<http://llvm.org/releases/3.4/docs/ReleaseNotes.html>
<http://llvm.org/releases/3.4/tools/clang/docs/ReleaseNotes.html>
MFC 262121 (by emaste):
Update lldb for clang/llvm 3.4 import
This commit largely restores the lldb source to the upstream r196259
snapshot with the addition of threaded inferior support and a few bug
fixes.
Specific upstream lldb revisions restored include:
SVN git
181387 779e6ac
181703 7bef4e2
182099 b31044e
182650 f2dcf35
182683 0d91b80
183862 15c1774
183929 99447a6
184177 0b2934b
184948 4dc3761
184954 007e7bc
186990 eebd175
Sponsored by: DARPA, AFRL
MFC 262186 (by emaste):
Fix mismerge in r262121
A break statement was lost in the merge. The error had no functional
impact, but restore it to reduce the diff against upstream.
MFC 262303:
Pull in r197521 from upstream clang trunk (by rdivacky):
Use the integrated assembler by default on FreeBSD/ppc and ppc64.
Requested by: jhibbits
MFC 262611:
Pull in r196874 from upstream llvm trunk:
Fix a crash that occurs when PWD is invalid.
MCJIT needs to be able to run in hostile environments, even when PWD
is invalid. There's no need to crash MCJIT in this case.
The obvious fix is to simply leave MCContext's CompilationDir empty
when PWD can't be determined. This way, MCJIT clients,
and other clients that link with LLVM don't need a valid working directory.
If we do want to guarantee valid CompilationDir, that should be done
only for clients of getCompilationDir(). This is as simple as checking
for an empty string.
The only current use of getCompilationDir is EmitGenDwarfInfo, which
won't conceivably run with an invalid working dir. However, in the
purely hypothetically and untestable case that this happens, the
AT_comp_dir will be omitted from the compilation_unit DIE.
This should help fix assertions occurring with ports-mgmt/tinderbox,
when it is using jails, and sometimes invalidates clang's current
working directory.
Reported by: decke
MFC 262809:
Pull in r203007 from upstream clang trunk:
Don't produce an alias between destructors with different calling conventions.
Fixes pr19007.
(Please note that is an LLVM PR identifier, not a FreeBSD one.)
This should fix Firefox and/or libxul crashes (due to problems with
regparm/stdcall calling conventions) on i386.
Reported by: multiple users on freebsd-current
PR: bin/187103
MFC 263048:
Repair recognition of "CC" as an alias for the C++ compiler, since it
was silently broken by upstream for a Windows-specific use-case.
Apparently some versions of CMake still rely on this archaic feature...
Reported by: rakuco
MFC 263049:
Garbage collect the old way of adding the libstdc++ include directories
in clang's InitHeaderSearch.cpp. This has been superseded by David
Chisnall's commit in r255321.
Moreover, if libc++ is used, the libstdc++ include directories should
not be in the search path at all. These directories are now only used
if you pass -stdlib=libstdc++.
Diffstat (limited to 'contrib/llvm/lib/Support/GraphWriter.cpp')
-rw-r--r-- | contrib/llvm/lib/Support/GraphWriter.cpp | 71 |
1 files changed, 44 insertions, 27 deletions
diff --git a/contrib/llvm/lib/Support/GraphWriter.cpp b/contrib/llvm/lib/Support/GraphWriter.cpp index bff182f..85be415 100644 --- a/contrib/llvm/lib/Support/GraphWriter.cpp +++ b/contrib/llvm/lib/Support/GraphWriter.cpp @@ -14,6 +14,7 @@ #include "llvm/Support/GraphWriter.h" #include "llvm/Config/config.h" #include "llvm/Support/CommandLine.h" +#include "llvm/Support/FileSystem.h" #include "llvm/Support/Path.h" #include "llvm/Support/Program.h" using namespace llvm; @@ -64,31 +65,46 @@ StringRef llvm::DOT::getColorString(unsigned ColorNumber) { return Colors[ColorNumber % NumColors]; } +std::string llvm::createGraphFilename(const Twine &Name, int &FD) { + FD = -1; + SmallString<128> Filename; + error_code EC = sys::fs::createTemporaryFile(Name, "dot", FD, Filename); + if (EC) { + errs() << "Error: " << EC.message() << "\n"; + return ""; + } + + errs() << "Writing '" << Filename << "'... "; + return Filename.str(); +} + // Execute the graph viewer. Return true if successful. static bool LLVM_ATTRIBUTE_UNUSED -ExecGraphViewer(const sys::Path &ExecPath, std::vector<const char*> &args, - const sys::Path &Filename, bool wait, std::string &ErrMsg) { +ExecGraphViewer(StringRef ExecPath, std::vector<const char*> &args, + StringRef Filename, bool wait, std::string &ErrMsg) { if (wait) { - if (sys::Program::ExecuteAndWait(ExecPath, &args[0],0,0,0,0,&ErrMsg)) { + if (sys::ExecuteAndWait(ExecPath, &args[0],0,0,0,0,&ErrMsg)) { errs() << "Error: " << ErrMsg << "\n"; return false; } - Filename.eraseFromDisk(); + bool Existed; + sys::fs::remove(Filename, Existed); errs() << " done. \n"; } else { - sys::Program::ExecuteNoWait(ExecPath, &args[0],0,0,0,&ErrMsg); + sys::ExecuteNoWait(ExecPath, &args[0],0,0,0,&ErrMsg); errs() << "Remember to erase graph file: " << Filename.str() << "\n"; } return true; } -void llvm::DisplayGraph(const sys::Path &Filename, bool wait, +void llvm::DisplayGraph(StringRef FilenameRef, bool wait, GraphProgram::Name program) { + std::string Filename = FilenameRef; wait &= !ViewBackground; std::string ErrMsg; #if HAVE_GRAPHVIZ - sys::Path Graphviz(LLVM_PATH_GRAPHVIZ); + std::string Graphviz(LLVM_PATH_GRAPHVIZ); std::vector<const char*> args; args.push_back(Graphviz.c_str()); @@ -99,9 +115,9 @@ void llvm::DisplayGraph(const sys::Path &Filename, bool wait, if (!ExecGraphViewer(Graphviz, args, Filename, wait, ErrMsg)) return; -#elif HAVE_XDOT_PY +#elif HAVE_XDOT std::vector<const char*> args; - args.push_back(LLVM_PATH_XDOT_PY); + args.push_back(LLVM_PATH_XDOT); args.push_back(Filename.c_str()); switch (program) { @@ -115,53 +131,51 @@ void llvm::DisplayGraph(const sys::Path &Filename, bool wait, args.push_back(0); errs() << "Running 'xdot.py' program... "; - if (!ExecGraphViewer(sys::Path(LLVM_PATH_XDOT_PY), args, Filename, wait, ErrMsg)) + if (!ExecGraphViewer(LLVM_PATH_XDOT, args, Filename, wait, ErrMsg)) return; #elif (HAVE_GV && (HAVE_DOT || HAVE_FDP || HAVE_NEATO || \ HAVE_TWOPI || HAVE_CIRCO)) - sys::Path PSFilename = Filename; - PSFilename.appendSuffix("ps"); - - sys::Path prog; + std::string PSFilename = Filename + ".ps"; + std::string prog; // Set default grapher #if HAVE_CIRCO - prog = sys::Path(LLVM_PATH_CIRCO); + prog = LLVM_PATH_CIRCO; #endif #if HAVE_TWOPI - prog = sys::Path(LLVM_PATH_TWOPI); + prog = LLVM_PATH_TWOPI; #endif #if HAVE_NEATO - prog = sys::Path(LLVM_PATH_NEATO); + prog = LLVM_PATH_NEATO; #endif #if HAVE_FDP - prog = sys::Path(LLVM_PATH_FDP); + prog = LLVM_PATH_FDP; #endif #if HAVE_DOT - prog = sys::Path(LLVM_PATH_DOT); + prog = LLVM_PATH_DOT; #endif // Find which program the user wants #if HAVE_DOT if (program == GraphProgram::DOT) - prog = sys::Path(LLVM_PATH_DOT); + prog = LLVM_PATH_DOT; #endif #if (HAVE_FDP) if (program == GraphProgram::FDP) - prog = sys::Path(LLVM_PATH_FDP); + prog = LLVM_PATH_FDP; #endif #if (HAVE_NEATO) if (program == GraphProgram::NEATO) - prog = sys::Path(LLVM_PATH_NEATO); + prog = LLVM_PATH_NEATO; #endif #if (HAVE_TWOPI) if (program == GraphProgram::TWOPI) - prog = sys::Path(LLVM_PATH_TWOPI); + prog = LLVM_PATH_TWOPI; #endif #if (HAVE_CIRCO) if (program == GraphProgram::CIRCO) - prog = sys::Path(LLVM_PATH_CIRCO); + prog = LLVM_PATH_CIRCO; #endif std::vector<const char*> args; @@ -174,12 +188,12 @@ void llvm::DisplayGraph(const sys::Path &Filename, bool wait, args.push_back(PSFilename.c_str()); args.push_back(0); - errs() << "Running '" << prog.str() << "' program... "; + errs() << "Running '" << prog << "' program... "; if (!ExecGraphViewer(prog, args, Filename, wait, ErrMsg)) return; - sys::Path gv(LLVM_PATH_GV); + std::string gv(LLVM_PATH_GV); args.clear(); args.push_back(gv.c_str()); args.push_back(PSFilename.c_str()); @@ -191,7 +205,7 @@ void llvm::DisplayGraph(const sys::Path &Filename, bool wait, return; #elif HAVE_DOTTY - sys::Path dotty(LLVM_PATH_DOTTY); + std::string dotty(LLVM_PATH_DOTTY); std::vector<const char*> args; args.push_back(dotty.c_str()); @@ -205,5 +219,8 @@ void llvm::DisplayGraph(const sys::Path &Filename, bool wait, errs() << "Running 'dotty' program... "; if (!ExecGraphViewer(dotty, args, Filename, wait, ErrMsg)) return; +#else + (void)Filename; + (void)ErrMsg; #endif } |