PR bootstrap/82916
[official-gcc.git] / libcilkrts / include / internal / metacall.h
blob00aa0f1598a5869b99b52544a94c20d6d452f8e9
1 // -*- C++ -*-
3 /*
4 * Copyright (C) 2009-2016, Intel Corporation
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
16 * distribution.
17 * * Neither the name of Intel Corporation nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
28 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
29 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
31 * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 * POSSIBILITY OF SUCH DAMAGE.
34 * *********************************************************************
36 * PLEASE NOTE: This file is a downstream copy of a file mainitained in
37 * a repository at cilkplus.org. Changes made to this file that are not
38 * submitted through the contribution process detailed at
39 * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
40 * time that a new version is released. Changes only submitted to the
41 * GNU compiler collection or posted to the git repository at
42 * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
43 * not tracked.
45 * We welcome your contributions to this open source project. Thank you
46 * for your assistance in helping us improve Cilk Plus.
48 ******************************************************************************
50 * metacall.h
52 * This is an internal header file defining part of the metacall
53 * interface used by Cilkscreen. It is not a stable API and is
54 * subject to change without notice.
57 // Provides the enum of metacall kinds. This is used by Cilkscreen and the
58 // runtime, and will probably be used by any future ptools.
60 #pragma once
62 ///////////////////////////////////////////////////////////////////////////////
64 enum
66 // Notify Cilkscreen to stop/start instrumenting code
67 HYPER_DISABLE_INSTRUMENTATION = 0,
68 HYPER_ENABLE_INSTRUMENTATION = 1,
70 // Write 0 in *(char *)arg if the p-tool is sequential. The Cilk runtime
71 // system invokes this metacall to know whether to spawn worker threads.
72 HYPER_ZERO_IF_SEQUENTIAL_PTOOL = 2,
74 // Write 0 in *(char *)arg if the runtime must force reducers to
75 // call the reduce() method even if no actual stealing occurs.
76 HYPER_ZERO_IF_FORCE_REDUCE = 3,
78 // Inform cilkscreen about the current stack pointer.
79 HYPER_ESTABLISH_C_STACK = 4,
81 // Inform Cilkscreen about the current worker
82 HYPER_ESTABLISH_WORKER = 5,
84 // Tell tools to ignore a block of memory. Parameter is a 2 element
85 // array: void *block[2] = {_begin, _end}; _end is 1 beyond the end
86 // of the block to be ignored. Essentially, if p is a pointer to an
87 // array, _begin = &p[0], _end = &p[max]
88 HYPER_IGNORE_MEMORY_BLOCK = 6
90 // If you add metacalls here, remember to update BOTH workspan.cpp AND
91 // cilkscreen-common.cpp!
94 typedef struct
96 unsigned int tool; // Specifies tool metacall is for
97 // (eg. system=0, cilkscreen=1, cilkview=2).
98 // All tools should understand system codes.
99 // Tools should ignore all other codes, except
100 // their own.
102 unsigned int code; // Tool-specific code specifies what to do and how to
103 // interpret data
105 void *data;
106 } metacall_data_t;
108 #define METACALL_TOOL_SYSTEM 0
110 ///////////////////////////////////////////////////////////////////////////////