LLVM API Documentation

Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
llvm::sys Namespace Reference

Namespaces

namespace  fs
namespace  locale
namespace  path

Classes

class  DynamicLibrary
class  MemoryBlock
 Memory block abstraction. More...
class  Memory
 An abstraction for memory operations. More...
class  MutexImpl
 Platform agnostic Mutex class. More...
class  SmartMutex
class  SmartScopedLock
class  FileStatus
 File status structure. More...
class  Path
 An abstraction for operating system paths. More...
class  PathWithStatus
 Path with file status class. More...
class  process
 Generic base class which exposes information about an operating system process. More...
class  self_process
 The specific class representing the current process. More...
class  Process
 A collection of legacy interfaces for querying information about the current executing process. More...
class  Program
 An abstraction for finding and executing programs. More...
class  RWMutexImpl
 Platform agnostic RWMutex class. More...
class  SmartRWMutex
struct  SmartScopedReader
 ScopedReader - RAII acquisition of a reader lock. More...
struct  SmartScopedWriter
 ScopedWriter - RAII acquisition of a writer lock. More...
class  ThreadLocalImpl
class  ThreadLocal
class  TimeValue
 Provides an abstraction for a fixed point in time. More...
class  Watchdog

Typedefs

typedef uint32_t cas_flag
typedef SmartMutex< falseMutex
 Mutex - A standard, always enforced mutex.
typedef SmartScopedLock< falseScopedLock
typedef SmartRWMutex< falseRWMutex
typedef SmartScopedReader< falseScopedReader
typedef SmartScopedWriter< falseScopedWriter

Enumerations

enum  LLVMFileType {
  Unknown_FileType = 0, Bitcode_FileType, Archive_FileType, ELF_Relocatable_FileType,
  ELF_Executable_FileType, ELF_SharedObject_FileType, ELF_Core_FileType, Mach_O_Object_FileType,
  Mach_O_Executable_FileType, Mach_O_FixedVirtualMemorySharedLib_FileType, Mach_O_Core_FileType, Mach_O_PreloadExecutable_FileType,
  Mach_O_DynamicallyLinkedSharedLib_FileType, Mach_O_DynamicLinker_FileType, Mach_O_Bundle_FileType, Mach_O_DynamicallyLinkedSharedLibStub_FileType,
  Mach_O_DSYMCompanion_FileType, COFF_FileType
}
 This enumeration delineates the kinds of files that LLVM knows about. More...

Functions

void MemoryFence ()
cas_flag CompareAndSwap (volatile cas_flag *ptr, cas_flag new_value, cas_flag old_value)
cas_flag AtomicIncrement (volatile cas_flag *ptr)
cas_flag AtomicDecrement (volatile cas_flag *ptr)
cas_flag AtomicAdd (volatile cas_flag *ptr, cas_flag val)
cas_flag AtomicMul (volatile cas_flag *ptr, cas_flag val)
cas_flag AtomicDiv (volatile cas_flag *ptr, cas_flag val)
bool hasDisassembler ()
std::string disassembleBuffer (uint8_t *start, size_t length, uint64_t pc=0)
std::string StrError ()
std::string StrError (int errnum)
 Like the no-argument version above, but uses errnum instead of errno.
static void llvm_fenv_clearexcept ()
 llvm_fenv_clearexcept - Clear the floating-point exception state.
static bool llvm_fenv_testexcept ()
 llvm_fenv_testexcept - Test if a floating-point exception was raised.
std::string getDefaultTargetTriple ()
std::string getProcessTriple ()
std::string getHostCPUName ()
bool getHostCPUFeatures (StringMap< bool > &Features)
LLVMFileType IdentifyFileType (const char *magic, unsigned length)
bool CopyFile (const Path &Dest, const Path &Src, std::string *ErrMsg)
 Copy one file to another.
bool argumentsFitWithinSystemLimits (ArrayRef< const char * > Args)
void RunInterruptHandlers ()
bool RemoveFileOnSignal (const Path &Filename, std::string *ErrMsg=0)
 Remove a file if a fatal signal occurs.
void DontRemoveFileOnSignal (const Path &Filename)
void PrintStackTraceOnErrorSignal ()
 Print a stack trace if a fatal signal occurs.
void PrintStackTrace (FILE *)
 Print the stack trace using the given FILE object.
void AddSignalHandler (void(*FnPtr)(void *), void *Cookie)
void SetInterruptFunction (void(*IF)())
 Register a function to be called when ctrl-c is pressed.
