Home ⌂Doc Index ◂Up ▴
Intel(R) Threading Building Blocks Doxygen Documentation  version 4.2.3
gcc_generic.h File Reference
#include <stdint.h>
#include <unistd.h>
Include dependency graph for gcc_generic.h:

Go to the source code of this file.

Namespaces

 tbb
 The graph class.
 
 tbb::internal
 Identifiers declared inside namespace internal should never be used directly by client code.
 
 tbb::internal::gcc_builtins
 

Macros

#define __TBB_WORDSIZE   __SIZEOF_POINTER__
 
#define __TBB_ENDIANNESS   __TBB_ENDIAN_DETECT
 
#define __TBB_acquire_consistency_helper()   __sync_synchronize()
 
#define __TBB_release_consistency_helper()   __sync_synchronize()
 
#define __TBB_full_memory_fence()   __sync_synchronize()
 
#define __TBB_control_consistency_helper()   __sync_synchronize()
 
#define __TBB_MACHINE_DEFINE_ATOMICS(S, T)
 
#define __TBB_USE_GENERIC_FETCH_STORE   1
 
#define __TBB_USE_GENERIC_HALF_FENCED_LOAD_STORE   1
 
#define __TBB_USE_GENERIC_RELAXED_LOAD_STORE   1
 
#define __TBB_USE_GENERIC_SEQUENTIAL_CONSISTENCY_LOAD_STORE   1
 
#define __TBB_AtomicOR(P, V)   __TBB_machine_or(P,V)
 
#define __TBB_AtomicAND(P, V)   __TBB_machine_and(P,V)
 
#define __TBB_TryLockByte   __TBB_machine_try_lock_byte
 
#define __TBB_UnlockByte   __TBB_machine_unlock_byte
 
#define __TBB_Log2(V)   __TBB_machine_lg(V)
 

Typedefs

typedef unsigned char __TBB_Flag
 
typedef __TBB_atomic __TBB_Flag __TBB_atomic_flag
 

Functions

static void __TBB_machine_or (volatile void *ptr, uintptr_t addend)
 
static void __TBB_machine_and (volatile void *ptr, uintptr_t addend)
 
bool __TBB_machine_try_lock_byte (__TBB_atomic_flag &flag)
 
void __TBB_machine_unlock_byte (__TBB_atomic_flag &flag)
 
int tbb::internal::gcc_builtins::clz (unsigned int x)
 
int tbb::internal::gcc_builtins::clz (unsigned long int x)
 
int tbb::internal::gcc_builtins::clz (unsigned long long int x)
 
static intptr_t __TBB_machine_lg (uintptr_t x)
 

Macro Definition Documentation

◆ __TBB_acquire_consistency_helper

#define __TBB_acquire_consistency_helper ( )    __sync_synchronize()

As this generic implementation has absolutely no information about underlying hardware, its performance most likely will be sub-optimal because of full memory fence usages where a more lightweight synchronization means (or none at all) could suffice. Thus if you use this header to enable TBB on a new platform, consider forking it and relaxing below helpers as appropriate.

Definition at line 57 of file gcc_generic.h.

◆ __TBB_AtomicAND

#define __TBB_AtomicAND (   P,
 
)    __TBB_machine_and(P,V)

Definition at line 208 of file gcc_generic.h.

◆ __TBB_AtomicOR

#define __TBB_AtomicOR (   P,
 
)    __TBB_machine_or(P,V)

Definition at line 207 of file gcc_generic.h.

◆ __TBB_control_consistency_helper

#define __TBB_control_consistency_helper ( )    __sync_synchronize()

Definition at line 60 of file gcc_generic.h.

◆ __TBB_ENDIANNESS

#define __TBB_ENDIANNESS   __TBB_ENDIAN_DETECT

FPU control setting not available for non-Intel architectures on Android

Definition at line 46 of file gcc_generic.h.

◆ __TBB_full_memory_fence

#define __TBB_full_memory_fence ( )    __sync_synchronize()

Definition at line 59 of file gcc_generic.h.

◆ __TBB_Log2

#define __TBB_Log2 (   V)    __TBB_machine_lg(V)

Definition at line 225 of file gcc_generic.h.

◆ __TBB_MACHINE_DEFINE_ATOMICS

