Update ChangeLog and version files for release
[official-gcc.git] / libcilkrts / runtime / metacall_impl.h
blob90cc7f9516857f470b7b335ab89cd3d788951246
1 /* metacall_impl.h -*-C++-*-
3 *************************************************************************
5 * @copyright
6 * Copyright (C) 2010-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.
38 **************************************************************************/
40 /**
41 * @file metacall_impl.h
43 * @brief Meta-function calls to be used within the Cilk runtime system.
45 * These differ from the macros in cilkscreen.h and cilkview.h because they go
46 * through the __cilkrts_metacall interface, which ensures that the operation
47 * is performed even when instrumentation is disabled.
50 #ifndef INCLUDED_CILKRTS_METACALL_H
51 #define INCLUDED_CILKRTS_METACALL_H
53 #include "rts-common.h"
54 #include <internal/metacall.h>
55 #include <cilk/common.h>
57 __CILKRTS_BEGIN_EXTERN_C
59 /**
60 * This function is effectively an unconditional call from the runtime into
61 * a tool. It is used for operations that must be performed by the tool,
62 * even when the tool is not instrumenting. For example, Cilkscreen always
63 * recognizes the address of this function and performs the action specified
64 * in the contained metadata.
66 * Note that this function MUST NOT BE INLINED within the runtime. This must
67 * be the ONLY instance of the cilkscreen_metacall metadata.
69 CILK_API_VOID
70 __cilkrts_metacall(unsigned int tool, unsigned int code, void *data);
72 /**
73 * Return non-zero if running under Cilkscreen or Cilkview
75 COMMON_PORTABLE
76 int __cilkrts_running_under_sequential_ptool(void);
78 /**
79 * Disable Cilkscreen implementation
81 #define __cilkrts_cilkscreen_disable_instrumentation() \
82 __cilkrts_metacall(METACALL_TOOL_SYSTEM, HYPER_DISABLE_INSTRUMENTATION, 0)
84 /**
85 * Enable Cilkscreen implementation
87 #define __cilkrts_cilkscreen_enable_instrumentation() \
88 __cilkrts_metacall(METACALL_TOOL_SYSTEM, HYPER_ENABLE_INSTRUMENTATION, 0)
90 /**
91 * Set the worker on entering runtime.
93 * @attention Deprecated in favor of __cilkrts_cilkscreen_ignore_block. The
94 * begin/enter pairs in the current metadata mean Cilkscreen no longer has to
95 * have improper knowledge of the __cilkrts_worker or __cilkrts_stack_frame
96 * structures.
98 #define __cilkrts_cilkscreen_establish_worker(w) \
99 __cilkrts_metacall(METACALL_TOOL_SYSTEM, HYPER_ESTABLISH_WORKER, w)
102 * Notify Cilkscreen of the extent of the stack.
104 * @param[in] begin Start (low address) of stack
105 * @param[in] end One past high address of stack
107 void __cilkrts_cilkscreen_establish_c_stack(char *begin, char *end);
110 * Tell tools to ignore a block of memory - currently the global state and
111 * memory allocated for workers.
113 #define __cilkrts_cilkscreen_ignore_block(_begin, _end) \
115 void *block[2] = {_begin, _end}; \
116 __cilkrts_metacall(METACALL_TOOL_SYSTEM, \
117 HYPER_IGNORE_MEMORY_BLOCK, \
118 block); \
121 __CILKRTS_END_EXTERN_C
123 #endif /* ! defined(INCLUDED_CILKRTS_METACALL_H) */