uint16_t SwapByteOrder_16 (uint16_t value)
uint32_t SwapByteOrder_32 (uint32_t value)
uint64_t SwapByteOrder_64 (uint64_t value)
unsigned char SwapByteOrder (unsigned char C)
signed char SwapByteOrder (signed char C)
char SwapByteOrder (char C)
unsigned short SwapByteOrder (unsigned short C)
signed short SwapByteOrder (signed short C)
unsigned int SwapByteOrder (unsigned int C)
signed int SwapByteOrder (signed int C)
unsigned long SwapByteOrder (unsigned long C)
signed long SwapByteOrder (signed long C)
unsigned long long SwapByteOrder (unsigned long long C)
signed long long SwapByteOrder (signed long long C)
TimeValue operator+ (const TimeValue &tv1, const TimeValue &tv2)
TimeValue operator- (const TimeValue &tv1, const TimeValue &tv2)
bool RunningOnValgrind ()
void ValgrindDiscardTranslations (const void *Addr, size_t Len)

Variables

static const bool IsBigEndianHost = false
static const bool IsLittleEndianHost = !IsBigEndianHost
const char PathSeparator

Typedef Documentation

typedef uint32_t llvm::sys::cas_flag

Definition at line 26 of file Atomic.h.

Mutex - A standard, always enforced mutex.

Definition at line 135 of file Mutex.h.

Definition at line 140 of file RWMutex.h.

Definition at line 151 of file Mutex.h.

Definition at line 155 of file RWMutex.h.

Definition at line 170 of file RWMutex.h.


Enumeration Type Documentation

This enumeration delineates the kinds of files that LLVM knows about.

Enumerator:
Unknown_FileType 

Unrecognized file.

Bitcode_FileType 

Bitcode file.

Archive_FileType 

ar style archive file

ELF_Relocatable_FileType 

ELF Relocatable object file.

ELF_Executable_FileType 

ELF Executable image.

ELF_SharedObject_FileType 

ELF dynamically linked shared lib.

ELF_Core_FileType 

ELF core image.

Mach_O_Object_FileType 

Mach-O Object file.

Mach_O_Executable_FileType 

Mach-O Executable.

Mach_O_FixedVirtualMemorySharedLib_FileType 

Mach-O Shared Lib, FVM.

Mach_O_Core_FileType 

Mach-O Core File.

Mach_O_PreloadExecutable_FileType 

Mach-O Preloaded Executable.

Mach_O_DynamicallyLinkedSharedLib_FileType 

Mach-O dynlinked shared lib.

Mach_O_DynamicLinker_FileType 

The Mach-O dynamic linker.

Mach_O_Bundle_FileType 

Mach-O Bundle file.

Mach_O_DynamicallyLinkedSharedLibStub_FileType 

Mach-O Shared lib stub.

Mach_O_DSYMCompanion_FileType 

Mach-O dSYM companion file.

COFF_FileType 

COFF object file or lib.

Definition at line 705 of file PathV1.h.


Function Documentation

void llvm::sys::AddSignalHandler ( void(*)(void *)  FnPtr,
void *  Cookie 
)

AddSignalHandler - Add a function to be called when an abort/kill signal is delivered to the process. The handler can have a cookie passed to it to identify what instance of the handler it is.

Referenced by llvm::dbgs(), and RegisterCrashPrinter().

bool llvm::sys::argumentsFitWithinSystemLimits ( ArrayRef< const char * >  Args)
cas_flag llvm::sys::AtomicAdd ( volatile cas_flag *  ptr,
cas_flag  val 
)
cas_flag llvm::sys::AtomicDecrement ( volatile cas_flag *  ptr)
cas_flag llvm::sys::AtomicDiv ( volatile cas_flag *  ptr,
cas_flag  val 
)
cas_flag llvm::sys::AtomicIncrement ( volatile cas_flag *  ptr)
cas_flag llvm::sys::AtomicMul ( volatile cas_flag *  ptr,
cas_flag  val 
)
cas_flag llvm::sys::CompareAndSwap ( volatile cas_flag *  ptr,
cas_flag  new_value,
cas_flag  old_value 
)
bool llvm::sys::CopyFile ( const Path &  Dest,
const Path &  Src,
std::string *  ErrMsg 
)

Copy one file to another.

This function can be used to copy the file specified by Src to the file specified by Dest. If an error occurs, Dest is removed.

