aix.h (TARGET_IEEEQUAD_DEFAULT): Set long double default to IBM.
[official-gcc.git] / liboffloadmic / runtime / dv_util.h
blob370ff01637d4b91d2b11fc8f3fe745148ed37340
1 /*
2 Copyright (c) 2014-2016 Intel Corporation. All Rights Reserved.
4 Redistribution and use in source and binary forms, with or without
5 modification, are permitted provided that the following conditions
6 are met:
8 * Redistributions of source code must retain the above copyright
9 notice, this list of conditions and the following disclaimer.
10 * Redistributions in binary form must reproduce the above copyright
11 notice, this list of conditions and the following disclaimer in the
12 documentation and/or other materials provided with the distribution.
13 * Neither the name of Intel Corporation nor the names of its
14 contributors may be used to endorse or promote products derived
15 from this software without specific prior written permission.
17 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 #ifndef DV_UTIL_H_INCLUDED
32 #define DV_UTIL_H_INCLUDED
34 #include <stdint.h>
35 #include "offload_util.h"
37 // Dope vector declarations
38 #define ArrDescMaxArrayRank 31
40 // Dope vector flags
41 #define ArrDescFlagsDefined 1
42 #define ArrDescFlagsNodealloc 2
43 #define ArrDescFlagsContiguous 4
45 typedef int64_t dv_size;
47 typedef struct DimDesc {
48 dv_size Extent; // Number of elements in this dimension
49 dv_size Mult; // Multiplier for this dimension.
50 // The number of bytes between successive
51 // elements in this dimension.
52 dv_size LowerBound; // LowerBound of this dimension
53 } DimDesc ;
55 typedef struct ArrDesc {
56 dv_size Base; // Base address
57 dv_size Len; // Length of data type, used only for
58 // character strings.
59 dv_size Offset;
60 dv_size Flags; // Flags
61 dv_size Rank; // Rank of pointer
62 dv_size Reserved; // reserved for openmp requests
63 DimDesc Dim[ArrDescMaxArrayRank];
64 } ArrDesc ;
66 typedef ArrDesc* pArrDesc;
68 DLL_LOCAL bool __dv_is_contiguous(const ArrDesc *dvp);
70 DLL_LOCAL bool __dv_is_allocated(const ArrDesc *dvp);
72 DLL_LOCAL uint64_t __dv_data_length(const ArrDesc *dvp);
74 DLL_LOCAL uint64_t __dv_data_length(const ArrDesc *dvp, int64_t nelems);
76 DLL_LOCAL CeanReadRanges * init_read_ranges_dv(const ArrDesc *dvp);
78 #if OFFLOAD_DEBUG > 0
79 DLL_LOCAL void __dv_desc_dump(const char *name, const ArrDesc *dvp);
80 #else // OFFLOAD_DEBUG
81 #define __dv_desc_dump(name, dvp)
82 #endif // OFFLOAD_DEBUG
84 #endif // DV_UTIL_H_INCLUDED