Commit Graph

3689 Commits

Author SHA1 Message Date
Pavel Labath
bca3cda284 Add Chrono.h - std::chrono support header
Summary:
std::chrono mostly covers the functionality of llvm::sys::TimeValue and
lldb_private::TimeValue. This header adds a bit of utility functions and
typedefs, which make the usage of the library and porting code from TimeValues
easier.

Rationale:
- TimePoint typedef - precision of system_clock is implementation defined -
  using a well-defined precision helps maintain consistency between platforms,
  makes it interact better with existing TimeValue classes, and avoids cases
  there a time point is implicitly convertible to a specific precision on some
  platforms but not on others.
- system_clock::to_time_t only accepts time_points with the default system
  precision (even though time_t has only second precision on all platforms we
  support). To avoid the need for explicit casts, I have added a toTimeT()
  wrapper function. toTimePoint(time_t) was not strictly necessary, but I have
  added it for symmetry.

Reviewers: zturner, mehdi_amini

Subscribers: beanz, mgorny, llvm-commits, modocache

Differential Revision: https://reviews.llvm.org/D25416

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284590 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-19 13:58:55 +00:00
Benjamin Kramer
6e3c4da116 Reduce global namespace pollution. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284521 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-18 19:39:31 +00:00
Renato Golin
8bb4ccc94b Revert "Resubmit "Add support for advanced number formatting.""
This reverts commits 284436 and 284437 because they still break AArch64 bots:

Value of: format_number(-10, IntegerStyle::Integer, 1)
  Actual: "-0"
  Expected: "-10"

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284462 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-18 09:30:18 +00:00
Zachary Turner
88bc637ad2 Rename HexStyle -> HexFormatStyle, and remove a constexpr.
This should fix the remaining broken builds.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284437 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-17 23:08:47 +00:00
Zachary Turner
b3a18516ab Resubmit "Add support for advanced number formatting."
This resubmits commits 284425 and r284428, which were reverted
in r284429 due to some infinite recursion caused by an incorrect
selection of function overloads.  Reproduced the failure on Linux
using GCC 4.8.4, and confirmed that with the new patch the tests
path on GCC as well as MSVC.  So hopefully this fixes everything.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284436 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-17 22:49:24 +00:00
Zachary Turner
fdfb1c554e Revert formatting changes.
This reverts r288425 and r284428 as they are causing test crashes
on some systems.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284429 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-17 21:25:41 +00:00
Zachary Turner
d4bb10c270 Try to fix build after invalid pointer conversion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284428 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-17 21:14:27 +00:00
Zachary Turner
0a7eca8829 [Support] Add support for "advanced" number formatting.
raw_ostream has not afforded a lot of flexibility in terms of
how to format numbers when outputting.  Wrap this all up into
a set of low level helper functions that can be used to output
numbers with arbitrary precision, alignment, format, etc and
then update raw_ostream to use these functions.

This will be useful for upcoming improvements to llvm's string
formatting libraries, but are still useful independently.

Differential Revision: https://reviews.llvm.org/D25497

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284425 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-17 20:57:45 +00:00
Teresa Johnson
6fb063ad06 Rename interface for querying physical hardware concurrency
Based on post-commit review for D25585/r284180, rename
hardware_physical_concurrency to heavyweight_hardware_concurrency,
to better reflect what type of tasks it should be used for and
to enable other systems to map this to something other than the
number of physical cores.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284390 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-17 14:56:53 +00:00
Benjamin Kramer
94b3ee41bc [Support] remove_dots: Remove .. from absolute paths.
/../foo is still a proper path after removing the dotdot. This should
now finally match https://9p.io/sys/doc/lexnames.html [Cleaning names].

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284384 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-17 13:28:21 +00:00
Justin Bogner
0f82c946ae Support: Return void from Scanner::scan_ns_uri_char, no one uses the result
Simplify this a little bit since the result is never used. It can be
added back easily enough if that changes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284348 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-16 22:01:22 +00:00
Richard Smith
6ae3d4e42d PR30711: Fix incorrect profiling of 'long long' in FoldingSet, then use it to
fix TBAA violation in profiling of pointers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284336 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-16 17:49:09 +00:00
Mehdi Amini
cb11533e7b hardware_physical_concurrency() should return 1 when LLVM is built with LLVM_ENABLE_THREADS=OFF
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284283 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-14 21:32:35 +00:00
David L Kreitzer
9b8425db90 Define "contiki" OS specifier.
Patch by Michael LeMay

Differential revision: http://reviews.llvm.org/D24897


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284240 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-14 14:41:46 +00:00
Matthias Braun
ca81740460 Timer: Fix doxygen comments, use member initializer; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284181 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-14 00:17:19 +00:00
Teresa Johnson
0a9d04f218 Add interface for querying physical hardware concurrency
Summary:
This will be used by ThinLTO to set the amount of backend
parallelism, which performs better when restricted to the number
of physical cores (on X86 at least, where getHostNumPhysicalCores is
currently defined). If not available this falls back to
thread::hardware_concurrency.