Returns:
true if an error occurs, false otherwise
std::string llvm::sys::disassembleBuffer ( uint8_t *  start,
size_t  length,
uint64_t  pc = 0 
)

This function provides some "glue" code to call external disassembler libraries.

Definition at line 42 of file Support/Disassembler.cpp.

void llvm::sys::DontRemoveFileOnSignal ( const Path &  Filename)

This function removes a file from the list of files to be removed on signal delivery.

std::string llvm::sys::getDefaultTargetTriple ( )

getDefaultTargetTriple() - Return the default target triple the compiler has been configured to produce code for.

The target triple is a string in the format of: CPU_TYPE-VENDOR-OPERATING_SYSTEM or CPU_TYPE-VENDOR-KERNEL-OPERATING_SYSTEM

Referenced by llvm::TargetRegistry::getClosestTargetForJIT().

bool llvm::sys::getHostCPUFeatures ( StringMap< bool > &  Features)

getHostCPUFeatures - Get the LLVM names for the host CPU features. The particular format of the names are target dependent, and suitable for passing as -mattr to the target which matches the host.

Parameters:
Features- A string mapping feature names to either true (if enabled) or false (if disabled). This routine makes no guarantees about exactly which features may appear in this map, except that they are all valid LLVM feature names.
Returns:
- True on success.

Definition at line 610 of file Host.cpp.

std::string llvm::sys::getHostCPUName ( )

getHostCPUName - Get the LLVM name for the host CPU. The particular format of the name is target dependent, and suitable for passing as -mcpu to the target which matches the host.

Returns:
- The host CPU name, or empty if the CPU could not be determined.

Definition at line 548 of file Host.cpp.

Referenced by llvm::X86_MC::createX86MCSubtargetInfo(), and llvm::PPCSubtarget::PPCSubtarget().

std::string llvm::sys::getProcessTriple ( )

getProcessTriple() - Return an appropriate target triple for generating code to be loaded into the current process, e.g. when using the JIT.

Definition at line 615 of file Host.cpp.

References llvm::Triple::get32BitArchVariant(), llvm::Triple::get64BitArchVariant(), llvm::Triple::isArch32Bit(), llvm::Triple::isArch64Bit(), LLVM_HOST_TRIPLE, and llvm::Triple::str().

Referenced by llvm::EngineBuilder::selectTarget().

bool llvm::sys::hasDisassembler ( )

This function returns true, if there is possible to use some external disassembler library. False otherwise.

Definition at line 28 of file Support/Disassembler.cpp.

LLVMFileType llvm::sys::IdentifyFileType ( const char *  magic,
unsigned  length 
)
static void llvm::sys::llvm_fenv_clearexcept ( ) [inline, static]

llvm_fenv_clearexcept - Clear the floating-point exception state.

Definition at line 34 of file FEnv.h.

Referenced by ConstantFoldBinaryFP(), and ConstantFoldFP().

static bool llvm::sys::llvm_fenv_testexcept ( ) [inline, static]

llvm_fenv_testexcept - Test if a floating-point exception was raised.

Definition at line 42 of file FEnv.h.

Referenced by ConstantFoldBinaryFP(), and ConstantFoldFP().

void llvm::sys::MemoryFence ( )
TimeValue llvm::sys::operator+ ( const TimeValue &  tv1,
const TimeValue &  tv2 
) [inline]

Adds two TimeValue objects together.

Returns:
The sum of the two operands as a new TimeValue

Definition at line 370 of file TimeValue.h.

TimeValue llvm::sys::operator- ( const TimeValue &  tv1,
const TimeValue &  tv2 
) [inline]

Subtracts two TimeValue objects.

Returns:
The difference of the two operands as a new TimeValue

Definition at line 376 of file TimeValue.h.

void llvm::sys::PrintStackTrace ( FILE *  )

Print the stack trace using the given FILE object.

void llvm::sys::PrintStackTraceOnErrorSignal ( )

Print a stack trace if a fatal signal occurs.

When an error signal (such as SIBABRT or SIGSEGV) is delivered to the process, print a stack trace and then exit.

bool llvm::sys::RemoveFileOnSignal ( const Path &  Filename,
std::string *  ErrMsg = 0 
)

Remove a file if a fatal signal occurs.

This function registers signal handlers to ensure that if a signal gets delivered that the named file is removed.

Referenced by llvm::Archive::writeToDisk().

void llvm::sys::RunInterruptHandlers ( )

This function runs all the registered interrupt handlers, including the removal of files registered by RemoveFileOnSignal.

