aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Metcalf <cmetcalf@mellanox.com>2017-03-23 11:31:19 -0400
committerChris Metcalf <cmetcalf@mellanox.com>2017-03-27 13:56:09 -0400
commit34649f72b628c7c4966c167b8208f2595ca51251 (patch)
tree5f64fe185bc5b77bf079f74aecbbe5823592909f
parentc02ed2e75ef4c74e41e421acb4ef1494671585e8 (diff)
tile: prefer <arch/intreg.h> to __need_int_reg_t
As part of some work in glibc to move away from the "__need" prefix, this commit breaks away the definitions of __int_reg_t, __uint_reg_t, __INT_REG_BITS, and __INT_REG_FMT to a separate <arch/intreg.h> "microheader". It is then included from <arch/abi.h> to preserve the semantics of the previous header. For now, we continue to preserve the __need_int_reg_t semantics in <arch/abi.h> as well, but anticipate that after a few years we can obsolete it.
-rw-r--r--arch/tile/include/uapi/arch/abi.h49
-rw-r--r--arch/tile/include/uapi/arch/intreg.h70
2 files changed, 74 insertions, 45 deletions
diff --git a/arch/tile/include/uapi/arch/abi.h b/arch/tile/include/uapi/arch/abi.h
index c55a3d432644..328e62260272 100644
--- a/arch/tile/include/uapi/arch/abi.h
+++ b/arch/tile/include/uapi/arch/abi.h
@@ -20,58 +20,17 @@
20 20
21#ifndef __ARCH_ABI_H__ 21#ifndef __ARCH_ABI_H__
22 22
23#if !defined __need_int_reg_t && !defined __DOXYGEN__ 23#ifndef __tile__ /* support uncommon use of arch headers in non-tile builds */
24# define __ARCH_ABI_H__
25# include <arch/chip.h>
26#endif
27
28/* Provide the basic machine types. */
29#ifndef __INT_REG_BITS
30
31/** Number of bits in a register. */
32#if defined __tilegx__
33# define __INT_REG_BITS 64
34#elif defined __tilepro__
35# define __INT_REG_BITS 32
36#elif !defined __need_int_reg_t
37# include <arch/chip.h> 24# include <arch/chip.h>
38# define __INT_REG_BITS CHIP_WORD_SIZE() 25# define __INT_REG_BITS CHIP_WORD_SIZE()
39#else
40# error Unrecognized architecture with __need_int_reg_t
41#endif
42
43#if __INT_REG_BITS == 64
44
45#ifndef __ASSEMBLER__
46/** Unsigned type that can hold a register. */
47typedef unsigned long long __uint_reg_t;
48
49/** Signed type that can hold a register. */
50typedef long long __int_reg_t;
51#endif
52
53/** String prefix to use for printf(). */
54#define __INT_REG_FMT "ll"
55
56#else
57
58#ifndef __ASSEMBLER__
59/** Unsigned type that can hold a register. */
60typedef unsigned long __uint_reg_t;
61
62/** Signed type that can hold a register. */
63typedef long __int_reg_t;
64#endif
65
66/** String prefix to use for printf(). */
67#define __INT_REG_FMT "l"
68
69#endif 26#endif
70#endif /* __INT_REG_BITS */
71 27
28#include <arch/intreg.h>
72 29
30/* __need_int_reg_t is deprecated: just include <arch/intreg.h> */
73#ifndef __need_int_reg_t 31#ifndef __need_int_reg_t
74 32
33#define __ARCH_ABI_H__
75 34
76#ifndef __ASSEMBLER__ 35#ifndef __ASSEMBLER__
77/** Unsigned type that can hold a register. */ 36/** Unsigned type that can hold a register. */
diff --git a/arch/tile/include/uapi/arch/intreg.h b/arch/tile/include/uapi/arch/intreg.h
new file mode 100644
index 000000000000..1cf2fbf74306
--- /dev/null
+++ b/arch/tile/include/uapi/arch/intreg.h
@@ -0,0 +1,70 @@
1/*
2 * Copyright 2017 Tilera Corporation. All Rights Reserved.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation, version 2.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
11 * NON INFRINGEMENT. See the GNU General Public License for
12 * more details.
13 */
14
15/**
16 * @file
17 *
18 * Provide types and defines for the type that can hold a register,
19 * in the implementation namespace.
20 */
21
22#ifndef __ARCH_INTREG_H__
23#define __ARCH_INTREG_H__
24
25/*
26 * Get number of bits in a register. __INT_REG_BITS may be defined
27 * prior to including this header to force a particular bit width.
28 */
29
30#ifndef __INT_REG_BITS
31# if defined __tilegx__
32# define __INT_REG_BITS 64
33# elif defined __tilepro__
34# define __INT_REG_BITS 32
35# else
36# error Unrecognized architecture
37# endif
38#endif
39
40#if __INT_REG_BITS == 64
41
42# ifndef __ASSEMBLER__
43/** Unsigned type that can hold a register. */
44typedef unsigned long long __uint_reg_t;
45
46/** Signed type that can hold a register. */
47typedef long long __int_reg_t;
48# endif
49
50/** String prefix to use for printf(). */
51# define __INT_REG_FMT "ll"
52
53#elif __INT_REG_BITS == 32
54
55# ifndef __ASSEMBLER__
56/** Unsigned type that can hold a register. */
57typedef unsigned long __uint_reg_t;
58
59/** Signed type that can hold a register. */
60typedef long __int_reg_t;
61# endif
62
63/** String prefix to use for printf(). */
64# define __INT_REG_FMT "l"
65
66#else
67# error Unrecognized value of __INT_REG_BITS
68#endif
69
70#endif /* !__ARCH_INTREG_H__ */