Commit Graph

671 Commits

Author SHA1 Message Date
Dan Gohman
7db949df78 Fix a bunch of namespace pollution.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78363 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-07 01:32:21 +00:00
Dan Gohman
7b3544ba97 Minor code simplification.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78239 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-05 20:16:55 +00:00
Dan Gohman
88abb89183 Update a comment to reflect the current code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78215 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-05 17:32:39 +00:00
Dan Gohman
2cd498be60 Remove needless uses of std::flush in the parent process after a
fork call. This eliminates a need for <iostream>. Also remove
needless fsync calls.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78131 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-05 00:17:00 +00:00
Dan Gohman
339685269f Use _exit rather than exit in the child process after a failed exec.
Add a comment explaining why.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78128 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-05 00:09:12 +00:00
Dan Gohman
f363bc8326 Follow Unix behavior and return 127 if the command is not found,
and 126 if it is not executable.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78120 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-04 23:15:49 +00:00
Daniel Dunbar
6db0a8b4fd When exec() fails, return 127 instead of errno; the parent process has no way to
distinguish that the result is errno, so it can't use it to provide more
information about the error (it also exposes the numeric value of errno).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78098 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-04 20:32:25 +00:00
Daniel Dunbar
defc85327a Fix a race condition in getting the process exit code on Win32.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77953 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-03 05:02:46 +00:00
Daniel Dunbar
9a0b574ba4 Empty arguments need to be quoted on Win32.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77913 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-02 20:41:09 +00:00
Chris Lattner
afebf3548b eXtensible Systems doesn't exist any more and Reid donated this to the
project under the normal license, yay. :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77823 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-01 22:54:17 +00:00
Dan Gohman
28daa10246 Remove another F_OK.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77405 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-29 00:02:58 +00:00
Dan Gohman
a87861e4f8 On "Unix", if Program::FindProgramByName is given a name containing
slashes, just go with it, regardless of whether it looks like it will
be executable. This follows the behavior of sh(1) more closely.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77396 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-28 23:25:18 +00:00
Dan Gohman
73c74ead21 It isn't necessary to use F_OK when using R_OK or similar.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77392 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-28 23:22:01 +00:00
Benjamin Kramer
b0facb18df Fix a fixme; don't take binaries from the working directory.
This fixes clang on non-darwin platforms if a file called 'ld' or 'as'
is in the working directory. Based on patch by Pawel Worach!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77379 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-28 22:08:15 +00:00
Douglas Gregor
e34887d5d0 CMake: make sure that the *.inc files for libSystem show up in the resulting
project.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77213 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-27 17:55:55 +00:00
Daniel Dunbar
2749b3e745 Don't use llvm_report_error in libSystem, this is a layering violation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77169 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-26 21:16:42 +00:00
Reid Kleckner
10b4fc552f Re-committing r76828 with the JIT memory manager changes now that the build
bots like the BumpPtrAllocator changes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76902 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-23 21:46:56 +00:00
Reid Kleckner
4bf370698a Reverting r76825 and r76828, since they caused clang runtime errors and some build failure involving memset.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76838 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-23 01:40:54 +00:00
Reid Kleckner
81ce3ed08c Make the JIT code emitter properly retry and ask for more memory when it runs
out of memory, and also make the default memory manager allocate more memory
when it runs out.

Also, switch function stubs and global data over to using the BumpPtrAllocator.

This makes it so the JIT no longer mmaps (or the equivalent on Windows) 16 MB
of memory, and instead allocates in 512K slabs.  I suspect this size could go
lower, especially on embedded platforms, now that more slabs can be allocated.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76828 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-23 00:49:59 +00:00
Mikhail Glushenkov
3140619c63 Remove duplication in Program::Execute{And,No}Wait.
Implemented by moving the code out of static functions into methods of Program
class.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76340 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-18 21:43:12 +00:00
Mikhail Glushenkov
234f6893a2 Trailing whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76229 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-17 20:38:17 +00:00
Ted Kremenek
1935629829 Lexically order files in CMakeLists.txt files.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75831 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-15 21:08:16 +00:00
Daniel Dunbar
cae9a3f51d Use llvm_report_error, not llvm_unreachable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75429 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-12 21:01:49 +00:00
Daniel Dunbar
a00e85c9b1 Improve sys::Path::makeAbsolute on Win32.
- Patch by Viktor Kutuzov!

 - Minor tweak by me to add llvm_unreachable calls on FIXMEd error paths.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75424 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-12 20:23:56 +00:00
