KallistiOS git master
Independent SDK for the Sega Dreamcast
Loading...
Searching...
No Matches
args.h
Go to the documentation of this file.
1/* KallistiOS ##version##
2
3 arch/dreamcast/include/arch/args.h
4 Copyright (C) 2023 Paul Cercueil <paul@crapouillou.net>
5
6*/
7
8/** \file arch/args.h
9 \brief Macros for getting argument registers in inline assembly
10
11 This file contains the KOS_FPARG(n) macro, which resolves to the register
12 name that corresponds to the nth floating-point argument of a function.
13
14 \author Paul Cercueil
15*/
16
17#ifdef __SH4_SINGLE_ONLY__
18#define KOS_SH4_SINGLE_ONLY 1
19#else
20#define KOS_SH4_SINGLE_ONLY 0
21#endif
22
23#define __KOS_FPARG_0_1 "fr4"
24#define __KOS_FPARG_0_0 "fr5"
25#define __KOS_FPARG_1_1 "fr5"
26#define __KOS_FPARG_1_0 "fr4"
27#define __KOS_FPARG_2_1 "fr6"
28#define __KOS_FPARG_2_0 "fr7"
29#define __KOS_FPARG_3_1 "fr7"
30#define __KOS_FPARG_3_0 "fr6"
31#define __KOS_FPARG_4_1 "fr8"
32#define __KOS_FPARG_4_0 "fr9"
33#define __KOS_FPARG_5_1 "fr9"
34#define __KOS_FPARG_5_0 "fr8"
35#define __KOS_FPARG_6_1 "fr10"
36#define __KOS_FPARG_6_0 "fr11"
37#define __KOS_FPARG_7_1 "fr11"
38#define __KOS_FPARG_7_0 "fr10"
39
40#define __KOS_FPARG(n,single) __KOS_FPARG_##n##_##single
41#define _KOS_FPARG(n,single) __KOS_FPARG(n,single)
42
43/** \brief Get the name of the nth floating-point argument register
44 *
45 * This macro resolves to the register name that corresponds to the nth
46 * floating-point argument of a function (starting from n=0).
47 */
48#define KOS_FPARG(n) _KOS_FPARG(n, KOS_SH4_SINGLE_ONLY)