Note I didn't add to the thread class since that is a typedef to
std::thread where available.

Reviewers: mehdi_amini

Subscribers: beanz, llvm-commits, mgorny

Differential Revision: https://reviews.llvm.org/D25585

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284180 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-14 00:13:59 +00:00
Teresa Johnson
26cb3d9e11 Add interface to compute number of physical cores on host system
Summary:
For now I have only added support for x86_64 Linux, but other systems
can be added incrementally.

This is to be used for setting the default parallelism for ThinLTO
backends (instead of thread::hardware_concurrency which includes
hyperthreading and is too aggressive). I'll send this as a follow-on
patch, and it will fall back to hardware_concurrency when the new
getHostNumPhysicalCores returns -1 (when not supported for a given
host system).

I also added an interface to MemoryBuffer to force reading a file
as a stream - this is required for /proc/cpuinfo which is a special
file that looks like a normal file but appears to have 0 size.
The existing readers of this file in Host.cpp are reading the first
1024 or so bytes from it, because the necessary info is near the top.
But for the new functionality we need to be able to read the entire
file. I can go back and change the other readers to use the new
getFileAsStream as a follow-on patch since it seems much more robust.

Added a unittest.

Reviewers: mehdi_amini

Subscribers: beanz, mgorny, llvm-commits, modocache

Differential Revision: https://reviews.llvm.org/D25564

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284138 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-13 17:43:20 +00:00
Eric Liu
e0d080d15d Do not delete leading ../ in remove_dots.
Reviewers: bkramer

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D25561

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284129 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-13 15:07:14 +00:00
Alex Lorenz
196e7047f4 [Support][CommandLine] Display subcommands in help when there are less than 3
subcommands

This commit fixes a bug where the help output doesn't display subcommands when
a tool has less than 3 subcommands.

This change doesn't include a corresponding unittest as there is no viable way
to provide a unittest for it.

Differential Revision: https://reviews.llvm.org/D25463


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283998 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-12 10:04:35 +00:00
Rui Ueyama
3d302487a2 Fix build error on LP64 platforms.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283922 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-11 19:28:56 +00:00
Zachary Turner
86a0c0db41 [raw_ostream] Raise some helper functions out of raw_ostream.
Low level functionality to format numbers were embedded in the
implementation of raw_ostream.  I have need to use these through
an interface other than the overloaded stream operators, so they
need to be raised to a level that they can be used from either
raw_ostream operators or other code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283921 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-11 19:24:45 +00:00
Zachary Turner
be78316854 [Support] Fix undefined behavior in RandomNumberGenerator.
This has existed pretty much forever AFAICT, but the code was
never being exercised because nobody was using the class.  A
user of this class surfaced, and now we're breaking with UB.
The code was obviously wrong, so it's fixed here.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283912 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-11 18:17:26 +00:00
Zachary Turner
ed36d63443 [cl] Don't print subcommand help when no subcommands present.
Previously we would print

  USAGE: <exe> [subcommand] [options]

Even if no subcommands were present.  This changes the output
format to only print "[subcommand]" if there is at least one
subcommand.

Fixes llvm.org/pr30598

Patch by Serge Guelton

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283892 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-11 15:58:48 +00:00
Mehdi Amini
6a59bc7c7d Make RandomNumberGenerator compatible with <random>
LLVM's RandomNumberGenerator wasn't compatible with
the random distribution from <random>.

Fixes PR25105

Patch by: Serge Guelton <serge.guelton@telecom-bretagne.eu>