Chris Lattner
0f55014430 "UNIX paths can contain non-ASCII characters, so Path::isValid() should not reject paths with such characters in them. The attached patch removes the check from Path::isValid()."
patch by Benjamin Kramer!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75421 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-12 19:01:16 +00:00
Chris Lattner
ac356602f2 eraseFromDisk no longer throws.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75139 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-09 16:17:28 +00:00
David Greene
59629c1d8b Add an ExecuteNoWait interface to support asynchronous process spawning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75055 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-08 21:46:40 +00:00
Chris Lattner
8b8d31e3ec remove two methods that no longer exist.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74982 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-08 01:07:39 +00:00
Chris Lattner
01d9a1b78d more getting windows to build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74981 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-08 00:52:12 +00:00
Chris Lattner
8e5a084d47 hopefully fix the build on windows.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74977 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-08 00:29:32 +00:00
Chris Lattner
a9b7d60d67 Eliminate the static constructors and locks from DynamicLibrary.cpp.
This fixes PR4512 and eliminating static ctors is always good.  Losing
thread safety is unfortunate, but the code is just incredibly poorly
designed.

If someone is interested, the "right" solution is to split
DynamicLibrary.cpp into two separate pieces: a stateless piece in
libsystem, and a simple support file in libsupport that has the
"state" (e.g.  AddSymbol) in managed static objects.

Doing this would both fix memory leaks we already have, as well as make
the code thread safe again.  it would also make sense to move all the
unix specific code in System/DynamicLibrary.cpp into 
System/Unix/DynamicLibrary.inc.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74927 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-07 18:17:07 +00:00
Chris Lattner
72501b4a21 remove dead code, noone creates instances of "DynamicLibrary", so the ctor and dtor are dead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74926 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-07 18:01:58 +00:00
Chris Lattner
0875c7ccf5 we don't use libtool anymore, update comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74924 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-07 17:50:11 +00:00
Owen Anderson
643dda1d62 No need to double-include config.h
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74854 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-06 21:24:37 +00:00
Owen Anderson
3d7622d0f5 We need to include config.h to get the proper setting to LLVM_MULTITHREADED.
Patch by Xerxes Ranby.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74846 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-06 18:50:47 +00:00
Chris Lattner
c880815c40 improve portability to windows, patch by Xerces Ranby!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74835 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-06 17:24:48 +00:00
Jeffrey Yasskin
4733e747d1 Oops, I #included errno.h from inside the llvm::sys namespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74834 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-06 16:50:27 +00:00
Duncan Sands
9170d592ee Fix windows build, patch by Howard Su.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74697 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-02 12:09:50 +00:00
Jeffrey Yasskin
ed1c0ffe0b Add a portable strerror*() wrapper, llvm::sys::StrError(). This includes the
Windows variant, strerror_s, but I couldn't test that.

I'll update configure and config.h.in in a subsequent patch.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74621 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-01 18:11:20 +00:00
Owen Anderson
4127ccdb8d Try again at making this work on OpenBSD.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74612 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-01 16:19:23 +00:00
Owen Anderson
91aef8ba97 Fix the build on OpenBSD.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74597 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-01 06:53:29 +00:00
Oscar Fuentes
2b1a6e7581 Fixed assert that checks return value of TlsSetValue.
See http://msdn.microsoft.com/en-us/library/ms686818(VS.85).aspx

