OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [hwint.h] - Blame information for rev 373

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 38 julius
/* HOST_WIDE_INT definitions for the GNU compiler.
2
   Copyright (C) 1998, 2002, 2004 Free Software Foundation, Inc.
3
 
4
   This file is part of GCC.
5
 
6
   Provide definitions for macros which depend on HOST_BITS_PER_INT
7
   and HOST_BITS_PER_LONG.  */
8
 
9
#ifndef GCC_HWINT_H
10
#define GCC_HWINT_H
11
 
12
/* This describes the machine the compiler is hosted on.  */
13
#define HOST_BITS_PER_CHAR  CHAR_BIT
14
#define HOST_BITS_PER_SHORT (CHAR_BIT * SIZEOF_SHORT)
15
#define HOST_BITS_PER_INT   (CHAR_BIT * SIZEOF_INT)
16
#define HOST_BITS_PER_LONG  (CHAR_BIT * SIZEOF_LONG)
17
 
18
/* The string that should be inserted into a printf style format to
19
   indicate a "long long" operand.  */
20
#ifndef HOST_LONG_LONG_FORMAT 
21
#define HOST_LONG_LONG_FORMAT "ll"
22
#endif
23
 
24
/* If HAVE_LONG_LONG and SIZEOF_LONG_LONG aren't defined, but
25
   GCC_VERSION >= 3000, assume this is the second or later stage of a
26
   bootstrap, we do have long long, and it's 64 bits.  (This is
27
   required by C99; we do have some ports that violate that assumption
28
   but they're all cross-compile-only.)  Just in case, force a
29
   constraint violation if that assumption is incorrect.  */
30
#if !defined HAVE_LONG_LONG
31
# if GCC_VERSION >= 3000
32
#  define HAVE_LONG_LONG 1
33
#  define SIZEOF_LONG_LONG 8
34
extern char sizeof_long_long_must_be_8[sizeof(long long) == 8 ? 1 : -1];
35
# endif
36
#endif
37
 
38
#ifdef HAVE_LONG_LONG
39
# define HOST_BITS_PER_LONGLONG (CHAR_BIT * SIZEOF_LONG_LONG)
40
#endif
41
#ifdef HAVE___INT64
42
# define HOST_BITS_PER___INT64 (CHAR_BIT * SIZEOF___INT64)
43
#endif
44
 
45
/* Set HOST_WIDE_INT.  This should be the widest efficient host
46
   integer type.  It can be 32 or 64 bits, except that if we are
47
   targeting a machine with 64-bit size_t then it has to be 64 bits.
48
 
49
   With a sane ABI, 'long' is the largest efficient host integer type.
50
   Thus, we use that unless we have to use 'long long' or '__int64'
51
   because we're targeting a 64-bit machine from a 32-bit host.  */
52
 
53
#if HOST_BITS_PER_LONG >= 64 || !defined NEED_64BIT_HOST_WIDE_INT
54
#   define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_LONG
55
#   define HOST_WIDE_INT long
56
#else
57
# if HOST_BITS_PER_LONGLONG >= 64
58
#   define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_LONGLONG
59
#   define HOST_WIDE_INT long long
60
# else
61
#  if HOST_BITS_PER___INT64 >= 64
62
#   define HOST_BITS_PER_WIDE_INT HOST_BITS_PER___INT64
63
#   define HOST_WIDE_INT __int64
64
#  else
65
    #error "Unable to find a suitable type for HOST_WIDE_INT"
66
#  endif
67
# endif
68
#endif
69
 
70
/* Various printf format strings for HOST_WIDE_INT.  */
71
 
72
#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
73
# define HOST_WIDE_INT_PRINT "l"
74
# define HOST_WIDE_INT_PRINT_C "L"
75
  /* 'long' might be 32 or 64 bits, and the number of leading zeroes
76
     must be tweaked accordingly.  */
77
# if HOST_BITS_PER_WIDE_INT == 64
78
#  define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%lx%016lx"
79
# else
80
#  define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%lx%08lx"
81
# endif
82
#else
83
# define HOST_WIDE_INT_PRINT HOST_LONG_LONG_FORMAT
84
# define HOST_WIDE_INT_PRINT_C "LL"
85
  /* We can assume that 'long long' is at least 64 bits.  */
86
# define HOST_WIDE_INT_PRINT_DOUBLE_HEX \
87
    "0x%" HOST_LONG_LONG_FORMAT "x%016" HOST_LONG_LONG_FORMAT "x"
