Merge trunk version 222452 into gupc branch.
[official-gcc.git] / gcc / tree-upc.h
blob942568380594790fbaf17581c511abb6fcc1105c
1 /* tree-upc.h: UPC language-specific tree node support.
2 Copyright (C) 2003-2014 Free Software Foundation, Inc.
3 Contributed by Gary Funck <gary@intrepid.com>
4 and Nenad Vukicevic <nenad@intrepid.com>.
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3, or (at your option)
11 any later version.
13 GCC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
22 #ifndef GCC_TREE_UPC_H
23 #define GCC_TREE_UPC_H 1
25 /* Non-zero if the UPC blocking factor is 0. */
26 #define TYPE_HAS_UPC_BLOCK_FACTOR_0(NODE) \
27 TYPE_CHECK (NODE)->base.u.bits.upc_block_factor_0
29 /* Non-zero if the UPC blocking factor is greater than 1.
30 In this case, the blocking factor value is stored in a hash table. */
31 #define TYPE_HAS_UPC_BLOCK_FACTOR_X(NODE) \
32 TYPE_CHECK (NODE)->base.u.bits.upc_block_factor_x
34 /* Non-zero if the UPC blocking factor is not equal to 1 (the default). */
35 #define TYPE_HAS_UPC_BLOCK_FACTOR(NODE) \
36 (TYPE_UPC_SHARED(NODE) \
37 && (TYPE_HAS_UPC_BLOCK_FACTOR_0 (NODE) \
38 || TYPE_HAS_UPC_BLOCK_FACTOR_X (NODE)))
40 /* Return the UPC blocking factor of the type given by NODE..
41 The default block factor is one. The additional flag bits
42 over-ride the default. */
43 #define TYPE_UPC_BLOCK_FACTOR(NODE) \
44 (TYPE_UPC_SHARED (NODE) \
45 ? (TYPE_HAS_UPC_BLOCK_FACTOR_0 (NODE) ? size_zero_node \
46 : TYPE_HAS_UPC_BLOCK_FACTOR_X (NODE) ? upc_block_factor_lookup (NODE) \
47 : NULL_TREE) \
48 : NULL_TREE)
50 /* Set the UPC block factor in the type described by NODE.
51 For a zero blocking factor set TYPE_UPC_BLOCK_FACTOR_0 (NODE).
52 For a blocking factor greater than 1, insert the value
53 into a hash table indexed by NODE, and then set the
54 flag TYPE_UPC_BLOCK_FACTOR_X (NODE). */
55 #define SET_TYPE_UPC_BLOCK_FACTOR(NODE, VAL) \
56 do { \
57 if (TYPE_UPC_SHARED (NODE)) \
58 { \
59 TYPE_HAS_UPC_BLOCK_FACTOR_0 (NODE) = 0; \
60 TYPE_HAS_UPC_BLOCK_FACTOR_X (NODE) = 0; \
61 if (VAL) \
62 { \
63 gcc_assert (INTEGRAL_TYPE_P (TREE_TYPE (VAL))); \
64 if (!integer_onep (VAL)) \
65 { \
66 if (integer_zerop (VAL)) \
67 TYPE_HAS_UPC_BLOCK_FACTOR_0 (NODE) = 1; \
68 else \
69 { \
70 TYPE_HAS_UPC_BLOCK_FACTOR_X (NODE) = 1; \
71 upc_block_factor_insert (NODE, VAL); \
72 } \
73 } \
74 } \
75 } \
76 else \
77 gcc_assert (!VAL); \
78 } while (0)
80 extern void upc_block_factor_insert (tree, tree);
81 extern tree upc_block_factor_lookup (const_tree);
82 extern tree build_upc_unshared_type (tree);
83 extern void upc_block_factor_lookup_init (void);
84 extern tree upc_get_block_factor (const tree);
86 #endif /* !GCC_TREE_UPC_H */