Patch by Olaf Krzikalla!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74526 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-30 14:12:28 +00:00
Owen Anderson
02b97355aa Fix compilation without pthreads.
Patch by Xerxes Ranby.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74283 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 08:48:03 +00:00
Daniel Dunbar
6f8f6066fd Fix unused variable warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74250 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 01:34:35 +00:00
Owen Anderson
1c7a848e54 Fix error in the Win32 implementation pointed out by Howard Su.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74248 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 00:51:20 +00:00
Owen Anderson
438d3946af Add support for const thread locals.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74226 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-25 23:31:18 +00:00
Owen Anderson
7e026b74dd Fix typo in assertion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74225 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-25 23:28:28 +00:00
Owen Anderson
27fcfe1364 Add a configure test for pthread_getspecific, and use it when building ThreadLocal.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74222 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-25 23:10:26 +00:00
Owen Anderson
3c99d29b60 Update cmake build files.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74210 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-25 21:58:34 +00:00
Owen Anderson
4a28522c1a Add a class for supporting platform independent thread-local storage.
Windows people, please double-check/patch this.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74209 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-25 21:58:01 +00:00
Owen Anderson
f37feb954f Guard dynamic library loading.
I did my best at implementing this for Win32, but I don't have a way to test it.
Can someone with access to a Win32 machine test/fix this?


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74188 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-25 18:12:44 +00:00
Owen Anderson
e0fa0b42b2 Add atomic multiply and divide operations, built on top of CompareAndSwap.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74004 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-23 21:19:04 +00:00
Owen Anderson
6f2c64d70a Revert my last series of commits related to Timer and 64-bit atomics. Not all the targets
we care about are capable of supporting it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73993 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-23 20:17:22 +00:00
Owen Anderson
f43f9d0ef8 Atomic ops that do arithmetic use signed arithmetic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73980 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-23 18:30:27 +00:00
Owen Anderson
0de9953e88 Label the existing atomic functions as 32-bit specific, and add a 64-bit one that will be useful in
the near future.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73971 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-23 18:01:04 +00:00
Owen Anderson
5a9c0eeaf2 Add an atomic add operation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73964 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-23 17:39:31 +00:00
Owen Anderson
107a537db1 Workaround for an... interesting bug in Darwin's pthread_rwlock_init.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73806 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-20 00:32:27 +00:00
Owen Anderson
b9c2f58229 Fix bad paste-o in the MSVC atomics.
Patch by Иван Сорокин.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73779 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-19 18:37:50 +00:00
Owen Anderson
b65e9ed106 Give RWMutex the SmartRWMutex treatment too.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73710 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-18 18:26:15 +00:00
Owen Anderson
b849a4dd4b Insert a SmartMutex templated class into the class hierarchy, which takes a template parameter specifying whether this mutex
should become a no-op when not running in multithreaded mode.  Make sys::Mutex a typedef of SmartMutex<false>, to preserve source compatibility.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73709 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-18 17:53:17 +00:00
Ted Kremenek
e53118ea32 Update CMake files to account for new location of Threading.cpp.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73708 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-18 17:47:09 +00:00
Owen Anderson
e3cd5ca7e7 Move Threading.[h|cpp] from Support to System.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73707 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-18 16:54:52 +00:00
Owen Anderson
6904858ab3 Fix build when disable thread support.
Patch by Howard Su.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73680 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-18 04:44:46 +00:00
Douglas Gregor
71c4a08869 Add RWMutex.cpp to the CMake makefiles
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73615 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-17 17:01:30 +00:00
Owen Anderson
c9f8e8ebab Improve the Win32 reader-writer lock implementation by making it just a normal
lock.  This is obviously bad, but at least it's threadsafe!  If you know how
to improve this in a pre-Vista friendly well, patches welcome!

