* config/msp430/msp430-modes.def (PSI): Add.
[official-gcc.git] / libcilkrts / runtime / cilk_malloc.h
blobfa0fa6d5c9d3480457855f1b7388eded20022508
1 /* cilk_malloc.h -*-C++-*-
3 *************************************************************************
5 * @copyright
6 * Copyright (C) 2009-2013, Intel Corporation
7 * All rights reserved.
8 *
9 * @copyright
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
14 * * Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * * Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in
18 * the documentation and/or other materials provided with the
19 * distribution.
20 * * Neither the name of Intel Corporation nor the names of its
21 * contributors may be used to endorse or promote products derived
22 * from this software without specific prior written permission.
24 * @copyright
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
30 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
31 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
32 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
33 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
35 * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 * POSSIBILITY OF SUCH DAMAGE.
37 **************************************************************************/
39 /**
40 * @file cilk_malloc.h
42 * @brief Provides replacement memory allocation functions to allocate
43 * (and free) memory on cache line boundaries, if supported by the OS.
45 * If aligned memory functions are not provided by the OS, the calls just
46 * pass through to the standard memory allocation functions.
49 #ifndef INCLUDED_CILK_MALLOC_DOT_H
50 #define INCLUDED_CILK_MALLOC_DOT_H
52 #include <cilk/common.h>
53 #include <stddef.h>
55 #include "rts-common.h"
57 __CILKRTS_BEGIN_EXTERN_C
59 /**
60 * malloc replacement function to allocate memory aligned on a cache line
61 * boundary if aligned memory allocations are supported by the OS.
63 * @param size Number of bytes to allocate.
65 * @return pointer to memory block allocated, or NULL if unsuccessful.
67 COMMON_PORTABLE void *__cilkrts_malloc(size_t size);
69 /**
70 * realloc replacement function to allocate memory aligned on a cache line
71 * boundary if aligned memory allocations are supported by the OS.
73 * @param ptr Block to be reallocated.
74 * @param size Number of bytes to allocate.
76 * @return pointer to memory block allocated, or NULL if unsuccessful.
78 COMMON_PORTABLE void *__cilkrts_realloc(void *ptr, size_t size);
80 /**
81 * free replacement function to deallocate memory aligned on a cache line
82 * boundary if aligned memory allocations are supported by the OS.
84 * @param ptr Block to be freed.
86 COMMON_PORTABLE void __cilkrts_free(void *ptr);
88 __CILKRTS_END_EXTERN_C
90 #endif // ! defined(INCLUDED_CILK_MALLOC_DOT_H)