Differential Revision: https://reviews.llvm.org/D25443

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283854 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-11 07:13:01 +00:00
Javed Absar
a297939a6a [ARM]: Add Cortex-R52 target to LLVM
This patch adds Cortex-R52, the new ARM real-time processor, to LLVM. 
Cortex-R52 implements the ARMv8-R architecture.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283542 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-07 12:06:40 +00:00
Mehdi Amini
a47cbd993e Use StringReg in TargetParser APIs (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283527 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-07 08:37:29 +00:00
Nuno Lopes
9f79578305 fix build on cygwin
Cygwin has dlfcn.h, but no Dl_info

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283427 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-06 09:32:16 +00:00
Petr Hosek
fc05fb6f65 [Triple] Add triple for Fuchsia
Fuchsia is a new operating system.

Differential Revision: https://reviews.llvm.org/D25116

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283419 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-06 05:17:26 +00:00
Mehdi Amini
f9bb6bcf37 Re-commit "Use StringRef in Support/Darf APIs (NFC)"
This reverts commit r283285 and re-commit r283275 with
a fix for format("%s", Str); where Str is a StringRef.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283298 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-05 05:59:29 +00:00
Dean Michael Berris
f6b865d41a [Support][CommandLine] Add cl::getRegisteredSubcommands()
This should allow users of the library to get a range to iterate through
all the subcommands that are registered to the global parser. This
allows users to define subcommands in libraries that self-register to
have dispatch done at a different stage (like main). It allows for
writing code like the following:

    for (auto *S : cl::getRegisteredSubcommands()) {
      if (*S) {
	// Dispatch on S->getName().
      }
    }

This change also contains tests that show this usage pattern.

Reviewers: zturner, dblaikie, echristo

Subscribers: llvm-commits, mehdi_amini

Differential Revision: https://reviews.llvm.org/D24489

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283296 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-05 05:20:08 +00:00
Mehdi Amini
6f45c30387 Blind attempt to fix windows build after r283290 - Use StringRef in StringSaver API (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283294 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-05 01:41:11 +00:00
Mehdi Amini
1455db37f5 Use StringRef in StringSaver API (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283290 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-05 01:32:41 +00:00
Mehdi Amini
ef350f2eb3 Revert "Re-commit "Use StringRef in Support/Darf APIs (NFC)""
One test seems randomly broken: DebugInfo/X86/gnu-public-names.ll

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283285 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-05 01:04:02 +00:00
Mehdi Amini
a2df9c87e9 Re-commit "Use StringRef in Support/Darf APIs (NFC)"
This reverts commit r283278 and re-commit r283275 with
the update to fix the build on the LLDB side.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283281 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-05 00:37:18 +00:00
Mehdi Amini
c441cc0af2 Revert "Use StringRef in Support/Darf APIs (NFC)"
This reverts commit r283275, it broke LLDB Android debug server.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283278 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-05 00:21:14 +00:00
Mehdi Amini
e57a377e09 Use StringRef instead of raw pointers in ARMBuildAttrs (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283277 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-05 00:15:18 +00:00
Mehdi Amini
ba4c13cb88 Use StringRef in Support/Darf APIs (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283275 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-04 23:55:40 +00:00
Alina Sbirlea
296fa89982 [cpu-detection] Copy simplified version of get_cpuid_max to remove dependency to clang's implementation
Summary:
Attempting to fix PR30384.
Take the same approach as in compiler_rt and add a simplified version of __get_cpuid_max.
Including cpuid.h is no longer needed.

Reviewers: echristo, joerg

Subscribers: mehdi_amini, llvm-commits

Differential Revision: https://reviews.llvm.org/D24597

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283265 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-04 22:39:53 +00:00
Mehdi Amini
793d2a4ced Use StringRef for MemoryBuffer identifier API (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283043 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-01 16:38:28 +00:00
Mehdi Amini
102077e6f3 Revert "Use StringRef instead of raw pointer in TargetRegistry API (NFC)"
This reverts commit r283017. Creates an infinite loop somehow.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283019 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-01 07:08:23 +00:00
Mehdi Amini
876fe65d27 Use StringRef instead of raw pointer in TargetRegistry API (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283017 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-01 06:25:30 +00:00
Mehdi Amini
b7d8ee46b4 Use StringRef in CommandLine Options handling (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283007 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-01 03:43:20 +00:00
Mehdi Amini
fc858827b4 Use StringRef in Triple API (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282996 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-01 01:16:22 +00:00
Joerg Sonnenberger
593505d39e Deal with the (historic) MAP_ANONYMOUS vs MAP_ANON directly by using CPP
to check for the former, don't depend on (dangling) HAVE_MMAP_ANONYMOUS.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282925 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-30 20:17:23 +00:00
Joerg Sonnenberger
f1086ea04d Retire NEED_DEV_ZERO_FOR_MMAP. It should be needed only on outdated
systems. It wasn't even hooked up in cmake, so problems on such systems
would be visible with 3.9 release already.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282924 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-30 20:16:01 +00:00
Joerg Sonnenberger
d8588ac73f Turn ENABLE_CRASH_OVERRIDES into a 0/1 definition.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282919 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-30 20:06:19 +00:00
Joerg Sonnenberger
2bf78b4d6c Convert ENABLE_BACKTRACES into a 0/1 definition.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282918 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-30 20:04:24 +00:00
Justin Lebar
449cdb5ad5 Move UTF functions into namespace llvm.
Summary:
This lets people link against LLVM and their own version of the UTF
library.

I determined this only affects llvm, clang, lld, and lldb by running

$ git grep -wl 'UTF[0-9]\+\|\bConvertUTF\bisLegalUTF\|getNumBytesFor' | cut -f 1 -d '/' | sort | uniq
  clang
  lld
  lldb
  llvm

Tested with

  ninja lldb
  ninja check-clang check-llvm check-lld

(ninja check-lldb doesn't complete for me with or without this patch.)

Reviewers: rnk

Subscribers: klimek, beanz, mgorny, llvm-commits

Differential Revision: https://reviews.llvm.org/D24996

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282822 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-30 00:38:45 +00:00
Joerg Sonnenberger
5a47084235 Make HAVE_DECL_ARC4RANDOM always defined. Sort the entry correctly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282768 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-29 21:10:38 +00:00
Joerg Sonnenberger
422655d988 HAVE_UNWIND_BACKTRACE -> HAVE__UNWIND_BACKTRACE
Check for existance and not truth value.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282767 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-29 21:07:57 +00:00