Patch by Max Burke.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73607 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-17 09:10:42 +00:00
Owen Anderson
efdbfc4cef Use atomic increment/decrement for reference counting of Type's.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73588 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-17 00:28:49 +00:00
Owen Anderson
9a3df671ab Add an atomic increment and decrement implementation, which will be used for
thread-safe reference counting.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73587 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-17 00:13:00 +00:00
Owen Anderson
95efbcb5e1 Accidentally broke this file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73552 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-16 20:57:51 +00:00
Owen Anderson
d76a0775f1 Remove the Win32 implementation, since it doesn't compile pre-Vista.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73550 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-16 20:49:20 +00:00
Owen Anderson
ff30b7d173 Fix/cleanup trailing newlines.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73546 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-16 20:23:05 +00:00
Owen Anderson
2a8cf9aadd Add a portable wrapper for reader-writer locks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73545 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-16 20:19:28 +00:00
Dan Gohman
070c42f311 glibc has two versions of strerror_r, a standards compliant one and a GNU
specific one. The GNU one is chosen when _GNU_SOURCE is defined. g++ always
defines _GNU_SOURCE on linux platforms because glibc's headers won't compile
in C++ mode without it. The GNU strerror_r doesn't always modify the buffer
which causes empty error messages on linux.

This patch changes MakeErrMsg to use the return value of strerror_r to get
the string instead of assuming the buffer will be modified, on GLIBC.

Patch by Benjamin Kramer!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73396 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-15 18:05:46 +00:00
Chris Lattner
c5718d073c "This patch implements the method with the GetModuleFileName function for windows."
Patch by Benjamin Kramer!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73379 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-15 05:38:04 +00:00
Chris Lattner
88d7e403d0 add a new static method to portably determine whether a patch is
absolute or not, based on a patch by Gregory Curfman!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73368 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-15 04:17:07 +00:00
Torok Edwin
6c8db34165 Fix comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72858 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-04 08:18:25 +00:00
Torok Edwin
e8ebb0fe1b Add support for outputting ANSI colors to raw_fd_ostream.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72854 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-04 07:09:50 +00:00
Duncan Sands
05a8c87bb2 At a newline at the end of this file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72767 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-03 11:54:28 +00:00
Owen Anderson
d8cf40372e Undef MemoryFence when compiling on MSVC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72732 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-02 17:35:55 +00:00
Bill Wendling
51b16f4737 Untabification.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72604 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-30 01:09:53 +00:00
Jay Foad
a14be3b264 Work around a page size issue on Cygwin.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72332 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-23 17:57:59 +00:00
Owen Anderson
4a4ea14f7d Add Atomic.cpp to the CMake build system.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72202 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-21 00:48:56 +00:00
Owen Anderson
2aa783b2e7 Tabs, be gone!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72180 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-20 19:06:49 +00:00
Owen Anderson
41583b97ce I just fail today.
Hopefully this fixes the last build errors on systems with GCC < 4.1.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72179 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-20 19:01:50 +00:00
Owen Anderson
d208fd7bdb Copy-and-paste-o.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72177 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-20 18:47:53 +00:00
Owen Anderson
3c1eaa0dc2 Move atomic operations' definitions out of line. While this seems kind of silly,
all kinds of problems caused by including windows.h and/or config.h in an LLVM header.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72174 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-20 18:26:15 +00:00
Douglas Gregor
071d73d67e termios.h contains the winsize structure we need to determine the
width of a terminal. Don't try to get the width of a terminal if we
don't have this header.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72018 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-18 17:21:34 +00:00
Douglas Gregor
01746745f1 Add terminal width detection to llvm::sys::Process. This is needed to
fix Clang PRs 4148 and 4183.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71448 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-11 18:05:52 +00:00
Stefanus Du Toit
5a4e11dd3f Fix choice of version of Windows callback to use to consider not only the Visual Studio version, but also the Windows SDK version.
Patch by Tareq Siraj.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70299 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-28 16:37:58 +00:00
Torok Edwin
4cdc44c82c Fix g++-4.4.0 warning, it was causing llvm-nm to fail on wrapped BC files:
Path.cpp:59: warning: case label value exceeds maximum value for type
magic[0] is a (signed) char, but some case values are unsigned (e.g. 0xde).
When magic[0] was 0xde, the switch has taken the default branch instead of case
0xde branch.
Apparently this was the behaviour with older versions of gcc too, but not with g++.
Now g++-4.4 behaves as gcc, and ignores unsigned case values out of range signed
range.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70038 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-25 10:25:12 +00:00
Anton Korobeynikov
83985d706b Silence warnings.
Patch by Jay Foad!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69679 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-21 16:04:56 +00:00
Anton Korobeynikov
0957fcbe0c Drop obsolete reference to __eprintf.
Patch by Jay Foad!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69678 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-21 16:04:41 +00:00
Daniel Dunbar
a7f2a9e69f Make Unix.h:MakeErrMsg separate the prefix and errno string, so we get:
clang: error: unable to make temporary file: /etc/cc: can't make
  unique filename: Permission denied

