Prefer #if defined to #ifdef
[ghc.git] / includes / stg / RtsMachRegs.h
1 /* -----------------------------------------------------------------------------
2 *
3 * (c) The GHC Team, 1998-2011
4 *
5 * Registers used in STG code. Might or might not correspond to
6 * actual machine registers.
7 *
8 * Do not #include this file directly: #include "Rts.h" instead.
9 *
10 * To understand the structure of the RTS headers, see the wiki:
11 * http://ghc.haskell.org/trac/ghc/wiki/Commentary/SourceTree/Includes
12 *
13 * ---------------------------------------------------------------------------*/
14
15 #pragma once
16
17 #if defined(UnregisterisedCompiler)
18 #if !defined(NO_REGS)
19 #define NO_REGS
20 #endif
21 #endif
22
23 /*
24 * Defining NO_REGS causes no global registers to be used. NO_REGS is
25 * typically defined by GHC, via a command-line option passed to gcc,
26 * when the -funregisterised flag is given.
27 *
28 * NB. When NO_REGS is on, calling & return conventions may be
29 * different. For example, all function arguments will be passed on
30 * the stack, and components of an unboxed tuple will be returned on
31 * the stack rather than in registers.
32 */
33 #if defined(NO_REGS)
34
35 #define MACHREGS_NO_REGS 1
36
37 #else
38
39 #define MACHREGS_NO_REGS 0
40
41 #if defined(i386_HOST_ARCH)
42 #define MACHREGS_i386 1
43 #endif
44
45 #if defined(x86_64_HOST_ARCH)
46 #define MACHREGS_x86_64 1
47 #endif
48
49 #if defined(powerpc_HOST_ARCH) || defined(powerpc64_HOST_ARCH) \
50 || defined(powerpc64le_HOST_ARCH) || defined(rs6000_HOST_ARCH)
51 #define MACHREGS_powerpc 1
52 #endif
53
54 #if defined(sparc_HOST_ARCH)
55 #define MACHREGS_sparc 1
56 #endif
57
58 #if defined(arm_HOST_ARCH)
59 #define MACHREGS_arm 1
60 #endif
61
62 #if defined(aarch64_HOST_ARCH)
63 #define MACHREGS_aarch64 1
64 #endif
65
66 #if defined(darwin_HOST_OS)
67 #define MACHREGS_darwin 1
68 #endif
69
70 #endif
71
72 #include "MachRegs.h"