variant.h (1240B)
1 /* ARM32 backend variant descriptor — an immutable per-profile table threaded 2 * through the otherwise stateless backend so a single backend can later serve 3 * ARMv7-M and (future) ARMv6-M / A-profile variants. It is always reached 4 * through a context (Arm32NativeTarget.variant) or arm32_variant_for_kind(), 5 * never as ambient global state (CLAUDE.md: hang off a context struct). 6 * 7 * v1 ships exactly one variant: ARMv7-M Thumb-2, soft-float. */ 8 #ifndef KIT_ARCH_ARM32_VARIANT_H 9 #define KIT_ARCH_ARM32_VARIANT_H 10 11 #include "core/core.h" 12 13 typedef struct Arm32Variant { 14 KitArchKind kind; /* KIT_ARCH_ARM_32 */ 15 const char* name; /* "arm32" */ 16 const char* profile; /* "armv7-m" / (future) "armv7e-m" / "armv6-m" */ 17 u8 ptr_bytes; /* 4 */ 18 u8 has_thumb2; /* 1 on v7-M (32-bit Thumb-2, MOVW/MOVT, IT) */ 19 u8 has_idiv; /* 1 on v7-M (hardware SDIV/UDIV) */ 20 u8 has_dsp; /* 0 on v7-M, 1 on v7E-M (saturating/SIMD; follow-on) */ 21 u32 frame_save_size; /* saved lr + fp pair = 2 * ptr_bytes */ 22 } Arm32Variant; 23 24 extern const Arm32Variant arm32_variant_v7m; 25 26 /* Returns the variant for KIT_ARCH_ARM_32. v1 has a single variant. */ 27 const Arm32Variant* arm32_variant_for_kind(KitArchKind kind); 28 29 #endif