instead of 

  clang: error: unable to make temporary file: /etc/cc: can't make
  unique filenamePermission denied

for example.

Also, audited the uses of MakeErrMsg to make the prefix strings
consistent (not end with newline/punctuation/space/": ").


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69626 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-20 20:50:13 +00:00
Mikhail Glushenkov
0526653956 Call CreateProcess with bInheritHandles = TRUE.
Makes llvmc show error messages printed by child processes when run from the
Cygwin/MSYS shell. Since ExecuteAndWait does not return until the child program
has finished execution, this change should be harmless.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69082 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-14 21:31:36 +00:00
Mikhail Glushenkov
bd50a16723 Delete trailing whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69081 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-14 21:31:14 +00:00
Chris Lattner
b7253150ab fix PR3965:SIGINT handler not restored after calling ParseAST(),
patch by Alexei Svitkine!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68929 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-12 23:33:13 +00:00
Daniel Dunbar
6ddf2c1930 Add sys::Path::makeAbsolute().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68663 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-09 00:33:08 +00:00
Chris Lattner
c23c1fc559 hopefully fix an apparent build error on windows.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68175 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-01 02:03:38 +00:00
Daniel Dunbar
be46c79501 Add llvm::sys::getHostTriple and remove
llvm::sys::getOS{Name,Version}.

Right now the implementation just derives from LLVM_HOSTTRIPLE (which
is wrong, but it doesn't look like we have a define for the target
triple). Ideally this routine would actually be able to compute the
triple for targets we care about.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68118 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-31 17:30:15 +00:00
Chris Lattner
a8bd27ff66 fix a bug Alexei Svitkine pointed out.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67510 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-23 06:46:20 +00:00
Chris Lattner
eab5cb3b55 When we restore signal handlers, restore them back to what they
were when we came around, not to their default handler.  This 
should fix PR3848


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67509 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-23 05:55:36 +00:00
Chris Lattner
1c4d8a00ab factorize signal registration, part of PR3848.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67508 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-23 05:42:29 +00:00
Sebastian Redl
48fe63526e Fix the Win32 VS2008 build:
- Make type declarations match the struct/class keyword of the definition.
 - Move AddSignalHandler into the namespace where it belongs.
 - Correctly call functions from template base.
 - Some other small changes.
With this patch, LLVM and Clang should build properly and with far less noise under VS2008.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67347 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-19 23:26:52 +00:00
Chris Lattner
f48ba7b74c add some explicit llvm:: qualifiers to the unix side, fix problems on the windows side.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66386 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-08 19:13:45 +00:00
Chris Lattner
922a881f32 When a crash signal is delivered do two things: remove all of our
signal handlers to prevent reentrance on unrelated things (a sigabort
where the handle bus errors) also, clear the signal mask so that the
signal doesn't infinitely reissue.  This fixes rdar://6654827 -
Crash causes clang to loop



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66330 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-07 08:15:47 +00:00
Chris Lattner
0f6290d698 move some code to gracefully handle the case when a handler crashes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66171 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-05 18:22:14 +00:00
Chris Lattner
35033a5876 Add a new 'AddSignalHandler' function to Signals.h that allows
arbitrary functions to be run when a crash happens.  Delete 
RemoveDirectoryOnSignal as it is dead and has never had clients.

Change PrintStackTraceOnErrorSignal to be implemented in terms of
AddSignalHandler.

