[runtime] Fix DISABLE_REFLECTION_EMIT build.
[mono.git] / mono / utils / mono-hwcap.h
1 /**
2  * \file
3  */
4
5 #ifndef __MONO_UTILS_HWCAP_H__
6 #define __MONO_UTILS_HWCAP_H__
7
8 #include <stdio.h>
9 #include <glib.h>
10
11 #include "config.h"
12
13 #include "mono/utils/mono-compiler.h"
14
15 #define MONO_HWCAP_VAR(NAME) extern gboolean mono_hwcap_ ## NAME;
16 #include "mono/utils/mono-hwcap-vars.h"
17 #undef MONO_HWCAP_VAR
18
19 /* Call this function to perform hardware feature detection. Until
20  * this function has been called, all feature variables will be
21  * FALSE as a default.
22  *
23  * While this function can be called multiple times, doing so from
24  * several threads at the same time is not supported as it will
25  * result in an inconsistent state of the variables. Further,
26  * feature variables should not be read *while* this function is
27  * executing.
28  */
29 void mono_hwcap_init (void);
30
31 /* Implemented in mono-hwcap-$TARGET.c. Do not call. */
32 void mono_hwcap_arch_init (void);
33
34 /* Print detected features to stdout. */
35 void mono_hwcap_print (void);
36
37 /* Please note: If you're going to use the Linux auxiliary vector
38  * to detect CPU features, don't use any of the constant names in
39  * the hwcap.h header. This ties us to a particular version of the
40  * header, and since the values are guaranteed to be stable, hard-
41  * coding them is not that terrible.
42  *
43  * Also, please do not add assumptions to mono-hwcap. The code here
44  * is meant to *discover* facts about the hardware, not assume that
45  * some feature exists because of $arbitrary_preprocessor_define.
46  * If you have to make assumptions, do so elsewhere, e.g. in the
47  * Mini back end you're modifying.
48  *
49  * Finally, be conservative. If you can't determine precisely if a
50  * feature is present, assume that it isn't. In the rare cases where
51  * the hardware or operating system are lying, work around that in
52  * a different place, as with the rule above.
53  */
54
55 #endif /* __MONO_UTILS_HWCAP_H__ */