summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support
Commit message (Collapse)AuthorAgeFilesLines
...
* reimplement truncate() to make it optimal.Nuno Lopes2012-07-191-10/+45
| | | | | | | | It is optimal at least up to 7 bits (I've tested all such cases) This change to truncate() allows a little simplification to the multiplication code, and it also makes multiplication optimal :) llvm-svn: 160512
* Remove tabs.Bill Wendling2012-07-191-4/+4
| | | | llvm-svn: 160479
* Remove tabs.Bill Wendling2012-07-192-4/+4
| | | | llvm-svn: 160476
* This patch fixes 8 out of 20 unexpected failures in "make check"Preston Gurd2012-07-181-0/+3
| | | | | | | | | | | | | | | when run on an Intel Atom processor. The failures have arisen due to changes elsewhere in the trunk over the past 8 weeks or so. These failures were not detected by the Atom buildbot because the CPU on the Atom buildbot was not being detected as an Atom CPU. The fix for this problem is in Host.cpp and X86Subtarget.cpp, but shall remain commented out until the current set of Atom test failures are fixed. Patch by Andy Zhang and Tyler Nowicki! llvm-svn: 160451
* simplify getSetSize() per Duncan's commentsNuno Lopes2012-07-171-6/+5
| | | | llvm-svn: 160368
* teach ConstantRange that zero times X is always zeroNuno Lopes2012-07-161-0/+6
| | | | llvm-svn: 160317
* make ConstantRange::getSetSize() properly compute the size of wrapped and ↵Nuno Lopes2012-07-161-8/+10
| | | | | | | | full sets. Make it always return APInts with the same bitwidth for the same ConstantRange bitwidth to simply clients llvm-svn: 160294
* Fixed few warnings.Galina Kistanova2012-07-123-7/+10
| | | | llvm-svn: 160142
* In MemoryBuffer::getOpenFile() don't verify that the mmap'edArgyrios Kyrtzidis2012-07-111-10/+0
| | | | | | | | | | | | file buffer is null-terminated. If the file is smaller than we thought, mmap will not allow dereferencing past the pages that are enough to cover the actual file size, even though we asked for a larger address range. rdar://11612916 llvm-svn: 160075
* PR13326: Fix a subtle edge case in the udiv -> magic multiply generator.Benjamin Kramer2012-07-111-1/+1
| | | | | | This caused 6 of 65k possible 8 bit udivs to be wrong. llvm-svn: 160058
* Enable automatic GCC<->LLVM intrinsic translation for mips.Benjamin Kramer2012-06-281-1/+6
| | | | llvm-svn: 159367
* add ConstantRange::difference (to perform set difference/relative complement)Nuno Lopes2012-06-281-0/+6
| | | | llvm-svn: 159352
* fix a off-by-one bug in intersectWith(), and add a bunch of testsNuno Lopes2012-06-281-1/+1
| | | | llvm-svn: 159319
* Implement getHostCPUName for ARM/linux. This will be used to implement ↵Benjamin Kramer2012-06-261-0/+55
| | | | | | | | | | -march=native in clang. The cpuid registers are only available in privileged mode so we don't have an OS-independent way of implementing this. ARM doesn't provide a list of processor IDs so the list is somewhat incomplete. llvm-svn: 159228
* Fix ThreadLocalImpl::getInstance for --disable-threads.Argyrios Kyrtzidis2012-06-261-3/+5
| | | | | | PR13114. llvm-svn: 159210
* PR13013: ELF Type identification fails for MSB type ELF files.Meador Inge2012-06-251-2/+5
| | | | | | | | | Fix 'sys::IdentifyFileType' to work with big and little endian byte orderings when reading the ELF object file type. Initial patch by Stefan Hepp. llvm-svn: 159138
* llvm/lib/Support/Errno.cpp: [Win32] Fix usage of strerror_s().NAKAMURA Takumi2012-06-241-1/+1
| | | | | | FYI, two arguments of strerror_s() is provided in C++ on msvc. llvm-svn: 159103
* Remove an "else" that snuck in after a "return" ;)Kaelyn Uhrain2012-06-201-1/+1
| | | | llvm-svn: 158844
* Check that a file is not a directory before reading it into a MemoryBuffer.Kaelyn Uhrain2012-06-201-0/+9
| | | | llvm-svn: 158841
* Unbreak the MSVC build: add return to unimplemented functions.Francois Pichet2012-06-201-0/+2
| | | | llvm-svn: 158788
* Add permissions(), map_file_pages(), and unmap_file_pages() to llvm::sys::fs ↵Nick Kledzik2012-06-202-7/+117
| | | | | | and add unit test. Unix is implemented. Windows side needs to be implemented. llvm-svn: 158770
* Don't assert when given an empty range.Kaelyn Uhrain2012-06-201-1/+1
| | | | | | | | | | llvm::RawMemoryObject handles empty ranges just fine, and the assert can be triggered in the wild by e.g. invoking clang with a file that included an empty pre-compiled header file when clang has been built with assertions enabled. Without assertions enabled, clang will properly report that the empty file is not a valid PCH. llvm-svn: 158769
* Fix PR13148, an inf-loop in StringMap.Chandler Carruth2012-06-191-1/+1
| | | | | | | | | | | | | | | StringMap suffered from the same bug as DenseMap: when you explicitly construct it with a small number of buckets, you can arrange for the tombstone-based growth path to be followed when the number of buckets was less than '8'. In that case, even with a full map, it would compare '0' as not less than '0', and refuse to grow the table, leading to inf-loops trying to find an empty bucket on the next insertion. The fix is very simple: use '<=' as the comparison. The same fix was applied to DenseMap as well during its recent refactoring. Thanks to Alex Bolz for the great report and test case. =] llvm-svn: 158725
* [Support/PathV2] Fix out of bounds access in identify_magic when the file is ↵Michael J. Spencer2012-06-191-0/+2
| | | | | | empty. llvm-svn: 158704
* Don't call 'FilesToRemove[0]' when the vector is empty, even to computeChandler Carruth2012-06-161-1/+1
| | | | | | | the address of it. Found by a checking STL implementation used on a dragonegg builder. Sorry about this one. =/ llvm-svn: 158582
* Harden the Unix signals code to be more async signal safe.Chandler Carruth2012-06-161-9/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is likely only the tip of the ice berg, but this particular bug caused any double-free on a glibc system to turn into a deadlock! It is not generally safe to either allocate or release heap memory from within the signal handler. The 'pop_back()' in RemoveFilesToRemove was deleting memory and causing the deadlock. What's worse, eraseFromDisk in PathV1 has lots of allocation and deallocation paths. We even passed 'true' in a place that would have caused the *signal handler* to try to run the 'system' system call and shell out to 'rm -rf'. That was never going to work... This patch switches the file removal to use a vector of strings so that the exact text needed for the 'unlink' system call can be stored there. It switches the loop to be a boring indexed loop, and directly calls unlink without looking at the error. It also works quite hard to ensure that calling 'c_str()' is safe, by ensuring that the non-signal-handling code path that manipulates the vector always leaves it in a state where every element has already had 'c_str()' called at least once. I dunno exactly how overkill this is, but it fixes the deadlock-on-double free issue, and seems likely to prevent any other issues from sneaking up. Sorry for not having a test case, but I *really* don't know how to test signal handling code easily.... llvm-svn: 158580
* Fix building ThreadLocal.cpp with --disable-threads.Argyrios Kyrtzidis2012-06-131-2/+9
| | | | llvm-svn: 158405
* Fixes for PPC host detection and features.Hal Finkel2012-06-121-1/+1
| | | | | | | | | POWER4 is a 64-bit CPU (better matched to the 970). The g3 is really the 750 (no altivec), the g4+ is the 74xx (not the 750). Patch by Andreas Tobler. llvm-svn: 158363
* Reapply r158337, this time properly protect Darwin/PPC host CPU use with ↵Hal Finkel2012-06-121-0/+130
| | | | | | | | | | | | | __ppc__. Original commit message: Move PPC host-CPU detection logic from PPCSubtarget into sys::getHostCPUName(). Both the new Linux functionality and the old Darwin functions have been moved. This change also allows this information to be queried directly by clang and other frontends (clang, for example, will now have real -mcpu=native support). llvm-svn: 158349
* Satisfy C++ aliasing rules, per suggestion by Chandler.Argyrios Kyrtzidis2012-06-122-2/+2
| | | | llvm-svn: 158346
* Revert r158337 "Move PPC host-CPU detection logic from PPCSubtarget into ↵Jakob Stoklund Olesen2012-06-121-130/+0
| | | | | | | | | sys::getHostCPUName()." This commit broke most of the PowerPC unit tests when running on Intel/Apple. llvm-svn: 158345
* For llvm::sys::ThreadLocalImpl instead of malloc'ing the platform-specificArgyrios Kyrtzidis2012-06-122-13/+11
| | | | | | | | | | | thread local data, embed them in the class using a uint64_t and make sure we get compiler errors if there's a platform where this is not big enough. This makes ThreadLocal more safe for using it in conjunction with CrashRecoveryContext. Related to crash in rdar://11434201. llvm-svn: 158342
* Move PPC host-CPU detection logic from PPCSubtarget into sys::getHostCPUName().Hal Finkel2012-06-111-0/+130
| | | | | | | | Both the new Linux functionality and the old Darwin functions have been moved. This change also allows this information to be queried directly by clang and other frontends (clang, for example, will now have real -mcpu=native support). llvm-svn: 158337
* Disabling a spurious deprecation warning about using PathV1 from within the ↵Aaron Ballman2012-06-091-0/+10
| | | | | | PathV1 implementation file. llvm-svn: 158274
* Fixing a typo in the comments.Aaron Ballman2012-06-091-1/+1
| | | | llvm-svn: 158273
* Convert comments to proper Doxygen comments.Dmitri Gribenko2012-06-091-6/+6
| | | | llvm-svn: 158248
* Fix a crash in APInt::lshr when shiftAmt > BitWidth.Chad Rosier2012-06-081-1/+1
| | | | | | Patch by James Benton <jbenton@vmware.com>. llvm-svn: 158213
* Use access(2) instead of stat(2) to check if a file exists.Benjamin Kramer2012-06-021-2/+1
| | | | | | | | | | | Apart from being slightly cheaper, this fixes a real bug that hits 32 bit linux systems. When passing a file larger than 2G to be linked (which isn't that uncommon with large projects such as WebKit), clang's driver checks if the file exists but the file size doesn't fit in an off_t and stat(2) fails with EOVERFLOW. Clang then says that the file doesn't exist instead of passing it to the linker. llvm-svn: 157891
* Path::GetTemporaryDirectory(): Add an assertion if TempDirectory is alive, ↵NAKAMURA Takumi2012-05-271-1/+3
| | | | | | to check when someone would remove the tempdir. llvm-svn: 157529
* Remove the PTX back-end and all of its artifacts (triple, etc.)Justin Holewinski2012-05-241-18/+0
| | | | | | | | This back-end was deprecated in favor of the NVPTX back-end. NV_CONTRIB llvm-svn: 157417
* Fix -Wcovered-switch-default warning.Patrik Hägglund2012-05-241-1/+0
| | | | llvm-svn: 157381
* fix corner case in ConstantRange::intersectWith().Nuno Lopes2012-05-181-1/+1
| | | | | | this fixes the missed optimization I was seeing in the CorrelatedValuePropagation pass llvm-svn: 157032
* [Support/YAMLParser] Use rtrim on plain scalars.Michael J. Spencer2012-05-141-3/+1
| | | | llvm-svn: 156787
* [Support/StringRef] Add find_last_not_of and {r,l,}trim.Michael J. Spencer2012-05-111-0/+26
| | | | llvm-svn: 156652
* Allow unique_file to take a mode for file permissions, but defaultEric Christopher2012-05-112-5/+8
| | | | | | | | to user only read/write. Part of rdar://11325849 llvm-svn: 156591
* Set the default iOS version to 3.0.Chad Rosier2012-05-091-2/+4
| | | | llvm-svn: 156492
* Use the cpuid 64 bit flag to pick the default CPU name for an unknown model.Bob Wilson2012-05-091-1/+1
| | | | | | | | | | | For the Family 6 switch in sys::getHostCPUName, an unrecognized model was reported as "i686". That's a really bad default since it means that new CPUs will be treated as if they can only use 32-bit code. This just looks at the cpuid extended feature flag for 64 bit support, and if that is set, it uses a default x86-64 cpu. Similar logic is already used for the Family 15 code. <rdar://problem/11314502> llvm-svn: 156486
* Don't return true on a function with a void return type.Chad Rosier2012-05-091-1/+1
| | | | llvm-svn: 156484
* Add Triple::getiOSVersion.Chad Rosier2012-05-091-0/+21
| | | | | | | This new function provides a way to get the iOS version number from ios triples. Part of rdar://11409204 llvm-svn: 156483
* Fix it so llvm-objdump -arch does accept x86 and x86-64 as valid arch names.Kevin Enderby2012-05-081-0/+41
| | | | | | PR12731. Patch by Meador Inge! llvm-svn: 156444
OpenPOWER on IntegriCloud