summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2014-12-04 16:59:36 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2014-12-04 16:59:36 +0000
commitc0610bf4e0e8844cec9e77dc53deafb211edadca (patch)
tree0e53ecac9e3225b39578f2bf978cbc4d8fb2eca4 /llvm/lib/Support
parenta4e55f4d1ec87056703c752644e12640e97fb5a1 (diff)
downloadbcm5719-llvm-c0610bf4e0e8844cec9e77dc53deafb211edadca.tar.gz
bcm5719-llvm-c0610bf4e0e8844cec9e77dc53deafb211edadca.zip
Remove dead code. NFC.
This interface was added 2 years ago but users never developed. llvm-svn: 223368
Diffstat (limited to 'llvm/lib/Support')
-rw-r--r--llvm/lib/Support/MemoryBuffer.cpp2
-rw-r--r--llvm/lib/Support/Process.cpp25
-rw-r--r--llvm/lib/Support/Unix/Memory.inc4
-rw-r--r--llvm/lib/Support/Unix/Path.inc2
-rw-r--r--llvm/lib/Support/Unix/Process.inc34
-rw-r--r--llvm/lib/Support/Windows/Process.inc31
6 files changed, 11 insertions, 87 deletions
diff --git a/llvm/lib/Support/MemoryBuffer.cpp b/llvm/lib/Support/MemoryBuffer.cpp
index 7eb0752c222..539b6c3e754 100644
--- a/llvm/lib/Support/MemoryBuffer.cpp
+++ b/llvm/lib/Support/MemoryBuffer.cpp
@@ -330,7 +330,7 @@ static ErrorOr<std::unique_ptr<MemoryBuffer>>
getOpenFileImpl(int FD, const Twine &Filename, uint64_t FileSize,
uint64_t MapSize, int64_t Offset, bool RequiresNullTerminator,
bool IsVolatileSize) {
- static int PageSize = sys::process::get_self()->page_size();
+ static int PageSize = sys::Process::getPageSize();
// Default is to map the full file.
if (MapSize == uint64_t(-1)) {
diff --git a/llvm/lib/Support/Process.cpp b/llvm/lib/Support/Process.cpp
index 0d42e0e35b9..ad67e1b10b4 100644
--- a/llvm/lib/Support/Process.cpp
+++ b/llvm/lib/Support/Process.cpp
@@ -26,25 +26,6 @@ using namespace sys;
//=== independent code.
//===----------------------------------------------------------------------===//
-// Empty virtual destructor to anchor the vtable for the process class.
-process::~process() {}
-
-self_process *process::get_self() {
- // Use a function local static for thread safe initialization and allocate it
- // as a raw pointer to ensure it is never destroyed.
- static self_process *SP = new self_process();
-
- return SP;
-}
-
-// The destructor for the self_process subclass must never actually be
-// executed. There should be at most one instance of this class, and that
-// instance should live until the process terminates to avoid the potential for
-// racy accesses during shutdown.
-self_process::~self_process() {
- llvm_unreachable("This destructor must never be executed!");
-}
-
/// \brief A helper function to compute the elapsed wall-time since the program
/// started.
///
@@ -63,12 +44,6 @@ static TimeValue getElapsedWallTime() {
/// create race conditions during program startup or shutdown.
static volatile TimeValue DummyTimeValue = getElapsedWallTime();
-// Implement this routine by using the static helpers above. They're already
-// portable.
-TimeValue self_process::get_wall_time() const {
- return getElapsedWallTime();
-}
-
Optional<std::string> Process::FindInEnvPath(const std::string& EnvName,
const std::string& FileName)
{
diff --git a/llvm/lib/Support/Unix/Memory.inc b/llvm/lib/Support/Unix/Memory.inc
index c9d89a82474..7ccde463459 100644
--- a/llvm/lib/Support/Unix/Memory.inc
+++ b/llvm/lib/Support/Unix/Memory.inc
@@ -88,7 +88,7 @@ Memory::allocateMappedMemory(size_t NumBytes,
if (NumBytes == 0)
return MemoryBlock();
- static const size_t PageSize = process::get_self()->page_size();
+ static const size_t PageSize = Process::getPageSize();
const size_t NumPages = (NumBytes+PageSize-1)/PageSize;
int fd = -1;
@@ -181,7 +181,7 @@ Memory::AllocateRWX(size_t NumBytes, const MemoryBlock* NearBlock,
std::string *ErrMsg) {
if (NumBytes == 0) return MemoryBlock();
- size_t PageSize = process::get_self()->page_size();
+ size_t PageSize = Process::getPageSize();
size_t NumPages = (NumBytes+PageSize-1)/PageSize;
int fd = -1;
diff --git a/llvm/lib/Support/Unix/Path.inc b/llvm/lib/Support/Unix/Path.inc
index 634d4049d7d..82b207eecaf 100644
--- a/llvm/lib/Support/Unix/Path.inc
+++ b/llvm/lib/Support/Unix/Path.inc
@@ -550,7 +550,7 @@ const char *mapped_file_region::const_data() const {
}
int mapped_file_region::alignment() {
- return process::get_self()->page_size();
+ return Process::getPageSize();
}
std::error_code detail::directory_iterator_construct(detail::DirIterState &it,
diff --git a/llvm/lib/Support/Unix/Process.inc b/llvm/lib/Support/Unix/Process.inc
index a429bb3984c..530f86cf907 100644
--- a/llvm/lib/Support/Unix/Process.inc
+++ b/llvm/lib/Support/Unix/Process.inc
@@ -57,10 +57,6 @@
using namespace llvm;
using namespace sys;
-process::id_type self_process::get_id() {
- return getpid();
-}
-
static std::pair<TimeValue, TimeValue> getRUsageTimes() {
#if defined(HAVE_GETRUSAGE)
struct rusage RU;
@@ -80,43 +76,19 @@ static std::pair<TimeValue, TimeValue> getRUsageTimes() {
#endif
}
-TimeValue self_process::get_user_time() const {
-#if _POSIX_TIMERS > 0 && _POSIX_CPUTIME > 0
- // Try to get a high resolution CPU timer.
- struct timespec TS;
- if (::clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &TS) == 0)
- return TimeValue(static_cast<TimeValue::SecondsType>(TS.tv_sec),
- static_cast<TimeValue::NanoSecondsType>(TS.tv_nsec));
-#endif
-
- // Otherwise fall back to rusage based timing.
- return getRUsageTimes().first;
-}
-
-TimeValue self_process::get_system_time() const {
- // We can only collect system time by inspecting the results of getrusage.
- return getRUsageTimes().second;
-}
-
// On Cygwin, getpagesize() returns 64k(AllocationGranularity) and
// offset in mmap(3) should be aligned to the AllocationGranularity.
-static unsigned getPageSize() {
+unsigned Process::getPageSize() {
#if defined(HAVE_GETPAGESIZE)
- const int page_size = ::getpagesize();
+ static const int page_size = ::getpagesize();
#elif defined(HAVE_SYSCONF)
- long page_size = ::sysconf(_SC_PAGE_SIZE);
+ static long page_size = ::sysconf(_SC_PAGE_SIZE);
#else
#warning Cannot get the page size on this machine
#endif
return static_cast<unsigned>(page_size);
}
-// This constructor guaranteed to be run exactly once on a single thread, and
-// sets up various process invariants that can be queried cheaply from then on.
-self_process::self_process() : PageSize(getPageSize()) {
-}
-
-
size_t Process::GetMallocUsage() {
#if defined(HAVE_MALLINFO)
struct mallinfo mi;
diff --git a/llvm/lib/Support/Windows/Process.inc b/llvm/lib/Support/Windows/Process.inc
index 3819e638c72..854eac73f23 100644
--- a/llvm/lib/Support/Windows/Process.inc
+++ b/llvm/lib/Support/Windows/Process.inc
@@ -49,10 +49,6 @@
using namespace llvm;
using namespace sys;
-process::id_type self_process::get_id() {
- return GetCurrentProcessId();
-}
-
static TimeValue getTimeValueFromFILETIME(FILETIME Time) {
ULARGE_INTEGER TimeInteger;
TimeInteger.LowPart = Time.dwLowDateTime;
@@ -65,28 +61,10 @@ static TimeValue getTimeValueFromFILETIME(FILETIME Time) {
(TimeInteger.QuadPart % 10000000) * 100));
}
-TimeValue self_process::get_user_time() const {
- FILETIME ProcCreate, ProcExit, KernelTime, UserTime;
- if (GetProcessTimes(GetCurrentProcess(), &ProcCreate, &ProcExit, &KernelTime,
- &UserTime) == 0)
- return TimeValue();
-
- return getTimeValueFromFILETIME(UserTime);
-}
-
-TimeValue self_process::get_system_time() const {
- FILETIME ProcCreate, ProcExit, KernelTime, UserTime;
- if (GetProcessTimes(GetCurrentProcess(), &ProcCreate, &ProcExit, &KernelTime,
- &UserTime) == 0)
- return TimeValue();
-
- return getTimeValueFromFILETIME(KernelTime);
-}
-
// This function retrieves the page size using GetNativeSystemInfo() and is
// present solely so it can be called once to initialize the self_process member
// below.
-static unsigned getPageSize() {
+static unsigned computePageSize() {
// GetNativeSystemInfo() provides the physical page size which may differ
// from GetSystemInfo() in 32-bit applications running under WOW64.
SYSTEM_INFO info;
@@ -96,12 +74,11 @@ static unsigned getPageSize() {
return static_cast<unsigned>(info.dwPageSize);
}
-// This constructor guaranteed to be run exactly once on a single thread, and
-// sets up various process invariants that can be queried cheaply from then on.
-self_process::self_process() : PageSize(getPageSize()) {
+unsigned Process::getPageSize() {
+ static unsigned Ret = computePageSize();
+ return Ret;
}
-
size_t
Process::GetMallocUsage()
{
OpenPOWER on IntegriCloud