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#ifndef __ARCH_ARGS_H
18#define __ARCH_ARGS_H
19
20#include <kos/cdefs.h>
21__BEGIN_DECLS
22
23#ifdef __SH4_SINGLE_ONLY__
24#define KOS_SH4_SINGLE_ONLY 1
25#else
26#define KOS_SH4_SINGLE_ONLY 0
27#endif
28
29#define __KOS_FPARG_0_1 "fr4"
30#define __KOS_FPARG_0_0 "fr5"
31#define __KOS_FPARG_1_1 "fr5"
32#define __KOS_FPARG_1_0 "fr4"
33#define __KOS_FPARG_2_1 "fr6"
34#define __KOS_FPARG_2_0 "fr7"
35#define __KOS_FPARG_3_1 "fr7"
36#define __KOS_FPARG_3_0 "fr6"
37#define __KOS_FPARG_4_1 "fr8"
38#define __KOS_FPARG_4_0 "fr9"
39#define __KOS_FPARG_5_1 "fr9"
40#define __KOS_FPARG_5_0 "fr8"
41#define __KOS_FPARG_6_1 "fr10"
42#define __KOS_FPARG_6_0 "fr11"
43#define __KOS_FPARG_7_1 "fr11"
44#define __KOS_FPARG_7_0 "fr10"
45
46#define __KOS_FPARG(n,single) __KOS_FPARG_##n##_##single
47#define _KOS_FPARG(n,single) __KOS_FPARG(n,single)
48
49/** \brief Get the name of the nth floating-point argument register
50 *
51 * This macro resolves to the register name that corresponds to the nth
52 * floating-point argument of a function (starting from n=0).
53 */
54#define KOS_FPARG(n) _KOS_FPARG(n, KOS_SH4_SINGLE_ONLY)
55
56__END_DECLS
57
58#endif /* __ARCH_ARGS_H */
Various common macros used throughout the codebase.