#define __TBB_MACHINE_DEFINE_ATOMICS (   S,
 
)
Value:
inline T __TBB_machine_cmpswp##S( volatile void *ptr, T value, T comparand ) { \
return __sync_val_compare_and_swap(reinterpret_cast<volatile T *>(ptr),comparand,value); \
} \
inline T __TBB_machine_fetchadd##S( volatile void *ptr, T value ) { \
return __sync_fetch_and_add(reinterpret_cast<volatile T *>(ptr),value); \
}
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain ITT_FORMAT p const __itt_domain __itt_string_handle unsigned long long ITT_FORMAT lu const __itt_domain __itt_string_handle unsigned long long ITT_FORMAT lu const __itt_domain __itt_id __itt_string_handle __itt_metadata_type size_t void ITT_FORMAT p const __itt_domain __itt_id __itt_string_handle const wchar_t size_t ITT_FORMAT lu const __itt_domain __itt_id __itt_relation __itt_id ITT_FORMAT p const wchar_t int ITT_FORMAT __itt_group_mark S
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain ITT_FORMAT p const __itt_domain __itt_string_handle unsigned long long value

Definition at line 62 of file gcc_generic.h.

◆ __TBB_release_consistency_helper

#define __TBB_release_consistency_helper ( )    __sync_synchronize()

Definition at line 58 of file gcc_generic.h.

◆ __TBB_TryLockByte

#define __TBB_TryLockByte   __TBB_machine_try_lock_byte

Definition at line 210 of file gcc_generic.h.

◆ __TBB_UnlockByte

#define __TBB_UnlockByte   __TBB_machine_unlock_byte

Definition at line 211 of file gcc_generic.h.

◆ __TBB_USE_GENERIC_FETCH_STORE

#define __TBB_USE_GENERIC_FETCH_STORE   1

Definition at line 70 of file gcc_generic.h.

◆ __TBB_USE_GENERIC_HALF_FENCED_LOAD_STORE

#define __TBB_USE_GENERIC_HALF_FENCED_LOAD_STORE   1

Definition at line 112 of file gcc_generic.h.

◆ __TBB_USE_GENERIC_RELAXED_LOAD_STORE

#define __TBB_USE_GENERIC_RELAXED_LOAD_STORE   1

Definition at line 113 of file gcc_generic.h.

◆ __TBB_USE_GENERIC_SEQUENTIAL_CONSISTENCY_LOAD_STORE

#define __TBB_USE_GENERIC_SEQUENTIAL_CONSISTENCY_LOAD_STORE   1

Definition at line 114 of file gcc_generic.h.

◆ __TBB_WORDSIZE

#define __TBB_WORDSIZE   __SIZEOF_POINTER__

Definition at line 26 of file gcc_generic.h.

Typedef Documentation

◆ __TBB_atomic_flag

Definition at line 106 of file gcc_generic.h.

◆ __TBB_Flag

typedef unsigned char __TBB_Flag

Definition at line 105 of file gcc_generic.h.

Function Documentation

◆ __TBB_machine_and()

static void __TBB_machine_and ( volatile void ptr,
uintptr_t  addend 
)
inlinestatic

Definition at line 120 of file gcc_generic.h.

120  {
121  __sync_fetch_and_and(reinterpret_cast<volatile uintptr_t *>(ptr),addend);
122 }

◆ __TBB_machine_lg()

static intptr_t __TBB_machine_lg ( uintptr_t  x)
inlinestatic

Definition at line 220 of file gcc_generic.h.

220  {
221  // If P is a power of 2 and x<P, then (P-1)-x == (P-1) XOR x
222  return (sizeof(x)*8 - 1) ^ tbb::internal::gcc_builtins::clz(x);
223 }
int clz(unsigned int x)
Definition: gcc_generic.h:215

References tbb::internal::gcc_builtins::clz().

Here is the call graph for this function:

◆ __TBB_machine_or()

static void __TBB_machine_or ( volatile void ptr,
uintptr_t  addend 
)
inlinestatic

Definition at line 116 of file gcc_generic.h.

116  {
117  __sync_fetch_and_or(reinterpret_cast<volatile uintptr_t *>(ptr),addend);
118 }

◆ __TBB_machine_try_lock_byte()

bool __TBB_machine_try_lock_byte ( __TBB_atomic_flag flag)
inline

Definition at line 124 of file gcc_generic.h.

124  {
125  return __sync_lock_test_and_set(&flag,1)==0;
126 }

◆ __TBB_machine_unlock_byte()

void __TBB_machine_unlock_byte ( __TBB_atomic_flag flag)
inline

Definition at line 128 of file gcc_generic.h.

128  {
129  __sync_lock_release(&flag);
130 }

Copyright © 2005-2020 Intel Corporation. All Rights Reserved.

Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are registered trademarks or trademarks of Intel Corporation or its subsidiaries in the United States and other countries.

* Other names and brands may be claimed as the property of others.