I updated the Win32 versions of these APIs, but can't test them.
If there are any problems, I'd be happy to fix them as well.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66072 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-04 21:21:36 +00:00
Chris Lattner
893a0f9f0e Fix main executable path name resolution on FreeBSD, patch by
Ed Schouten!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65882 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-02 22:17:15 +00:00
Chris Lattner
d18a2c1eae If an executable is run through a symlink, dladdr will return the
symlink.  We really want the ultimate executable being run, not
the symlink.  This lets clang find its headers when invoked through
a symlink. rdar://6602012


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65017 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-19 05:34:35 +00:00
Mikhail Glushenkov
8eada627d5 Fix warning on gcc 4.3.
"system() declared with attribute warn_unused_result."

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64574 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-15 03:20:32 +00:00
Mikhail Glushenkov
b8863a16ad Whitespace fixes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64573 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-15 03:20:03 +00:00
Cedric Venet
aff9c270de Unbreak the build on win32.
Cleanup some warning.

Remark: when struct/class are declared differently than they are defined, this make problem for VC++ since it seems to mangle class differently that struct. These error are very hard to understand and find. So please, try to keep your definition/declaration in sync.

Only tested with VS2008. hope it does not break anything. feel free to revert.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64554 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-14 16:06:42 +00:00
Julien Lerouge
9430fe7092 Fix MingW build, patch by Kenneth Boyd!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64366 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-12 07:39:10 +00:00
Dan Gohman
d4e1845849 Use const, to support platforms where strrchr returns a const char *.
This fixes PR3535.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64224 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-10 17:56:28 +00:00
Mikhail Glushenkov
ba041f45fe Add a Sleep() function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64101 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-08 22:47:39 +00:00
Mikhail Glushenkov
0cdadd8b9d Add Emacs hints to Alarm.inc.
Also removes some trailing whitespace and fixes one 80-column violation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64094 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-08 21:10:57 +00:00
Chris Lattner
f87d28745a Fix windows build, patch by Marius Wachtler!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63325 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-29 18:53:28 +00:00
Chris Lattner
cee3e7cb68 Fix PR3424, a static constructor ordering issue. Patch by Robert Schuster!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63269 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-29 04:43:42 +00:00
Chris Lattner
b67c958342 rename methods in System/Host to be more consistent.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62776 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-22 19:53:00 +00:00
Misha Brukman
9b8f542e27 Removed trailing whitespace from Makefiles.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61991 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-09 16:44:42 +00:00
Dan Gohman
dd17b25611 Don't use plain %x to print pointer values. I had changed it from %p
since %p isn't formatted consistently, but obviously plain %x is wrong.
PRIxPTR with a cast to uintptr_t would work here, but that requires
inconvenient build-system changes. %lu works on all current and
foreseable future hosts.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60616 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-05 23:39:24 +00:00
Dan Gohman
56d9b6dff3 Demangle and pretty-print symbols in internal backtraces. Patch by
Wesley Peck, with a few fixes by me.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60605 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-05 20:12:48 +00:00
Evan Cheng
c663beecdb ARM / Mac OS X also wants to invalidate icache after jitting.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59291 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-14 02:33:17 +00:00
Oscar Fuentes
bc8dda83ef CMake: when bulding shared libraries on non-WIN32 systems, link dl to
LLVMSystem.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59159 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-12 20:40:56 +00:00
Nuno Lopes
274c6a6145 plug leakage of mutex data. pthread_mutex_destroy() doesnt free our malloc'ed memory.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58805 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-06 16:21:49 +00:00
Evan Cheng
afc0e0ac1c hasDisassembler should return false if disassembler isn't available.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58682 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-04 06:09:38 +00:00
Anton Korobeynikov
fc09f64209 Silence a warning
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58563 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-02 11:47:11 +00:00
Jim Grosbach
932a32d251 Update the stub and callback code to handle lazy compilation. The stub
is re-written by the callback to branch directly to the compiled code
in future invocations.