Referenced by llvm::MCContext::FatalError(), and llvm::report_fatal_error().

bool llvm::sys::RunningOnValgrind ( )

Definition at line 32 of file Valgrind.cpp.

References NotUnderValgrind.

void llvm::sys::SetInterruptFunction ( void(*)()  IF)

Register a function to be called when ctrl-c is pressed.

This function registers a function to be called when the user "interrupts" the program (typically by pressing ctrl-c). When the user interrupts the program, the specified interrupt function is called instead of the program being killed, and the interrupt function automatically disabled. Note that interrupt functions are not allowed to call any non-reentrant functions. An null interrupt function pointer disables the current installed function. Note also that the handler may be executed on a different thread on some platforms.

std::string llvm::sys::StrError ( )

Returns a string representation of the errno value, using whatever thread-safe variant of strerror() is available. Be sure to call this immediately after the function that set errno, or errno may have been overwritten by an intervening call.

Definition at line 34 of file Errno.cpp.

Referenced by MakeErrMsg(), and llvm::_do_message::message().

std::string llvm::sys::StrError ( int  errnum)

Like the no-argument version above, but uses errnum instead of errno.

Definition at line 39 of file Errno.cpp.

References llvm::raw_ostream::flush().

unsigned char llvm::sys::SwapByteOrder ( unsigned char  C) [inline]
signed char llvm::sys::SwapByteOrder ( signed char  C) [inline]

Definition at line 72 of file SwapByteOrder.h.

References llvm::CallingConv::C.

char llvm::sys::SwapByteOrder ( char  C) [inline]

Definition at line 73 of file SwapByteOrder.h.

References llvm::CallingConv::C.

unsigned short llvm::sys::SwapByteOrder ( unsigned short  C) [inline]

Definition at line 75 of file SwapByteOrder.h.

References SwapByteOrder_16().

signed short llvm::sys::SwapByteOrder ( signed short  C) [inline]

Definition at line 76 of file SwapByteOrder.h.

References SwapByteOrder_16().

unsigned int llvm::sys::SwapByteOrder ( unsigned int  C) [inline]

Definition at line 78 of file SwapByteOrder.h.

References SwapByteOrder_32().

signed int llvm::sys::SwapByteOrder ( signed int  C) [inline]

Definition at line 79 of file SwapByteOrder.h.

References SwapByteOrder_32().

unsigned long llvm::sys::SwapByteOrder ( unsigned long  C) [inline]

Definition at line 82 of file SwapByteOrder.h.

References SwapByteOrder_32().

signed long llvm::sys::SwapByteOrder ( signed long  C) [inline]

Definition at line 83 of file SwapByteOrder.h.

References SwapByteOrder_32().

unsigned long long llvm::sys::SwapByteOrder ( unsigned long long  C) [inline]

Definition at line 91 of file SwapByteOrder.h.

References SwapByteOrder_64().

signed long long llvm::sys::SwapByteOrder ( signed long long  C) [inline]

Definition at line 94 of file SwapByteOrder.h.

References SwapByteOrder_64().

uint16_t llvm::sys::SwapByteOrder_16 ( uint16_t  value) [inline]

SwapByteOrder_16 - This function returns a byte-swapped representation of the 16-bit argument.

Definition at line 27 of file SwapByteOrder.h.

References llvm::HexagonISD::Hi, and llvm::HexagonISD::Lo.

Referenced by llvm::ByteSwap_16(), and SwapByteOrder().

uint32_t llvm::sys::SwapByteOrder_32 ( uint32_t  value) [inline]

SwapByteOrder_32 - This function returns a byte-swapped representation of the 32-bit argument.

Definition at line 41 of file SwapByteOrder.h.

Referenced by llvm::ByteSwap_32(), SwapByteOrder(), and SwapByteOrder_64().

uint64_t llvm::sys::SwapByteOrder_64 ( uint64_t  value) [inline]

SwapByteOrder_64 - This function returns a byte-swapped representation of the 64-bit argument.

Definition at line 58 of file SwapByteOrder.h.

References llvm::HexagonISD::Hi, llvm::HexagonISD::Lo, and SwapByteOrder_32().

Referenced by llvm::ByteSwap_64(), and SwapByteOrder().

void llvm::sys::ValgrindDiscardTranslations ( const void *  Addr,
size_t  Len 
)

Variable Documentation

This is the OS-specific path separator: a colon on Unix or a semicolon on Windows.

Referenced by getPathList().