88
#endif /* HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG */
89
 
90
#define HOST_WIDE_INT_PRINT_DEC "%" HOST_WIDE_INT_PRINT "d"
91
#define HOST_WIDE_INT_PRINT_DEC_C HOST_WIDE_INT_PRINT_DEC HOST_WIDE_INT_PRINT_C
92
#define HOST_WIDE_INT_PRINT_UNSIGNED "%" HOST_WIDE_INT_PRINT "u"
93
#define HOST_WIDE_INT_PRINT_HEX "0x%" HOST_WIDE_INT_PRINT "x"
94
 
95
/* Set HOST_WIDEST_INT.  This is a 64-bit type unless the compiler
96
   in use has no 64-bit type at all; in that case it's 32 bits.  */
97
 
98
#if HOST_BITS_PER_WIDE_INT >= 64 \
99
    || (HOST_BITS_PER_LONGLONG < 64 && HOST_BITS_PER___INT64 < 64)
100
# define HOST_WIDEST_INT                      HOST_WIDE_INT
101
# define HOST_BITS_PER_WIDEST_INT             HOST_BITS_PER_WIDE_INT
102
# define HOST_WIDEST_INT_PRINT_DEC            HOST_WIDE_INT_PRINT_DEC
103
# define HOST_WIDEST_INT_PRINT_DEC_C          HOST_WIDE_INT_PRINT_DEC_C
104
# define HOST_WIDEST_INT_PRINT_UNSIGNED       HOST_WIDE_INT_PRINT_UNSIGNED
105
# define HOST_WIDEST_INT_PRINT_HEX            HOST_WIDE_INT_PRINT_HEX
106
# define HOST_WIDEST_INT_PRINT_DOUBLE_HEX     HOST_WIDE_INT_PRINT_DOUBLE_HEX
107
#else
108
# if HOST_BITS_PER_LONGLONG >= 64
109
#  define HOST_BITS_PER_WIDEST_INT            HOST_BITS_PER_LONGLONG
110
#  define HOST_WIDEST_INT                     long long
111
# else
112
#  if HOST_BITS_PER___INT64 >= 64
113
#   define HOST_BITS_PER_WIDEST_INT           HOST_BITS_PER___INT64
114
#   define HOST_WIDEST_INT                    __int64
115
#  else
116
    #error "This line should be impossible to reach"
117
#  endif
118
# endif
119
# define HOST_WIDEST_INT_PRINT_DEC            "%" HOST_LONG_LONG_FORMAT "d"
120
# define HOST_WIDEST_INT_PRINT_DEC_C          "%" HOST_LONG_LONG_FORMAT "dLL"
121
# define HOST_WIDEST_INT_PRINT_UNSIGNED       "%" HOST_LONG_LONG_FORMAT "u"
122
# define HOST_WIDEST_INT_PRINT_HEX            "0x%" HOST_LONG_LONG_FORMAT "x"
123
# define HOST_WIDEST_INT_PRINT_DOUBLE_HEX     \
124
    "0x%" HOST_LONG_LONG_FORMAT "x%016" HOST_LONG_LONG_FORMAT "x"
125
#endif
126
 
127
/* Define HOST_WIDEST_FAST_INT to the widest integer type supported
128
   efficiently in hardware.  (That is, the widest integer type that fits
129
   in a hardware register.)  Normally this is "long" but on some hosts it
130
   should be "long long" or "__int64".  This is no convenient way to
131
   autodect this, so such systems must set a flag in config.host; see there
132
   for details.  */
133
 
134
#ifdef USE_LONG_LONG_FOR_WIDEST_FAST_INT
135
#  ifdef HAVE_LONG_LONG
136
#    define HOST_WIDEST_FAST_INT long long
137
#    define HOST_BITS_PER_WIDEST_FAST_INT HOST_BITS_PER_LONGLONG
138
#  elif defined (HAVE___INT64)
139
#    define HOST_WIDEST_FAST_INT __int64
140
#    define HOST_BITS_PER_WIDEST_FAST_INT HOST_BITS_PER___INT64
141
#  else
142
#    error "Your host said it wantted to use long long or __int64 but neither"
143
#    error "exist"
144
#  endif
145
#else
146
#  define HOST_WIDEST_FAST_INT long
147
#  define HOST_BITS_PER_WIDEST_FAST_INT HOST_BITS_PER_LONG
148
#endif
149
 
150
#endif /* ! GCC_HWINT_H */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.