2 * This file is part of libFirm.
3 * Copyright (C) 2012 University of Karlsruhe.
8 * @brief declarations for arm backend -- private header
9 * @author Oliver Richter, Tobias Gneist
11 #ifndef FIRM_BE_ARM_BEARCH_ARM_T_H
12 #define FIRM_BE_ARM_BEARCH_ARM_T_H
16 #include "arm_nodes_attr.h"
19 typedef struct arm_isa_t arm_isa_t;
21 /** The following bitmasks control CPU extensions: */
22 enum arm_cpu_extensions {
23 ARM_EXT_V1 = 0x00000001, /**< All processors (core set). */
24 ARM_EXT_V2 = 0x00000002, /**< Multiply instructions. */
25 ARM_EXT_V2S = 0x00000004, /**< SWP instructions. */
26 ARM_EXT_V3 = 0x00000008, /**< MSR MRS. */
27 ARM_EXT_V3M = 0x00000010, /**< Allow long multiplies. */
28 ARM_EXT_V4 = 0x00000020, /**< Allow half word loads. */
29 ARM_EXT_V4T = 0x00000040, /**< Thumb v1. */
30 ARM_EXT_V5 = 0x00000080, /**< Allow CLZ, etc. */
31 ARM_EXT_V5T = 0x00000100, /**< Thumb v2.ยด*/
32 ARM_EXT_V5ExP = 0x00000200, /**< DSP core set. */
33 ARM_EXT_V5E = 0x00000400, /**< DSP Double transfers. */
34 ARM_EXT_V5J = 0x00000800, /**< Jazelle extension. */
36 /* Co-processor space extensions. */
37 ARM_CEXT_XSCALE = 0x00800000, /**< Allow MIA etc. */
38 ARM_CEXT_MAVERICK = 0x00400000, /**< Use Cirrus/DSP coprocessor. */
39 ARM_CEXT_IWMMXT = 0x00200000, /**< Intel Wireless MMX technology coprocessor. */
43 * Architectures are the sum of the base and extensions. The ARM ARM (rev E)
44 * defines the following: ARMv3, ARMv3M, ARMv4xM, ARMv4, ARMv4TxM, ARMv4T,
45 * ARMv5xM, ARMv5, ARMv5TxM, ARMv5T, ARMv5TExP, ARMv5TE. To these we add
46 * three more to cover cores prior to ARM6. Finally, there are cores which
47 * implement further extensions in the co-processor space.
49 enum arm_architectures {
50 ARM_ARCH_V1 = ARM_EXT_V1,
51 ARM_ARCH_V2 = ARM_ARCH_V1 | ARM_EXT_V2,
52 ARM_ARCH_V2S = ARM_ARCH_V2 | ARM_EXT_V2S,
53 ARM_ARCH_V3 = ARM_ARCH_V2S | ARM_EXT_V3,
54 ARM_ARCH_V3M = ARM_ARCH_V3 | ARM_EXT_V3M,
55 ARM_ARCH_V4xM = ARM_ARCH_V3 | ARM_EXT_V4,
56 ARM_ARCH_V4 = ARM_ARCH_V3M | ARM_EXT_V4,
57 ARM_ARCH_V4TxM = ARM_ARCH_V4xM | ARM_EXT_V4T,
58 ARM_ARCH_V4T = ARM_ARCH_V4 | ARM_EXT_V4T,
59 ARM_ARCH_V5xM = ARM_ARCH_V4xM| ARM_EXT_V5,
60 ARM_ARCH_V5 = ARM_ARCH_V4 | ARM_EXT_V5,
61 ARM_ARCH_V5TxM = ARM_ARCH_V5xM | ARM_EXT_V4T | ARM_EXT_V5T,
62 ARM_ARCH_V5T = ARM_ARCH_V5 | ARM_EXT_V4T | ARM_EXT_V5T,
63 ARM_ARCH_V5TExP = ARM_ARCH_V5T | ARM_EXT_V5ExP,
64 ARM_ARCH_V5TE = ARM_ARCH_V5TExP | ARM_EXT_V5E,
65 ARM_ARCH_V5TEJ = ARM_ARCH_V5TE | ARM_EXT_V5J,
67 /* Processors with specific extensions in the co-processor space. */
68 ARM_ARCH_XSCALE = ARM_ARCH_V5TE | ARM_CEXT_XSCALE,
69 ARM_ARCH_IWMMXT = ARM_ARCH_XSCALE | ARM_CEXT_IWMMXT,
71 ARM_ARCH_MASK = 0x00ffffff,
74 /** Floating point instruction set. */
75 enum arm_fp_architectures {
76 ARM_FPU_FPA_EXT_V1 = 0x80000000, /**< Base FPA instruction set. */
77 ARM_FPU_FPA_EXT_V2 = 0x40000000, /**< LFM/SFM. */
78 ARM_FPU_VFP_EXT_NONE = 0x20000000, /**< Use VFP word-ordering. */
79 ARM_FPU_VFP_EXT_V1xD = 0x10000000, /**< Base VFP instruction set. */
80 ARM_FPU_VFP_EXT_V1 = 0x08000000, /**< Double-precision insns. */
81 ARM_FPU_VFP_EXT_V2 = 0x04000000, /**< ARM10E VFPr1. */
83 ARM_FPU_SOFTFLOAT = 0x01000000, /**< soft float library */
86 ARM_FPU_ARCH_FPE = ARM_FPU_FPA_EXT_V1,
87 ARM_FPU_ARCH_FPA = ARM_FPU_ARCH_FPE | ARM_FPU_FPA_EXT_V2,
89 ARM_FPU_ARCH_VFP = ARM_FPU_VFP_EXT_NONE,
90 ARM_FPU_ARCH_VFP_V1xD = ARM_FPU_VFP_EXT_V1xD | ARM_FPU_VFP_EXT_NONE,
91 ARM_FPU_ARCH_VFP_V1 = ARM_FPU_ARCH_VFP_V1xD | ARM_FPU_VFP_EXT_V1,
92 ARM_FPU_ARCH_VFP_V2 = ARM_FPU_ARCH_VFP_V1 | ARM_FPU_VFP_EXT_V2,
94 ARM_FPU_ARCH_SOFTFLOAT = ARM_FPU_SOFTFLOAT,
96 ARM_FPU_MASK = 0xff000000,
99 /** Returns non-zero if FPA instructions should be issued. */
100 #define USE_FPA(isa) ((isa)->fpu_arch & ARM_FPU_FPA_EXT_V1)
102 /** Returns non-zero if VFP instructions should be issued. */
103 #define USE_VFP(isa) ((isa)->fpu_arch & ARM_FPU_VFP_EXT_V1xD)
105 /** Types of processor to generate code for. */
106 enum arm_processor_types {
109 ARM_2a = ARM_ARCH_V2,
110 ARM_3 = ARM_ARCH_V2S,
111 ARM_3G = ARM_ARCH_V2S,
112 ARM_250 = ARM_ARCH_V2S,
116 ARM_9 = ARM_ARCH_V4T,
117 ARM_STRONG = ARM_ARCH_V4,
121 arch_env_t base; /**< must be derived from arch_env_t */
122 int fpu_arch; /**< FPU architecture */