]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/include/parallel/types.h
builtins.c (std_canonical_va_list): Treat structure based va_list types.
[thirdparty/gcc.git] / libstdc++-v3 / include / parallel / types.h
CommitLineData
c2ba9709
JS
1// -*- C++ -*-
2
847eb551 3// Copyright (C) 2007, 2008 Free Software Foundation, Inc.
c2ba9709
JS
4//
5// This file is part of the GNU ISO C++ Library. This library is free
6// software; you can redistribute it and/or modify it under the terms
7// of the GNU General Public License as published by the Free Software
8// Foundation; either version 2, or (at your option) any later
9// version.
10
11// This library is distributed in the hope that it will be useful, but
12// WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14// General Public License for more details.
15
16// You should have received a copy of the GNU General Public License
17// along with this library; see the file COPYING. If not, write to
18// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
19// MA 02111-1307, USA.
20
21// As a special exception, you may use this file as part of a free
22// software library without restriction. Specifically, if other files
23// instantiate templates or use macros or inline functions from this
24// file, or you compile this file and link it with other files to
25// produce an executable, this file does not by itself cause the
26// resulting executable to be covered by the GNU General Public
27// License. This exception does not however invalidate any other
28// reasons why the executable file might be covered by the GNU General
29// Public License.
30
31/** @file parallel/types.h
847eb551 32 * @brief Basic types and typedefs.
c2ba9709
JS
33 * This file is a GNU parallel extension to the Standard C++ Library.
34 */
35
36// Written by Johannes Singler and Felix Putze.
37
38#ifndef _GLIBCXX_PARALLEL_TYPES_H
39#define _GLIBCXX_PARALLEL_TYPES_H 1
40
41#include <cstdlib>
42
43namespace __gnu_parallel
44{
847eb551
BK
45 // Enumerated types.
46
ee1b5fc5
BK
47 /// Run-time equivalents for the compile-time tags.
48 enum _Parallelism
847eb551
BK
49 {
50 /// Not parallel.
51 sequential,
52
53 /// Parallel unbalanced (equal-sized chunks).
54 parallel_unbalanced,
55
56 /// Parallel balanced (work-stealing).
57 parallel_balanced,
58
59 /// Parallel with OpenMP dynamic load-balancing.
60 parallel_omp_loop,
61
62 /// Parallel with OpenMP static load-balancing.
63 parallel_omp_loop_static,
64
65 /// Parallel with OpenMP taskqueue construct.
66 parallel_taskqueue
67 };
68
ee1b5fc5
BK
69 /// Strategies for run-time algorithm selection:
70 // force_sequential, force_parallel, heuristic.
71 enum _AlgorithmStrategy
72 {
73 heuristic,
74 force_sequential,
75 force_parallel
76 };
77
78 /// Sorting algorithms:
79 // multi-way mergesort, quicksort, load-balanced quicksort.
80 enum _SortAlgorithm
81 {
82 MWMS,
83 QS,
84 QS_BALANCED
85 };
86
87 /// Merging algorithms:
88 // bubblesort-alike, loser-tree variants, enum sentinel.
89 enum _MultiwayMergeAlgorithm
f9985df5
JS
90 {
91 LOSER_TREE
ee1b5fc5 92 };
f9985df5 93
ee1b5fc5
BK
94 /// Partial sum algorithms: recursive, linear.
95 enum _PartialSumAlgorithm
96 {
97 RECURSIVE,
98 LINEAR
99 };
100
101 /// Sorting/merging algorithms: sampling, exact.
102 enum _SplittingAlgorithm
103 {
104 SAMPLING,
105 EXACT
106 };
847eb551 107
ee1b5fc5
BK
108 /// Find algorithms:
109 // growing blocks, equal-sized blocks, equal splitting.
110 enum _FindAlgorithm
111 {
112 GROWING_BLOCKS,
113 CONSTANT_SIZE_BLOCKS,
114 EQUAL_SPLIT
115 };
116
117 /// Integer Types.
6df548d2
PC
118 // XXX need to use <cstdint>
119 /** @brief 16-bit signed integer. */
120 typedef short int16;
847eb551 121
6df548d2
PC
122 /** @brief 16-bit unsigned integer. */
123 typedef unsigned short uint16;
847eb551 124
6df548d2
PC
125 /** @brief 32-bit signed integer. */
126 typedef int int32;
127
128 /** @brief 32-bit unsigned integer. */
129 typedef unsigned int uint32;
130
131 /** @brief 64-bit signed integer. */
132 typedef long long int64;
133
134 /** @brief 64-bit unsigned integer. */
135 typedef unsigned long long uint64;
c2ba9709
JS
136
137 /**
138 * @brief Unsigned integer to index elements.
139 * The total number of elements for each algorithm must fit into this type.
140 */
6df548d2 141 typedef uint64 sequence_index_t;
c2ba9709
JS
142
143 /**
144 * @brief Unsigned integer to index a thread number.
145 * The maximum thread number (for each processor) must fit into this type.
146 */
6df548d2 147 typedef uint16 thread_index_t;
c2ba9709 148
847eb551 149 // XXX atomics interface?
ee1b5fc5 150 /// Longest compare-and-swappable integer type on this platform.
6df548d2 151 typedef int64 lcas_t;
c2ba9709 152
847eb551 153 // XXX numeric_limits::digits?
ee1b5fc5 154 /// Number of bits of ::lcas_t.
c2ba9709
JS
155 static const int lcas_t_bits = sizeof(lcas_t) * 8;
156
ee1b5fc5 157 /// ::lcas_t with the right half of bits set to 1.
847eb551 158 static const lcas_t lcas_t_mask = ((lcas_t(1) << (lcas_t_bits / 2)) - 1);
c2ba9709
JS
159}
160
161#endif /* _GLIBCXX_TYPES_H */