Added back in range-based memory permission functions for the updating of
the stub on Darwin.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57846 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-20 21:39:23 +00:00
Duncan Sands
4520dd2b7b Add <cstdio> include where needed by gcc-4.4.
Patch by Samuel Tardieu.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57291 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-08 07:23:46 +00:00
Argyrios Kyrtzidis
c8a07733d3 Add implementations for sys::Memory::setWritable and sys::Memory::setExecutable on Win32 platform.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57047 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-04 08:15:32 +00:00
Jim Grosbach
cce6c297c5 On Darwin ARM, memory needs special handling to do JIT. This patch expands
this handling to work properly for modifying stub functions, relocations
back to entry points after JIT compilation, etc..


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57013 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-03 16:17:20 +00:00
Oscar Fuentes
208ca6aa14 CMake: Added Host.cpp to lib/System/CMakeLists.txt.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56957 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-02 17:39:29 +00:00
Daniel Dunbar
bb14672097 Add llvm::sys::{osName,osVersion} for retrieving operating system name
& version as strings.
 - Win32 code is untested.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56942 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-02 01:17:28 +00:00
Oscar Fuentes
3d01fc7de8 Initial support for the CMake build system.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56419 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-22 01:08:49 +00:00
Evan Cheng
bc4707a255 Preliminary support for systems which require changing JIT memory regions privilege from read / write to read / executable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56303 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-18 07:54:21 +00:00
Evan Cheng
19a341acb8 AllocateRWXMemory -> AllocateRWX.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56244 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-16 17:28:18 +00:00
Chris Lattner
0eab5e2efa add a helper method to sys::Path for clang, patch by
Kovarththanan Rajaratnam!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54655 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-11 23:39:47 +00:00
Devang Patel
bdfa9ac445 Create temp. file in current path.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53973 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-24 00:35:38 +00:00
Devang Patel
ce8fdf105c While creating temp. file on disk, if the current filename points to a existing directory then create new temp. file inside the directory.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53929 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-22 20:02:39 +00:00
Devang Patel
54ce536a2d Handle bitcode wrappers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53924 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-22 18:00:36 +00:00
Chris Lattner
ae55e04d7a open plugins with RTLD_GLOBAL, pointed out by Bram Adams.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53385 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-10 00:52:20 +00:00
Chris Lattner
6fa6a32e4e Add a little wrapper header that is put around bc files when emitting
bc files for modules with a target triple that indicates they are for
darwin.  The reader unconditionally handles this, and the writer could
turn this on for more targets if we care.

This change has two benefits for darwin:

1) it allows us to encode the cpu type of the file in an easy to read
   place that doesn't require decoding the bc file.
2) it works around a bug (IMO) in darwin's AR where it is incapable of
   handling files that are not a multiple of 8 bytes long.  BC files
   are only guaranteed to be multiples of 4 bytes long.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53275 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-09 05:14:23 +00:00
Seo Sanghyeon
fd6437f4f9 Fix GetMainExecutable. Patch by Sam Bishop.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52847 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-27 22:55:30 +00:00
Matthijs Kooijman
f512281d61 Make LLVM compile on DragonFly BSD (PR2499).
Patch by Hasso Tepper!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52781 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-26 10:36:58 +00:00
Bill Wendling
fc1fd54a34 Cleanup for unitialized types. Patch by Jean-Daniel Dupas!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52775 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-26 08:32:05 +00:00
Chris Lattner
6521549188 "An improved Mach-O file type detection for sys::IdentifyFileType()
This patch add supports for single architecture mach-o files (the current implementation only support Universal Binary), and solve the signature conflict between java class and Universal Binary magics.

Note that this function will always returned dynamic library for Universal Binaries (like the current implementation) because the binary type is not include in the file header."

Patch by Jean-Daniel Dupas!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52766 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-26 05:17:18 +00:00
Chris Lattner
95f39009aa fix compilation errors in my previous patch
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52733 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-25 17:17:53 +00:00
Chris Lattner
93bb4aa0ce Add a new InvalidateInstructionCache method to sys::Memory.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52731 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-25 17:14:10 +00:00
Dan Gohman
933e51c5e3 Use static_cast instead of reinterpret_cast for casting void*.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52592 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-21 20:17:03 +00:00
Argyrios Kyrtzidis
4bd3225088 Minor comment fix.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52312 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 10:14:09 +00:00
Wojciech Matyjewicz
93c534623c Add a missing semicolon.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52290 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-15 18:02:47 +00:00