Implemented project structure
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,14 @@
|
||||
This README file is copied into the directory for GCC-only header files
|
||||
when fixincludes is run by the makefile for GCC.
|
||||
|
||||
Many of the files in this directory were automatically edited from the
|
||||
standard system header files by the fixincludes process. They are
|
||||
system-specific, and will not work on any other kind of system. They
|
||||
are also not part of GCC. The reason we have to do this is because
|
||||
GCC requires ANSI C headers and many vendors supply ANSI-incompatible
|
||||
headers.
|
||||
|
||||
Because this is an automated process, sometimes headers get "fixed"
|
||||
that do not, strictly speaking, need a fix. As long as nothing is broken
|
||||
by the process, it is just an unfortunate collateral inconvenience.
|
||||
We would like to rectify it, if it is not "too inconvenient".
|
||||
@@ -0,0 +1,321 @@
|
||||
/* Declarations for ISO Fortran binding.
|
||||
Copyright (C) 2018-2023 Free Software Foundation, Inc.
|
||||
Contributed by Daniel Celis Garza <celisdanieljr@gmail.com>
|
||||
|
||||
This file is part of the GNU Fortran runtime library (libgfortran).
|
||||
|
||||
Libgfortran is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3, or (at your option)
|
||||
any later version.
|
||||
|
||||
Libgfortran is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Under Section 7 of GPL version 3, you are granted additional
|
||||
permissions described in the GCC Runtime Library Exception, version
|
||||
3.1, as published by the Free Software Foundation.
|
||||
|
||||
You should have received a copy of the GNU General Public License and
|
||||
a copy of the GCC Runtime Library Exception along with this program;
|
||||
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef ISO_FORTRAN_BINDING_H
|
||||
#define ISO_FORTRAN_BINDING_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stddef.h> /* Standard ptrdiff_t tand size_t. */
|
||||
#include <stdint.h> /* Integer types. */
|
||||
|
||||
/* Constants, defined as macros. */
|
||||
#define CFI_VERSION 1
|
||||
#define CFI_MAX_RANK 15
|
||||
|
||||
/* Attributes. */
|
||||
#define CFI_attribute_pointer 0
|
||||
#define CFI_attribute_allocatable 1
|
||||
#define CFI_attribute_other 2
|
||||
|
||||
/* Error codes.
|
||||
Note that CFI_FAILURE and CFI_INVALID_STRIDE are specific to GCC
|
||||
and not part of the Fortran standard */
|
||||
#define CFI_SUCCESS 0
|
||||
#define CFI_FAILURE 1
|
||||
#define CFI_ERROR_BASE_ADDR_NULL 2
|
||||
#define CFI_ERROR_BASE_ADDR_NOT_NULL 3
|
||||
#define CFI_INVALID_ELEM_LEN 4
|
||||
#define CFI_INVALID_RANK 5
|
||||
#define CFI_INVALID_TYPE 6
|
||||
#define CFI_INVALID_ATTRIBUTE 7
|
||||
#define CFI_INVALID_EXTENT 8
|
||||
#define CFI_INVALID_STRIDE 9
|
||||
#define CFI_INVALID_DESCRIPTOR 10
|
||||
#define CFI_ERROR_MEM_ALLOCATION 11
|
||||
#define CFI_ERROR_OUT_OF_BOUNDS 12
|
||||
|
||||
/* CFI type definitions. */
|
||||
typedef ptrdiff_t CFI_index_t;
|
||||
typedef int8_t CFI_rank_t;
|
||||
typedef int8_t CFI_attribute_t;
|
||||
typedef int16_t CFI_type_t;
|
||||
|
||||
/* CFI_dim_t. */
|
||||
typedef struct CFI_dim_t
|
||||
{
|
||||
CFI_index_t lower_bound;
|
||||
CFI_index_t extent;
|
||||
CFI_index_t sm;
|
||||
}
|
||||
CFI_dim_t;
|
||||
|
||||
/* CFI_cdesc_t, C descriptors are cast to this structure as follows:
|
||||
CFI_CDESC_T(CFI_MAX_RANK) foo;
|
||||
CFI_cdesc_t * bar = (CFI_cdesc_t *) &foo;
|
||||
*/
|
||||
typedef struct CFI_cdesc_t
|
||||
{
|
||||
void *base_addr;
|
||||
size_t elem_len;
|
||||
int version;
|
||||
CFI_rank_t rank;
|
||||
CFI_attribute_t attribute;
|
||||
CFI_type_t type;
|
||||
CFI_dim_t dim[];
|
||||
}
|
||||
CFI_cdesc_t;
|
||||
|
||||
/* CFI_CDESC_T with an explicit type. */
|
||||
#define CFI_CDESC_TYPE_T(r, base_type) \
|
||||
struct { \
|
||||
base_type *base_addr; \
|
||||
size_t elem_len; \
|
||||
int version; \
|
||||
CFI_rank_t rank; \
|
||||
CFI_attribute_t attribute; \
|
||||
CFI_type_t type; \
|
||||
CFI_dim_t dim[r]; \
|
||||
}
|
||||
#define CFI_CDESC_T(r) CFI_CDESC_TYPE_T (r, void)
|
||||
|
||||
/* CFI function declarations. */
|
||||
extern void *CFI_address (const CFI_cdesc_t *, const CFI_index_t []);
|
||||
extern int CFI_allocate (CFI_cdesc_t *, const CFI_index_t [], const CFI_index_t [],
|
||||
size_t);
|
||||
extern int CFI_deallocate (CFI_cdesc_t *);
|
||||
extern int CFI_establish (CFI_cdesc_t *, void *, CFI_attribute_t, CFI_type_t, size_t,
|
||||
CFI_rank_t, const CFI_index_t []);
|
||||
extern int CFI_is_contiguous (const CFI_cdesc_t *);
|
||||
extern int CFI_section (CFI_cdesc_t *, const CFI_cdesc_t *, const CFI_index_t [],
|
||||
const CFI_index_t [], const CFI_index_t []);
|
||||
extern int CFI_select_part (CFI_cdesc_t *, const CFI_cdesc_t *, size_t, size_t);
|
||||
extern int CFI_setpointer (CFI_cdesc_t *, CFI_cdesc_t *, const CFI_index_t []);
|
||||
|
||||
/* Types and kind numbers. Allows bitwise and to reveal the intrinsic type of a kind type. It also allows us to find the kind parameter by inverting the bit-shift equation.
|
||||
CFI_type_kind_shift = 8
|
||||
CFI_intrinsic_type = 0 0 0 0 0 0 0 0 0 0 1 0
|
||||
CFI_type_kind = 0 0 0 0 0 0 0 0 1 0 0 0
|
||||
CFI_type_example = CFI_intrinsic_type + (CFI_type_kind << CFI_type_kind_shift)
|
||||
Defining the CFI_type_example.
|
||||
CFI_type_kind = 0 0 0 0 0 0 0 0 1 0 0 0 << CFI_type_kind_shift
|
||||
-------------------------
|
||||
1 0 0 0 0 0 0 0 0 0 0 0 +
|
||||
CFI_intrinsic_type = 0 0 0 0 0 0 0 0 0 0 1 0
|
||||
-------------------------
|
||||
CFI_type_example = 1 0 0 0 0 0 0 0 0 0 1 0
|
||||
Finding the intrinsic type with the logical mask.
|
||||
CFI_type_example = 1 0 0 0 0 0 0 0 0 0 1 0 &
|
||||
CFI_type_mask = 0 0 0 0 1 1 1 1 1 1 1 1
|
||||
-------------------------
|
||||
CFI_intrinsic_type = 0 0 0 0 0 0 0 0 0 0 1 0
|
||||
Using the intrinsic type and kind shift to find the kind value of the type.
|
||||
CFI_type_kind = (CFI_type_example - CFI_intrinsic_type) >> CFI_type_kind_shift
|
||||
CFI_type_example = 1 0 0 0 0 0 0 0 0 0 1 0 -
|
||||
CFI_intrinsic_type = 0 0 0 0 0 0 0 0 0 0 1 0
|
||||
-------------------------
|
||||
1 0 0 0 0 0 0 0 0 0 0 0 >> CFI_type_kind_shift
|
||||
-------------------------
|
||||
CFI_type_kind = 0 0 0 0 0 0 0 0 1 0 0 0
|
||||
*/
|
||||
#define CFI_type_mask 0xFF
|
||||
#define CFI_type_kind_shift 8
|
||||
|
||||
/* Intrinsic types. Their kind number defines their storage size. */
|
||||
#define CFI_type_Integer 1
|
||||
#define CFI_type_Logical 2
|
||||
#define CFI_type_Real 3
|
||||
#define CFI_type_Complex 4
|
||||
#define CFI_type_Character 5
|
||||
|
||||
/* Types with no kind. */
|
||||
#define CFI_type_struct 6
|
||||
#define CFI_type_cptr 7
|
||||
#define CFI_type_cfunptr 8
|
||||
#define CFI_type_other -1
|
||||
|
||||
/* Types with kind parameter.
|
||||
The kind parameter represents the type's byte size. The exception is
|
||||
real kind = 10, which has byte size of 128 bits but 80 bit precision.
|
||||
Complex variables are double the byte size of their real counterparts.
|
||||
The ucs4_char matches wchar_t if sizeof (wchar_t) == 4.
|
||||
*/
|
||||
#define CFI_type_char (CFI_type_Character + (1 << CFI_type_kind_shift))
|
||||
#define CFI_type_ucs4_char (CFI_type_Character + (4 << CFI_type_kind_shift))
|
||||
|
||||
/* C-Fortran Interoperability types. */
|
||||
#define CFI_type_signed_char (CFI_type_Integer + (sizeof (char) << CFI_type_kind_shift))
|
||||
#define CFI_type_short (CFI_type_Integer + (sizeof (short) << CFI_type_kind_shift))
|
||||
#define CFI_type_int (CFI_type_Integer + (sizeof (int) << CFI_type_kind_shift))
|
||||
#define CFI_type_long (CFI_type_Integer + (sizeof (long) << CFI_type_kind_shift))
|
||||
#define CFI_type_long_long (CFI_type_Integer + (sizeof (long long) << CFI_type_kind_shift))
|
||||
#define CFI_type_size_t (CFI_type_Integer + (sizeof (size_t) << CFI_type_kind_shift))
|
||||
#define CFI_type_int8_t (CFI_type_Integer + (sizeof (int8_t) << CFI_type_kind_shift))
|
||||
#define CFI_type_int16_t (CFI_type_Integer + (sizeof (int16_t) << CFI_type_kind_shift))
|
||||
#define CFI_type_int32_t (CFI_type_Integer + (sizeof (int32_t) << CFI_type_kind_shift))
|
||||
#define CFI_type_int64_t (CFI_type_Integer + (sizeof (int64_t) << CFI_type_kind_shift))
|
||||
#define CFI_type_int_least8_t (CFI_type_Integer + (sizeof (int_least8_t) << CFI_type_kind_shift))
|
||||
#define CFI_type_int_least16_t (CFI_type_Integer + (sizeof (int_least16_t) << CFI_type_kind_shift))
|
||||
#define CFI_type_int_least32_t (CFI_type_Integer + (sizeof (int_least32_t) << CFI_type_kind_shift))
|
||||
#define CFI_type_int_least64_t (CFI_type_Integer + (sizeof (int_least64_t) << CFI_type_kind_shift))
|
||||
#define CFI_type_int_fast8_t (CFI_type_Integer + (sizeof (int_fast8_t) << CFI_type_kind_shift))
|
||||
#define CFI_type_int_fast16_t (CFI_type_Integer + (sizeof (int_fast16_t) << CFI_type_kind_shift))
|
||||
#define CFI_type_int_fast32_t (CFI_type_Integer + (sizeof (int_fast32_t) << CFI_type_kind_shift))
|
||||
#define CFI_type_int_fast64_t (CFI_type_Integer + (sizeof (int_fast64_t) << CFI_type_kind_shift))
|
||||
#define CFI_type_intmax_t (CFI_type_Integer + (sizeof (intmax_t) << CFI_type_kind_shift))
|
||||
#define CFI_type_intptr_t (CFI_type_Integer + (sizeof (intptr_t) << CFI_type_kind_shift))
|
||||
#define CFI_type_ptrdiff_t (CFI_type_Integer + (sizeof (ptrdiff_t) << CFI_type_kind_shift))
|
||||
#define CFI_type_Bool (CFI_type_Logical + (sizeof (_Bool) << CFI_type_kind_shift))
|
||||
#define CFI_type_float (CFI_type_Real + (sizeof (float) << CFI_type_kind_shift))
|
||||
#define CFI_type_double (CFI_type_Real + (sizeof (double) << CFI_type_kind_shift))
|
||||
#define CFI_type_float_Complex (CFI_type_Complex + (sizeof (float) << CFI_type_kind_shift))
|
||||
#define CFI_type_double_Complex (CFI_type_Complex + (sizeof (double) << CFI_type_kind_shift))
|
||||
|
||||
/* If GCC supports int128_t on this target, it predefines
|
||||
__SIZEOF_INT128__ to 16. */
|
||||
#if defined(__SIZEOF_INT128__)
|
||||
#if (__SIZEOF_INT128__ == 16)
|
||||
#define CFI_type_int128_t (CFI_type_Integer + (16 << CFI_type_kind_shift))
|
||||
#define CFI_type_int_least128_t (CFI_type_Integer + (16 << CFI_type_kind_shift))
|
||||
#define CFI_type_int_fast128_t (CFI_type_Integer + (16 << CFI_type_kind_shift))
|
||||
#else
|
||||
#error "Can't determine kind of int128_t"
|
||||
#endif
|
||||
#else
|
||||
#define CFI_type_int128_t -2
|
||||
#define CFI_type_int_least128_t -2
|
||||
#define CFI_type_int_fast128_t -2
|
||||
#endif
|
||||
|
||||
/* The situation with long double support is more complicated; we need to
|
||||
examine the type in more detail to figure out its kind.
|
||||
GCC and some other compilers predefine the __LDBL* macros; otherwise
|
||||
get the parameters we need from float.h. */
|
||||
|
||||
#if (defined (__LDBL_MANT_DIG__) \
|
||||
&& defined (__LDBL_MIN_EXP__) \
|
||||
&& defined (__LDBL_MAX_EXP__) \
|
||||
&& defined (__DBL_MANT_DIG__) \
|
||||
&& defined (__DBL_MIN_EXP__) \
|
||||
&& defined (__DBL_MAX_EXP__))
|
||||
#define __CFI_LDBL_MANT_DIG__ __LDBL_MANT_DIG__
|
||||
#define __CFI_LDBL_MIN_EXP__ __LDBL_MIN_EXP__
|
||||
#define __CFI_LDBL_MAX_EXP__ __LDBL_MAX_EXP__
|
||||
#define __CFI_DBL_MANT_DIG__ __DBL_MANT_DIG__
|
||||
#define __CFI_DBL_MIN_EXP__ __DBL_MIN_EXP__
|
||||
#define __CFI_DBL_MAX_EXP__ __DBL_MAX_EXP__
|
||||
|
||||
#else
|
||||
#include <float.h>
|
||||
|
||||
#if (defined (LDBL_MANT_DIG) \
|
||||
&& defined (LDBL_MIN_EXP) \
|
||||
&& defined (LDBL_MAX_EXP) \
|
||||
&& defined (DBL_MANT_DIG) \
|
||||
&& defined (DBL_MIN_EXP) \
|
||||
&& defined (DBL_MAX_EXP))
|
||||
#define __CFI_LDBL_MANT_DIG__ LDBL_MANT_DIG
|
||||
#define __CFI_LDBL_MIN_EXP__ LDBL_MIN_EXP
|
||||
#define __CFI_LDBL_MAX_EXP__ LDBL_MAX_EXP
|
||||
#define __CFI_DBL_MANT_DIG__ DBL_MANT_DIG
|
||||
#define __CFI_DBL_MIN_EXP__ DBL_MIN_EXP
|
||||
#define __CFI_DBL_MAX_EXP__ DBL_MAX_EXP
|
||||
|
||||
#else
|
||||
#define CFI_no_long_double 1
|
||||
|
||||
#endif /* Definitions from float.h. */
|
||||
#endif /* Definitions from compiler builtins. */
|
||||
|
||||
/* Can't determine anything about long double support? */
|
||||
#if (defined (CFI_no_long_double))
|
||||
#define CFI_type_long_double -2
|
||||
#define CFI_type_long_double_Complex -2
|
||||
|
||||
/* Long double is the same kind as double. */
|
||||
#elif (__CFI_LDBL_MANT_DIG__ == __CFI_DBL_MANT_DIG__ \
|
||||
&& __CFI_LDBL_MIN_EXP__ == __CFI_DBL_MIN_EXP__ \
|
||||
&& __CFI_LDBL_MAX_EXP__ == __CFI_DBL_MAX_EXP__)
|
||||
#define CFI_type_long_double CFI_type_double
|
||||
#define CFI_type_long_double_Complex CFI_type_double_Complex
|
||||
|
||||
/* This is the 80-bit encoding on x86; Fortran assigns it kind 10. */
|
||||
#elif ((__CFI_LDBL_MANT_DIG__ == 64 || __CFI_LDBL_MANT_DIG__ == 53) \
|
||||
&& __CFI_LDBL_MIN_EXP__ == -16381 \
|
||||
&& __CFI_LDBL_MAX_EXP__ == 16384)
|
||||
#define CFI_type_long_double (CFI_type_Real + (10 << CFI_type_kind_shift))
|
||||
#define CFI_type_long_double_Complex (CFI_type_Complex + (10 << CFI_type_kind_shift))
|
||||
|
||||
/* This is the 96-bit encoding on m68k; Fortran assigns it kind 10. */
|
||||
#elif (__CFI_LDBL_MANT_DIG__ == 64 \
|
||||
&& __CFI_LDBL_MIN_EXP__ == -16382 \
|
||||
&& __CFI_LDBL_MAX_EXP__ == 16384)
|
||||
#define CFI_type_long_double (CFI_type_Real + (10 << CFI_type_kind_shift))
|
||||
#define CFI_type_long_double_Complex (CFI_type_Complex + (10 << CFI_type_kind_shift))
|
||||
|
||||
/* This is the IEEE 128-bit encoding, same as _Float128. */
|
||||
#elif (__CFI_LDBL_MANT_DIG__ == 113 \
|
||||
&& __CFI_LDBL_MIN_EXP__ == -16381 \
|
||||
&& __CFI_LDBL_MAX_EXP__ == 16384)
|
||||
#define CFI_type_long_double (CFI_type_Real + (16 << CFI_type_kind_shift))
|
||||
#define CFI_type_long_double_Complex (CFI_type_Complex + (16 << CFI_type_kind_shift))
|
||||
|
||||
/* This is the IBM128 encoding used on PowerPC; also assigned kind 16. */
|
||||
#elif (__CFI_LDBL_MANT_DIG__ == 106 \
|
||||
&& __CFI_LDBL_MIN_EXP__ == -968 \
|
||||
&& __CFI_LDBL_MAX_EXP__ == 1024)
|
||||
#define CFI_type_long_double (CFI_type_Real + (16 << CFI_type_kind_shift))
|
||||
#define CFI_type_long_double_Complex (CFI_type_Complex + (16 << CFI_type_kind_shift))
|
||||
#define CFI_no_float128 1
|
||||
|
||||
/* It's a bug if we get here. If you've got a target that has some other
|
||||
long double encoding, you need add something here for Fortran to
|
||||
recognize it. */
|
||||
#else
|
||||
#error "Can't determine kind of long double"
|
||||
#endif
|
||||
|
||||
/* Similarly for _Float128. This always refers to the IEEE encoding
|
||||
and not some other 128-bit representation, so if we already used
|
||||
kind 16 for a non-IEEE representation, this one must be unsupported
|
||||
in Fortran even if it's available in C. */
|
||||
#if (!defined (CFI_no_float128) \
|
||||
&& defined(__FLT128_MANT_DIG__) && __FLT128_MANT_DIG__ == 113 \
|
||||
&& defined(__FLT128_MIN_EXP__) && __FLT128_MIN_EXP__ == -16381 \
|
||||
&& defined(__FLT128_MAX_EXP__) && __FLT128_MAX_EXP__ == 16384)
|
||||
#define CFI_type_float128 (CFI_type_Real + (16 << CFI_type_kind_shift))
|
||||
#define CFI_type_float128_Complex (CFI_type_Complex + (16 << CFI_type_kind_shift))
|
||||
#else
|
||||
#define CFI_type_float128 -2
|
||||
#define CFI_type_float128_Complex -2
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ISO_FORTRAN_BINDING_H */
|
||||
@@ -0,0 +1,631 @@
|
||||
/* Copyright (C) 2002-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3, or (at your option)
|
||||
any later version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Under Section 7 of GPL version 3, you are granted additional
|
||||
permissions described in the GCC Runtime Library Exception, version
|
||||
3.1, as published by the Free Software Foundation.
|
||||
|
||||
You should have received a copy of the GNU General Public License and
|
||||
a copy of the GCC Runtime Library Exception along with this program;
|
||||
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/*
|
||||
* ISO C Standard: 5.2.4.2.2 Characteristics of floating types <float.h>
|
||||
*/
|
||||
|
||||
#ifndef _FLOAT_H___
|
||||
#define _FLOAT_H___
|
||||
|
||||
/* Radix of exponent representation, b. */
|
||||
#undef FLT_RADIX
|
||||
#define FLT_RADIX __FLT_RADIX__
|
||||
|
||||
/* Number of base-FLT_RADIX digits in the significand, p. */
|
||||
#undef FLT_MANT_DIG
|
||||
#undef DBL_MANT_DIG
|
||||
#undef LDBL_MANT_DIG
|
||||
#define FLT_MANT_DIG __FLT_MANT_DIG__
|
||||
#define DBL_MANT_DIG __DBL_MANT_DIG__
|
||||
#define LDBL_MANT_DIG __LDBL_MANT_DIG__
|
||||
|
||||
/* Number of decimal digits, q, such that any floating-point number with q
|
||||
decimal digits can be rounded into a floating-point number with p radix b
|
||||
digits and back again without change to the q decimal digits,
|
||||
|
||||
p * log10(b) if b is a power of 10
|
||||
floor((p - 1) * log10(b)) otherwise
|
||||
*/
|
||||
#undef FLT_DIG
|
||||
#undef DBL_DIG
|
||||
#undef LDBL_DIG
|
||||
#define FLT_DIG __FLT_DIG__
|
||||
#define DBL_DIG __DBL_DIG__
|
||||
#define LDBL_DIG __LDBL_DIG__
|
||||
|
||||
/* Minimum int x such that FLT_RADIX**(x-1) is a normalized float, emin */
|
||||
#undef FLT_MIN_EXP
|
||||
#undef DBL_MIN_EXP
|
||||
#undef LDBL_MIN_EXP
|
||||
#define FLT_MIN_EXP __FLT_MIN_EXP__
|
||||
#define DBL_MIN_EXP __DBL_MIN_EXP__
|
||||
#define LDBL_MIN_EXP __LDBL_MIN_EXP__
|
||||
|
||||
/* Minimum negative integer such that 10 raised to that power is in the
|
||||
range of normalized floating-point numbers,
|
||||
|
||||
ceil(log10(b) * (emin - 1))
|
||||
*/
|
||||
#undef FLT_MIN_10_EXP
|
||||
#undef DBL_MIN_10_EXP
|
||||
#undef LDBL_MIN_10_EXP
|
||||
#define FLT_MIN_10_EXP __FLT_MIN_10_EXP__
|
||||
#define DBL_MIN_10_EXP __DBL_MIN_10_EXP__
|
||||
#define LDBL_MIN_10_EXP __LDBL_MIN_10_EXP__
|
||||
|
||||
/* Maximum int x such that FLT_RADIX**(x-1) is a representable float, emax. */
|
||||
#undef FLT_MAX_EXP
|
||||
#undef DBL_MAX_EXP
|
||||
#undef LDBL_MAX_EXP
|
||||
#define FLT_MAX_EXP __FLT_MAX_EXP__
|
||||
#define DBL_MAX_EXP __DBL_MAX_EXP__
|
||||
#define LDBL_MAX_EXP __LDBL_MAX_EXP__
|
||||
|
||||
/* Maximum integer such that 10 raised to that power is in the range of
|
||||
representable finite floating-point numbers,
|
||||
|
||||
floor(log10((1 - b**-p) * b**emax))
|
||||
*/
|
||||
#undef FLT_MAX_10_EXP
|
||||
#undef DBL_MAX_10_EXP
|
||||
#undef LDBL_MAX_10_EXP
|
||||
#define FLT_MAX_10_EXP __FLT_MAX_10_EXP__
|
||||
#define DBL_MAX_10_EXP __DBL_MAX_10_EXP__
|
||||
#define LDBL_MAX_10_EXP __LDBL_MAX_10_EXP__
|
||||
|
||||
/* Maximum representable finite floating-point number,
|
||||
|
||||
(1 - b**-p) * b**emax
|
||||
*/
|
||||
#undef FLT_MAX
|
||||
#undef DBL_MAX
|
||||
#undef LDBL_MAX
|
||||
#define FLT_MAX __FLT_MAX__
|
||||
#define DBL_MAX __DBL_MAX__
|
||||
#define LDBL_MAX __LDBL_MAX__
|
||||
|
||||
/* The difference between 1 and the least value greater than 1 that is
|
||||
representable in the given floating point type, b**1-p. */
|
||||
#undef FLT_EPSILON
|
||||
#undef DBL_EPSILON
|
||||
#undef LDBL_EPSILON
|
||||
#define FLT_EPSILON __FLT_EPSILON__
|
||||
#define DBL_EPSILON __DBL_EPSILON__
|
||||
#define LDBL_EPSILON __LDBL_EPSILON__
|
||||
|
||||
/* Minimum normalized positive floating-point number, b**(emin - 1). */
|
||||
#undef FLT_MIN
|
||||
#undef DBL_MIN
|
||||
#undef LDBL_MIN
|
||||
#define FLT_MIN __FLT_MIN__
|
||||
#define DBL_MIN __DBL_MIN__
|
||||
#define LDBL_MIN __LDBL_MIN__
|
||||
|
||||
/* Addition rounds to 0: zero, 1: nearest, 2: +inf, 3: -inf, -1: unknown. */
|
||||
/* ??? This is supposed to change with calls to fesetround in <fenv.h>. */
|
||||
#undef FLT_ROUNDS
|
||||
#define FLT_ROUNDS 1
|
||||
|
||||
#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) \
|
||||
|| (defined (__cplusplus) && __cplusplus >= 201103L)
|
||||
/* The floating-point expression evaluation method. The precise
|
||||
definitions of these values are generalised to include support for
|
||||
the interchange and extended types defined in ISO/IEC TS 18661-3.
|
||||
Prior to this (for C99/C11) the definitions were:
|
||||
|
||||
-1 indeterminate
|
||||
0 evaluate all operations and constants just to the range and
|
||||
precision of the type
|
||||
1 evaluate operations and constants of type float and double
|
||||
to the range and precision of the double type, evaluate
|
||||
long double operations and constants to the range and
|
||||
precision of the long double type
|
||||
2 evaluate all operations and constants to the range and
|
||||
precision of the long double type
|
||||
|
||||
The TS 18661-3 definitions are:
|
||||
|
||||
-1 indeterminate
|
||||
0 evaluate all operations and constants, whose semantic type has
|
||||
at most the range and precision of float, to the range and
|
||||
precision of float; evaluate all other operations and constants
|
||||
to the range and precision of the semantic type.
|
||||
1 evaluate all operations and constants, whose semantic type has
|
||||
at most the range and precision of double, to the range and
|
||||
precision of double; evaluate all other operations and constants
|
||||
to the range and precision of the semantic type.
|
||||
2 evaluate all operations and constants, whose semantic type has
|
||||
at most the range and precision of long double, to the range and
|
||||
precision of long double; evaluate all other operations and
|
||||
constants to the range and precision of the semantic type.
|
||||
N where _FloatN is a supported interchange floating type
|
||||
evaluate all operations and constants, whose semantic type has
|
||||
at most the range and precision of the _FloatN type, to the
|
||||
range and precision of the _FloatN type; evaluate all other
|
||||
operations and constants to the range and precision of the
|
||||
semantic type.
|
||||
N + 1, where _FloatNx is a supported extended floating type
|
||||
evaluate operations and constants, whose semantic type has at
|
||||
most the range and precision of the _FloatNx type, to the range
|
||||
and precision of the _FloatNx type; evaluate all other
|
||||
operations and constants to the range and precision of the
|
||||
semantic type.
|
||||
|
||||
The compiler predefines two macros:
|
||||
|
||||
__FLT_EVAL_METHOD__
|
||||
Which, depending on the value given for
|
||||
-fpermitted-flt-eval-methods, may be limited to only those values
|
||||
for FLT_EVAL_METHOD defined in C99/C11.
|
||||
|
||||
__FLT_EVAL_METHOD_TS_18661_3__
|
||||
Which always permits the values for FLT_EVAL_METHOD defined in
|
||||
ISO/IEC TS 18661-3.
|
||||
|
||||
Here we want to use __FLT_EVAL_METHOD__, unless
|
||||
__STDC_WANT_IEC_60559_TYPES_EXT__ is defined, in which case the user
|
||||
is specifically asking for the ISO/IEC TS 18661-3 types, so we use
|
||||
__FLT_EVAL_METHOD_TS_18661_3__.
|
||||
|
||||
??? This ought to change with the setting of the fp control word;
|
||||
the value provided by the compiler assumes the widest setting. */
|
||||
#undef FLT_EVAL_METHOD
|
||||
#ifdef __STDC_WANT_IEC_60559_TYPES_EXT__
|
||||
#define FLT_EVAL_METHOD __FLT_EVAL_METHOD_TS_18661_3__
|
||||
#else
|
||||
#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
|
||||
#endif
|
||||
|
||||
/* Number of decimal digits, n, such that any floating-point number in the
|
||||
widest supported floating type with pmax radix b digits can be rounded
|
||||
to a floating-point number with n decimal digits and back again without
|
||||
change to the value,
|
||||
|
||||
pmax * log10(b) if b is a power of 10
|
||||
ceil(1 + pmax * log10(b)) otherwise
|
||||
*/
|
||||
#undef DECIMAL_DIG
|
||||
#define DECIMAL_DIG __DECIMAL_DIG__
|
||||
|
||||
#endif /* C99 */
|
||||
|
||||
#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) \
|
||||
|| (defined (__cplusplus) && __cplusplus >= 201703L)
|
||||
/* Versions of DECIMAL_DIG for each floating-point type. */
|
||||
#undef FLT_DECIMAL_DIG
|
||||
#undef DBL_DECIMAL_DIG
|
||||
#undef LDBL_DECIMAL_DIG
|
||||
#define FLT_DECIMAL_DIG __FLT_DECIMAL_DIG__
|
||||
#define DBL_DECIMAL_DIG __DBL_DECIMAL_DIG__
|
||||
#define LDBL_DECIMAL_DIG __LDBL_DECIMAL_DIG__
|
||||
|
||||
/* Whether types support subnormal numbers. */
|
||||
#undef FLT_HAS_SUBNORM
|
||||
#undef DBL_HAS_SUBNORM
|
||||
#undef LDBL_HAS_SUBNORM
|
||||
#define FLT_HAS_SUBNORM __FLT_HAS_DENORM__
|
||||
#define DBL_HAS_SUBNORM __DBL_HAS_DENORM__
|
||||
#define LDBL_HAS_SUBNORM __LDBL_HAS_DENORM__
|
||||
|
||||
/* Minimum positive values, including subnormals. */
|
||||
#undef FLT_TRUE_MIN
|
||||
#undef DBL_TRUE_MIN
|
||||
#undef LDBL_TRUE_MIN
|
||||
#define FLT_TRUE_MIN __FLT_DENORM_MIN__
|
||||
#define DBL_TRUE_MIN __DBL_DENORM_MIN__
|
||||
#define LDBL_TRUE_MIN __LDBL_DENORM_MIN__
|
||||
|
||||
#endif /* C11 */
|
||||
|
||||
#if defined __STDC_VERSION__ && __STDC_VERSION__ > 201710L
|
||||
/* Maximum finite positive value with MANT_DIG digits in the
|
||||
significand taking their maximum value. */
|
||||
#undef FLT_NORM_MAX
|
||||
#undef DBL_NORM_MAX
|
||||
#undef LDBL_NORM_MAX
|
||||
#define FLT_NORM_MAX __FLT_NORM_MAX__
|
||||
#define DBL_NORM_MAX __DBL_NORM_MAX__
|
||||
#define LDBL_NORM_MAX __LDBL_NORM_MAX__
|
||||
|
||||
/* Whether each type matches an IEC 60559 format. */
|
||||
#undef FLT_IS_IEC_60559
|
||||
#undef DBL_IS_IEC_60559
|
||||
#undef LDBL_IS_IEC_60559
|
||||
#define FLT_IS_IEC_60559 __FLT_IS_IEC_60559__
|
||||
#define DBL_IS_IEC_60559 __DBL_IS_IEC_60559__
|
||||
#define LDBL_IS_IEC_60559 __LDBL_IS_IEC_60559__
|
||||
|
||||
/* Infinity in type float; not defined if infinity not supported. */
|
||||
#if __FLT_HAS_INFINITY__
|
||||
#undef INFINITY
|
||||
#define INFINITY (__builtin_inff ())
|
||||
#endif
|
||||
|
||||
/* Quiet NaN, if supported for float. */
|
||||
#if __FLT_HAS_QUIET_NAN__
|
||||
#undef NAN
|
||||
#define NAN (__builtin_nanf (""))
|
||||
#endif
|
||||
|
||||
/* Signaling NaN, if supported for each type. All formats supported
|
||||
by GCC support either both quiet and signaling NaNs, or neither
|
||||
kind of NaN. */
|
||||
#if __FLT_HAS_QUIET_NAN__
|
||||
#undef FLT_SNAN
|
||||
#define FLT_SNAN (__builtin_nansf (""))
|
||||
#endif
|
||||
#if __DBL_HAS_QUIET_NAN__
|
||||
#undef DBL_SNAN
|
||||
#define DBL_SNAN (__builtin_nans (""))
|
||||
#endif
|
||||
#if __LDBL_HAS_QUIET_NAN__
|
||||
#undef LDBL_SNAN
|
||||
#define LDBL_SNAN (__builtin_nansl (""))
|
||||
#endif
|
||||
|
||||
#endif /* C2X */
|
||||
|
||||
#if (defined __STDC_WANT_IEC_60559_BFP_EXT__ \
|
||||
|| defined __STDC_WANT_IEC_60559_EXT__)
|
||||
/* Number of decimal digits for which conversions between decimal
|
||||
character strings and binary formats, in both directions, are
|
||||
correctly rounded. */
|
||||
#define CR_DECIMAL_DIG __UINTMAX_MAX__
|
||||
#endif
|
||||
|
||||
#ifdef __STDC_WANT_IEC_60559_TYPES_EXT__
|
||||
/* Constants for _FloatN and _FloatNx types from TS 18661-3. See
|
||||
comments above for their semantics. */
|
||||
|
||||
#ifdef __FLT16_MANT_DIG__
|
||||
#undef FLT16_MANT_DIG
|
||||
#define FLT16_MANT_DIG __FLT16_MANT_DIG__
|
||||
#undef FLT16_DIG
|
||||
#define FLT16_DIG __FLT16_DIG__
|
||||
#undef FLT16_MIN_EXP
|
||||
#define FLT16_MIN_EXP __FLT16_MIN_EXP__
|
||||
#undef FLT16_MIN_10_EXP
|
||||
#define FLT16_MIN_10_EXP __FLT16_MIN_10_EXP__
|
||||
#undef FLT16_MAX_EXP
|
||||
#define FLT16_MAX_EXP __FLT16_MAX_EXP__
|
||||
#undef FLT16_MAX_10_EXP
|
||||
#define FLT16_MAX_10_EXP __FLT16_MAX_10_EXP__
|
||||
#undef FLT16_MAX
|
||||
#define FLT16_MAX __FLT16_MAX__
|
||||
#undef FLT16_EPSILON
|
||||
#define FLT16_EPSILON __FLT16_EPSILON__
|
||||
#undef FLT16_MIN
|
||||
#define FLT16_MIN __FLT16_MIN__
|
||||
#undef FLT16_DECIMAL_DIG
|
||||
#define FLT16_DECIMAL_DIG __FLT16_DECIMAL_DIG__
|
||||
#undef FLT16_TRUE_MIN
|
||||
#define FLT16_TRUE_MIN __FLT16_DENORM_MIN__
|
||||
#if defined __STDC_VERSION__ && __STDC_VERSION__ > 201710L
|
||||
#undef FLT16_SNAN
|
||||
#define FLT16_SNAN (__builtin_nansf16 (""))
|
||||
#endif /* C2X */
|
||||
#endif /* __FLT16_MANT_DIG__. */
|
||||
|
||||
#ifdef __FLT32_MANT_DIG__
|
||||
#undef FLT32_MANT_DIG
|
||||
#define FLT32_MANT_DIG __FLT32_MANT_DIG__
|
||||
#undef FLT32_DIG
|
||||
#define FLT32_DIG __FLT32_DIG__
|
||||
#undef FLT32_MIN_EXP
|
||||
#define FLT32_MIN_EXP __FLT32_MIN_EXP__
|
||||
#undef FLT32_MIN_10_EXP
|
||||
#define FLT32_MIN_10_EXP __FLT32_MIN_10_EXP__
|
||||
#undef FLT32_MAX_EXP
|
||||
#define FLT32_MAX_EXP __FLT32_MAX_EXP__
|
||||
#undef FLT32_MAX_10_EXP
|
||||
#define FLT32_MAX_10_EXP __FLT32_MAX_10_EXP__
|
||||
#undef FLT32_MAX
|
||||
#define FLT32_MAX __FLT32_MAX__
|
||||
#undef FLT32_EPSILON
|
||||
#define FLT32_EPSILON __FLT32_EPSILON__
|
||||
#undef FLT32_MIN
|
||||
#define FLT32_MIN __FLT32_MIN__
|
||||
#undef FLT32_DECIMAL_DIG
|
||||
#define FLT32_DECIMAL_DIG __FLT32_DECIMAL_DIG__
|
||||
#undef FLT32_TRUE_MIN
|
||||
#define FLT32_TRUE_MIN __FLT32_DENORM_MIN__
|
||||
#if defined __STDC_VERSION__ && __STDC_VERSION__ > 201710L
|
||||
#undef FLT32_SNAN
|
||||
#define FLT32_SNAN (__builtin_nansf32 (""))
|
||||
#endif /* C2X */
|
||||
#endif /* __FLT32_MANT_DIG__. */
|
||||
|
||||
#ifdef __FLT64_MANT_DIG__
|
||||
#undef FLT64_MANT_DIG
|
||||
#define FLT64_MANT_DIG __FLT64_MANT_DIG__
|
||||
#undef FLT64_DIG
|
||||
#define FLT64_DIG __FLT64_DIG__
|
||||
#undef FLT64_MIN_EXP
|
||||
#define FLT64_MIN_EXP __FLT64_MIN_EXP__
|
||||
#undef FLT64_MIN_10_EXP
|
||||
#define FLT64_MIN_10_EXP __FLT64_MIN_10_EXP__
|
||||
#undef FLT64_MAX_EXP
|
||||
#define FLT64_MAX_EXP __FLT64_MAX_EXP__
|
||||
#undef FLT64_MAX_10_EXP
|
||||
#define FLT64_MAX_10_EXP __FLT64_MAX_10_EXP__
|
||||
#undef FLT64_MAX
|
||||
#define FLT64_MAX __FLT64_MAX__
|
||||
#undef FLT64_EPSILON
|
||||
#define FLT64_EPSILON __FLT64_EPSILON__
|
||||
#undef FLT64_MIN
|
||||
#define FLT64_MIN __FLT64_MIN__
|
||||
#undef FLT64_DECIMAL_DIG
|
||||
#define FLT64_DECIMAL_DIG __FLT64_DECIMAL_DIG__
|
||||
#undef FLT64_TRUE_MIN
|
||||
#define FLT64_TRUE_MIN __FLT64_DENORM_MIN__
|
||||
#if defined __STDC_VERSION__ && __STDC_VERSION__ > 201710L
|
||||
#undef FLT64_SNAN
|
||||
#define FLT64_SNAN (__builtin_nansf64 (""))
|
||||
#endif /* C2X */
|
||||
#endif /* __FLT64_MANT_DIG__. */
|
||||
|
||||
#ifdef __FLT128_MANT_DIG__
|
||||
#undef FLT128_MANT_DIG
|
||||
#define FLT128_MANT_DIG __FLT128_MANT_DIG__
|
||||
#undef FLT128_DIG
|
||||
#define FLT128_DIG __FLT128_DIG__
|
||||
#undef FLT128_MIN_EXP
|
||||
#define FLT128_MIN_EXP __FLT128_MIN_EXP__
|
||||
#undef FLT128_MIN_10_EXP
|
||||
#define FLT128_MIN_10_EXP __FLT128_MIN_10_EXP__
|
||||
#undef FLT128_MAX_EXP
|
||||
#define FLT128_MAX_EXP __FLT128_MAX_EXP__
|
||||
#undef FLT128_MAX_10_EXP
|
||||
#define FLT128_MAX_10_EXP __FLT128_MAX_10_EXP__
|
||||
#undef FLT128_MAX
|
||||
#define FLT128_MAX __FLT128_MAX__
|
||||
#undef FLT128_EPSILON
|
||||
#define FLT128_EPSILON __FLT128_EPSILON__
|
||||
#undef FLT128_MIN
|
||||
#define FLT128_MIN __FLT128_MIN__
|
||||
#undef FLT128_DECIMAL_DIG
|
||||
#define FLT128_DECIMAL_DIG __FLT128_DECIMAL_DIG__
|
||||
#undef FLT128_TRUE_MIN
|
||||
#define FLT128_TRUE_MIN __FLT128_DENORM_MIN__
|
||||
#if defined __STDC_VERSION__ && __STDC_VERSION__ > 201710L
|
||||
#undef FLT128_SNAN
|
||||
#define FLT128_SNAN (__builtin_nansf128 (""))
|
||||
#endif /* C2X */
|
||||
#endif /* __FLT128_MANT_DIG__. */
|
||||
|
||||
#ifdef __FLT32X_MANT_DIG__
|
||||
#undef FLT32X_MANT_DIG
|
||||
#define FLT32X_MANT_DIG __FLT32X_MANT_DIG__
|
||||
#undef FLT32X_DIG
|
||||
#define FLT32X_DIG __FLT32X_DIG__
|
||||
#undef FLT32X_MIN_EXP
|
||||
#define FLT32X_MIN_EXP __FLT32X_MIN_EXP__
|
||||
#undef FLT32X_MIN_10_EXP
|
||||
#define FLT32X_MIN_10_EXP __FLT32X_MIN_10_EXP__
|
||||
#undef FLT32X_MAX_EXP
|
||||
#define FLT32X_MAX_EXP __FLT32X_MAX_EXP__
|
||||
#undef FLT32X_MAX_10_EXP
|
||||
#define FLT32X_MAX_10_EXP __FLT32X_MAX_10_EXP__
|
||||
#undef FLT32X_MAX
|
||||
#define FLT32X_MAX __FLT32X_MAX__
|
||||
#undef FLT32X_EPSILON
|
||||
#define FLT32X_EPSILON __FLT32X_EPSILON__
|
||||
#undef FLT32X_MIN
|
||||
#define FLT32X_MIN __FLT32X_MIN__
|
||||
#undef FLT32X_DECIMAL_DIG
|
||||
#define FLT32X_DECIMAL_DIG __FLT32X_DECIMAL_DIG__
|
||||
#undef FLT32X_TRUE_MIN
|
||||
#define FLT32X_TRUE_MIN __FLT32X_DENORM_MIN__
|
||||
#if defined __STDC_VERSION__ && __STDC_VERSION__ > 201710L
|
||||
#undef FLT32X_SNAN
|
||||
#define FLT32X_SNAN (__builtin_nansf32x (""))
|
||||
#endif /* C2X */
|
||||
#endif /* __FLT32X_MANT_DIG__. */
|
||||
|
||||
#ifdef __FLT64X_MANT_DIG__
|
||||
#undef FLT64X_MANT_DIG
|
||||
#define FLT64X_MANT_DIG __FLT64X_MANT_DIG__
|
||||
#undef FLT64X_DIG
|
||||
#define FLT64X_DIG __FLT64X_DIG__
|
||||
#undef FLT64X_MIN_EXP
|
||||
#define FLT64X_MIN_EXP __FLT64X_MIN_EXP__
|
||||
#undef FLT64X_MIN_10_EXP
|
||||
#define FLT64X_MIN_10_EXP __FLT64X_MIN_10_EXP__
|
||||
#undef FLT64X_MAX_EXP
|
||||
#define FLT64X_MAX_EXP __FLT64X_MAX_EXP__
|
||||
#undef FLT64X_MAX_10_EXP
|
||||
#define FLT64X_MAX_10_EXP __FLT64X_MAX_10_EXP__
|
||||
#undef FLT64X_MAX
|
||||
#define FLT64X_MAX __FLT64X_MAX__
|
||||
#undef FLT64X_EPSILON
|
||||
#define FLT64X_EPSILON __FLT64X_EPSILON__
|
||||
#undef FLT64X_MIN
|
||||
#define FLT64X_MIN __FLT64X_MIN__
|
||||
#undef FLT64X_DECIMAL_DIG
|
||||
#define FLT64X_DECIMAL_DIG __FLT64X_DECIMAL_DIG__
|
||||
#undef FLT64X_TRUE_MIN
|
||||
#define FLT64X_TRUE_MIN __FLT64X_DENORM_MIN__
|
||||
#if defined __STDC_VERSION__ && __STDC_VERSION__ > 201710L
|
||||
#undef FLT64X_SNAN
|
||||
#define FLT64X_SNAN (__builtin_nansf64x (""))
|
||||
#endif /* C2X */
|
||||
#endif /* __FLT64X_MANT_DIG__. */
|
||||
|
||||
#ifdef __FLT128X_MANT_DIG__
|
||||
#undef FLT128X_MANT_DIG
|
||||
#define FLT128X_MANT_DIG __FLT128X_MANT_DIG__
|
||||
#undef FLT128X_DIG
|
||||
#define FLT128X_DIG __FLT128X_DIG__
|
||||
#undef FLT128X_MIN_EXP
|
||||
#define FLT128X_MIN_EXP __FLT128X_MIN_EXP__
|
||||
#undef FLT128X_MIN_10_EXP
|
||||
#define FLT128X_MIN_10_EXP __FLT128X_MIN_10_EXP__
|
||||
#undef FLT128X_MAX_EXP
|
||||
#define FLT128X_MAX_EXP __FLT128X_MAX_EXP__
|
||||
#undef FLT128X_MAX_10_EXP
|
||||
#define FLT128X_MAX_10_EXP __FLT128X_MAX_10_EXP__
|
||||
#undef FLT128X_MAX
|
||||
#define FLT128X_MAX __FLT128X_MAX__
|
||||
#undef FLT128X_EPSILON
|
||||
#define FLT128X_EPSILON __FLT128X_EPSILON__
|
||||
#undef FLT128X_MIN
|
||||
#define FLT128X_MIN __FLT128X_MIN__
|
||||
#undef FLT128X_DECIMAL_DIG
|
||||
#define FLT128X_DECIMAL_DIG __FLT128X_DECIMAL_DIG__
|
||||
#undef FLT128X_TRUE_MIN
|
||||
#define FLT128X_TRUE_MIN __FLT128X_DENORM_MIN__
|
||||
#if defined __STDC_VERSION__ && __STDC_VERSION__ > 201710L
|
||||
#undef FLT128X_SNAN
|
||||
#define FLT128X_SNAN (__builtin_nansf128x (""))
|
||||
#endif /* C2X */
|
||||
#endif /* __FLT128X_MANT_DIG__. */
|
||||
|
||||
#endif /* __STDC_WANT_IEC_60559_TYPES_EXT__. */
|
||||
|
||||
#ifdef __DEC32_MANT_DIG__
|
||||
#if (defined __STDC_WANT_DEC_FP__ \
|
||||
|| defined __STDC_WANT_IEC_60559_DFP_EXT__ \
|
||||
|| (defined __STDC_VERSION__ && __STDC_VERSION__ > 201710L))
|
||||
/* C2X; formerly Technical Report 24732, extension for decimal
|
||||
floating-point arithmetic: Characteristic of decimal floating types
|
||||
<float.h>, and TS 18661-2. */
|
||||
|
||||
/* Number of base-FLT_RADIX digits in the significand, p. */
|
||||
#undef DEC32_MANT_DIG
|
||||
#undef DEC64_MANT_DIG
|
||||
#undef DEC128_MANT_DIG
|
||||
#define DEC32_MANT_DIG __DEC32_MANT_DIG__
|
||||
#define DEC64_MANT_DIG __DEC64_MANT_DIG__
|
||||
#define DEC128_MANT_DIG __DEC128_MANT_DIG__
|
||||
|
||||
/* Minimum exponent. */
|
||||
#undef DEC32_MIN_EXP
|
||||
#undef DEC64_MIN_EXP
|
||||
#undef DEC128_MIN_EXP
|
||||
#define DEC32_MIN_EXP __DEC32_MIN_EXP__
|
||||
#define DEC64_MIN_EXP __DEC64_MIN_EXP__
|
||||
#define DEC128_MIN_EXP __DEC128_MIN_EXP__
|
||||
|
||||
/* Maximum exponent. */
|
||||
#undef DEC32_MAX_EXP
|
||||
#undef DEC64_MAX_EXP
|
||||
#undef DEC128_MAX_EXP
|
||||
#define DEC32_MAX_EXP __DEC32_MAX_EXP__
|
||||
#define DEC64_MAX_EXP __DEC64_MAX_EXP__
|
||||
#define DEC128_MAX_EXP __DEC128_MAX_EXP__
|
||||
|
||||
/* Maximum representable finite decimal floating-point number
|
||||
(there are 6, 15, and 33 9s after the decimal points respectively). */
|
||||
#undef DEC32_MAX
|
||||
#undef DEC64_MAX
|
||||
#undef DEC128_MAX
|
||||
#define DEC32_MAX __DEC32_MAX__
|
||||
#define DEC64_MAX __DEC64_MAX__
|
||||
#define DEC128_MAX __DEC128_MAX__
|
||||
|
||||
/* The difference between 1 and the least value greater than 1 that is
|
||||
representable in the given floating point type. */
|
||||
#undef DEC32_EPSILON
|
||||
#undef DEC64_EPSILON
|
||||
#undef DEC128_EPSILON
|
||||
#define DEC32_EPSILON __DEC32_EPSILON__
|
||||
#define DEC64_EPSILON __DEC64_EPSILON__
|
||||
#define DEC128_EPSILON __DEC128_EPSILON__
|
||||
|
||||
/* Minimum normalized positive floating-point number. */
|
||||
#undef DEC32_MIN
|
||||
#undef DEC64_MIN
|
||||
#undef DEC128_MIN
|
||||
#define DEC32_MIN __DEC32_MIN__
|
||||
#define DEC64_MIN __DEC64_MIN__
|
||||
#define DEC128_MIN __DEC128_MIN__
|
||||
|
||||
/* The floating-point expression evaluation method.
|
||||
-1 indeterminate
|
||||
0 evaluate all operations and constants just to the range and
|
||||
precision of the type
|
||||
1 evaluate operations and constants of type _Decimal32
|
||||
and _Decimal64 to the range and precision of the _Decimal64
|
||||
type, evaluate _Decimal128 operations and constants to the
|
||||
range and precision of the _Decimal128 type;
|
||||
2 evaluate all operations and constants to the range and
|
||||
precision of the _Decimal128 type. */
|
||||
|
||||
#undef DEC_EVAL_METHOD
|
||||
#define DEC_EVAL_METHOD __DEC_EVAL_METHOD__
|
||||
|
||||
#endif /* __STDC_WANT_DEC_FP__ || __STDC_WANT_IEC_60559_DFP_EXT__ || C2X. */
|
||||
|
||||
#ifdef __STDC_WANT_DEC_FP__
|
||||
|
||||
/* Minimum subnormal positive floating-point number. */
|
||||
#undef DEC32_SUBNORMAL_MIN
|
||||
#undef DEC64_SUBNORMAL_MIN
|
||||
#undef DEC128_SUBNORMAL_MIN
|
||||
#define DEC32_SUBNORMAL_MIN __DEC32_SUBNORMAL_MIN__
|
||||
#define DEC64_SUBNORMAL_MIN __DEC64_SUBNORMAL_MIN__
|
||||
#define DEC128_SUBNORMAL_MIN __DEC128_SUBNORMAL_MIN__
|
||||
|
||||
#endif /* __STDC_WANT_DEC_FP__. */
|
||||
|
||||
#if (defined __STDC_WANT_IEC_60559_DFP_EXT__ \
|
||||
|| (defined __STDC_VERSION__ && __STDC_VERSION__ > 201710L))
|
||||
|
||||
/* Minimum subnormal positive floating-point number. */
|
||||
#undef DEC32_TRUE_MIN
|
||||
#undef DEC64_TRUE_MIN
|
||||
#undef DEC128_TRUE_MIN
|
||||
#define DEC32_TRUE_MIN __DEC32_SUBNORMAL_MIN__
|
||||
#define DEC64_TRUE_MIN __DEC64_SUBNORMAL_MIN__
|
||||
#define DEC128_TRUE_MIN __DEC128_SUBNORMAL_MIN__
|
||||
|
||||
#endif /* __STDC_WANT_IEC_60559_DFP_EXT__ || C2X. */
|
||||
|
||||
#if defined __STDC_VERSION__ && __STDC_VERSION__ > 201710L
|
||||
|
||||
/* Infinity in type _Decimal32. */
|
||||
#undef DEC_INFINITY
|
||||
#define DEC_INFINITY (__builtin_infd32 ())
|
||||
|
||||
/* Quiet NaN in type _Decimal32. */
|
||||
#undef DEC_NAN
|
||||
#define DEC_NAN (__builtin_nand32 (""))
|
||||
|
||||
/* Signaling NaN in each decimal floating-point type. */
|
||||
#undef DEC32_SNAN
|
||||
#define DEC32_SNAN (__builtin_nansd32 (""))
|
||||
#undef DEC64_SNAN
|
||||
#define DEC64_SNAN (__builtin_nansd64 (""))
|
||||
#undef DEC128_SNAN
|
||||
#define DEC128_SNAN (__builtin_nansd128 (""))
|
||||
|
||||
#endif /* C2X */
|
||||
|
||||
#endif /* __DEC32_MANT_DIG__ */
|
||||
|
||||
#if defined __STDC_VERSION__ && __STDC_VERSION__ > 201710L
|
||||
#define __STDC_VERSION_FLOAT_H__ 202311L
|
||||
#endif
|
||||
|
||||
#endif /* _FLOAT_H___ */
|
||||
@@ -0,0 +1,70 @@
|
||||
/* GCOV interface routines.
|
||||
Copyright (C) 2017-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
Under Section 7 of GPL version 3, you are granted additional
|
||||
permissions described in the GCC Runtime Library Exception, version
|
||||
3.1, as published by the Free Software Foundation.
|
||||
|
||||
You should have received a copy of the GNU General Public License and
|
||||
a copy of the GCC Runtime Library Exception along with this program;
|
||||
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef GCC_GCOV_H
|
||||
#define GCC_GCOV_H
|
||||
|
||||
struct gcov_info;
|
||||
|
||||
/* Set all counters to zero. */
|
||||
|
||||
extern void __gcov_reset (void);
|
||||
|
||||
/* Write profile information to a file. */
|
||||
|
||||
extern void __gcov_dump (void);
|
||||
|
||||
/* Convert the gcov information referenced by INFO to a gcda data stream.
|
||||
The FILENAME_FN callback is called exactly once with the filename associated
|
||||
with the gcov information. The filename may be NULL. Afterwards, the
|
||||
DUMP_FN callback is subsequently called with chunks (the begin and length of
|
||||
the chunk are passed as the first two callback parameters) of the gcda data
|
||||
stream. The ALLOCATE_FN callback shall allocate memory with a size in
|
||||
characters specified by the first callback parameter. The ARG parameter is
|
||||
a user-provided argument passed as the last argument to the callback
|
||||
functions. It is recommended to use the __gcov_filename_to_gcfn()
|
||||
in the filename callback function. */
|
||||
|
||||
extern void
|
||||
__gcov_info_to_gcda (const struct gcov_info *__info,
|
||||
void (*__filename_fn) (const char *, void *),
|
||||
void (*__dump_fn) (const void *, unsigned, void *),
|
||||
void *(*__allocate_fn) (unsigned, void *),
|
||||
void *__arg);
|
||||
|
||||
/* Convert the FILENAME to a gcfn data stream. The DUMP_FN callback is
|
||||
subsequently called with chunks (the begin and length of the chunk are
|
||||
passed as the first two callback parameters) of the gcfn data stream.
|
||||
The ARG parameter is a user-provided argument passed as the last
|
||||
argument to the DUMP_FN callback function. This function is intended
|
||||
to be used by the filename callback of __gcov_info_to_gcda(). The gcfn
|
||||
data stream is used by the merge-stream subcommand of the gcov-tool to
|
||||
get the filename associated with a gcda data stream. */
|
||||
|
||||
extern void
|
||||
__gcov_filename_to_gcfn (const char *__filename,
|
||||
void (*__dump_fn) (const void *, unsigned, void *),
|
||||
void *__arg);
|
||||
|
||||
#endif /* GCC_GCOV_H */
|
||||
@@ -0,0 +1,45 @@
|
||||
/* Copyright (C) 1997-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3, or (at your option)
|
||||
any later version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Under Section 7 of GPL version 3, you are granted additional
|
||||
permissions described in the GCC Runtime Library Exception, version
|
||||
3.1, as published by the Free Software Foundation.
|
||||
|
||||
You should have received a copy of the GNU General Public License and
|
||||
a copy of the GCC Runtime Library Exception along with this program;
|
||||
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/*
|
||||
* ISO C Standard: 7.9 Alternative spellings <iso646.h>
|
||||
*/
|
||||
|
||||
#ifndef _ISO646_H
|
||||
#define _ISO646_H
|
||||
|
||||
#ifndef __cplusplus
|
||||
#define and &&
|
||||
#define and_eq &=
|
||||
#define bitand &
|
||||
#define bitor |
|
||||
#define compl ~
|
||||
#define not !
|
||||
#define not_eq !=
|
||||
#define or ||
|
||||
#define or_eq |=
|
||||
#define xor ^
|
||||
#define xor_eq ^=
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,208 @@
|
||||
/* Copyright (C) 1992-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
Under Section 7 of GPL version 3, you are granted additional
|
||||
permissions described in the GCC Runtime Library Exception, version
|
||||
3.1, as published by the Free Software Foundation.
|
||||
|
||||
You should have received a copy of the GNU General Public License and
|
||||
a copy of the GCC Runtime Library Exception along with this program;
|
||||
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* This administrivia gets added to the beginning of limits.h
|
||||
if the system has its own version of limits.h. */
|
||||
|
||||
/* We use _GCC_LIMITS_H_ because we want this not to match
|
||||
any macros that the system's limits.h uses for its own purposes. */
|
||||
#ifndef _GCC_LIMITS_H_ /* Terminated in limity.h. */
|
||||
#define _GCC_LIMITS_H_
|
||||
|
||||
#ifndef _LIBC_LIMITS_H_
|
||||
/* Use "..." so that we find syslimits.h only in this same directory. */
|
||||
#include "syslimits.h"
|
||||
#endif
|
||||
/* Copyright (C) 1991-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
Under Section 7 of GPL version 3, you are granted additional
|
||||
permissions described in the GCC Runtime Library Exception, version
|
||||
3.1, as published by the Free Software Foundation.
|
||||
|
||||
You should have received a copy of the GNU General Public License and
|
||||
a copy of the GCC Runtime Library Exception along with this program;
|
||||
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _LIMITS_H___
|
||||
#define _LIMITS_H___
|
||||
|
||||
/* Number of bits in a `char'. */
|
||||
#undef CHAR_BIT
|
||||
#define CHAR_BIT __CHAR_BIT__
|
||||
|
||||
/* Maximum length of a multibyte character. */
|
||||
#ifndef MB_LEN_MAX
|
||||
#define MB_LEN_MAX 1
|
||||
#endif
|
||||
|
||||
/* Minimum and maximum values a `signed char' can hold. */
|
||||
#undef SCHAR_MIN
|
||||
#define SCHAR_MIN (-SCHAR_MAX - 1)
|
||||
#undef SCHAR_MAX
|
||||
#define SCHAR_MAX __SCHAR_MAX__
|
||||
|
||||
/* Maximum value an `unsigned char' can hold. (Minimum is 0). */
|
||||
#undef UCHAR_MAX
|
||||
#if __SCHAR_MAX__ == __INT_MAX__
|
||||
# define UCHAR_MAX (SCHAR_MAX * 2U + 1U)
|
||||
#else
|
||||
# define UCHAR_MAX (SCHAR_MAX * 2 + 1)
|
||||
#endif
|
||||
|
||||
/* Minimum and maximum values a `char' can hold. */
|
||||
#ifdef __CHAR_UNSIGNED__
|
||||
# undef CHAR_MIN
|
||||
# if __SCHAR_MAX__ == __INT_MAX__
|
||||
# define CHAR_MIN 0U
|
||||
# else
|
||||
# define CHAR_MIN 0
|
||||
# endif
|
||||
# undef CHAR_MAX
|
||||
# define CHAR_MAX UCHAR_MAX
|
||||
#else
|
||||
# undef CHAR_MIN
|
||||
# define CHAR_MIN SCHAR_MIN
|
||||
# undef CHAR_MAX
|
||||
# define CHAR_MAX SCHAR_MAX
|
||||
#endif
|
||||
|
||||
/* Minimum and maximum values a `signed short int' can hold. */
|
||||
#undef SHRT_MIN
|
||||
#define SHRT_MIN (-SHRT_MAX - 1)
|
||||
#undef SHRT_MAX
|
||||
#define SHRT_MAX __SHRT_MAX__
|
||||
|
||||
/* Maximum value an `unsigned short int' can hold. (Minimum is 0). */
|
||||
#undef USHRT_MAX
|
||||
#if __SHRT_MAX__ == __INT_MAX__
|
||||
# define USHRT_MAX (SHRT_MAX * 2U + 1U)
|
||||
#else
|
||||
# define USHRT_MAX (SHRT_MAX * 2 + 1)
|
||||
#endif
|
||||
|
||||
/* Minimum and maximum values a `signed int' can hold. */
|
||||
#undef INT_MIN
|
||||
#define INT_MIN (-INT_MAX - 1)
|
||||
#undef INT_MAX
|
||||
#define INT_MAX __INT_MAX__
|
||||
|
||||
/* Maximum value an `unsigned int' can hold. (Minimum is 0). */
|
||||
#undef UINT_MAX
|
||||
#define UINT_MAX (INT_MAX * 2U + 1U)
|
||||
|
||||
/* Minimum and maximum values a `signed long int' can hold.
|
||||
(Same as `int'). */
|
||||
#undef LONG_MIN
|
||||
#define LONG_MIN (-LONG_MAX - 1L)
|
||||
#undef LONG_MAX
|
||||
#define LONG_MAX __LONG_MAX__
|
||||
|
||||
/* Maximum value an `unsigned long int' can hold. (Minimum is 0). */
|
||||
#undef ULONG_MAX
|
||||
#define ULONG_MAX (LONG_MAX * 2UL + 1UL)
|
||||
|
||||
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
||||
/* Minimum and maximum values a `signed long long int' can hold. */
|
||||
# undef LLONG_MIN
|
||||
# define LLONG_MIN (-LLONG_MAX - 1LL)
|
||||
# undef LLONG_MAX
|
||||
# define LLONG_MAX __LONG_LONG_MAX__
|
||||
|
||||
/* Maximum value an `unsigned long long int' can hold. (Minimum is 0). */
|
||||
# undef ULLONG_MAX
|
||||
# define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
|
||||
#endif
|
||||
|
||||
#if defined (__GNU_LIBRARY__) ? defined (__USE_GNU) : !defined (__STRICT_ANSI__)
|
||||
/* Minimum and maximum values a `signed long long int' can hold. */
|
||||
# undef LONG_LONG_MIN
|
||||
# define LONG_LONG_MIN (-LONG_LONG_MAX - 1LL)
|
||||
# undef LONG_LONG_MAX
|
||||
# define LONG_LONG_MAX __LONG_LONG_MAX__
|
||||
|
||||
/* Maximum value an `unsigned long long int' can hold. (Minimum is 0). */
|
||||
# undef ULONG_LONG_MAX
|
||||
# define ULONG_LONG_MAX (LONG_LONG_MAX * 2ULL + 1ULL)
|
||||
#endif
|
||||
|
||||
#if (defined __STDC_WANT_IEC_60559_BFP_EXT__ \
|
||||
|| (defined (__STDC_VERSION__) && __STDC_VERSION__ > 201710L))
|
||||
/* TS 18661-1 / C2X widths of integer types. */
|
||||
# undef CHAR_WIDTH
|
||||
# define CHAR_WIDTH __SCHAR_WIDTH__
|
||||
# undef SCHAR_WIDTH
|
||||
# define SCHAR_WIDTH __SCHAR_WIDTH__
|
||||
# undef UCHAR_WIDTH
|
||||
# define UCHAR_WIDTH __SCHAR_WIDTH__
|
||||
# undef SHRT_WIDTH
|
||||
# define SHRT_WIDTH __SHRT_WIDTH__
|
||||
# undef USHRT_WIDTH
|
||||
# define USHRT_WIDTH __SHRT_WIDTH__
|
||||
# undef INT_WIDTH
|
||||
# define INT_WIDTH __INT_WIDTH__
|
||||
# undef UINT_WIDTH
|
||||
# define UINT_WIDTH __INT_WIDTH__
|
||||
# undef LONG_WIDTH
|
||||
# define LONG_WIDTH __LONG_WIDTH__
|
||||
# undef ULONG_WIDTH
|
||||
# define ULONG_WIDTH __LONG_WIDTH__
|
||||
# undef LLONG_WIDTH
|
||||
# define LLONG_WIDTH __LONG_LONG_WIDTH__
|
||||
# undef ULLONG_WIDTH
|
||||
# define ULLONG_WIDTH __LONG_LONG_WIDTH__
|
||||
#endif
|
||||
|
||||
#if defined (__STDC_VERSION__) && __STDC_VERSION__ > 201710L
|
||||
/* C2X width and limit of _Bool. */
|
||||
# undef BOOL_MAX
|
||||
# define BOOL_MAX 1
|
||||
# undef BOOL_WIDTH
|
||||
# define BOOL_WIDTH 1
|
||||
|
||||
# define __STDC_VERSION_LIMITS_H__ 202311L
|
||||
#endif
|
||||
|
||||
#endif /* _LIMITS_H___ */
|
||||
/* This administrivia gets added to the end of limits.h
|
||||
if the system has its own version of limits.h. */
|
||||
|
||||
#else /* not _GCC_LIMITS_H_ */
|
||||
|
||||
#ifdef _GCC_NEXT_LIMITS_H
|
||||
#include_next <limits.h> /* recurse down to the real one */
|
||||
#endif
|
||||
|
||||
#endif /* not _GCC_LIMITS_H_ */
|
||||
@@ -0,0 +1,100 @@
|
||||
/* RISC-V 'V' Extension intrinsics include file.
|
||||
Copyright (C) 2022-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published
|
||||
by the Free Software Foundation; either version 3, or (at your
|
||||
option) any later version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
License for more details.
|
||||
|
||||
Under Section 7 of GPL version 3, you are granted additional
|
||||
permissions described in the GCC Runtime Library Exception, version
|
||||
3.1, as published by the Free Software Foundation.
|
||||
|
||||
You should have received a copy of the GNU General Public License and
|
||||
a copy of the GCC Runtime Library Exception along with this program;
|
||||
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef __RISCV_VECTOR_H
|
||||
#define __RISCV_VECTOR_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#ifndef __riscv_vector
|
||||
#error "Vector intrinsics require the vector extension."
|
||||
#else
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum RVV_CSR {
|
||||
RVV_VSTART = 0,
|
||||
RVV_VXSAT,
|
||||
RVV_VXRM,
|
||||
RVV_VCSR,
|
||||
};
|
||||
|
||||
__extension__ extern __inline unsigned long
|
||||
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
|
||||
vread_csr(enum RVV_CSR csr)
|
||||
{
|
||||
unsigned long rv = 0;
|
||||
switch (csr)
|
||||
{
|
||||
case RVV_VSTART:
|
||||
__asm__ __volatile__ ("csrr\t%0,vstart" : "=r"(rv) : : "memory");
|
||||
break;
|
||||
case RVV_VXSAT:
|
||||
__asm__ __volatile__ ("csrr\t%0,vxsat" : "=r"(rv) : : "memory");
|
||||
break;
|
||||
case RVV_VXRM:
|
||||
__asm__ __volatile__ ("csrr\t%0,vxrm" : "=r"(rv) : : "memory");
|
||||
break;
|
||||
case RVV_VCSR:
|
||||
__asm__ __volatile__ ("csrr\t%0,vcsr" : "=r"(rv) : : "memory");
|
||||
break;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
__extension__ extern __inline void
|
||||
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
|
||||
vwrite_csr(enum RVV_CSR csr, unsigned long value)
|
||||
{
|
||||
switch (csr)
|
||||
{
|
||||
case RVV_VSTART:
|
||||
__asm__ __volatile__ ("csrw\tvstart,%z0" : : "rJ"(value) : "memory");
|
||||
break;
|
||||
case RVV_VXSAT:
|
||||
__asm__ __volatile__ ("csrw\tvxsat,%z0" : : "rJ"(value) : "memory");
|
||||
break;
|
||||
case RVV_VXRM:
|
||||
__asm__ __volatile__ ("csrw\tvxrm,%z0" : : "rJ"(value) : "memory");
|
||||
break;
|
||||
case RVV_VCSR:
|
||||
__asm__ __volatile__ ("csrw\tvcsr,%z0" : : "rJ"(value) : "memory");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* NOTE: This implementation of riscv_vector.h is intentionally short. It does
|
||||
not define the RVV types and intrinsic functions directly in C and C++
|
||||
code, but instead uses the following pragma to tell GCC to insert the
|
||||
necessary type and function definitions itself. The net effect is the
|
||||
same, and the file is a complete implementation of riscv_vector.h. */
|
||||
#pragma riscv intrinsic "vector"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // __cplusplus
|
||||
#endif // __riscv_vector
|
||||
#endif // __RISCV_VECTOR_H
|
||||
@@ -0,0 +1,65 @@
|
||||
/* Object size checking support macros.
|
||||
Copyright (C) 2004-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
In addition to the permissions in the GNU General Public License, the
|
||||
Free Software Foundation gives you unlimited permission to link the
|
||||
compiled version of this file into combinations with other programs,
|
||||
and to distribute those combinations without any restriction coming
|
||||
from the use of this file. (The General Public License restrictions
|
||||
do apply in other respects; for example, they cover modification of
|
||||
the file, and distribution when not linked into a combine
|
||||
executable.)
|
||||
|
||||
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
Under Section 7 of GPL version 3, you are granted additional
|
||||
permissions described in the GCC Runtime Library Exception, version
|
||||
3.1, as published by the Free Software Foundation.
|
||||
|
||||
You should have received a copy of the GNU General Public License and
|
||||
a copy of the GCC Runtime Library Exception along with this program;
|
||||
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
|
||||
#ifndef _SSP_H
|
||||
#define _SSP_H 1
|
||||
|
||||
#if _FORTIFY_SOURCE > 0 && __OPTIMIZE__ > 0 \
|
||||
&& defined __GNUC__ \
|
||||
&& (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) \
|
||||
&& !defined __cplusplus
|
||||
# if _FORTIFY_SOURCE == 1
|
||||
# define __SSP_FORTIFY_LEVEL 1
|
||||
# elif _FORTIFY_SOURCE > 1
|
||||
# define __SSP_FORTIFY_LEVEL 2
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if __SSP_FORTIFY_LEVEL > 0
|
||||
# include <stddef.h>
|
||||
# define __ssp_bos(ptr) __builtin_object_size (ptr, __SSP_FORTIFY_LEVEL > 1)
|
||||
# define __ssp_bos0(ptr) __builtin_object_size (ptr, 0)
|
||||
|
||||
# define __SSP_REDIRECT(name, proto, alias) \
|
||||
name proto __asm__ (__SSP_ASMNAME (#alias))
|
||||
# define __SSP_ASMNAME(cname) __SSP_ASMNAME2 (__USER_LABEL_PREFIX__, cname)
|
||||
# define __SSP_ASMNAME2(prefix, cname) __SSP_ASMNAME3 (prefix) cname
|
||||
# define __SSP_ASMNAME3(prefix) #prefix
|
||||
|
||||
# undef __SSP_HAVE_VSNPRINTF
|
||||
|
||||
extern void __chk_fail (void) __attribute__((__noreturn__));
|
||||
#endif
|
||||
|
||||
#endif /* _SSP_H */
|
||||
@@ -0,0 +1,100 @@
|
||||
/* Checking macros for stdio functions.
|
||||
Copyright (C) 2004-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
In addition to the permissions in the GNU General Public License, the
|
||||
Free Software Foundation gives you unlimited permission to link the
|
||||
compiled version of this file into combinations with other programs,
|
||||
and to distribute those combinations without any restriction coming
|
||||
from the use of this file. (The General Public License restrictions
|
||||
do apply in other respects; for example, they cover modification of
|
||||
the file, and distribution when not linked into a combine
|
||||
executable.)
|
||||
|
||||
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
Under Section 7 of GPL version 3, you are granted additional
|
||||
permissions described in the GCC Runtime Library Exception, version
|
||||
3.1, as published by the Free Software Foundation.
|
||||
|
||||
You should have received a copy of the GNU General Public License and
|
||||
a copy of the GCC Runtime Library Exception along with this program;
|
||||
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
|
||||
#ifndef _SSP_STDIO_H
|
||||
#define _SSP_STDIO_H 1
|
||||
|
||||
#include <ssp.h>
|
||||
#include_next <stdio.h>
|
||||
|
||||
#if __SSP_FORTIFY_LEVEL > 0
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#undef sprintf
|
||||
#undef vsprintf
|
||||
#undef snprintf
|
||||
#undef vsnprintf
|
||||
#undef gets
|
||||
#undef fgets
|
||||
|
||||
extern int __sprintf_chk (char *__restrict__ __s, int __flag, size_t __slen,
|
||||
__const char *__restrict__ __format, ...);
|
||||
extern int __vsprintf_chk (char *__restrict__ __s, int __flag, size_t __slen,
|
||||
__const char *__restrict__ __format,
|
||||
va_list __ap);
|
||||
|
||||
#define sprintf(str, ...) \
|
||||
__builtin___sprintf_chk (str, 0, __ssp_bos (str), \
|
||||
__VA_ARGS__)
|
||||
#define vsprintf(str, fmt, ap) \
|
||||
__builtin___vsprintf_chk (str, 0, __ssp_bos (str), fmt, ap)
|
||||
|
||||
extern int __snprintf_chk (char *__restrict__ __s, size_t __n, int __flag,
|
||||
size_t __slen, __const char *__restrict__ __format,
|
||||
...);
|
||||
extern int __vsnprintf_chk (char *__restrict__ __s, size_t __n, int __flag,
|
||||
size_t __slen, __const char *__restrict__ __format,
|
||||
va_list __ap);
|
||||
|
||||
#define snprintf(str, len, ...) \
|
||||
__builtin___snprintf_chk (str, len, 0, __ssp_bos (str), __VA_ARGS__)
|
||||
#define vsnprintf(str, len, fmt, ap) \
|
||||
__builtin___vsnprintf_chk (str, len, 0, __ssp_bos (str), fmt, ap)
|
||||
|
||||
extern char *__gets_chk (char *__str, size_t);
|
||||
extern char *__SSP_REDIRECT (__gets_alias, (char *__str), gets);
|
||||
|
||||
extern inline __attribute__((__always_inline__)) char *
|
||||
gets (char *__str)
|
||||
{
|
||||
if (__ssp_bos (__str) != (size_t) -1)
|
||||
return __gets_chk (__str, __ssp_bos (__str));
|
||||
return __gets_alias (__str);
|
||||
}
|
||||
|
||||
extern char *__SSP_REDIRECT (__fgets_alias,
|
||||
(char *__restrict__ __s, int __n,
|
||||
FILE *__restrict__ __stream), fgets);
|
||||
|
||||
extern inline __attribute__((__always_inline__)) char *
|
||||
fgets (char *__restrict__ __s, int __n, FILE *__restrict__ __stream)
|
||||
{
|
||||
if (__ssp_bos (__s) != (size_t) -1 && (size_t) __n > __ssp_bos (__s))
|
||||
__chk_fail ();
|
||||
return __fgets_alias (__s, __n, __stream);
|
||||
}
|
||||
|
||||
#endif /* __SSP_FORTIFY_LEVEL > 0 */
|
||||
#endif /* _SSP_STDIO_H */
|
||||
@@ -0,0 +1,167 @@
|
||||
/* Checking macros for string functions.
|
||||
Copyright (C) 2004-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
In addition to the permissions in the GNU General Public License, the
|
||||
Free Software Foundation gives you unlimited permission to link the
|
||||
compiled version of this file into combinations with other programs,
|
||||
and to distribute those combinations without any restriction coming
|
||||
from the use of this file. (The General Public License restrictions
|
||||
do apply in other respects; for example, they cover modification of
|
||||
the file, and distribution when not linked into a combine
|
||||
executable.)
|
||||
|
||||
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
Under Section 7 of GPL version 3, you are granted additional
|
||||
permissions described in the GCC Runtime Library Exception, version
|
||||
3.1, as published by the Free Software Foundation.
|
||||
|
||||
You should have received a copy of the GNU General Public License and
|
||||
a copy of the GCC Runtime Library Exception along with this program;
|
||||
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
|
||||
#ifndef _SSP_STRING_H
|
||||
#define _SSP_STRING_H 1
|
||||
|
||||
#include <ssp.h>
|
||||
#include_next <string.h>
|
||||
|
||||
#if __SSP_FORTIFY_LEVEL > 0
|
||||
|
||||
#undef memcpy
|
||||
#undef memmove
|
||||
#undef memset
|
||||
#undef strcat
|
||||
#undef strcpy
|
||||
#undef strncat
|
||||
#undef strncpy
|
||||
#undef mempcpy
|
||||
#undef stpcpy
|
||||
#undef bcopy
|
||||
#undef bzero
|
||||
|
||||
#define memcpy(dest, src, len) \
|
||||
((__ssp_bos0 (dest) != (size_t) -1) \
|
||||
? __builtin___memcpy_chk (dest, src, len, __ssp_bos0 (dest)) \
|
||||
: __memcpy_ichk (dest, src, len))
|
||||
static inline __attribute__((__always_inline__)) void *
|
||||
__memcpy_ichk (void *__restrict__ __dest, const void *__restrict__ __src,
|
||||
size_t __len)
|
||||
{
|
||||
return __builtin___memcpy_chk (__dest, __src, __len, __ssp_bos0 (__dest));
|
||||
}
|
||||
|
||||
|
||||
#define memmove(dest, src, len) \
|
||||
((__ssp_bos0 (dest) != (size_t) -1) \
|
||||
? __builtin___memmove_chk (dest, src, len, __ssp_bos0 (dest)) \
|
||||
: __memmove_ichk (dest, src, len))
|
||||
static inline __attribute__((__always_inline__)) void *
|
||||
__memmove_ichk (void *__dest, const void *__src, size_t __len)
|
||||
{
|
||||
return __builtin___memmove_chk (__dest, __src, __len, __ssp_bos0 (__dest));
|
||||
}
|
||||
|
||||
|
||||
#define mempcpy(dest, src, len) \
|
||||
((__ssp_bos0 (dest) != (size_t) -1) \
|
||||
? __builtin___mempcpy_chk (dest, src, len, __ssp_bos0 (dest)) \
|
||||
: __mempcpy_ichk (dest, src, len))
|
||||
static inline __attribute__((__always_inline__)) void *
|
||||
__mempcpy_ichk (void *__restrict__ __dest, const void *__restrict__ __src,
|
||||
size_t __len)
|
||||
{
|
||||
return __builtin___mempcpy_chk (__dest, __src, __len, __ssp_bos0 (__dest));
|
||||
}
|
||||
|
||||
|
||||
#define memset(dest, ch, len) \
|
||||
((__ssp_bos0 (dest) != (size_t) -1) \
|
||||
? __builtin___memset_chk (dest, ch, len, __ssp_bos0 (dest)) \
|
||||
: __memset_ichk (dest, ch, len))
|
||||
static inline __attribute__((__always_inline__)) void *
|
||||
__memset_ichk (void *__dest, int __ch, size_t __len)
|
||||
{
|
||||
return __builtin___memset_chk (__dest, __ch, __len, __ssp_bos0 (__dest));
|
||||
}
|
||||
|
||||
#define bcopy(src, dest, len) ((void) \
|
||||
((__ssp_bos0 (dest) != (size_t) -1) \
|
||||
? __builtin___memmove_chk (dest, src, len, __ssp_bos0 (dest)) \
|
||||
: __memmove_ichk (dest, src, len)))
|
||||
#define bzero(dest, len) ((void) \
|
||||
((__ssp_bos0 (dest) != (size_t) -1) \
|
||||
? __builtin___memset_chk (dest, '\0', len, __ssp_bos0 (dest)) \
|
||||
: __memset_ichk (dest, '\0', len)))
|
||||
|
||||
|
||||
#define strcpy(dest, src) \
|
||||
((__ssp_bos (dest) != (size_t) -1) \
|
||||
? __builtin___strcpy_chk (dest, src, __ssp_bos (dest)) \
|
||||
: __strcpy_ichk (dest, src))
|
||||
static inline __attribute__((__always_inline__)) char *
|
||||
__strcpy_ichk (char *__restrict__ __dest, const char *__restrict__ __src)
|
||||
{
|
||||
return __builtin___strcpy_chk (__dest, __src, __ssp_bos (__dest));
|
||||
}
|
||||
|
||||
|
||||
#define stpcpy(dest, src) \
|
||||
((__ssp_bos (dest) != (size_t) -1) \
|
||||
? __builtin___stpcpy_chk (dest, src, __ssp_bos (dest)) \
|
||||
: __stpcpy_ichk (dest, src))
|
||||
static inline __attribute__((__always_inline__)) char *
|
||||
__stpcpy_ichk (char *__restrict__ __dest, const char *__restrict__ __src)
|
||||
{
|
||||
return __builtin___stpcpy_chk (__dest, __src, __ssp_bos (__dest));
|
||||
}
|
||||
|
||||
|
||||
#define strncpy(dest, src, len) \
|
||||
((__ssp_bos (dest) != (size_t) -1) \
|
||||
? __builtin___strncpy_chk (dest, src, len, __ssp_bos (dest)) \
|
||||
: __strncpy_ichk (dest, src, len))
|
||||
static inline __attribute__((__always_inline__)) char *
|
||||
__strncpy_ichk (char *__restrict__ __dest, const char *__restrict__ __src,
|
||||
size_t __len)
|
||||
{
|
||||
return __builtin___strncpy_chk (__dest, __src, __len, __ssp_bos (__dest));
|
||||
}
|
||||
|
||||
|
||||
#define strcat(dest, src) \
|
||||
((__ssp_bos (dest) != (size_t) -1) \
|
||||
? __builtin___strcat_chk (dest, src, __ssp_bos (dest)) \
|
||||
: __strcat_ichk (dest, src))
|
||||
static inline __attribute__((__always_inline__)) char *
|
||||
__strcat_ichk (char *__restrict__ __dest, const char *__restrict__ __src)
|
||||
{
|
||||
return __builtin___strcat_chk (__dest, __src, __ssp_bos (__dest));
|
||||
}
|
||||
|
||||
|
||||
#define strncat(dest, src, len) \
|
||||
((__ssp_bos (dest) != (size_t) -1) \
|
||||
? __builtin___strncat_chk (dest, src, len, __ssp_bos (dest)) \
|
||||
: __strncat_ichk (dest, src, len))
|
||||
static inline __attribute__((__always_inline__)) char *
|
||||
__strncat_ichk (char *__restrict__ __dest, const char *__restrict__ __src,
|
||||
size_t __len)
|
||||
{
|
||||
return __builtin___strncat_chk (__dest, __src, __len, __ssp_bos (__dest));
|
||||
}
|
||||
|
||||
#endif /* __SSP_FORTIFY_LEVEL > 0 */
|
||||
#endif /* _SSP_STRING_H */
|
||||
@@ -0,0 +1,84 @@
|
||||
/* Checking macros for unistd functions.
|
||||
Copyright (C) 2005-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
In addition to the permissions in the GNU General Public License, the
|
||||
Free Software Foundation gives you unlimited permission to link the
|
||||
compiled version of this file into combinations with other programs,
|
||||
and to distribute those combinations without any restriction coming
|
||||
from the use of this file. (The General Public License restrictions
|
||||
do apply in other respects; for example, they cover modification of
|
||||
the file, and distribution when not linked into a combine
|
||||
executable.)
|
||||
|
||||
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
Under Section 7 of GPL version 3, you are granted additional
|
||||
permissions described in the GCC Runtime Library Exception, version
|
||||
3.1, as published by the Free Software Foundation.
|
||||
|
||||
You should have received a copy of the GNU General Public License and
|
||||
a copy of the GCC Runtime Library Exception along with this program;
|
||||
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
|
||||
#ifndef _SSP_UNISTD_H
|
||||
#define _SSP_UNISTD_H 1
|
||||
|
||||
#include <ssp.h>
|
||||
#include_next <unistd.h>
|
||||
|
||||
#if __SSP_FORTIFY_LEVEL > 0
|
||||
|
||||
#undef read
|
||||
#undef readlink
|
||||
#undef getcwd
|
||||
|
||||
extern ssize_t __SSP_REDIRECT (__read_alias, (int __fd, void *__buf,
|
||||
size_t __nbytes), read);
|
||||
|
||||
extern inline __attribute__((__always_inline__)) ssize_t
|
||||
read (int __fd, void *__buf, size_t __nbytes)
|
||||
{
|
||||
if (__ssp_bos0 (__buf) != (size_t) -1 && __nbytes > __ssp_bos0 (__buf))
|
||||
__chk_fail ();
|
||||
return __read_alias (__fd, __buf, __nbytes);
|
||||
}
|
||||
|
||||
extern int __SSP_REDIRECT (__readlink_alias,
|
||||
(const char *__restrict__ __path,
|
||||
char *__restrict__ __buf, size_t __len),
|
||||
readlink);
|
||||
|
||||
extern inline __attribute__((__always_inline__)) int
|
||||
readlink (const char *__restrict__ __path, char *__restrict__ __buf,
|
||||
size_t __len)
|
||||
{
|
||||
if (__ssp_bos (__buf) != (size_t) -1 && __len > __ssp_bos (__buf))
|
||||
__chk_fail ();
|
||||
return __readlink_alias (__path, __buf, __len);
|
||||
}
|
||||
|
||||
extern char *__SSP_REDIRECT (__getcwd_alias,
|
||||
(char *__buf, size_t __size), getcwd);
|
||||
|
||||
extern inline __attribute__((__always_inline__)) char *
|
||||
getcwd (char *__buf, size_t __size)
|
||||
{
|
||||
if (__ssp_bos (__buf) != (size_t) -1 && __size > __ssp_bos (__buf))
|
||||
__chk_fail ();
|
||||
return __getcwd_alias (__buf, __size);
|
||||
}
|
||||
|
||||
#endif /* __SSP_FORTIFY_LEVEL > 0 */
|
||||
#endif /* _SSP_UNISTD_H */
|
||||
@@ -0,0 +1,40 @@
|
||||
/* Copyright (C) 2011-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3, or (at your option)
|
||||
any later version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Under Section 7 of GPL version 3, you are granted additional
|
||||
permissions described in the GCC Runtime Library Exception, version
|
||||
3.1, as published by the Free Software Foundation.
|
||||
|
||||
You should have received a copy of the GNU General Public License and
|
||||
a copy of the GCC Runtime Library Exception along with this program;
|
||||
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* ISO C1X: 7.15 Alignment <stdalign.h>. */
|
||||
|
||||
#ifndef _STDALIGN_H
|
||||
#define _STDALIGN_H
|
||||
|
||||
#if (!defined __cplusplus \
|
||||
&& !(defined __STDC_VERSION__ && __STDC_VERSION__ > 201710L))
|
||||
|
||||
#define alignas _Alignas
|
||||
#define alignof _Alignof
|
||||
|
||||
#define __alignas_is_defined 1
|
||||
#define __alignof_is_defined 1
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* stdalign.h */
|
||||
@@ -0,0 +1,135 @@
|
||||
/* Copyright (C) 1989-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3, or (at your option)
|
||||
any later version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Under Section 7 of GPL version 3, you are granted additional
|
||||
permissions described in the GCC Runtime Library Exception, version
|
||||
3.1, as published by the Free Software Foundation.
|
||||
|
||||
You should have received a copy of the GNU General Public License and
|
||||
a copy of the GCC Runtime Library Exception along with this program;
|
||||
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/*
|
||||
* ISO C Standard: 7.15 Variable arguments <stdarg.h>
|
||||
*/
|
||||
|
||||
#ifndef _STDARG_H
|
||||
#ifndef _ANSI_STDARG_H_
|
||||
#ifndef __need___va_list
|
||||
#define _STDARG_H
|
||||
#define _ANSI_STDARG_H_
|
||||
#endif /* not __need___va_list */
|
||||
#undef __need___va_list
|
||||
|
||||
/* Define __gnuc_va_list. */
|
||||
|
||||
#ifndef __GNUC_VA_LIST
|
||||
#define __GNUC_VA_LIST
|
||||
typedef __builtin_va_list __gnuc_va_list;
|
||||
#endif
|
||||
|
||||
/* Define the standard macros for the user,
|
||||
if this invocation was from the user program. */
|
||||
#ifdef _STDARG_H
|
||||
|
||||
#if defined __STDC_VERSION__ && __STDC_VERSION__ > 201710L
|
||||
#define va_start(v, ...) __builtin_va_start(v, 0)
|
||||
#else
|
||||
#define va_start(v,l) __builtin_va_start(v,l)
|
||||
#endif
|
||||
#define va_end(v) __builtin_va_end(v)
|
||||
#define va_arg(v,l) __builtin_va_arg(v,l)
|
||||
#if !defined(__STRICT_ANSI__) || __STDC_VERSION__ + 0 >= 199900L \
|
||||
|| __cplusplus + 0 >= 201103L
|
||||
#define va_copy(d,s) __builtin_va_copy(d,s)
|
||||
#endif
|
||||
#define __va_copy(d,s) __builtin_va_copy(d,s)
|
||||
|
||||
/* Define va_list, if desired, from __gnuc_va_list. */
|
||||
/* We deliberately do not define va_list when called from
|
||||
stdio.h, because ANSI C says that stdio.h is not supposed to define
|
||||
va_list. stdio.h needs to have access to that data type,
|
||||
but must not use that name. It should use the name __gnuc_va_list,
|
||||
which is safe because it is reserved for the implementation. */
|
||||
|
||||
#ifdef _BSD_VA_LIST
|
||||
#undef _BSD_VA_LIST
|
||||
#endif
|
||||
|
||||
#if defined(__svr4__) || (defined(_SCO_DS) && !defined(__VA_LIST))
|
||||
/* SVR4.2 uses _VA_LIST for an internal alias for va_list,
|
||||
so we must avoid testing it and setting it here.
|
||||
SVR4 uses _VA_LIST as a flag in stdarg.h, but we should
|
||||
have no conflict with that. */
|
||||
#ifndef _VA_LIST_
|
||||
#define _VA_LIST_
|
||||
#ifdef __i860__
|
||||
#ifndef _VA_LIST
|
||||
#define _VA_LIST va_list
|
||||
#endif
|
||||
#endif /* __i860__ */
|
||||
typedef __gnuc_va_list va_list;
|
||||
#ifdef _SCO_DS
|
||||
#define __VA_LIST
|
||||
#endif
|
||||
#endif /* _VA_LIST_ */
|
||||
#else /* not __svr4__ || _SCO_DS */
|
||||
|
||||
/* The macro _VA_LIST_ is the same thing used by this file in Ultrix.
|
||||
But on BSD NET2 we must not test or define or undef it.
|
||||
(Note that the comments in NET 2's ansi.h
|
||||
are incorrect for _VA_LIST_--see stdio.h!) */
|
||||
#if !defined (_VA_LIST_) || defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__) || defined(WINNT)
|
||||
/* The macro _VA_LIST_DEFINED is used in Windows NT 3.5 */
|
||||
#ifndef _VA_LIST_DEFINED
|
||||
/* The macro _VA_LIST is used in SCO Unix 3.2. */
|
||||
#ifndef _VA_LIST
|
||||
/* The macro _VA_LIST_T_H is used in the Bull dpx2 */
|
||||
#ifndef _VA_LIST_T_H
|
||||
/* The macro __va_list__ is used by BeOS. */
|
||||
#ifndef __va_list__
|
||||
typedef __gnuc_va_list va_list;
|
||||
#endif /* not __va_list__ */
|
||||
#endif /* not _VA_LIST_T_H */
|
||||
#endif /* not _VA_LIST */
|
||||
#endif /* not _VA_LIST_DEFINED */
|
||||
#if !(defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__))
|
||||
#define _VA_LIST_
|
||||
#endif
|
||||
#ifndef _VA_LIST
|
||||
#define _VA_LIST
|
||||
#endif
|
||||
#ifndef _VA_LIST_DEFINED
|
||||
#define _VA_LIST_DEFINED
|
||||
#endif
|
||||
#ifndef _VA_LIST_T_H
|
||||
#define _VA_LIST_T_H
|
||||
#endif
|
||||
#ifndef __va_list__
|
||||
#define __va_list__
|
||||
#endif
|
||||
|
||||
#endif /* not _VA_LIST_, except on certain systems */
|
||||
|
||||
#endif /* not __svr4__ */
|
||||
|
||||
#if defined __STDC_VERSION__ && __STDC_VERSION__ > 201710L
|
||||
#define __STDC_VERSION_STDARG_H__ 202311L
|
||||
#endif
|
||||
|
||||
#endif /* _STDARG_H */
|
||||
|
||||
#endif /* not _ANSI_STDARG_H_ */
|
||||
#endif /* not _STDARG_H */
|
||||
@@ -0,0 +1,255 @@
|
||||
/* Copyright (C) 2013-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3, or (at your option)
|
||||
any later version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Under Section 7 of GPL version 3, you are granted additional
|
||||
permissions described in the GCC Runtime Library Exception, version
|
||||
3.1, as published by the Free Software Foundation.
|
||||
|
||||
You should have received a copy of the GNU General Public License and
|
||||
a copy of the GCC Runtime Library Exception along with this program;
|
||||
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* ISO C11 Standard: 7.17 Atomics <stdatomic.h>. */
|
||||
|
||||
#ifndef _STDATOMIC_H
|
||||
#define _STDATOMIC_H
|
||||
|
||||
typedef enum
|
||||
{
|
||||
memory_order_relaxed = __ATOMIC_RELAXED,
|
||||
memory_order_consume = __ATOMIC_CONSUME,
|
||||
memory_order_acquire = __ATOMIC_ACQUIRE,
|
||||
memory_order_release = __ATOMIC_RELEASE,
|
||||
memory_order_acq_rel = __ATOMIC_ACQ_REL,
|
||||
memory_order_seq_cst = __ATOMIC_SEQ_CST
|
||||
} memory_order;
|
||||
|
||||
|
||||
typedef _Atomic _Bool atomic_bool;
|
||||
typedef _Atomic char atomic_char;
|
||||
typedef _Atomic signed char atomic_schar;
|
||||
typedef _Atomic unsigned char atomic_uchar;
|
||||
typedef _Atomic short atomic_short;
|
||||
typedef _Atomic unsigned short atomic_ushort;
|
||||
typedef _Atomic int atomic_int;
|
||||
typedef _Atomic unsigned int atomic_uint;
|
||||
typedef _Atomic long atomic_long;
|
||||
typedef _Atomic unsigned long atomic_ulong;
|
||||
typedef _Atomic long long atomic_llong;
|
||||
typedef _Atomic unsigned long long atomic_ullong;
|
||||
#ifdef __CHAR8_TYPE__
|
||||
typedef _Atomic __CHAR8_TYPE__ atomic_char8_t;
|
||||
#endif
|
||||
typedef _Atomic __CHAR16_TYPE__ atomic_char16_t;
|
||||
typedef _Atomic __CHAR32_TYPE__ atomic_char32_t;
|
||||
typedef _Atomic __WCHAR_TYPE__ atomic_wchar_t;
|
||||
typedef _Atomic __INT_LEAST8_TYPE__ atomic_int_least8_t;
|
||||
typedef _Atomic __UINT_LEAST8_TYPE__ atomic_uint_least8_t;
|
||||
typedef _Atomic __INT_LEAST16_TYPE__ atomic_int_least16_t;
|
||||
typedef _Atomic __UINT_LEAST16_TYPE__ atomic_uint_least16_t;
|
||||
typedef _Atomic __INT_LEAST32_TYPE__ atomic_int_least32_t;
|
||||
typedef _Atomic __UINT_LEAST32_TYPE__ atomic_uint_least32_t;
|
||||
typedef _Atomic __INT_LEAST64_TYPE__ atomic_int_least64_t;
|
||||
typedef _Atomic __UINT_LEAST64_TYPE__ atomic_uint_least64_t;
|
||||
typedef _Atomic __INT_FAST8_TYPE__ atomic_int_fast8_t;
|
||||
typedef _Atomic __UINT_FAST8_TYPE__ atomic_uint_fast8_t;
|
||||
typedef _Atomic __INT_FAST16_TYPE__ atomic_int_fast16_t;
|
||||
typedef _Atomic __UINT_FAST16_TYPE__ atomic_uint_fast16_t;
|
||||
typedef _Atomic __INT_FAST32_TYPE__ atomic_int_fast32_t;
|
||||
typedef _Atomic __UINT_FAST32_TYPE__ atomic_uint_fast32_t;
|
||||
typedef _Atomic __INT_FAST64_TYPE__ atomic_int_fast64_t;
|
||||
typedef _Atomic __UINT_FAST64_TYPE__ atomic_uint_fast64_t;
|
||||
typedef _Atomic __INTPTR_TYPE__ atomic_intptr_t;
|
||||
typedef _Atomic __UINTPTR_TYPE__ atomic_uintptr_t;
|
||||
typedef _Atomic __SIZE_TYPE__ atomic_size_t;
|
||||
typedef _Atomic __PTRDIFF_TYPE__ atomic_ptrdiff_t;
|
||||
typedef _Atomic __INTMAX_TYPE__ atomic_intmax_t;
|
||||
typedef _Atomic __UINTMAX_TYPE__ atomic_uintmax_t;
|
||||
|
||||
|
||||
#if !(defined __STDC_VERSION__ && __STDC_VERSION__ > 201710L)
|
||||
#define ATOMIC_VAR_INIT(VALUE) (VALUE)
|
||||
#endif
|
||||
|
||||
/* Initialize an atomic object pointed to by PTR with VAL. */
|
||||
#define atomic_init(PTR, VAL) \
|
||||
atomic_store_explicit (PTR, VAL, __ATOMIC_RELAXED)
|
||||
|
||||
#define kill_dependency(Y) \
|
||||
__extension__ \
|
||||
({ \
|
||||
__auto_type __kill_dependency_tmp = (Y); \
|
||||
__kill_dependency_tmp; \
|
||||
})
|
||||
|
||||
extern void atomic_thread_fence (memory_order);
|
||||
#define atomic_thread_fence(MO) __atomic_thread_fence (MO)
|
||||
extern void atomic_signal_fence (memory_order);
|
||||
#define atomic_signal_fence(MO) __atomic_signal_fence (MO)
|
||||
#define atomic_is_lock_free(OBJ) __atomic_is_lock_free (sizeof (*(OBJ)), (OBJ))
|
||||
|
||||
#define ATOMIC_BOOL_LOCK_FREE __GCC_ATOMIC_BOOL_LOCK_FREE
|
||||
#define ATOMIC_CHAR_LOCK_FREE __GCC_ATOMIC_CHAR_LOCK_FREE
|
||||
#ifdef __GCC_ATOMIC_CHAR8_T_LOCK_FREE
|
||||
#define ATOMIC_CHAR8_T_LOCK_FREE __GCC_ATOMIC_CHAR8_T_LOCK_FREE
|
||||
#endif
|
||||
#define ATOMIC_CHAR16_T_LOCK_FREE __GCC_ATOMIC_CHAR16_T_LOCK_FREE
|
||||
#define ATOMIC_CHAR32_T_LOCK_FREE __GCC_ATOMIC_CHAR32_T_LOCK_FREE
|
||||
#define ATOMIC_WCHAR_T_LOCK_FREE __GCC_ATOMIC_WCHAR_T_LOCK_FREE
|
||||
#define ATOMIC_SHORT_LOCK_FREE __GCC_ATOMIC_SHORT_LOCK_FREE
|
||||
#define ATOMIC_INT_LOCK_FREE __GCC_ATOMIC_INT_LOCK_FREE
|
||||
#define ATOMIC_LONG_LOCK_FREE __GCC_ATOMIC_LONG_LOCK_FREE
|
||||
#define ATOMIC_LLONG_LOCK_FREE __GCC_ATOMIC_LLONG_LOCK_FREE
|
||||
#define ATOMIC_POINTER_LOCK_FREE __GCC_ATOMIC_POINTER_LOCK_FREE
|
||||
|
||||
|
||||
/* Note that these macros require __auto_type to remove
|
||||
_Atomic qualifiers (and const qualifiers, if those are valid on
|
||||
macro operands).
|
||||
|
||||
Also note that the header file uses the generic form of __atomic
|
||||
builtins, which requires the address to be taken of the value
|
||||
parameter, and then we pass that value on. This allows the macros
|
||||
to work for any type, and the compiler is smart enough to convert
|
||||
these to lock-free _N variants if possible, and throw away the
|
||||
temps. */
|
||||
|
||||
#define atomic_store_explicit(PTR, VAL, MO) \
|
||||
__extension__ \
|
||||
({ \
|
||||
__auto_type __atomic_store_ptr = (PTR); \
|
||||
__typeof__ ((void)0, *__atomic_store_ptr) __atomic_store_tmp = (VAL); \
|
||||
__atomic_store (__atomic_store_ptr, &__atomic_store_tmp, (MO)); \
|
||||
})
|
||||
|
||||
#define atomic_store(PTR, VAL) \
|
||||
atomic_store_explicit (PTR, VAL, __ATOMIC_SEQ_CST)
|
||||
|
||||
|
||||
#define atomic_load_explicit(PTR, MO) \
|
||||
__extension__ \
|
||||
({ \
|
||||
__auto_type __atomic_load_ptr = (PTR); \
|
||||
__typeof__ ((void)0, *__atomic_load_ptr) __atomic_load_tmp; \
|
||||
__atomic_load (__atomic_load_ptr, &__atomic_load_tmp, (MO)); \
|
||||
__atomic_load_tmp; \
|
||||
})
|
||||
|
||||
#define atomic_load(PTR) atomic_load_explicit (PTR, __ATOMIC_SEQ_CST)
|
||||
|
||||
|
||||
#define atomic_exchange_explicit(PTR, VAL, MO) \
|
||||
__extension__ \
|
||||
({ \
|
||||
__auto_type __atomic_exchange_ptr = (PTR); \
|
||||
__typeof__ ((void)0, *__atomic_exchange_ptr) __atomic_exchange_val = (VAL); \
|
||||
__typeof__ ((void)0, *__atomic_exchange_ptr) __atomic_exchange_tmp; \
|
||||
__atomic_exchange (__atomic_exchange_ptr, &__atomic_exchange_val, \
|
||||
&__atomic_exchange_tmp, (MO)); \
|
||||
__atomic_exchange_tmp; \
|
||||
})
|
||||
|
||||
#define atomic_exchange(PTR, VAL) \
|
||||
atomic_exchange_explicit (PTR, VAL, __ATOMIC_SEQ_CST)
|
||||
|
||||
|
||||
#define atomic_compare_exchange_strong_explicit(PTR, VAL, DES, SUC, FAIL) \
|
||||
__extension__ \
|
||||
({ \
|
||||
__auto_type __atomic_compare_exchange_ptr = (PTR); \
|
||||
__typeof__ ((void)0, *__atomic_compare_exchange_ptr) __atomic_compare_exchange_tmp \
|
||||
= (DES); \
|
||||
__atomic_compare_exchange (__atomic_compare_exchange_ptr, (VAL), \
|
||||
&__atomic_compare_exchange_tmp, 0, \
|
||||
(SUC), (FAIL)); \
|
||||
})
|
||||
|
||||
#define atomic_compare_exchange_strong(PTR, VAL, DES) \
|
||||
atomic_compare_exchange_strong_explicit (PTR, VAL, DES, __ATOMIC_SEQ_CST, \
|
||||
__ATOMIC_SEQ_CST)
|
||||
|
||||
#define atomic_compare_exchange_weak_explicit(PTR, VAL, DES, SUC, FAIL) \
|
||||
__extension__ \
|
||||
({ \
|
||||
__auto_type __atomic_compare_exchange_ptr = (PTR); \
|
||||
__typeof__ ((void)0, *__atomic_compare_exchange_ptr) __atomic_compare_exchange_tmp \
|
||||
= (DES); \
|
||||
__atomic_compare_exchange (__atomic_compare_exchange_ptr, (VAL), \
|
||||
&__atomic_compare_exchange_tmp, 1, \
|
||||
(SUC), (FAIL)); \
|
||||
})
|
||||
|
||||
#define atomic_compare_exchange_weak(PTR, VAL, DES) \
|
||||
atomic_compare_exchange_weak_explicit (PTR, VAL, DES, __ATOMIC_SEQ_CST, \
|
||||
__ATOMIC_SEQ_CST)
|
||||
|
||||
|
||||
|
||||
#define atomic_fetch_add(PTR, VAL) __atomic_fetch_add ((PTR), (VAL), \
|
||||
__ATOMIC_SEQ_CST)
|
||||
#define atomic_fetch_add_explicit(PTR, VAL, MO) \
|
||||
__atomic_fetch_add ((PTR), (VAL), (MO))
|
||||
|
||||
#define atomic_fetch_sub(PTR, VAL) __atomic_fetch_sub ((PTR), (VAL), \
|
||||
__ATOMIC_SEQ_CST)
|
||||
#define atomic_fetch_sub_explicit(PTR, VAL, MO) \
|
||||
__atomic_fetch_sub ((PTR), (VAL), (MO))
|
||||
|
||||
#define atomic_fetch_or(PTR, VAL) __atomic_fetch_or ((PTR), (VAL), \
|
||||
__ATOMIC_SEQ_CST)
|
||||
#define atomic_fetch_or_explicit(PTR, VAL, MO) \
|
||||
__atomic_fetch_or ((PTR), (VAL), (MO))
|
||||
|
||||
#define atomic_fetch_xor(PTR, VAL) __atomic_fetch_xor ((PTR), (VAL), \
|
||||
__ATOMIC_SEQ_CST)
|
||||
#define atomic_fetch_xor_explicit(PTR, VAL, MO) \
|
||||
__atomic_fetch_xor ((PTR), (VAL), (MO))
|
||||
|
||||
#define atomic_fetch_and(PTR, VAL) __atomic_fetch_and ((PTR), (VAL), \
|
||||
__ATOMIC_SEQ_CST)
|
||||
#define atomic_fetch_and_explicit(PTR, VAL, MO) \
|
||||
__atomic_fetch_and ((PTR), (VAL), (MO))
|
||||
|
||||
|
||||
typedef _Atomic struct
|
||||
{
|
||||
#if __GCC_ATOMIC_TEST_AND_SET_TRUEVAL == 1
|
||||
_Bool __val;
|
||||
#else
|
||||
unsigned char __val;
|
||||
#endif
|
||||
} atomic_flag;
|
||||
|
||||
#define ATOMIC_FLAG_INIT { 0 }
|
||||
|
||||
|
||||
extern _Bool atomic_flag_test_and_set (volatile atomic_flag *);
|
||||
#define atomic_flag_test_and_set(PTR) \
|
||||
__atomic_test_and_set ((PTR), __ATOMIC_SEQ_CST)
|
||||
extern _Bool atomic_flag_test_and_set_explicit (volatile atomic_flag *,
|
||||
memory_order);
|
||||
#define atomic_flag_test_and_set_explicit(PTR, MO) \
|
||||
__atomic_test_and_set ((PTR), (MO))
|
||||
|
||||
extern void atomic_flag_clear (volatile atomic_flag *);
|
||||
#define atomic_flag_clear(PTR) __atomic_clear ((PTR), __ATOMIC_SEQ_CST)
|
||||
extern void atomic_flag_clear_explicit (volatile atomic_flag *, memory_order);
|
||||
#define atomic_flag_clear_explicit(PTR, MO) __atomic_clear ((PTR), (MO))
|
||||
|
||||
#if defined __STDC_VERSION__ && __STDC_VERSION__ > 201710L
|
||||
#define __STDC_VERSION_STDATOMIC_H__ 202311L
|
||||
#endif
|
||||
|
||||
#endif /* _STDATOMIC_H */
|
||||
@@ -0,0 +1,51 @@
|
||||
/* Copyright (C) 1998-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3, or (at your option)
|
||||
any later version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Under Section 7 of GPL version 3, you are granted additional
|
||||
permissions described in the GCC Runtime Library Exception, version
|
||||
3.1, as published by the Free Software Foundation.
|
||||
|
||||
You should have received a copy of the GNU General Public License and
|
||||
a copy of the GCC Runtime Library Exception along with this program;
|
||||
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/*
|
||||
* ISO C Standard: 7.16 Boolean type and values <stdbool.h>
|
||||
*/
|
||||
|
||||
#ifndef _STDBOOL_H
|
||||
#define _STDBOOL_H
|
||||
|
||||
#ifndef __cplusplus
|
||||
|
||||
#if defined __STDC_VERSION__ && __STDC_VERSION__ > 201710L
|
||||
/* bool, true and false are keywords. */
|
||||
#else
|
||||
#define bool _Bool
|
||||
#define true 1
|
||||
#define false 0
|
||||
#endif
|
||||
|
||||
#else /* __cplusplus */
|
||||
|
||||
/* Supporting _Bool in C++ is a GCC extension. */
|
||||
#define _Bool bool
|
||||
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* Signal that all the definitions are present. */
|
||||
#define __bool_true_false_are_defined 1
|
||||
|
||||
#endif /* stdbool.h */
|
||||
@@ -0,0 +1,461 @@
|
||||
/* Copyright (C) 1989-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3, or (at your option)
|
||||
any later version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Under Section 7 of GPL version 3, you are granted additional
|
||||
permissions described in the GCC Runtime Library Exception, version
|
||||
3.1, as published by the Free Software Foundation.
|
||||
|
||||
You should have received a copy of the GNU General Public License and
|
||||
a copy of the GCC Runtime Library Exception along with this program;
|
||||
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/*
|
||||
* ISO C Standard: 7.17 Common definitions <stddef.h>
|
||||
*/
|
||||
#if (!defined(_STDDEF_H) && !defined(_STDDEF_H_) && !defined(_ANSI_STDDEF_H) \
|
||||
&& !defined(__STDDEF_H__)) \
|
||||
|| defined(__need_wchar_t) || defined(__need_size_t) \
|
||||
|| defined(__need_ptrdiff_t) || defined(__need_NULL) \
|
||||
|| defined(__need_wint_t)
|
||||
|
||||
/* Any one of these symbols __need_* means that GNU libc
|
||||
wants us just to define one data type. So don't define
|
||||
the symbols that indicate this file's entire job has been done. */
|
||||
#if (!defined(__need_wchar_t) && !defined(__need_size_t) \
|
||||
&& !defined(__need_ptrdiff_t) && !defined(__need_NULL) \
|
||||
&& !defined(__need_wint_t))
|
||||
#define _STDDEF_H
|
||||
#define _STDDEF_H_
|
||||
/* snaroff@next.com says the NeXT needs this. */
|
||||
#define _ANSI_STDDEF_H
|
||||
#endif
|
||||
|
||||
#ifndef __sys_stdtypes_h
|
||||
/* This avoids lossage on SunOS but only if stdtypes.h comes first.
|
||||
There's no way to win with the other order! Sun lossage. */
|
||||
|
||||
#if defined(__NetBSD__)
|
||||
#include <machine/ansi.h>
|
||||
#endif
|
||||
|
||||
#if defined (__FreeBSD__)
|
||||
#include <sys/_types.h>
|
||||
#endif
|
||||
|
||||
#if defined(__NetBSD__)
|
||||
#if !defined(_SIZE_T_) && !defined(_BSD_SIZE_T_)
|
||||
#define _SIZE_T
|
||||
#endif
|
||||
#if !defined(_PTRDIFF_T_) && !defined(_BSD_PTRDIFF_T_)
|
||||
#define _PTRDIFF_T
|
||||
#endif
|
||||
/* On BSD/386 1.1, at least, machine/ansi.h defines _BSD_WCHAR_T_
|
||||
instead of _WCHAR_T_. */
|
||||
#if !defined(_WCHAR_T_) && !defined(_BSD_WCHAR_T_)
|
||||
#ifndef _BSD_WCHAR_T_
|
||||
#define _WCHAR_T
|
||||
#endif
|
||||
#endif
|
||||
/* Undef _FOO_T_ if we are supposed to define foo_t. */
|
||||
#if defined (__need_ptrdiff_t) || defined (_STDDEF_H_)
|
||||
#undef _PTRDIFF_T_
|
||||
#undef _BSD_PTRDIFF_T_
|
||||
#endif
|
||||
#if defined (__need_size_t) || defined (_STDDEF_H_)
|
||||
#undef _SIZE_T_
|
||||
#undef _BSD_SIZE_T_
|
||||
#endif
|
||||
#if defined (__need_wchar_t) || defined (_STDDEF_H_)
|
||||
#undef _WCHAR_T_
|
||||
#undef _BSD_WCHAR_T_
|
||||
#endif
|
||||
#endif /* defined(__NetBSD__) */
|
||||
|
||||
/* Sequent's header files use _PTRDIFF_T_ in some conflicting way.
|
||||
Just ignore it. */
|
||||
#if defined (__sequent__) && defined (_PTRDIFF_T_)
|
||||
#undef _PTRDIFF_T_
|
||||
#endif
|
||||
|
||||
/* On VxWorks, <type/vxTypesBase.h> may have defined macros like
|
||||
_TYPE_size_t which will typedef size_t. fixincludes patched the
|
||||
vxTypesBase.h so that this macro is only defined if _GCC_SIZE_T is
|
||||
not defined, and so that defining this macro defines _GCC_SIZE_T.
|
||||
If we find that the macros are still defined at this point, we must
|
||||
invoke them so that the type is defined as expected. */
|
||||
#if defined (_TYPE_ptrdiff_t) && (defined (__need_ptrdiff_t) || defined (_STDDEF_H_))
|
||||
_TYPE_ptrdiff_t;
|
||||
#undef _TYPE_ptrdiff_t
|
||||
#endif
|
||||
#if defined (_TYPE_size_t) && (defined (__need_size_t) || defined (_STDDEF_H_))
|
||||
_TYPE_size_t;
|
||||
#undef _TYPE_size_t
|
||||
#endif
|
||||
#if defined (_TYPE_wchar_t) && (defined (__need_wchar_t) || defined (_STDDEF_H_))
|
||||
_TYPE_wchar_t;
|
||||
#undef _TYPE_wchar_t
|
||||
#endif
|
||||
|
||||
/* In case nobody has defined these types, but we aren't running under
|
||||
GCC 2.00, make sure that __PTRDIFF_TYPE__, __SIZE_TYPE__, and
|
||||
__WCHAR_TYPE__ have reasonable values. This can happen if the
|
||||
parts of GCC is compiled by an older compiler, that actually
|
||||
include gstddef.h, such as collect2. */
|
||||
|
||||
/* Signed type of difference of two pointers. */
|
||||
|
||||
/* Define this type if we are doing the whole job,
|
||||
or if we want this type in particular. */
|
||||
#if defined (_STDDEF_H) || defined (__need_ptrdiff_t)
|
||||
#ifndef _PTRDIFF_T /* in case <sys/types.h> has defined it. */
|
||||
#ifndef _T_PTRDIFF_
|
||||
#ifndef _T_PTRDIFF
|
||||
#ifndef __PTRDIFF_T
|
||||
#ifndef _PTRDIFF_T_
|
||||
#ifndef _BSD_PTRDIFF_T_
|
||||
#ifndef ___int_ptrdiff_t_h
|
||||
#ifndef _GCC_PTRDIFF_T
|
||||
#ifndef _PTRDIFF_T_DECLARED /* DragonFly */
|
||||
#ifndef __DEFINED_ptrdiff_t /* musl libc */
|
||||
#define _PTRDIFF_T
|
||||
#define _T_PTRDIFF_
|
||||
#define _T_PTRDIFF
|
||||
#define __PTRDIFF_T
|
||||
#define _PTRDIFF_T_
|
||||
#define _BSD_PTRDIFF_T_
|
||||
#define ___int_ptrdiff_t_h
|
||||
#define _GCC_PTRDIFF_T
|
||||
#define _PTRDIFF_T_DECLARED
|
||||
#define __DEFINED_ptrdiff_t
|
||||
#ifndef __PTRDIFF_TYPE__
|
||||
#define __PTRDIFF_TYPE__ long int
|
||||
#endif
|
||||
typedef __PTRDIFF_TYPE__ ptrdiff_t;
|
||||
#endif /* __DEFINED_ptrdiff_t */
|
||||
#endif /* _PTRDIFF_T_DECLARED */
|
||||
#endif /* _GCC_PTRDIFF_T */
|
||||
#endif /* ___int_ptrdiff_t_h */
|
||||
#endif /* _BSD_PTRDIFF_T_ */
|
||||
#endif /* _PTRDIFF_T_ */
|
||||
#endif /* __PTRDIFF_T */
|
||||
#endif /* _T_PTRDIFF */
|
||||
#endif /* _T_PTRDIFF_ */
|
||||
#endif /* _PTRDIFF_T */
|
||||
|
||||
/* If this symbol has done its job, get rid of it. */
|
||||
#undef __need_ptrdiff_t
|
||||
|
||||
#endif /* _STDDEF_H or __need_ptrdiff_t. */
|
||||
|
||||
/* Unsigned type of `sizeof' something. */
|
||||
|
||||
/* Define this type if we are doing the whole job,
|
||||
or if we want this type in particular. */
|
||||
#if defined (_STDDEF_H) || defined (__need_size_t)
|
||||
#ifndef __size_t__ /* BeOS */
|
||||
#ifndef __SIZE_T__ /* Cray Unicos/Mk */
|
||||
#ifndef _SIZE_T /* in case <sys/types.h> has defined it. */
|
||||
#ifndef _SYS_SIZE_T_H
|
||||
#ifndef _T_SIZE_
|
||||
#ifndef _T_SIZE
|
||||
#ifndef __SIZE_T
|
||||
#ifndef _SIZE_T_
|
||||
#ifndef _BSD_SIZE_T_
|
||||
#ifndef _SIZE_T_DEFINED_
|
||||
#ifndef _SIZE_T_DEFINED
|
||||
#ifndef _BSD_SIZE_T_DEFINED_ /* Darwin */
|
||||
#ifndef _SIZE_T_DECLARED /* FreeBSD 5 */
|
||||
#ifndef __DEFINED_size_t /* musl libc */
|
||||
#ifndef ___int_size_t_h
|
||||
#ifndef _GCC_SIZE_T
|
||||
#ifndef _SIZET_
|
||||
#ifndef __size_t
|
||||
#define __size_t__ /* BeOS */
|
||||
#define __SIZE_T__ /* Cray Unicos/Mk */
|
||||
#define _SIZE_T
|
||||
#define _SYS_SIZE_T_H
|
||||
#define _T_SIZE_
|
||||
#define _T_SIZE
|
||||
#define __SIZE_T
|
||||
#define _SIZE_T_
|
||||
#define _BSD_SIZE_T_
|
||||
#define _SIZE_T_DEFINED_
|
||||
#define _SIZE_T_DEFINED
|
||||
#define _BSD_SIZE_T_DEFINED_ /* Darwin */
|
||||
#define _SIZE_T_DECLARED /* FreeBSD 5 */
|
||||
#define __DEFINED_size_t /* musl libc */
|
||||
#define ___int_size_t_h
|
||||
#define _GCC_SIZE_T
|
||||
#define _SIZET_
|
||||
#if defined (__FreeBSD__) \
|
||||
|| defined(__DragonFly__) \
|
||||
|| defined(__FreeBSD_kernel__) \
|
||||
|| defined(__VMS__)
|
||||
/* __size_t is a typedef, must not trash it. */
|
||||
#else
|
||||
#define __size_t
|
||||
#endif
|
||||
#ifndef __SIZE_TYPE__
|
||||
#define __SIZE_TYPE__ long unsigned int
|
||||
#endif
|
||||
#if !(defined (__GNUG__) && defined (size_t))
|
||||
typedef __SIZE_TYPE__ size_t;
|
||||
#ifdef __BEOS__
|
||||
typedef long ssize_t;
|
||||
#endif /* __BEOS__ */
|
||||
#endif /* !(defined (__GNUG__) && defined (size_t)) */
|
||||
#endif /* __size_t */
|
||||
#endif /* _SIZET_ */
|
||||
#endif /* _GCC_SIZE_T */
|
||||
#endif /* ___int_size_t_h */
|
||||
#endif /* __DEFINED_size_t */
|
||||
#endif /* _SIZE_T_DECLARED */
|
||||
#endif /* _BSD_SIZE_T_DEFINED_ */
|
||||
#endif /* _SIZE_T_DEFINED */
|
||||
#endif /* _SIZE_T_DEFINED_ */
|
||||
#endif /* _BSD_SIZE_T_ */
|
||||
#endif /* _SIZE_T_ */
|
||||
#endif /* __SIZE_T */
|
||||
#endif /* _T_SIZE */
|
||||
#endif /* _T_SIZE_ */
|
||||
#endif /* _SYS_SIZE_T_H */
|
||||
#endif /* _SIZE_T */
|
||||
#endif /* __SIZE_T__ */
|
||||
#endif /* __size_t__ */
|
||||
#undef __need_size_t
|
||||
#endif /* _STDDEF_H or __need_size_t. */
|
||||
|
||||
|
||||
/* Wide character type.
|
||||
Locale-writers should change this as necessary to
|
||||
be big enough to hold unique values not between 0 and 127,
|
||||
and not (wchar_t) -1, for each defined multibyte character. */
|
||||
|
||||
/* Define this type if we are doing the whole job,
|
||||
or if we want this type in particular. */
|
||||
#if defined (_STDDEF_H) || defined (__need_wchar_t)
|
||||
#ifndef __wchar_t__ /* BeOS */
|
||||
#ifndef __WCHAR_T__ /* Cray Unicos/Mk */
|
||||
#ifndef _WCHAR_T
|
||||
#ifndef _T_WCHAR_
|
||||
#ifndef _T_WCHAR
|
||||
#ifndef __WCHAR_T
|
||||
#ifndef _WCHAR_T_
|
||||
#ifndef _BSD_WCHAR_T_
|
||||
#ifndef _BSD_WCHAR_T_DEFINED_ /* Darwin */
|
||||
#ifndef _BSD_RUNE_T_DEFINED_ /* Darwin */
|
||||
#ifndef _WCHAR_T_DECLARED /* FreeBSD 5 */
|
||||
#ifndef __DEFINED_wchar_t /* musl libc */
|
||||
#ifndef _WCHAR_T_DEFINED_
|
||||
#ifndef _WCHAR_T_DEFINED
|
||||
#ifndef _WCHAR_T_H
|
||||
#ifndef ___int_wchar_t_h
|
||||
#ifndef __INT_WCHAR_T_H
|
||||
#ifndef _GCC_WCHAR_T
|
||||
#define __wchar_t__ /* BeOS */
|
||||
#define __WCHAR_T__ /* Cray Unicos/Mk */
|
||||
#define _WCHAR_T
|
||||
#define _T_WCHAR_
|
||||
#define _T_WCHAR
|
||||
#define __WCHAR_T
|
||||
#define _WCHAR_T_
|
||||
#define _BSD_WCHAR_T_
|
||||
#define _WCHAR_T_DEFINED_
|
||||
#define _WCHAR_T_DEFINED
|
||||
#define _WCHAR_T_H
|
||||
#define ___int_wchar_t_h
|
||||
#define __INT_WCHAR_T_H
|
||||
#define _GCC_WCHAR_T
|
||||
#define _WCHAR_T_DECLARED
|
||||
#define __DEFINED_wchar_t
|
||||
|
||||
/* On BSD/386 1.1, at least, machine/ansi.h defines _BSD_WCHAR_T_
|
||||
instead of _WCHAR_T_, and _BSD_RUNE_T_ (which, unlike the other
|
||||
symbols in the _FOO_T_ family, stays defined even after its
|
||||
corresponding type is defined). If we define wchar_t, then we
|
||||
must undef _WCHAR_T_; for BSD/386 1.1 (and perhaps others), if
|
||||
we undef _WCHAR_T_, then we must also define rune_t, since
|
||||
headers like runetype.h assume that if machine/ansi.h is included,
|
||||
and _BSD_WCHAR_T_ is not defined, then rune_t is available.
|
||||
machine/ansi.h says, "Note that _WCHAR_T_ and _RUNE_T_ must be of
|
||||
the same type." */
|
||||
#ifdef _BSD_WCHAR_T_
|
||||
#undef _BSD_WCHAR_T_
|
||||
#ifdef _BSD_RUNE_T_
|
||||
#if !defined (_ANSI_SOURCE) && !defined (_POSIX_SOURCE)
|
||||
typedef _BSD_RUNE_T_ rune_t;
|
||||
#define _BSD_WCHAR_T_DEFINED_
|
||||
#define _BSD_RUNE_T_DEFINED_ /* Darwin */
|
||||
#if defined (__FreeBSD__) && (__FreeBSD__ < 5)
|
||||
/* Why is this file so hard to maintain properly? In contrast to
|
||||
the comment above regarding BSD/386 1.1, on FreeBSD for as long
|
||||
as the symbol has existed, _BSD_RUNE_T_ must not stay defined or
|
||||
redundant typedefs will occur when stdlib.h is included after this file. */
|
||||
#undef _BSD_RUNE_T_
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
/* FreeBSD 5 can't be handled well using "traditional" logic above
|
||||
since it no longer defines _BSD_RUNE_T_ yet still desires to export
|
||||
rune_t in some cases... */
|
||||
#if defined (__FreeBSD__) && (__FreeBSD__ >= 5)
|
||||
#if !defined (_ANSI_SOURCE) && !defined (_POSIX_SOURCE)
|
||||
#if __BSD_VISIBLE
|
||||
#ifndef _RUNE_T_DECLARED
|
||||
typedef __rune_t rune_t;
|
||||
#define _RUNE_T_DECLARED
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef __WCHAR_TYPE__
|
||||
#define __WCHAR_TYPE__ int
|
||||
#endif
|
||||
#ifndef __cplusplus
|
||||
typedef __WCHAR_TYPE__ wchar_t;
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif /* __DEFINED_wchar_t */
|
||||
#endif /* _WCHAR_T_DECLARED */
|
||||
#endif /* _BSD_RUNE_T_DEFINED_ */
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif /* __WCHAR_T__ */
|
||||
#endif /* __wchar_t__ */
|
||||
#undef __need_wchar_t
|
||||
#endif /* _STDDEF_H or __need_wchar_t. */
|
||||
|
||||
#if defined (__need_wint_t)
|
||||
#ifndef _WINT_T
|
||||
#define _WINT_T
|
||||
|
||||
#ifndef __WINT_TYPE__
|
||||
#define __WINT_TYPE__ unsigned int
|
||||
#endif
|
||||
typedef __WINT_TYPE__ wint_t;
|
||||
#endif
|
||||
#undef __need_wint_t
|
||||
#endif
|
||||
|
||||
#if defined(__NetBSD__)
|
||||
/* The references to _GCC_PTRDIFF_T_, _GCC_SIZE_T_, and _GCC_WCHAR_T_
|
||||
are probably typos and should be removed before 2.8 is released. */
|
||||
#ifdef _GCC_PTRDIFF_T_
|
||||
#undef _PTRDIFF_T_
|
||||
#undef _BSD_PTRDIFF_T_
|
||||
#endif
|
||||
#ifdef _GCC_SIZE_T_
|
||||
#undef _SIZE_T_
|
||||
#undef _BSD_SIZE_T_
|
||||
#endif
|
||||
#ifdef _GCC_WCHAR_T_
|
||||
#undef _WCHAR_T_
|
||||
#undef _BSD_WCHAR_T_
|
||||
#endif
|
||||
/* The following ones are the real ones. */
|
||||
#ifdef _GCC_PTRDIFF_T
|
||||
#undef _PTRDIFF_T_
|
||||
#undef _BSD_PTRDIFF_T_
|
||||
#endif
|
||||
#ifdef _GCC_SIZE_T
|
||||
#undef _SIZE_T_
|
||||
#undef _BSD_SIZE_T_
|
||||
#endif
|
||||
#ifdef _GCC_WCHAR_T
|
||||
#undef _WCHAR_T_
|
||||
#undef _BSD_WCHAR_T_
|
||||
#endif
|
||||
#endif /* __NetBSD__ */
|
||||
|
||||
#endif /* __sys_stdtypes_h */
|
||||
|
||||
/* A null pointer constant. */
|
||||
|
||||
#if defined (_STDDEF_H) || defined (__need_NULL)
|
||||
#undef NULL /* in case <stdio.h> has defined it. */
|
||||
#ifdef __GNUG__
|
||||
#define NULL __null
|
||||
#else /* G++ */
|
||||
#ifndef __cplusplus
|
||||
#define NULL ((void *)0)
|
||||
#else /* C++ */
|
||||
#define NULL 0
|
||||
#endif /* C++ */
|
||||
#endif /* G++ */
|
||||
#endif /* NULL not defined and <stddef.h> or need NULL. */
|
||||
#undef __need_NULL
|
||||
|
||||
#ifdef _STDDEF_H
|
||||
|
||||
/* Offset of member MEMBER in a struct of type TYPE. */
|
||||
#undef offsetof /* in case a system header has defined it. */
|
||||
#define offsetof(TYPE, MEMBER) __builtin_offsetof (TYPE, MEMBER)
|
||||
|
||||
#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) \
|
||||
|| (defined(__cplusplus) && __cplusplus >= 201103L)
|
||||
#ifndef _GCC_MAX_ALIGN_T
|
||||
#define _GCC_MAX_ALIGN_T
|
||||
/* Type whose alignment is supported in every context and is at least
|
||||
as great as that of any standard type not using alignment
|
||||
specifiers. */
|
||||
typedef struct {
|
||||
long long __max_align_ll __attribute__((__aligned__(__alignof__(long long))));
|
||||
long double __max_align_ld __attribute__((__aligned__(__alignof__(long double))));
|
||||
/* _Float128 is defined as a basic type, so max_align_t must be
|
||||
sufficiently aligned for it. This code must work in C++, so we
|
||||
use __float128 here; that is only available on some
|
||||
architectures, but only on i386 is extra alignment needed for
|
||||
__float128. */
|
||||
#ifdef __i386__
|
||||
__float128 __max_align_f128 __attribute__((__aligned__(__alignof(__float128))));
|
||||
#endif
|
||||
} max_align_t;
|
||||
#endif
|
||||
#endif /* C11 or C++11. */
|
||||
|
||||
#if defined(__cplusplus) && __cplusplus >= 201103L
|
||||
#ifndef _GXX_NULLPTR_T
|
||||
#define _GXX_NULLPTR_T
|
||||
typedef decltype(nullptr) nullptr_t;
|
||||
#endif
|
||||
#endif /* C++11. */
|
||||
|
||||
#if defined (__STDC_VERSION__) && __STDC_VERSION__ > 201710L
|
||||
#ifndef _GCC_NULLPTR_T
|
||||
#define _GCC_NULLPTR_T
|
||||
typedef __typeof__(nullptr) nullptr_t;
|
||||
#endif
|
||||
#ifndef __STDC_VERSION_STDDEF_H__
|
||||
#define unreachable() (__builtin_unreachable ())
|
||||
#define __STDC_VERSION_STDDEF_H__ 202311L
|
||||
#endif
|
||||
#endif /* C23. */
|
||||
|
||||
#endif /* _STDDEF_H was defined this time */
|
||||
|
||||
#endif /* !_STDDEF_H && !_STDDEF_H_ && !_ANSI_STDDEF_H && !__STDDEF_H__
|
||||
|| __need_XXX was not defined before */
|
||||
@@ -0,0 +1,204 @@
|
||||
/* Copyright (C) 2007-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3, or (at your option)
|
||||
any later version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Under Section 7 of GPL version 3, you are granted additional
|
||||
permissions described in the GCC Runtime Library Exception, version
|
||||
3.1, as published by the Free Software Foundation.
|
||||
|
||||
You should have received a copy of the GNU General Public License and
|
||||
a copy of the GCC Runtime Library Exception along with this program;
|
||||
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* ISO/IEC JTC1 SC22 WG14 N1169
|
||||
* Date: 2006-04-04
|
||||
* ISO/IEC TR 18037
|
||||
* Programming languages - C - Extensions to support embedded processors
|
||||
*/
|
||||
|
||||
#ifndef _STDFIX_H
|
||||
#define _STDFIX_H
|
||||
|
||||
/* 7.18a.1 Introduction. */
|
||||
|
||||
#undef fract
|
||||
#undef accum
|
||||
#undef sat
|
||||
#define fract _Fract
|
||||
#define accum _Accum
|
||||
#define sat _Sat
|
||||
|
||||
/* 7.18a.3 Precision macros. */
|
||||
|
||||
#undef SFRACT_FBIT
|
||||
#undef SFRACT_MIN
|
||||
#undef SFRACT_MAX
|
||||
#undef SFRACT_EPSILON
|
||||
#define SFRACT_FBIT __SFRACT_FBIT__
|
||||
#define SFRACT_MIN __SFRACT_MIN__
|
||||
#define SFRACT_MAX __SFRACT_MAX__
|
||||
#define SFRACT_EPSILON __SFRACT_EPSILON__
|
||||
|
||||
#undef USFRACT_FBIT
|
||||
#undef USFRACT_MIN
|
||||
#undef USFRACT_MAX
|
||||
#undef USFRACT_EPSILON
|
||||
#define USFRACT_FBIT __USFRACT_FBIT__
|
||||
#define USFRACT_MIN __USFRACT_MIN__ /* GCC extension. */
|
||||
#define USFRACT_MAX __USFRACT_MAX__
|
||||
#define USFRACT_EPSILON __USFRACT_EPSILON__
|
||||
|
||||
#undef FRACT_FBIT
|
||||
#undef FRACT_MIN
|
||||
#undef FRACT_MAX
|
||||
#undef FRACT_EPSILON
|
||||
#define FRACT_FBIT __FRACT_FBIT__
|
||||
#define FRACT_MIN __FRACT_MIN__
|
||||
#define FRACT_MAX __FRACT_MAX__
|
||||
#define FRACT_EPSILON __FRACT_EPSILON__
|
||||
|
||||
#undef UFRACT_FBIT
|
||||
#undef UFRACT_MIN
|
||||
#undef UFRACT_MAX
|
||||
#undef UFRACT_EPSILON
|
||||
#define UFRACT_FBIT __UFRACT_FBIT__
|
||||
#define UFRACT_MIN __UFRACT_MIN__ /* GCC extension. */
|
||||
#define UFRACT_MAX __UFRACT_MAX__
|
||||
#define UFRACT_EPSILON __UFRACT_EPSILON__
|
||||
|
||||
#undef LFRACT_FBIT
|
||||
#undef LFRACT_MIN
|
||||
#undef LFRACT_MAX
|
||||
#undef LFRACT_EPSILON
|
||||
#define LFRACT_FBIT __LFRACT_FBIT__
|
||||
#define LFRACT_MIN __LFRACT_MIN__
|
||||
#define LFRACT_MAX __LFRACT_MAX__
|
||||
#define LFRACT_EPSILON __LFRACT_EPSILON__
|
||||
|
||||
#undef ULFRACT_FBIT
|
||||
#undef ULFRACT_MIN
|
||||
#undef ULFRACT_MAX
|
||||
#undef ULFRACT_EPSILON
|
||||
#define ULFRACT_FBIT __ULFRACT_FBIT__
|
||||
#define ULFRACT_MIN __ULFRACT_MIN__ /* GCC extension. */
|
||||
#define ULFRACT_MAX __ULFRACT_MAX__
|
||||
#define ULFRACT_EPSILON __ULFRACT_EPSILON__
|
||||
|
||||
#undef LLFRACT_FBIT
|
||||
#undef LLFRACT_MIN
|
||||
#undef LLFRACT_MAX
|
||||
#undef LLFRACT_EPSILON
|
||||
#define LLFRACT_FBIT __LLFRACT_FBIT__ /* GCC extension. */
|
||||
#define LLFRACT_MIN __LLFRACT_MIN__ /* GCC extension. */
|
||||
#define LLFRACT_MAX __LLFRACT_MAX__ /* GCC extension. */
|
||||
#define LLFRACT_EPSILON __LLFRACT_EPSILON__ /* GCC extension. */
|
||||
|
||||
#undef ULLFRACT_FBIT
|
||||
#undef ULLFRACT_MIN
|
||||
#undef ULLFRACT_MAX
|
||||
#undef ULLFRACT_EPSILON
|
||||
#define ULLFRACT_FBIT __ULLFRACT_FBIT__ /* GCC extension. */
|
||||
#define ULLFRACT_MIN __ULLFRACT_MIN__ /* GCC extension. */
|
||||
#define ULLFRACT_MAX __ULLFRACT_MAX__ /* GCC extension. */
|
||||
#define ULLFRACT_EPSILON __ULLFRACT_EPSILON__ /* GCC extension. */
|
||||
|
||||
#undef SACCUM_FBIT
|
||||
#undef SACCUM_IBIT
|
||||
#undef SACCUM_MIN
|
||||
#undef SACCUM_MAX
|
||||
#undef SACCUM_EPSILON
|
||||
#define SACCUM_FBIT __SACCUM_FBIT__
|
||||
#define SACCUM_IBIT __SACCUM_IBIT__
|
||||
#define SACCUM_MIN __SACCUM_MIN__
|
||||
#define SACCUM_MAX __SACCUM_MAX__
|
||||
#define SACCUM_EPSILON __SACCUM_EPSILON__
|
||||
|
||||
#undef USACCUM_FBIT
|
||||
#undef USACCUM_IBIT
|
||||
#undef USACCUM_MIN
|
||||
#undef USACCUM_MAX
|
||||
#undef USACCUM_EPSILON
|
||||
#define USACCUM_FBIT __USACCUM_FBIT__
|
||||
#define USACCUM_IBIT __USACCUM_IBIT__
|
||||
#define USACCUM_MIN __USACCUM_MIN__ /* GCC extension. */
|
||||
#define USACCUM_MAX __USACCUM_MAX__
|
||||
#define USACCUM_EPSILON __USACCUM_EPSILON__
|
||||
|
||||
#undef ACCUM_FBIT
|
||||
#undef ACCUM_IBIT
|
||||
#undef ACCUM_MIN
|
||||
#undef ACCUM_MAX
|
||||
#undef ACCUM_EPSILON
|
||||
#define ACCUM_FBIT __ACCUM_FBIT__
|
||||
#define ACCUM_IBIT __ACCUM_IBIT__
|
||||
#define ACCUM_MIN __ACCUM_MIN__
|
||||
#define ACCUM_MAX __ACCUM_MAX__
|
||||
#define ACCUM_EPSILON __ACCUM_EPSILON__
|
||||
|
||||
#undef UACCUM_FBIT
|
||||
#undef UACCUM_IBIT
|
||||
#undef UACCUM_MIN
|
||||
#undef UACCUM_MAX
|
||||
#undef UACCUM_EPSILON
|
||||
#define UACCUM_FBIT __UACCUM_FBIT__
|
||||
#define UACCUM_IBIT __UACCUM_IBIT__
|
||||
#define UACCUM_MIN __UACCUM_MIN__ /* GCC extension. */
|
||||
#define UACCUM_MAX __UACCUM_MAX__
|
||||
#define UACCUM_EPSILON __UACCUM_EPSILON__
|
||||
|
||||
#undef LACCUM_FBIT
|
||||
#undef LACCUM_IBIT
|
||||
#undef LACCUM_MIN
|
||||
#undef LACCUM_MAX
|
||||
#undef LACCUM_EPSILON
|
||||
#define LACCUM_FBIT __LACCUM_FBIT__
|
||||
#define LACCUM_IBIT __LACCUM_IBIT__
|
||||
#define LACCUM_MIN __LACCUM_MIN__
|
||||
#define LACCUM_MAX __LACCUM_MAX__
|
||||
#define LACCUM_EPSILON __LACCUM_EPSILON__
|
||||
|
||||
#undef ULACCUM_FBIT
|
||||
#undef ULACCUM_IBIT
|
||||
#undef ULACCUM_MIN
|
||||
#undef ULACCUM_MAX
|
||||
#undef ULACCUM_EPSILON
|
||||
#define ULACCUM_FBIT __ULACCUM_FBIT__
|
||||
#define ULACCUM_IBIT __ULACCUM_IBIT__
|
||||
#define ULACCUM_MIN __ULACCUM_MIN__ /* GCC extension. */
|
||||
#define ULACCUM_MAX __ULACCUM_MAX__
|
||||
#define ULACCUM_EPSILON __ULACCUM_EPSILON__
|
||||
|
||||
#undef LLACCUM_FBIT
|
||||
#undef LLACCUM_IBIT
|
||||
#undef LLACCUM_MIN
|
||||
#undef LLACCUM_MAX
|
||||
#undef LLACCUM_EPSILON
|
||||
#define LLACCUM_FBIT __LLACCUM_FBIT__ /* GCC extension. */
|
||||
#define LLACCUM_IBIT __LLACCUM_IBIT__ /* GCC extension. */
|
||||
#define LLACCUM_MIN __LLACCUM_MIN__ /* GCC extension. */
|
||||
#define LLACCUM_MAX __LLACCUM_MAX__ /* GCC extension. */
|
||||
#define LLACCUM_EPSILON __LLACCUM_EPSILON__ /* GCC extension. */
|
||||
|
||||
#undef ULLACCUM_FBIT
|
||||
#undef ULLACCUM_IBIT
|
||||
#undef ULLACCUM_MIN
|
||||
#undef ULLACCUM_MAX
|
||||
#undef ULLACCUM_EPSILON
|
||||
#define ULLACCUM_FBIT __ULLACCUM_FBIT__ /* GCC extension. */
|
||||
#define ULLACCUM_IBIT __ULLACCUM_IBIT__ /* GCC extension. */
|
||||
#define ULLACCUM_MIN __ULLACCUM_MIN__ /* GCC extension. */
|
||||
#define ULLACCUM_MAX __ULLACCUM_MAX__ /* GCC extension. */
|
||||
#define ULLACCUM_EPSILON __ULLACCUM_EPSILON__ /* GCC extension. */
|
||||
|
||||
#endif /* _STDFIX_H */
|
||||
@@ -0,0 +1,369 @@
|
||||
/* Copyright (C) 2008-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3, or (at your option)
|
||||
any later version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Under Section 7 of GPL version 3, you are granted additional
|
||||
permissions described in the GCC Runtime Library Exception, version
|
||||
3.1, as published by the Free Software Foundation.
|
||||
|
||||
You should have received a copy of the GNU General Public License and
|
||||
a copy of the GCC Runtime Library Exception along with this program;
|
||||
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/*
|
||||
* ISO C Standard: 7.18 Integer types <stdint.h>
|
||||
*/
|
||||
|
||||
#ifndef _GCC_STDINT_H
|
||||
#define _GCC_STDINT_H
|
||||
|
||||
/* 7.8.1.1 Exact-width integer types */
|
||||
|
||||
#ifdef __INT8_TYPE__
|
||||
typedef __INT8_TYPE__ int8_t;
|
||||
#endif
|
||||
#ifdef __INT16_TYPE__
|
||||
typedef __INT16_TYPE__ int16_t;
|
||||
#endif
|
||||
#ifdef __INT32_TYPE__
|
||||
typedef __INT32_TYPE__ int32_t;
|
||||
#endif
|
||||
#ifdef __INT64_TYPE__
|
||||
typedef __INT64_TYPE__ int64_t;
|
||||
#endif
|
||||
#ifdef __UINT8_TYPE__
|
||||
typedef __UINT8_TYPE__ uint8_t;
|
||||
#endif
|
||||
#ifdef __UINT16_TYPE__
|
||||
typedef __UINT16_TYPE__ uint16_t;
|
||||
#endif
|
||||
#ifdef __UINT32_TYPE__
|
||||
typedef __UINT32_TYPE__ uint32_t;
|
||||
#endif
|
||||
#ifdef __UINT64_TYPE__
|
||||
typedef __UINT64_TYPE__ uint64_t;
|
||||
#endif
|
||||
|
||||
/* 7.8.1.2 Minimum-width integer types */
|
||||
|
||||
typedef __INT_LEAST8_TYPE__ int_least8_t;
|
||||
typedef __INT_LEAST16_TYPE__ int_least16_t;
|
||||
typedef __INT_LEAST32_TYPE__ int_least32_t;
|
||||
typedef __INT_LEAST64_TYPE__ int_least64_t;
|
||||
typedef __UINT_LEAST8_TYPE__ uint_least8_t;
|
||||
typedef __UINT_LEAST16_TYPE__ uint_least16_t;
|
||||
typedef __UINT_LEAST32_TYPE__ uint_least32_t;
|
||||
typedef __UINT_LEAST64_TYPE__ uint_least64_t;
|
||||
|
||||
/* 7.8.1.3 Fastest minimum-width integer types */
|
||||
|
||||
typedef __INT_FAST8_TYPE__ int_fast8_t;
|
||||
typedef __INT_FAST16_TYPE__ int_fast16_t;
|
||||
typedef __INT_FAST32_TYPE__ int_fast32_t;
|
||||
typedef __INT_FAST64_TYPE__ int_fast64_t;
|
||||
typedef __UINT_FAST8_TYPE__ uint_fast8_t;
|
||||
typedef __UINT_FAST16_TYPE__ uint_fast16_t;
|
||||
typedef __UINT_FAST32_TYPE__ uint_fast32_t;
|
||||
typedef __UINT_FAST64_TYPE__ uint_fast64_t;
|
||||
|
||||
/* 7.8.1.4 Integer types capable of holding object pointers */
|
||||
|
||||
#ifdef __INTPTR_TYPE__
|
||||
typedef __INTPTR_TYPE__ intptr_t;
|
||||
#endif
|
||||
#ifdef __UINTPTR_TYPE__
|
||||
typedef __UINTPTR_TYPE__ uintptr_t;
|
||||
#endif
|
||||
|
||||
/* 7.8.1.5 Greatest-width integer types */
|
||||
|
||||
typedef __INTMAX_TYPE__ intmax_t;
|
||||
typedef __UINTMAX_TYPE__ uintmax_t;
|
||||
|
||||
#if (!defined __cplusplus || __cplusplus >= 201103L \
|
||||
|| defined __STDC_LIMIT_MACROS)
|
||||
|
||||
/* 7.18.2 Limits of specified-width integer types */
|
||||
|
||||
#ifdef __INT8_MAX__
|
||||
# undef INT8_MAX
|
||||
# define INT8_MAX __INT8_MAX__
|
||||
# undef INT8_MIN
|
||||
# define INT8_MIN (-INT8_MAX - 1)
|
||||
#endif
|
||||
#ifdef __UINT8_MAX__
|
||||
# undef UINT8_MAX
|
||||
# define UINT8_MAX __UINT8_MAX__
|
||||
#endif
|
||||
#ifdef __INT16_MAX__
|
||||
# undef INT16_MAX
|
||||
# define INT16_MAX __INT16_MAX__
|
||||
# undef INT16_MIN
|
||||
# define INT16_MIN (-INT16_MAX - 1)
|
||||
#endif
|
||||
#ifdef __UINT16_MAX__
|
||||
# undef UINT16_MAX
|
||||
# define UINT16_MAX __UINT16_MAX__
|
||||
#endif
|
||||
#ifdef __INT32_MAX__
|
||||
# undef INT32_MAX
|
||||
# define INT32_MAX __INT32_MAX__
|
||||
# undef INT32_MIN
|
||||
# define INT32_MIN (-INT32_MAX - 1)
|
||||
#endif
|
||||
#ifdef __UINT32_MAX__
|
||||
# undef UINT32_MAX
|
||||
# define UINT32_MAX __UINT32_MAX__
|
||||
#endif
|
||||
#ifdef __INT64_MAX__
|
||||
# undef INT64_MAX
|
||||
# define INT64_MAX __INT64_MAX__
|
||||
# undef INT64_MIN
|
||||
# define INT64_MIN (-INT64_MAX - 1)
|
||||
#endif
|
||||
#ifdef __UINT64_MAX__
|
||||
# undef UINT64_MAX
|
||||
# define UINT64_MAX __UINT64_MAX__
|
||||
#endif
|
||||
|
||||
#undef INT_LEAST8_MAX
|
||||
#define INT_LEAST8_MAX __INT_LEAST8_MAX__
|
||||
#undef INT_LEAST8_MIN
|
||||
#define INT_LEAST8_MIN (-INT_LEAST8_MAX - 1)
|
||||
#undef UINT_LEAST8_MAX
|
||||
#define UINT_LEAST8_MAX __UINT_LEAST8_MAX__
|
||||
#undef INT_LEAST16_MAX
|
||||
#define INT_LEAST16_MAX __INT_LEAST16_MAX__
|
||||
#undef INT_LEAST16_MIN
|
||||
#define INT_LEAST16_MIN (-INT_LEAST16_MAX - 1)
|
||||
#undef UINT_LEAST16_MAX
|
||||
#define UINT_LEAST16_MAX __UINT_LEAST16_MAX__
|
||||
#undef INT_LEAST32_MAX
|
||||
#define INT_LEAST32_MAX __INT_LEAST32_MAX__
|
||||
#undef INT_LEAST32_MIN
|
||||
#define INT_LEAST32_MIN (-INT_LEAST32_MAX - 1)
|
||||
#undef UINT_LEAST32_MAX
|
||||
#define UINT_LEAST32_MAX __UINT_LEAST32_MAX__
|
||||
#undef INT_LEAST64_MAX
|
||||
#define INT_LEAST64_MAX __INT_LEAST64_MAX__
|
||||
#undef INT_LEAST64_MIN
|
||||
#define INT_LEAST64_MIN (-INT_LEAST64_MAX - 1)
|
||||
#undef UINT_LEAST64_MAX
|
||||
#define UINT_LEAST64_MAX __UINT_LEAST64_MAX__
|
||||
|
||||
#undef INT_FAST8_MAX
|
||||
#define INT_FAST8_MAX __INT_FAST8_MAX__
|
||||
#undef INT_FAST8_MIN
|
||||
#define INT_FAST8_MIN (-INT_FAST8_MAX - 1)
|
||||
#undef UINT_FAST8_MAX
|
||||
#define UINT_FAST8_MAX __UINT_FAST8_MAX__
|
||||
#undef INT_FAST16_MAX
|
||||
#define INT_FAST16_MAX __INT_FAST16_MAX__
|
||||
#undef INT_FAST16_MIN
|
||||
#define INT_FAST16_MIN (-INT_FAST16_MAX - 1)
|
||||
#undef UINT_FAST16_MAX
|
||||
#define UINT_FAST16_MAX __UINT_FAST16_MAX__
|
||||
#undef INT_FAST32_MAX
|
||||
#define INT_FAST32_MAX __INT_FAST32_MAX__
|
||||
#undef INT_FAST32_MIN
|
||||
#define INT_FAST32_MIN (-INT_FAST32_MAX - 1)
|
||||
#undef UINT_FAST32_MAX
|
||||
#define UINT_FAST32_MAX __UINT_FAST32_MAX__
|
||||
#undef INT_FAST64_MAX
|
||||
#define INT_FAST64_MAX __INT_FAST64_MAX__
|
||||
#undef INT_FAST64_MIN
|
||||
#define INT_FAST64_MIN (-INT_FAST64_MAX - 1)
|
||||
#undef UINT_FAST64_MAX
|
||||
#define UINT_FAST64_MAX __UINT_FAST64_MAX__
|
||||
|
||||
#ifdef __INTPTR_MAX__
|
||||
# undef INTPTR_MAX
|
||||
# define INTPTR_MAX __INTPTR_MAX__
|
||||
# undef INTPTR_MIN
|
||||
# define INTPTR_MIN (-INTPTR_MAX - 1)
|
||||
#endif
|
||||
#ifdef __UINTPTR_MAX__
|
||||
# undef UINTPTR_MAX
|
||||
# define UINTPTR_MAX __UINTPTR_MAX__
|
||||
#endif
|
||||
|
||||
#undef INTMAX_MAX
|
||||
#define INTMAX_MAX __INTMAX_MAX__
|
||||
#undef INTMAX_MIN
|
||||
#define INTMAX_MIN (-INTMAX_MAX - 1)
|
||||
#undef UINTMAX_MAX
|
||||
#define UINTMAX_MAX __UINTMAX_MAX__
|
||||
|
||||
/* 7.18.3 Limits of other integer types */
|
||||
|
||||
#undef PTRDIFF_MAX
|
||||
#define PTRDIFF_MAX __PTRDIFF_MAX__
|
||||
#undef PTRDIFF_MIN
|
||||
#define PTRDIFF_MIN (-PTRDIFF_MAX - 1)
|
||||
|
||||
#undef SIG_ATOMIC_MAX
|
||||
#define SIG_ATOMIC_MAX __SIG_ATOMIC_MAX__
|
||||
#undef SIG_ATOMIC_MIN
|
||||
#define SIG_ATOMIC_MIN __SIG_ATOMIC_MIN__
|
||||
|
||||
#undef SIZE_MAX
|
||||
#define SIZE_MAX __SIZE_MAX__
|
||||
|
||||
#undef WCHAR_MAX
|
||||
#define WCHAR_MAX __WCHAR_MAX__
|
||||
#undef WCHAR_MIN
|
||||
#define WCHAR_MIN __WCHAR_MIN__
|
||||
|
||||
#undef WINT_MAX
|
||||
#define WINT_MAX __WINT_MAX__
|
||||
#undef WINT_MIN
|
||||
#define WINT_MIN __WINT_MIN__
|
||||
|
||||
#endif /* (!defined __cplusplus || __cplusplus >= 201103L
|
||||
|| defined __STDC_LIMIT_MACROS) */
|
||||
|
||||
#if (!defined __cplusplus || __cplusplus >= 201103L \
|
||||
|| defined __STDC_CONSTANT_MACROS)
|
||||
|
||||
#undef INT8_C
|
||||
#define INT8_C(c) __INT8_C(c)
|
||||
#undef INT16_C
|
||||
#define INT16_C(c) __INT16_C(c)
|
||||
#undef INT32_C
|
||||
#define INT32_C(c) __INT32_C(c)
|
||||
#undef INT64_C
|
||||
#define INT64_C(c) __INT64_C(c)
|
||||
#undef UINT8_C
|
||||
#define UINT8_C(c) __UINT8_C(c)
|
||||
#undef UINT16_C
|
||||
#define UINT16_C(c) __UINT16_C(c)
|
||||
#undef UINT32_C
|
||||
#define UINT32_C(c) __UINT32_C(c)
|
||||
#undef UINT64_C
|
||||
#define UINT64_C(c) __UINT64_C(c)
|
||||
#undef INTMAX_C
|
||||
#define INTMAX_C(c) __INTMAX_C(c)
|
||||
#undef UINTMAX_C
|
||||
#define UINTMAX_C(c) __UINTMAX_C(c)
|
||||
|
||||
#endif /* (!defined __cplusplus || __cplusplus >= 201103L
|
||||
|| defined __STDC_CONSTANT_MACROS) */
|
||||
|
||||
#if (defined __STDC_WANT_IEC_60559_BFP_EXT__ \
|
||||
|| (defined (__STDC_VERSION__) && __STDC_VERSION__ > 201710L))
|
||||
/* TS 18661-1 / C2X widths of integer types. */
|
||||
|
||||
#ifdef __INT8_TYPE__
|
||||
# undef INT8_WIDTH
|
||||
# define INT8_WIDTH 8
|
||||
#endif
|
||||
#ifdef __UINT8_TYPE__
|
||||
# undef UINT8_WIDTH
|
||||
# define UINT8_WIDTH 8
|
||||
#endif
|
||||
#ifdef __INT16_TYPE__
|
||||
# undef INT16_WIDTH
|
||||
# define INT16_WIDTH 16
|
||||
#endif
|
||||
#ifdef __UINT16_TYPE__
|
||||
# undef UINT16_WIDTH
|
||||
# define UINT16_WIDTH 16
|
||||
#endif
|
||||
#ifdef __INT32_TYPE__
|
||||
# undef INT32_WIDTH
|
||||
# define INT32_WIDTH 32
|
||||
#endif
|
||||
#ifdef __UINT32_TYPE__
|
||||
# undef UINT32_WIDTH
|
||||
# define UINT32_WIDTH 32
|
||||
#endif
|
||||
#ifdef __INT64_TYPE__
|
||||
# undef INT64_WIDTH
|
||||
# define INT64_WIDTH 64
|
||||
#endif
|
||||
#ifdef __UINT64_TYPE__
|
||||
# undef UINT64_WIDTH
|
||||
# define UINT64_WIDTH 64
|
||||
#endif
|
||||
|
||||
#undef INT_LEAST8_WIDTH
|
||||
#define INT_LEAST8_WIDTH __INT_LEAST8_WIDTH__
|
||||
#undef UINT_LEAST8_WIDTH
|
||||
#define UINT_LEAST8_WIDTH __INT_LEAST8_WIDTH__
|
||||
#undef INT_LEAST16_WIDTH
|
||||
#define INT_LEAST16_WIDTH __INT_LEAST16_WIDTH__
|
||||
#undef UINT_LEAST16_WIDTH
|
||||
#define UINT_LEAST16_WIDTH __INT_LEAST16_WIDTH__
|
||||
#undef INT_LEAST32_WIDTH
|
||||
#define INT_LEAST32_WIDTH __INT_LEAST32_WIDTH__
|
||||
#undef UINT_LEAST32_WIDTH
|
||||
#define UINT_LEAST32_WIDTH __INT_LEAST32_WIDTH__
|
||||
#undef INT_LEAST64_WIDTH
|
||||
#define INT_LEAST64_WIDTH __INT_LEAST64_WIDTH__
|
||||
#undef UINT_LEAST64_WIDTH
|
||||
#define UINT_LEAST64_WIDTH __INT_LEAST64_WIDTH__
|
||||
|
||||
#undef INT_FAST8_WIDTH
|
||||
#define INT_FAST8_WIDTH __INT_FAST8_WIDTH__
|
||||
#undef UINT_FAST8_WIDTH
|
||||
#define UINT_FAST8_WIDTH __INT_FAST8_WIDTH__
|
||||
#undef INT_FAST16_WIDTH
|
||||
#define INT_FAST16_WIDTH __INT_FAST16_WIDTH__
|
||||
#undef UINT_FAST16_WIDTH
|
||||
#define UINT_FAST16_WIDTH __INT_FAST16_WIDTH__
|
||||
#undef INT_FAST32_WIDTH
|
||||
#define INT_FAST32_WIDTH __INT_FAST32_WIDTH__
|
||||
#undef UINT_FAST32_WIDTH
|
||||
#define UINT_FAST32_WIDTH __INT_FAST32_WIDTH__
|
||||
#undef INT_FAST64_WIDTH
|
||||
#define INT_FAST64_WIDTH __INT_FAST64_WIDTH__
|
||||
#undef UINT_FAST64_WIDTH
|
||||
#define UINT_FAST64_WIDTH __INT_FAST64_WIDTH__
|
||||
|
||||
#ifdef __INTPTR_TYPE__
|
||||
# undef INTPTR_WIDTH
|
||||
# define INTPTR_WIDTH __INTPTR_WIDTH__
|
||||
#endif
|
||||
#ifdef __UINTPTR_TYPE__
|
||||
# undef UINTPTR_WIDTH
|
||||
# define UINTPTR_WIDTH __INTPTR_WIDTH__
|
||||
#endif
|
||||
|
||||
#undef INTMAX_WIDTH
|
||||
#define INTMAX_WIDTH __INTMAX_WIDTH__
|
||||
#undef UINTMAX_WIDTH
|
||||
#define UINTMAX_WIDTH __INTMAX_WIDTH__
|
||||
|
||||
#undef PTRDIFF_WIDTH
|
||||
#define PTRDIFF_WIDTH __PTRDIFF_WIDTH__
|
||||
|
||||
#undef SIG_ATOMIC_WIDTH
|
||||
#define SIG_ATOMIC_WIDTH __SIG_ATOMIC_WIDTH__
|
||||
|
||||
#undef SIZE_WIDTH
|
||||
#define SIZE_WIDTH __SIZE_WIDTH__
|
||||
|
||||
#undef WCHAR_WIDTH
|
||||
#define WCHAR_WIDTH __WCHAR_WIDTH__
|
||||
|
||||
#undef WINT_WIDTH
|
||||
#define WINT_WIDTH __WINT_WIDTH__
|
||||
|
||||
#endif
|
||||
|
||||
#if defined __STDC_VERSION__ && __STDC_VERSION__ > 201710L
|
||||
#define __STDC_VERSION_STDINT_H__ 202311L
|
||||
#endif
|
||||
|
||||
#endif /* _GCC_STDINT_H */
|
||||
@@ -0,0 +1,14 @@
|
||||
#ifndef _GCC_WRAP_STDINT_H
|
||||
#if __STDC_HOSTED__
|
||||
# if defined __cplusplus && __cplusplus >= 201103L
|
||||
# undef __STDC_LIMIT_MACROS
|
||||
# define __STDC_LIMIT_MACROS
|
||||
# undef __STDC_CONSTANT_MACROS
|
||||
# define __STDC_CONSTANT_MACROS
|
||||
# endif
|
||||
# include_next <stdint.h>
|
||||
#else
|
||||
# include "stdint-gcc.h"
|
||||
#endif
|
||||
#define _GCC_WRAP_STDINT_H
|
||||
#endif
|
||||
@@ -0,0 +1,35 @@
|
||||
/* Copyright (C) 2011-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3, or (at your option)
|
||||
any later version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Under Section 7 of GPL version 3, you are granted additional
|
||||
permissions described in the GCC Runtime Library Exception, version
|
||||
3.1, as published by the Free Software Foundation.
|
||||
|
||||
You should have received a copy of the GNU General Public License and
|
||||
a copy of the GCC Runtime Library Exception along with this program;
|
||||
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* ISO C1X: 7.23 _Noreturn <stdnoreturn.h>. */
|
||||
|
||||
#ifndef _STDNORETURN_H
|
||||
#define _STDNORETURN_H
|
||||
|
||||
#ifndef __cplusplus
|
||||
|
||||
#define noreturn _Noreturn
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* stdnoreturn.h */
|
||||
@@ -0,0 +1,8 @@
|
||||
/* syslimits.h stands for the system's own limits.h file.
|
||||
If we can use it ok unmodified, then we install this text.
|
||||
If fixincludes fixes it, then the fixed version is installed
|
||||
instead of this text. */
|
||||
|
||||
#define _GCC_NEXT_LIMITS_H /* tell gcc's limits.h to recurse */
|
||||
#include_next <limits.h>
|
||||
#undef _GCC_NEXT_LIMITS_H
|
||||
@@ -0,0 +1,127 @@
|
||||
/* Copyright (C) 2004-2023 Free Software Foundation, Inc.
|
||||
Contributed by Apple, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3, or (at your option)
|
||||
any later version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Under Section 7 of GPL version 3, you are granted additional
|
||||
permissions described in the GCC Runtime Library Exception, version
|
||||
3.1, as published by the Free Software Foundation.
|
||||
|
||||
You should have received a copy of the GNU General Public License and
|
||||
a copy of the GCC Runtime Library Exception along with this program;
|
||||
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/*
|
||||
* ISO C Standard: 7.22 Type-generic math <tgmath.h>
|
||||
*/
|
||||
|
||||
#ifndef _TGMATH_H
|
||||
#define _TGMATH_H
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#ifndef __cplusplus
|
||||
#include <complex.h>
|
||||
|
||||
/* Naming convention: generic macros are defining using
|
||||
__TGMATH_CPLX*, __TGMATH_REAL*, and __TGMATH_CPLX_ONLY. _CPLX
|
||||
means the generic argument(s) may be real or complex, _REAL means
|
||||
real only, _CPLX means complex only. If there is no suffix, we are
|
||||
defining a function of one argument. If the suffix is _n
|
||||
it is a function of n arguments. We only define these macros for
|
||||
values of n that are needed. */
|
||||
|
||||
#define __TGMATH_CPLX(z,R,C) \
|
||||
__builtin_tgmath (R##f, R, R##l, C##f, C, C##l, (z))
|
||||
|
||||
#define __TGMATH_CPLX_2(z1,z2,R,C) \
|
||||
__builtin_tgmath (R##f, R, R##l, C##f, C, C##l, (z1), (z2))
|
||||
|
||||
#define __TGMATH_REAL(x,R) \
|
||||
__builtin_tgmath (R##f, R, R##l, (x))
|
||||
#define __TGMATH_REAL_2(x,y,R) \
|
||||
__builtin_tgmath (R##f, R, R##l, (x), (y))
|
||||
#define __TGMATH_REAL_3(x,y,z,R) \
|
||||
__builtin_tgmath (R##f, R, R##l, (x), (y), (z))
|
||||
#define __TGMATH_CPLX_ONLY(z,C) \
|
||||
__builtin_tgmath (C##f, C, C##l, (z))
|
||||
|
||||
/* Functions defined in both <math.h> and <complex.h> (7.22p4) */
|
||||
#define acos(z) __TGMATH_CPLX(z, acos, cacos)
|
||||
#define asin(z) __TGMATH_CPLX(z, asin, casin)
|
||||
#define atan(z) __TGMATH_CPLX(z, atan, catan)
|
||||
#define acosh(z) __TGMATH_CPLX(z, acosh, cacosh)
|
||||
#define asinh(z) __TGMATH_CPLX(z, asinh, casinh)
|
||||
#define atanh(z) __TGMATH_CPLX(z, atanh, catanh)
|
||||
#define cos(z) __TGMATH_CPLX(z, cos, ccos)
|
||||
#define sin(z) __TGMATH_CPLX(z, sin, csin)
|
||||
#define tan(z) __TGMATH_CPLX(z, tan, ctan)
|
||||
#define cosh(z) __TGMATH_CPLX(z, cosh, ccosh)
|
||||
#define sinh(z) __TGMATH_CPLX(z, sinh, csinh)
|
||||
#define tanh(z) __TGMATH_CPLX(z, tanh, ctanh)
|
||||
#define exp(z) __TGMATH_CPLX(z, exp, cexp)
|
||||
#define log(z) __TGMATH_CPLX(z, log, clog)
|
||||
#define pow(z1,z2) __TGMATH_CPLX_2(z1, z2, pow, cpow)
|
||||
#define sqrt(z) __TGMATH_CPLX(z, sqrt, csqrt)
|
||||
#define fabs(z) __TGMATH_CPLX(z, fabs, cabs)
|
||||
|
||||
/* Functions defined in <math.h> only (7.22p5) */
|
||||
#define atan2(x,y) __TGMATH_REAL_2(x, y, atan2)
|
||||
#define cbrt(x) __TGMATH_REAL(x, cbrt)
|
||||
#define ceil(x) __TGMATH_REAL(x, ceil)
|
||||
#define copysign(x,y) __TGMATH_REAL_2(x, y, copysign)
|
||||
#define erf(x) __TGMATH_REAL(x, erf)
|
||||
#define erfc(x) __TGMATH_REAL(x, erfc)
|
||||
#define exp2(x) __TGMATH_REAL(x, exp2)
|
||||
#define expm1(x) __TGMATH_REAL(x, expm1)
|
||||
#define fdim(x,y) __TGMATH_REAL_2(x, y, fdim)
|
||||
#define floor(x) __TGMATH_REAL(x, floor)
|
||||
#define fma(x,y,z) __TGMATH_REAL_3(x, y, z, fma)
|
||||
#define fmax(x,y) __TGMATH_REAL_2(x, y, fmax)
|
||||
#define fmin(x,y) __TGMATH_REAL_2(x, y, fmin)
|
||||
#define fmod(x,y) __TGMATH_REAL_2(x, y, fmod)
|
||||
#define frexp(x,y) __TGMATH_REAL_2(x, y, frexp)
|
||||
#define hypot(x,y) __TGMATH_REAL_2(x, y, hypot)
|
||||
#define ilogb(x) __TGMATH_REAL(x, ilogb)
|
||||
#define ldexp(x,y) __TGMATH_REAL_2(x, y, ldexp)
|
||||
#define lgamma(x) __TGMATH_REAL(x, lgamma)
|
||||
#define llrint(x) __TGMATH_REAL(x, llrint)
|
||||
#define llround(x) __TGMATH_REAL(x, llround)
|
||||
#define log10(x) __TGMATH_REAL(x, log10)
|
||||
#define log1p(x) __TGMATH_REAL(x, log1p)
|
||||
#define log2(x) __TGMATH_REAL(x, log2)
|
||||
#define logb(x) __TGMATH_REAL(x, logb)
|
||||
#define lrint(x) __TGMATH_REAL(x, lrint)
|
||||
#define lround(x) __TGMATH_REAL(x, lround)
|
||||
#define nearbyint(x) __TGMATH_REAL(x, nearbyint)
|
||||
#define nextafter(x,y) __TGMATH_REAL_2(x, y, nextafter)
|
||||
#define nexttoward(x,y) __TGMATH_REAL_2(x, y, nexttoward)
|
||||
#define remainder(x,y) __TGMATH_REAL_2(x, y, remainder)
|
||||
#define remquo(x,y,z) __TGMATH_REAL_3(x, y, z, remquo)
|
||||
#define rint(x) __TGMATH_REAL(x, rint)
|
||||
#define round(x) __TGMATH_REAL(x, round)
|
||||
#define scalbn(x,y) __TGMATH_REAL_2(x, y, scalbn)
|
||||
#define scalbln(x,y) __TGMATH_REAL_2(x, y, scalbln)
|
||||
#define tgamma(x) __TGMATH_REAL(x, tgamma)
|
||||
#define trunc(x) __TGMATH_REAL(x, trunc)
|
||||
|
||||
/* Functions defined in <complex.h> only (7.22p6) */
|
||||
#define carg(z) __TGMATH_CPLX_ONLY(z, carg)
|
||||
#define cimag(z) __TGMATH_CPLX_ONLY(z, cimag)
|
||||
#define conj(z) __TGMATH_CPLX_ONLY(z, conj)
|
||||
#define cproj(z) __TGMATH_CPLX_ONLY(z, cproj)
|
||||
#define creal(z) __TGMATH_CPLX_ONLY(z, creal)
|
||||
|
||||
#endif /* __cplusplus */
|
||||
#endif /* _TGMATH_H */
|
||||
@@ -0,0 +1,298 @@
|
||||
/* Exception handling and frame unwind runtime interface routines.
|
||||
Copyright (C) 2001-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3, or (at your option)
|
||||
any later version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
License for more details.
|
||||
|
||||
Under Section 7 of GPL version 3, you are granted additional
|
||||
permissions described in the GCC Runtime Library Exception, version
|
||||
3.1, as published by the Free Software Foundation.
|
||||
|
||||
You should have received a copy of the GNU General Public License and
|
||||
a copy of the GCC Runtime Library Exception along with this program;
|
||||
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* This is derived from the C++ ABI for IA-64. Where we diverge
|
||||
for cross-architecture compatibility are noted with "@@@". */
|
||||
|
||||
#ifndef _UNWIND_H
|
||||
#define _UNWIND_H
|
||||
|
||||
#if defined (__SEH__) && !defined (__USING_SJLJ_EXCEPTIONS__)
|
||||
/* Only for _GCC_specific_handler. */
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#ifndef HIDE_EXPORTS
|
||||
#pragma GCC visibility push(default)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Level 1: Base ABI */
|
||||
|
||||
/* @@@ The IA-64 ABI uses uint64 throughout. Most places this is
|
||||
inefficient for 32-bit and smaller machines. */
|
||||
typedef unsigned _Unwind_Word __attribute__((__mode__(__unwind_word__)));
|
||||
typedef signed _Unwind_Sword __attribute__((__mode__(__unwind_word__)));
|
||||
#if defined(__ia64__) && defined(__hpux__)
|
||||
typedef unsigned _Unwind_Ptr __attribute__((__mode__(__word__)));
|
||||
#else
|
||||
typedef unsigned _Unwind_Ptr __attribute__((__mode__(__pointer__)));
|
||||
#endif
|
||||
typedef unsigned _Unwind_Internal_Ptr __attribute__((__mode__(__pointer__)));
|
||||
|
||||
/* @@@ The IA-64 ABI uses a 64-bit word to identify the producer and
|
||||
consumer of an exception. We'll go along with this for now even on
|
||||
32-bit machines. We'll need to provide some other option for
|
||||
16-bit machines and for machines with > 8 bits per byte. */
|
||||
typedef unsigned _Unwind_Exception_Class __attribute__((__mode__(__DI__)));
|
||||
|
||||
/* The unwind interface uses reason codes in several contexts to
|
||||
identify the reasons for failures or other actions. */
|
||||
typedef enum
|
||||
{
|
||||
_URC_NO_REASON = 0,
|
||||
_URC_FOREIGN_EXCEPTION_CAUGHT = 1,
|
||||
_URC_FATAL_PHASE2_ERROR = 2,
|
||||
_URC_FATAL_PHASE1_ERROR = 3,
|
||||
_URC_NORMAL_STOP = 4,
|
||||
_URC_END_OF_STACK = 5,
|
||||
_URC_HANDLER_FOUND = 6,
|
||||
_URC_INSTALL_CONTEXT = 7,
|
||||
_URC_CONTINUE_UNWIND = 8
|
||||
} _Unwind_Reason_Code;
|
||||
|
||||
|
||||
/* The unwind interface uses a pointer to an exception header object
|
||||
as its representation of an exception being thrown. In general, the
|
||||
full representation of an exception object is language- and
|
||||
implementation-specific, but it will be prefixed by a header
|
||||
understood by the unwind interface. */
|
||||
|
||||
struct _Unwind_Exception;
|
||||
|
||||
typedef void (*_Unwind_Exception_Cleanup_Fn) (_Unwind_Reason_Code,
|
||||
struct _Unwind_Exception *);
|
||||
|
||||
struct _Unwind_Exception
|
||||
{
|
||||
_Unwind_Exception_Class exception_class;
|
||||
_Unwind_Exception_Cleanup_Fn exception_cleanup;
|
||||
|
||||
#if !defined (__USING_SJLJ_EXCEPTIONS__) && defined (__SEH__)
|
||||
_Unwind_Word private_[6];
|
||||
#else
|
||||
_Unwind_Word private_1;
|
||||
_Unwind_Word private_2;
|
||||
#endif
|
||||
|
||||
/* @@@ The IA-64 ABI says that this structure must be double-word aligned.
|
||||
Taking that literally does not make much sense generically. Instead we
|
||||
provide the maximum alignment required by any type for the machine. */
|
||||
} __attribute__((__aligned__));
|
||||
|
||||
|
||||
/* The ACTIONS argument to the personality routine is a bitwise OR of one
|
||||
or more of the following constants. */
|
||||
typedef int _Unwind_Action;
|
||||
|
||||
#define _UA_SEARCH_PHASE 1
|
||||
#define _UA_CLEANUP_PHASE 2
|
||||
#define _UA_HANDLER_FRAME 4
|
||||
#define _UA_FORCE_UNWIND 8
|
||||
#define _UA_END_OF_STACK 16
|
||||
|
||||
/* The target can override this macro to define any back-end-specific
|
||||
attributes required for the lowest-level stack frame. */
|
||||
#ifndef LIBGCC2_UNWIND_ATTRIBUTE
|
||||
#define LIBGCC2_UNWIND_ATTRIBUTE
|
||||
#endif
|
||||
|
||||
/* This is an opaque type used to refer to a system-specific data
|
||||
structure used by the system unwinder. This context is created and
|
||||
destroyed by the system, and passed to the personality routine
|
||||
during unwinding. */
|
||||
struct _Unwind_Context;
|
||||
|
||||
/* Raise an exception, passing along the given exception object. */
|
||||
extern _Unwind_Reason_Code LIBGCC2_UNWIND_ATTRIBUTE
|
||||
_Unwind_RaiseException (struct _Unwind_Exception *);
|
||||
|
||||
/* Raise an exception for forced unwinding. */
|
||||
|
||||
typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn)
|
||||
(int, _Unwind_Action, _Unwind_Exception_Class,
|
||||
struct _Unwind_Exception *, struct _Unwind_Context *, void *);
|
||||
|
||||
extern _Unwind_Reason_Code LIBGCC2_UNWIND_ATTRIBUTE
|
||||
_Unwind_ForcedUnwind (struct _Unwind_Exception *, _Unwind_Stop_Fn, void *);
|
||||
|
||||
/* Helper to invoke the exception_cleanup routine. */
|
||||
extern void _Unwind_DeleteException (struct _Unwind_Exception *);
|
||||
|
||||
/* Resume propagation of an existing exception. This is used after
|
||||
e.g. executing cleanup code, and not to implement rethrowing. */
|
||||
extern void LIBGCC2_UNWIND_ATTRIBUTE
|
||||
_Unwind_Resume (struct _Unwind_Exception *);
|
||||
|
||||
/* @@@ Resume propagation of a FORCE_UNWIND exception, or to rethrow
|
||||
a normal exception that was handled. */
|
||||
extern _Unwind_Reason_Code LIBGCC2_UNWIND_ATTRIBUTE
|
||||
_Unwind_Resume_or_Rethrow (struct _Unwind_Exception *);
|
||||
|
||||
/* @@@ Use unwind data to perform a stack backtrace. The trace callback
|
||||
is called for every stack frame in the call chain, but no cleanup
|
||||
actions are performed. */
|
||||
typedef _Unwind_Reason_Code (*_Unwind_Trace_Fn)
|
||||
(struct _Unwind_Context *, void *);
|
||||
|
||||
extern _Unwind_Reason_Code LIBGCC2_UNWIND_ATTRIBUTE
|
||||
_Unwind_Backtrace (_Unwind_Trace_Fn, void *);
|
||||
|
||||
/* These functions are used for communicating information about the unwind
|
||||
context (i.e. the unwind descriptors and the user register state) between
|
||||
the unwind library and the personality routine and landing pad. Only
|
||||
selected registers may be manipulated. */
|
||||
|
||||
extern _Unwind_Word _Unwind_GetGR (struct _Unwind_Context *, int);
|
||||
extern void _Unwind_SetGR (struct _Unwind_Context *, int, _Unwind_Word);
|
||||
|
||||
extern _Unwind_Ptr _Unwind_GetIP (struct _Unwind_Context *);
|
||||
extern _Unwind_Ptr _Unwind_GetIPInfo (struct _Unwind_Context *, int *);
|
||||
extern void _Unwind_SetIP (struct _Unwind_Context *, _Unwind_Ptr);
|
||||
|
||||
/* @@@ Retrieve the CFA of the given context. */
|
||||
extern _Unwind_Word _Unwind_GetCFA (struct _Unwind_Context *);
|
||||
|
||||
extern void *_Unwind_GetLanguageSpecificData (struct _Unwind_Context *);
|
||||
|
||||
extern _Unwind_Ptr _Unwind_GetRegionStart (struct _Unwind_Context *);
|
||||
|
||||
|
||||
/* The personality routine is the function in the C++ (or other language)
|
||||
runtime library which serves as an interface between the system unwind
|
||||
library and language-specific exception handling semantics. It is
|
||||
specific to the code fragment described by an unwind info block, and
|
||||
it is always referenced via the pointer in the unwind info block, and
|
||||
hence it has no ABI-specified name.
|
||||
|
||||
Note that this implies that two different C++ implementations can
|
||||
use different names, and have different contents in the language
|
||||
specific data area. Moreover, that the language specific data
|
||||
area contains no version info because name of the function invoked
|
||||
provides more effective versioning by detecting at link time the
|
||||
lack of code to handle the different data format. */
|
||||
|
||||
typedef _Unwind_Reason_Code (*_Unwind_Personality_Fn)
|
||||
(int, _Unwind_Action, _Unwind_Exception_Class,
|
||||
struct _Unwind_Exception *, struct _Unwind_Context *);
|
||||
|
||||
/* @@@ The following alternate entry points are for setjmp/longjmp
|
||||
based unwinding. */
|
||||
|
||||
struct SjLj_Function_Context;
|
||||
extern void _Unwind_SjLj_Register (struct SjLj_Function_Context *);
|
||||
extern void _Unwind_SjLj_Unregister (struct SjLj_Function_Context *);
|
||||
|
||||
extern _Unwind_Reason_Code LIBGCC2_UNWIND_ATTRIBUTE
|
||||
_Unwind_SjLj_RaiseException (struct _Unwind_Exception *);
|
||||
extern _Unwind_Reason_Code LIBGCC2_UNWIND_ATTRIBUTE
|
||||
_Unwind_SjLj_ForcedUnwind (struct _Unwind_Exception *, _Unwind_Stop_Fn, void *);
|
||||
extern void LIBGCC2_UNWIND_ATTRIBUTE
|
||||
_Unwind_SjLj_Resume (struct _Unwind_Exception *);
|
||||
extern _Unwind_Reason_Code LIBGCC2_UNWIND_ATTRIBUTE
|
||||
_Unwind_SjLj_Resume_or_Rethrow (struct _Unwind_Exception *);
|
||||
|
||||
/* @@@ The following provide access to the base addresses for text
|
||||
and data-relative addressing in the LDSA. In order to stay link
|
||||
compatible with the standard ABI for IA-64, we inline these. */
|
||||
|
||||
#ifdef __ia64__
|
||||
static inline _Unwind_Ptr
|
||||
_Unwind_GetDataRelBase (struct _Unwind_Context *_C)
|
||||
{
|
||||
/* The GP is stored in R1. */
|
||||
return _Unwind_GetGR (_C, 1);
|
||||
}
|
||||
|
||||
static inline _Unwind_Ptr
|
||||
_Unwind_GetTextRelBase (struct _Unwind_Context *_C __attribute__ ((__unused__)))
|
||||
{
|
||||
__builtin_abort ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* @@@ Retrieve the Backing Store Pointer of the given context. */
|
||||
extern _Unwind_Word _Unwind_GetBSP (struct _Unwind_Context *);
|
||||
#else
|
||||
extern _Unwind_Ptr _Unwind_GetDataRelBase (struct _Unwind_Context *);
|
||||
extern _Unwind_Ptr _Unwind_GetTextRelBase (struct _Unwind_Context *);
|
||||
#endif
|
||||
|
||||
/* @@@ Given an address, return the entry point of the function that
|
||||
contains it. */
|
||||
extern void * _Unwind_FindEnclosingFunction (void *pc);
|
||||
|
||||
#ifndef __SIZEOF_LONG__
|
||||
#error "__SIZEOF_LONG__ macro not defined"
|
||||
#endif
|
||||
|
||||
#ifndef __SIZEOF_POINTER__
|
||||
#error "__SIZEOF_POINTER__ macro not defined"
|
||||
#endif
|
||||
|
||||
|
||||
/* leb128 type numbers have a potentially unlimited size.
|
||||
The target of the following definitions of _sleb128_t and _uleb128_t
|
||||
is to have efficient data types large enough to hold the leb128 type
|
||||
numbers used in the unwind code.
|
||||
Mostly these types will simply be defined to long and unsigned long
|
||||
except when a unsigned long data type on the target machine is not
|
||||
capable of storing a pointer. */
|
||||
|
||||
#if __SIZEOF_LONG__ >= __SIZEOF_POINTER__
|
||||
typedef long _sleb128_t;
|
||||
typedef unsigned long _uleb128_t;
|
||||
#elif __SIZEOF_LONG_LONG__ >= __SIZEOF_POINTER__
|
||||
typedef long long _sleb128_t;
|
||||
typedef unsigned long long _uleb128_t;
|
||||
#else
|
||||
# error "What type shall we use for _sleb128_t?"
|
||||
#endif
|
||||
|
||||
#if defined (__SEH__) && !defined (__USING_SJLJ_EXCEPTIONS__)
|
||||
/* Handles the mapping from SEH to GCC interfaces. */
|
||||
EXCEPTION_DISPOSITION _GCC_specific_handler (PEXCEPTION_RECORD, void *,
|
||||
PCONTEXT, PDISPATCHER_CONTEXT,
|
||||
_Unwind_Personality_Fn);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef HIDE_EXPORTS
|
||||
#pragma GCC visibility pop
|
||||
#endif
|
||||
|
||||
/* Additional actions to unwind number of stack frames. */
|
||||
#define _Unwind_Frames_Extra(frames)
|
||||
|
||||
/* Increment frame count. */
|
||||
#define _Unwind_Frames_Increment(exc, context, frames) frames++
|
||||
|
||||
#endif /* unwind.h */
|
||||
@@ -0,0 +1,7 @@
|
||||
#ifndef _VARARGS_H
|
||||
#define _VARARGS_H
|
||||
|
||||
#error "GCC no longer implements <varargs.h>."
|
||||
#error "Revise your code to use <stdarg.h>."
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1 @@
|
||||
;
|
||||
@@ -0,0 +1,8 @@
|
||||
/* syslimits.h stands for the system's own limits.h file.
|
||||
If we can use it ok unmodified, then we install this text.
|
||||
If fixincludes fixes it, then the fixed version is installed
|
||||
instead of this text. */
|
||||
|
||||
#define _GCC_NEXT_LIMITS_H /* tell gcc's limits.h to recurse */
|
||||
#include_next <limits.h>
|
||||
#undef _GCC_NEXT_LIMITS_H
|
||||
@@ -0,0 +1,14 @@
|
||||
This README file is copied into the directory for GCC-only header files
|
||||
when fixincludes is run by the makefile for GCC.
|
||||
|
||||
Many of the files in this directory were automatically edited from the
|
||||
standard system header files by the fixincludes process. They are
|
||||
system-specific, and will not work on any other kind of system. They
|
||||
are also not part of GCC. The reason we have to do this is because
|
||||
GCC requires ANSI C headers and many vendors supply ANSI-incompatible
|
||||
headers.
|
||||
|
||||
Because this is an automated process, sometimes headers get "fixed"
|
||||
that do not, strictly speaking, need a fix. As long as nothing is broken
|
||||
by the process, it is just an unfortunate collateral inconvenience.
|
||||
We would like to rectify it, if it is not "too inconvenient".
|
||||
@@ -0,0 +1,208 @@
|
||||
/* Copyright (C) 1992-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
Under Section 7 of GPL version 3, you are granted additional
|
||||
permissions described in the GCC Runtime Library Exception, version
|
||||
3.1, as published by the Free Software Foundation.
|
||||
|
||||
You should have received a copy of the GNU General Public License and
|
||||
a copy of the GCC Runtime Library Exception along with this program;
|
||||
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* This administrivia gets added to the beginning of limits.h
|
||||
if the system has its own version of limits.h. */
|
||||
|
||||
/* We use _GCC_LIMITS_H_ because we want this not to match
|
||||
any macros that the system's limits.h uses for its own purposes. */
|
||||
#ifndef _GCC_LIMITS_H_ /* Terminated in limity.h. */
|
||||
#define _GCC_LIMITS_H_
|
||||
|
||||
#ifndef _LIBC_LIMITS_H_
|
||||
/* Use "..." so that we find syslimits.h only in this same directory. */
|
||||
#include "syslimits.h"
|
||||
#endif
|
||||
/* Copyright (C) 1991-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
Under Section 7 of GPL version 3, you are granted additional
|
||||
permissions described in the GCC Runtime Library Exception, version
|
||||
3.1, as published by the Free Software Foundation.
|
||||
|
||||
You should have received a copy of the GNU General Public License and
|
||||
a copy of the GCC Runtime Library Exception along with this program;
|
||||
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _LIMITS_H___
|
||||
#define _LIMITS_H___
|
||||
|
||||
/* Number of bits in a `char'. */
|
||||
#undef CHAR_BIT
|
||||
#define CHAR_BIT __CHAR_BIT__
|
||||
|
||||
/* Maximum length of a multibyte character. */
|
||||
#ifndef MB_LEN_MAX
|
||||
#define MB_LEN_MAX 1
|
||||
#endif
|
||||
|
||||
/* Minimum and maximum values a `signed char' can hold. */
|
||||
#undef SCHAR_MIN
|
||||
#define SCHAR_MIN (-SCHAR_MAX - 1)
|
||||
#undef SCHAR_MAX
|
||||
#define SCHAR_MAX __SCHAR_MAX__
|
||||
|
||||
/* Maximum value an `unsigned char' can hold. (Minimum is 0). */
|
||||
#undef UCHAR_MAX
|
||||
#if __SCHAR_MAX__ == __INT_MAX__
|
||||
# define UCHAR_MAX (SCHAR_MAX * 2U + 1U)
|
||||
#else
|
||||
# define UCHAR_MAX (SCHAR_MAX * 2 + 1)
|
||||
#endif
|
||||
|
||||
/* Minimum and maximum values a `char' can hold. */
|
||||
#ifdef __CHAR_UNSIGNED__
|
||||
# undef CHAR_MIN
|
||||
# if __SCHAR_MAX__ == __INT_MAX__
|
||||
# define CHAR_MIN 0U
|
||||
# else
|
||||
# define CHAR_MIN 0
|
||||
# endif
|
||||
# undef CHAR_MAX
|
||||
# define CHAR_MAX UCHAR_MAX
|
||||
#else
|
||||
# undef CHAR_MIN
|
||||
# define CHAR_MIN SCHAR_MIN
|
||||
# undef CHAR_MAX
|
||||
# define CHAR_MAX SCHAR_MAX
|
||||
#endif
|
||||
|
||||
/* Minimum and maximum values a `signed short int' can hold. */
|
||||
#undef SHRT_MIN
|
||||
#define SHRT_MIN (-SHRT_MAX - 1)
|
||||
#undef SHRT_MAX
|
||||
#define SHRT_MAX __SHRT_MAX__
|
||||
|
||||
/* Maximum value an `unsigned short int' can hold. (Minimum is 0). */
|
||||
#undef USHRT_MAX
|
||||
#if __SHRT_MAX__ == __INT_MAX__
|
||||
# define USHRT_MAX (SHRT_MAX * 2U + 1U)
|
||||
#else
|
||||
# define USHRT_MAX (SHRT_MAX * 2 + 1)
|
||||
#endif
|
||||
|
||||
/* Minimum and maximum values a `signed int' can hold. */
|
||||
#undef INT_MIN
|
||||
#define INT_MIN (-INT_MAX - 1)
|
||||
#undef INT_MAX
|
||||
#define INT_MAX __INT_MAX__
|
||||
|
||||
/* Maximum value an `unsigned int' can hold. (Minimum is 0). */
|
||||
#undef UINT_MAX
|
||||
#define UINT_MAX (INT_MAX * 2U + 1U)
|
||||
|
||||
/* Minimum and maximum values a `signed long int' can hold.
|
||||
(Same as `int'). */
|
||||
#undef LONG_MIN
|
||||
#define LONG_MIN (-LONG_MAX - 1L)
|
||||
#undef LONG_MAX
|
||||
#define LONG_MAX __LONG_MAX__
|
||||
|
||||
/* Maximum value an `unsigned long int' can hold. (Minimum is 0). */
|
||||
#undef ULONG_MAX
|
||||
#define ULONG_MAX (LONG_MAX * 2UL + 1UL)
|
||||
|
||||
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
||||
/* Minimum and maximum values a `signed long long int' can hold. */
|
||||
# undef LLONG_MIN
|
||||
# define LLONG_MIN (-LLONG_MAX - 1LL)
|
||||
# undef LLONG_MAX
|
||||
# define LLONG_MAX __LONG_LONG_MAX__
|
||||
|
||||
/* Maximum value an `unsigned long long int' can hold. (Minimum is 0). */
|
||||
# undef ULLONG_MAX
|
||||
# define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
|
||||
#endif
|
||||
|
||||
#if defined (__GNU_LIBRARY__) ? defined (__USE_GNU) : !defined (__STRICT_ANSI__)
|
||||
/* Minimum and maximum values a `signed long long int' can hold. */
|
||||
# undef LONG_LONG_MIN
|
||||
# define LONG_LONG_MIN (-LONG_LONG_MAX - 1LL)
|
||||
# undef LONG_LONG_MAX
|
||||
# define LONG_LONG_MAX __LONG_LONG_MAX__
|
||||
|
||||
/* Maximum value an `unsigned long long int' can hold. (Minimum is 0). */
|
||||
# undef ULONG_LONG_MAX
|
||||
# define ULONG_LONG_MAX (LONG_LONG_MAX * 2ULL + 1ULL)
|
||||
#endif
|
||||
|
||||
#if (defined __STDC_WANT_IEC_60559_BFP_EXT__ \
|
||||
|| (defined (__STDC_VERSION__) && __STDC_VERSION__ > 201710L))
|
||||
/* TS 18661-1 / C2X widths of integer types. */
|
||||
# undef CHAR_WIDTH
|
||||
# define CHAR_WIDTH __SCHAR_WIDTH__
|
||||
# undef SCHAR_WIDTH
|
||||
# define SCHAR_WIDTH __SCHAR_WIDTH__
|
||||
# undef UCHAR_WIDTH
|
||||
# define UCHAR_WIDTH __SCHAR_WIDTH__
|
||||
# undef SHRT_WIDTH
|
||||
# define SHRT_WIDTH __SHRT_WIDTH__
|
||||
# undef USHRT_WIDTH
|
||||
# define USHRT_WIDTH __SHRT_WIDTH__
|
||||
# undef INT_WIDTH
|
||||
# define INT_WIDTH __INT_WIDTH__
|
||||
# undef UINT_WIDTH
|
||||
# define UINT_WIDTH __INT_WIDTH__
|
||||
# undef LONG_WIDTH
|
||||
# define LONG_WIDTH __LONG_WIDTH__
|
||||
# undef ULONG_WIDTH
|
||||
# define ULONG_WIDTH __LONG_WIDTH__
|
||||
# undef LLONG_WIDTH
|
||||
# define LLONG_WIDTH __LONG_LONG_WIDTH__
|
||||
# undef ULLONG_WIDTH
|
||||
# define ULLONG_WIDTH __LONG_LONG_WIDTH__
|
||||
#endif
|
||||
|
||||
#if defined (__STDC_VERSION__) && __STDC_VERSION__ > 201710L
|
||||
/* C2X width and limit of _Bool. */
|
||||
# undef BOOL_MAX
|
||||
# define BOOL_MAX 1
|
||||
# undef BOOL_WIDTH
|
||||
# define BOOL_WIDTH 1
|
||||
|
||||
# define __STDC_VERSION_LIMITS_H__ 202311L
|
||||
#endif
|
||||
|
||||
#endif /* _LIMITS_H___ */
|
||||
/* This administrivia gets added to the end of limits.h
|
||||
if the system has its own version of limits.h. */
|
||||
|
||||
#else /* not _GCC_LIMITS_H_ */
|
||||
|
||||
#ifdef _GCC_NEXT_LIMITS_H
|
||||
#include_next <limits.h> /* recurse down to the real one */
|
||||
#endif
|
||||
|
||||
#endif /* not _GCC_LIMITS_H_ */
|
||||
@@ -0,0 +1,3 @@
|
||||
SYSTEM_HEADER_DIR="/home/ilg/actions-runners/xpack-dev-tools/1/_work/riscv-none-elf-gcc-xpack/riscv-none-elf-gcc-xpack/build-assets/build/linux-x64/application/riscv-none-elf${sysroot_headers_suffix}/include"
|
||||
OTHER_FIXINCLUDES_DIRS=""
|
||||
STMP_FIXINC="stmp-fixinc"
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,83 @@
|
||||
/****************************************************************************
|
||||
* *
|
||||
* GNAT COMPILER COMPONENTS *
|
||||
* *
|
||||
* GNAT-SPECIFIC GCC TREE CODES *
|
||||
* *
|
||||
* Specification *
|
||||
* *
|
||||
* Copyright (C) 1992-2023, Free Software Foundation, Inc. *
|
||||
* *
|
||||
* GNAT is free software; you can redistribute it and/or modify it under *
|
||||
* terms of the GNU General Public License as published by the Free Soft- *
|
||||
* ware Foundation; either version 3, or (at your option) any later ver- *
|
||||
* sion. GNAT is distributed in the hope that it will be useful, but WITH- *
|
||||
* OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License *
|
||||
* for more details. You should have received a copy of the GNU General *
|
||||
* Public License along with GCC; see the file COPYING3. If not see *
|
||||
* <http://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
* GNAT was originally developed by the GNAT team at New York University. *
|
||||
* Extensive contributions were provided by Ada Core Technologies Inc. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
|
||||
/* A type that is an unconstrained array. This node is never passed to GCC.
|
||||
TREE_TYPE is the type of the fat pointer and TYPE_OBJECT_RECORD_TYPE is
|
||||
the type of a record containing the template and data. */
|
||||
DEFTREECODE (UNCONSTRAINED_ARRAY_TYPE, "unconstrained_array_type", tcc_type, 0)
|
||||
|
||||
/* A reference to an unconstrained array. This node only exists as an
|
||||
intermediate node during the translation of a GNAT tree to a GCC tree;
|
||||
it is never passed to GCC. The only field used is operand 0, which
|
||||
is the fat pointer object. */
|
||||
DEFTREECODE (UNCONSTRAINED_ARRAY_REF, "unconstrained_array_ref",
|
||||
tcc_reference, 1)
|
||||
|
||||
/* Same as SAVE_EXPR, but operand 1 contains the statement used to initialize
|
||||
the temporary instead of using the value of operand 0 directly. */
|
||||
DEFTREECODE (LOAD_EXPR, "load_expr", tcc_expression, 2)
|
||||
|
||||
/* An expression that returns an RTL suitable for its type. Operand 0
|
||||
is an expression to be evaluated for side effects only. */
|
||||
DEFTREECODE (NULL_EXPR, "null_expr", tcc_expression, 1)
|
||||
|
||||
/* Same as PLUS_EXPR, except that no modulo reduction is applied.
|
||||
This is used for loops and never shows up in the tree. */
|
||||
DEFTREECODE (PLUS_NOMOD_EXPR, "plus_nomod_expr", tcc_binary, 2)
|
||||
|
||||
/* Same as MINUS_EXPR, except that no modulo reduction is applied.
|
||||
This is used for loops and never shows up in the tree. */
|
||||
DEFTREECODE (MINUS_NOMOD_EXPR, "minus_nomod_expr", tcc_binary, 2)
|
||||
|
||||
/* An expression that computes an exponentiation. Operand 0 is the base and
|
||||
Operand 1 is the exponent. This node is never passed to GCC: it is only
|
||||
used internally to describe fixed point types scale factors. */
|
||||
DEFTREECODE (POWER_EXPR, "power_expr", tcc_binary, 2)
|
||||
|
||||
/* Same as ADDR_EXPR, except that if the operand represents a bit field,
|
||||
return the address of the byte containing the bit. This is used
|
||||
for the Address attribute and never shows up in the tree. */
|
||||
DEFTREECODE (ATTR_ADDR_EXPR, "attr_addr_expr", tcc_reference, 1)
|
||||
|
||||
/* Here are the tree codes for the statement types known to Ada. These
|
||||
must be at the end of this file to allow IS_ADA_STMT to work. */
|
||||
|
||||
/* This is how record_code_position and insert_code_for work. The former
|
||||
makes this tree node, whose operand is a statement. The latter inserts
|
||||
the actual statements into this node. Gimplification consists of
|
||||
just returning the inner statement. */
|
||||
DEFTREECODE (STMT_STMT, "stmt_stmt", tcc_statement, 1)
|
||||
|
||||
/* A loop. LOOP_STMT_COND is the test to exit the loop. LOOP_STMT_UPDATE
|
||||
is the statement to update the loop iteration variable at the continue
|
||||
point. LOOP_STMT_BODY are the statements in the body of the loop. And
|
||||
LOOP_STMT_LABEL points to the LABEL_DECL of the end label of the loop. */
|
||||
DEFTREECODE (LOOP_STMT, "loop_stmt", tcc_statement, 4)
|
||||
|
||||
/* Conditionally exit a loop. EXIT_STMT_COND is the condition, which, if
|
||||
true, will cause the loop to be exited. If no condition is specified,
|
||||
the loop is unconditionally exited. EXIT_STMT_LABEL is the end label
|
||||
corresponding to the loop to exit. */
|
||||
DEFTREECODE (EXIT_STMT, "exit_stmt", tcc_statement, 2)
|
||||
@@ -0,0 +1,90 @@
|
||||
/* Inline functions to test validity of reg classes for addressing modes.
|
||||
Copyright (C) 2006-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GCC; see the file COPYING3. If not see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Wrapper function to unify target macros MODE_CODE_BASE_REG_CLASS,
|
||||
MODE_BASE_REG_REG_CLASS, MODE_BASE_REG_CLASS and BASE_REG_CLASS.
|
||||
Arguments as for the MODE_CODE_BASE_REG_CLASS macro. */
|
||||
|
||||
#ifndef GCC_ADDRESSES_H
|
||||
#define GCC_ADDRESSES_H
|
||||
|
||||
inline enum reg_class
|
||||
base_reg_class (machine_mode mode ATTRIBUTE_UNUSED,
|
||||
addr_space_t as ATTRIBUTE_UNUSED,
|
||||
enum rtx_code outer_code ATTRIBUTE_UNUSED,
|
||||
enum rtx_code index_code ATTRIBUTE_UNUSED)
|
||||
{
|
||||
#ifdef MODE_CODE_BASE_REG_CLASS
|
||||
return MODE_CODE_BASE_REG_CLASS (MACRO_MODE (mode), as, outer_code,
|
||||
index_code);
|
||||
#else
|
||||
#ifdef MODE_BASE_REG_REG_CLASS
|
||||
if (index_code == REG)
|
||||
return MODE_BASE_REG_REG_CLASS (MACRO_MODE (mode));
|
||||
#endif
|
||||
#ifdef MODE_BASE_REG_CLASS
|
||||
return MODE_BASE_REG_CLASS (MACRO_MODE (mode));
|
||||
#else
|
||||
return BASE_REG_CLASS;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Wrapper function to unify target macros REGNO_MODE_CODE_OK_FOR_BASE_P,
|
||||
REGNO_MODE_OK_FOR_REG_BASE_P, REGNO_MODE_OK_FOR_BASE_P and
|
||||
REGNO_OK_FOR_BASE_P.
|
||||
Arguments as for the REGNO_MODE_CODE_OK_FOR_BASE_P macro. */
|
||||
|
||||
inline bool
|
||||
ok_for_base_p_1 (unsigned regno ATTRIBUTE_UNUSED,
|
||||
machine_mode mode ATTRIBUTE_UNUSED,
|
||||
addr_space_t as ATTRIBUTE_UNUSED,
|
||||
enum rtx_code outer_code ATTRIBUTE_UNUSED,
|
||||
enum rtx_code index_code ATTRIBUTE_UNUSED)
|
||||
{
|
||||
#ifdef REGNO_MODE_CODE_OK_FOR_BASE_P
|
||||
return REGNO_MODE_CODE_OK_FOR_BASE_P (regno, MACRO_MODE (mode), as,
|
||||
outer_code, index_code);
|
||||
#else
|
||||
#ifdef REGNO_MODE_OK_FOR_REG_BASE_P
|
||||
if (index_code == REG)
|
||||
return REGNO_MODE_OK_FOR_REG_BASE_P (regno, MACRO_MODE (mode));
|
||||
#endif
|
||||
#ifdef REGNO_MODE_OK_FOR_BASE_P
|
||||
return REGNO_MODE_OK_FOR_BASE_P (regno, MACRO_MODE (mode));
|
||||
#else
|
||||
return REGNO_OK_FOR_BASE_P (regno);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Wrapper around ok_for_base_p_1, for use after register allocation is
|
||||
complete. Arguments as for the called function. */
|
||||
|
||||
inline bool
|
||||
regno_ok_for_base_p (unsigned regno, machine_mode mode, addr_space_t as,
|
||||
enum rtx_code outer_code, enum rtx_code index_code)
|
||||
{
|
||||
if (regno >= FIRST_PSEUDO_REGISTER && reg_renumber[regno] >= 0)
|
||||
regno = reg_renumber[regno];
|
||||
|
||||
return ok_for_base_p_1 (regno, mode, as, outer_code, index_code);
|
||||
}
|
||||
|
||||
#endif /* GCC_ADDRESSES_H */
|
||||
@@ -0,0 +1,51 @@
|
||||
/* Exported functions from alias.cc
|
||||
Copyright (C) 2004-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GCC; see the file COPYING3. If not see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef GCC_ALIAS_H
|
||||
#define GCC_ALIAS_H
|
||||
|
||||
extern alias_set_type new_alias_set (void);
|
||||
extern alias_set_type get_alias_set (tree);
|
||||
extern alias_set_type get_deref_alias_set (tree);
|
||||
extern alias_set_type get_varargs_alias_set (void);
|
||||
extern alias_set_type get_frame_alias_set (void);
|
||||
extern tree component_uses_parent_alias_set_from (const_tree);
|
||||
extern bool ends_tbaa_access_path_p (const_tree);
|
||||
extern bool alias_set_subset_of (alias_set_type, alias_set_type);
|
||||
extern void record_alias_subset (alias_set_type, alias_set_type);
|
||||
extern void record_component_aliases (tree);
|
||||
extern int alias_sets_conflict_p (alias_set_type, alias_set_type);
|
||||
extern int alias_sets_must_conflict_p (alias_set_type, alias_set_type);
|
||||
extern int objects_must_conflict_p (tree, tree);
|
||||
extern int nonoverlapping_memrefs_p (const_rtx, const_rtx, bool);
|
||||
extern void dump_alias_stats_in_alias_c (FILE *s);
|
||||
tree reference_alias_ptr_type (tree);
|
||||
tree reference_alias_ptr_type_1 (tree *);
|
||||
bool alias_ptr_types_compatible_p (tree, tree);
|
||||
int compare_base_decls (tree, tree);
|
||||
bool refs_same_for_tbaa_p (tree, tree);
|
||||
bool mems_same_for_tbaa_p (rtx, rtx);
|
||||
|
||||
/* This alias set can be used to force a memory to conflict with all
|
||||
other memories, creating a barrier across which no memory reference
|
||||
can move. Note that there are other legacy ways to create such
|
||||
memory barriers, including an address of SCRATCH. */
|
||||
#define ALIAS_SET_MEMORY_BARRIER ((alias_set_type) -1)
|
||||
|
||||
#endif /* GCC_ALIAS_H */
|
||||
@@ -0,0 +1,83 @@
|
||||
/* Alignment-related classes.
|
||||
Copyright (C) 2018-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GCC; see the file COPYING3. If not see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Align flags tuple with alignment in log form and with a maximum skip. */
|
||||
|
||||
struct align_flags_tuple
|
||||
{
|
||||
/* Values of the -falign-* flags: how much to align labels in code.
|
||||
log is "align to 2^log" (so 0 means no alignment).
|
||||
maxskip is the maximum allowed amount of padding to insert. */
|
||||
int log;
|
||||
int maxskip;
|
||||
|
||||
/* Normalize filled values so that maxskip is not bigger than 1 << log. */
|
||||
void normalize ()
|
||||
{
|
||||
int n = (1 << log);
|
||||
if (maxskip > n)
|
||||
maxskip = n - 1;
|
||||
}
|
||||
|
||||
/* Return original value of an alignment flag. */
|
||||
int get_value ()
|
||||
{
|
||||
return maxskip + 1;
|
||||
}
|
||||
};
|
||||
|
||||
/* Alignment flags is structure used as value of -align-* options.
|
||||
It's used in target-dependant code. */
|
||||
|
||||
class align_flags
|
||||
{
|
||||
public:
|
||||
/* Default constructor. */
|
||||
align_flags (int log0 = 0, int maxskip0 = 0, int log1 = 0, int maxskip1 = 0)
|
||||
{
|
||||
levels[0].log = log0;
|
||||
levels[0].maxskip = maxskip0;
|
||||
levels[1].log = log1;
|
||||
levels[1].maxskip = maxskip1;
|
||||
normalize ();
|
||||
}
|
||||
|
||||
/* Normalize both components of align_flags. */
|
||||
void normalize ()
|
||||
{
|
||||
for (unsigned i = 0; i < 2; i++)
|
||||
levels[i].normalize ();
|
||||
}
|
||||
|
||||
/* Get alignment that is common bigger alignment of alignments F0 and F1. */
|
||||
static align_flags max (const align_flags f0, const align_flags f1)
|
||||
{
|
||||
int log0 = MAX (f0.levels[0].log, f1.levels[0].log);
|
||||
int maxskip0 = MAX (f0.levels[0].maxskip, f1.levels[0].maxskip);
|
||||
int log1 = MAX (f0.levels[1].log, f1.levels[1].log);
|
||||
int maxskip1 = MAX (f0.levels[1].maxskip, f1.levels[1].maxskip);
|
||||
return align_flags (log0, maxskip0, log1, maxskip1);
|
||||
}
|
||||
|
||||
align_flags_tuple levels[2];
|
||||
};
|
||||
|
||||
/* Define maximum supported code alignment. */
|
||||
#define MAX_CODE_ALIGN 16
|
||||
#define MAX_CODE_ALIGN_VALUE (1 << MAX_CODE_ALIGN)
|
||||
@@ -0,0 +1,8 @@
|
||||
#include "tree.def"
|
||||
END_OF_BASE_TREE_CODES
|
||||
#include "c-family/c-common.def"
|
||||
#include "ada/gcc-interface/ada-tree.def"
|
||||
#include "cp/cp-tree.def"
|
||||
#include "d/d-tree.def"
|
||||
#include "m2/m2-tree.def"
|
||||
#include "objc/objc-tree.def"
|
||||
@@ -0,0 +1,576 @@
|
||||
/* Functions to support a pool of allocatable objects
|
||||
Copyright (C) 1997-2023 Free Software Foundation, Inc.
|
||||
Contributed by Daniel Berlin <dan@cgsoftware.com>
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3, or (at your option)
|
||||
any later version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GCC; see the file COPYING3. If not see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
#ifndef ALLOC_POOL_H
|
||||
#define ALLOC_POOL_H
|
||||
|
||||
#include "memory-block.h"
|
||||
#include "options.h" // for flag_checking
|
||||
|
||||
extern void dump_alloc_pool_statistics (void);
|
||||
|
||||
/* Flag indicates whether memory statistics are gathered any longer. */
|
||||
extern bool after_memory_report;
|
||||
|
||||
typedef unsigned long ALLOC_POOL_ID_TYPE;
|
||||
|
||||
/* Last used ID. */
|
||||
extern ALLOC_POOL_ID_TYPE last_id;
|
||||
|
||||
/* Pool allocator memory usage. */
|
||||
class pool_usage: public mem_usage
|
||||
{
|
||||
public:
|
||||
/* Default contructor. */
|
||||
pool_usage (): m_element_size (0), m_pool_name ("") {}
|
||||
/* Constructor. */
|
||||
pool_usage (size_t allocated, size_t times, size_t peak,
|
||||
size_t instances, size_t element_size,
|
||||
const char *pool_name)
|
||||
: mem_usage (allocated, times, peak, instances),
|
||||
m_element_size (element_size),
|
||||
m_pool_name (pool_name) {}
|
||||
|
||||
/* Sum the usage with SECOND usage. */
|
||||
pool_usage
|
||||
operator+ (const pool_usage &second)
|
||||
{
|
||||
return pool_usage (m_allocated + second.m_allocated,
|
||||
m_times + second.m_times,
|
||||
m_peak + second.m_peak,
|
||||
m_instances + second.m_instances,
|
||||
m_element_size, m_pool_name);
|
||||
}
|
||||
|
||||
/* Dump usage coupled to LOC location, where TOTAL is sum of all rows. */
|
||||
inline void
|
||||
dump (mem_location *loc, const mem_usage &total) const
|
||||
{
|
||||
char *location_string = loc->to_string ();
|
||||
|
||||
fprintf (stderr, "%-32s%-48s " PRsa(5) PRsa(9) ":%5.1f%%"
|
||||
PRsa(9) PRsa(9) ":%5.1f%%%12" PRIu64 "\n",
|
||||
m_pool_name, location_string,
|
||||
SIZE_AMOUNT (m_instances),
|
||||
SIZE_AMOUNT (m_allocated),
|
||||
get_percent (m_allocated, total.m_allocated),
|
||||
SIZE_AMOUNT (m_peak),
|
||||
SIZE_AMOUNT (m_times),
|
||||
get_percent (m_times, total.m_times),
|
||||
(uint64_t)m_element_size);
|
||||
|
||||
free (location_string);
|
||||
}
|
||||
|
||||
/* Dump header with NAME. */
|
||||
static inline void
|
||||
dump_header (const char *name)
|
||||
{
|
||||
fprintf (stderr, "%-32s%-48s %6s%11s%16s%17s%12s\n", "Pool name", name,
|
||||
"Pools", "Leak", "Peak", "Times", "Elt size");
|
||||
}
|
||||
|
||||
/* Dump footer. */
|
||||
inline void
|
||||
dump_footer ()
|
||||
{
|
||||
fprintf (stderr, "%s" PRsa(82) PRsa(10) "\n", "Total",
|
||||
SIZE_AMOUNT (m_instances), SIZE_AMOUNT (m_allocated));
|
||||
}
|
||||
|
||||
/* Element size. */
|
||||
size_t m_element_size;
|
||||
/* Pool name. */
|
||||
const char *m_pool_name;
|
||||
};
|
||||
|
||||
extern mem_alloc_description<pool_usage> pool_allocator_usage;
|
||||
|
||||
#if 0
|
||||
/* If a pool with custom block size is needed, one might use the following
|
||||
template. An instance of this template can be used as a parameter for
|
||||
instantiating base_pool_allocator template:
|
||||
|
||||
typedef custom_block_allocator <128*1024> huge_block_allocator;
|
||||
...
|
||||
static base_pool_allocator <huge_block_allocator>
|
||||
value_pool ("value", 16384);
|
||||
|
||||
Right now it's not used anywhere in the code, and is given here as an
|
||||
example). */
|
||||
|
||||
template <size_t BlockSize>
|
||||
class custom_block_allocator
|
||||
{
|
||||
public:
|
||||
static const size_t block_size = BlockSize;
|
||||
|
||||
static inline void *
|
||||
allocate () ATTRIBUTE_MALLOC
|
||||
{
|
||||
return XNEWVEC (char, BlockSize);
|
||||
}
|
||||
|
||||
static inline void
|
||||
release (void *block)
|
||||
{
|
||||
XDELETEVEC (block);
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
/* Generic pool allocator. */
|
||||
|
||||
template <typename TBlockAllocator>
|
||||
class base_pool_allocator
|
||||
{
|
||||
public:
|
||||
/* Default constructor for pool allocator called NAME. */
|
||||
base_pool_allocator (const char *name, size_t size CXX_MEM_STAT_INFO);
|
||||
~base_pool_allocator ();
|
||||
void release ();
|
||||
void release_if_empty ();
|
||||
void *allocate () ATTRIBUTE_MALLOC;
|
||||
void remove (void *object);
|
||||
size_t num_elts_current ();
|
||||
|
||||
private:
|
||||
struct allocation_pool_list
|
||||
{
|
||||
allocation_pool_list *next;
|
||||
};
|
||||
|
||||
/* Initialize a pool allocator. */
|
||||
void initialize ();
|
||||
|
||||
struct allocation_object
|
||||
{
|
||||
#if CHECKING_P
|
||||
/* The ID of alloc pool which the object was allocated from. */
|
||||
ALLOC_POOL_ID_TYPE id;
|
||||
#endif
|
||||
|
||||
union
|
||||
{
|
||||
/* The data of the object. */
|
||||
char data[1];
|
||||
|
||||
/* Because we want any type of data to be well aligned after the ID,
|
||||
the following elements are here. They are never accessed so
|
||||
the allocated object may be even smaller than this structure.
|
||||
We do not care about alignment for floating-point types. */
|
||||
char *align_p;
|
||||
int64_t align_i;
|
||||
} u;
|
||||
|
||||
#if CHECKING_P
|
||||
static inline allocation_object*
|
||||
get_instance (void *data_ptr)
|
||||
{
|
||||
return (allocation_object *)(((char *)(data_ptr))
|
||||
- offsetof (allocation_object,
|
||||
u.data));
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline void*
|
||||
get_data (void *instance_ptr)
|
||||
{
|
||||
return (void*)(((allocation_object *) instance_ptr)->u.data);
|
||||
}
|
||||
};
|
||||
|
||||
/* Align X to 8. */
|
||||
static inline size_t
|
||||
align_eight (size_t x)
|
||||
{
|
||||
return (((x+7) >> 3) << 3);
|
||||
}
|
||||
|
||||
const char *m_name;
|
||||
ALLOC_POOL_ID_TYPE m_id;
|
||||
size_t m_elts_per_block;
|
||||
|
||||
/* These are the elements that have been allocated at least once
|
||||
and freed. */
|
||||
allocation_pool_list *m_returned_free_list;
|
||||
|
||||
/* These are the elements that have not yet been allocated out of
|
||||
the last block obtained from XNEWVEC. */
|
||||
char* m_virgin_free_list;
|
||||
|
||||
/* The number of elements in the virgin_free_list that can be
|
||||
allocated before needing another block. */
|
||||
size_t m_virgin_elts_remaining;
|
||||
/* The number of elements that are allocated. */
|
||||
size_t m_elts_allocated;
|
||||
/* The number of elements that are released. */
|
||||
size_t m_elts_free;
|
||||
/* The number of allocated blocks. */
|
||||
size_t m_blocks_allocated;
|
||||
/* List of blocks that are used to allocate new objects. */
|
||||
allocation_pool_list *m_block_list;
|
||||
/* Size of a pool elements in bytes. */
|
||||
size_t m_elt_size;
|
||||
/* Size in bytes that should be allocated for each element. */
|
||||
size_t m_size;
|
||||
/* Flag if a pool allocator is initialized. */
|
||||
bool m_initialized;
|
||||
/* Memory allocation location. */
|
||||
mem_location m_location;
|
||||
};
|
||||
|
||||
template <typename TBlockAllocator>
|
||||
inline
|
||||
base_pool_allocator <TBlockAllocator>::base_pool_allocator (
|
||||
const char *name, size_t size MEM_STAT_DECL):
|
||||
m_name (name), m_id (0), m_elts_per_block (0), m_returned_free_list (NULL),
|
||||
m_virgin_free_list (NULL), m_virgin_elts_remaining (0), m_elts_allocated (0),
|
||||
m_elts_free (0), m_blocks_allocated (0), m_block_list (NULL), m_elt_size (0),
|
||||
m_size (size), m_initialized (false),
|
||||
m_location (ALLOC_POOL_ORIGIN, false PASS_MEM_STAT) {}
|
||||
|
||||
/* Initialize a pool allocator. */
|
||||
|
||||
template <typename TBlockAllocator>
|
||||
inline void
|
||||
base_pool_allocator <TBlockAllocator>::initialize ()
|
||||
{
|
||||
gcc_checking_assert (!m_initialized);
|
||||
m_initialized = true;
|
||||
|
||||
size_t size = m_size;
|
||||
|
||||
gcc_checking_assert (m_name);
|
||||
gcc_checking_assert (m_size);
|
||||
|
||||
/* Make size large enough to store the list header. */
|
||||
if (size < sizeof (allocation_pool_list*))
|
||||
size = sizeof (allocation_pool_list*);
|
||||
|
||||
/* Now align the size to a multiple of 8. */
|
||||
size = align_eight (size);
|
||||
|
||||
/* Add the aligned size of ID. */
|
||||
size += offsetof (allocation_object, u.data);
|
||||
|
||||
m_elt_size = size;
|
||||
|
||||
if (GATHER_STATISTICS)
|
||||
{
|
||||
pool_usage *u = pool_allocator_usage.register_descriptor
|
||||
(this, new mem_location (m_location));
|
||||
|
||||
u->m_element_size = m_elt_size;
|
||||
u->m_pool_name = m_name;
|
||||
}
|
||||
|
||||
/* List header size should be a multiple of 8. */
|
||||
size_t header_size = align_eight (sizeof (allocation_pool_list));
|
||||
|
||||
m_elts_per_block = (TBlockAllocator::block_size - header_size) / size;
|
||||
gcc_checking_assert (m_elts_per_block != 0);
|
||||
|
||||
/* Increase the last used ID and use it for this pool.
|
||||
ID == 0 is used for free elements of pool so skip it. */
|
||||
last_id++;
|
||||
if (last_id == 0)
|
||||
last_id++;
|
||||
|
||||
m_id = last_id;
|
||||
}
|
||||
|
||||
/* Free all memory allocated for the given memory pool. */
|
||||
template <typename TBlockAllocator>
|
||||
inline void
|
||||
base_pool_allocator <TBlockAllocator>::release ()
|
||||
{
|
||||
if (!m_initialized)
|
||||
return;
|
||||
|
||||
allocation_pool_list *block, *next_block;
|
||||
|
||||
/* Free each block allocated to the pool. */
|
||||
for (block = m_block_list; block != NULL; block = next_block)
|
||||
{
|
||||
next_block = block->next;
|
||||
TBlockAllocator::release (block);
|
||||
}
|
||||
|
||||
if (GATHER_STATISTICS && !after_memory_report)
|
||||
{
|
||||
pool_allocator_usage.release_instance_overhead
|
||||
(this, (m_elts_allocated - m_elts_free) * m_elt_size);
|
||||
}
|
||||
|
||||
m_returned_free_list = NULL;
|
||||
m_virgin_free_list = NULL;
|
||||
m_virgin_elts_remaining = 0;
|
||||
m_elts_allocated = 0;
|
||||
m_elts_free = 0;
|
||||
m_blocks_allocated = 0;
|
||||
m_block_list = NULL;
|
||||
}
|
||||
|
||||
template <typename TBlockAllocator>
|
||||
inline void
|
||||
base_pool_allocator <TBlockAllocator>::release_if_empty ()
|
||||
{
|
||||
if (m_elts_free == m_elts_allocated)
|
||||
release ();
|
||||
}
|
||||
|
||||
template <typename TBlockAllocator>
|
||||
inline base_pool_allocator <TBlockAllocator>::~base_pool_allocator ()
|
||||
{
|
||||
release ();
|
||||
}
|
||||
|
||||
/* Allocates one element from the pool specified. */
|
||||
template <typename TBlockAllocator>
|
||||
inline void*
|
||||
base_pool_allocator <TBlockAllocator>::allocate ()
|
||||
{
|
||||
if (!m_initialized)
|
||||
initialize ();
|
||||
|
||||
allocation_pool_list *header;
|
||||
#ifdef ENABLE_VALGRIND_ANNOTATIONS
|
||||
int size;
|
||||
#endif
|
||||
|
||||
if (GATHER_STATISTICS)
|
||||
{
|
||||
pool_allocator_usage.register_instance_overhead (m_elt_size, this);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_VALGRIND_ANNOTATIONS
|
||||
size = m_elt_size - offsetof (allocation_object, u.data);
|
||||
#endif
|
||||
|
||||
/* If there are no more free elements, make some more!. */
|
||||
if (!m_returned_free_list)
|
||||
{
|
||||
char *block;
|
||||
if (!m_virgin_elts_remaining)
|
||||
{
|
||||
allocation_pool_list *block_header;
|
||||
|
||||
/* Make the block. */
|
||||
block = reinterpret_cast<char *> (TBlockAllocator::allocate ());
|
||||
block_header = new (block) allocation_pool_list;
|
||||
block += align_eight (sizeof (allocation_pool_list));
|
||||
|
||||
/* Throw it on the block list. */
|
||||
block_header->next = m_block_list;
|
||||
m_block_list = block_header;
|
||||
|
||||
/* Make the block available for allocation. */
|
||||
m_virgin_free_list = block;
|
||||
m_virgin_elts_remaining = m_elts_per_block;
|
||||
|
||||
/* Also update the number of elements we have free/allocated, and
|
||||
increment the allocated block count. */
|
||||
m_elts_allocated += m_elts_per_block;
|
||||
m_elts_free += m_elts_per_block;
|
||||
m_blocks_allocated += 1;
|
||||
}
|
||||
|
||||
/* We now know that we can take the first elt off the virgin list and
|
||||
put it on the returned list. */
|
||||
block = m_virgin_free_list;
|
||||
header = (allocation_pool_list*) allocation_object::get_data (block);
|
||||
header->next = NULL;
|
||||
|
||||
/* Mark the element to be free. */
|
||||
#if CHECKING_P
|
||||
((allocation_object*) block)->id = 0;
|
||||
#endif
|
||||
VALGRIND_DISCARD (VALGRIND_MAKE_MEM_NOACCESS (header,size));
|
||||
m_returned_free_list = header;
|
||||
m_virgin_free_list += m_elt_size;
|
||||
m_virgin_elts_remaining--;
|
||||
|
||||
}
|
||||
|
||||
/* Pull the first free element from the free list, and return it. */
|
||||
header = m_returned_free_list;
|
||||
VALGRIND_DISCARD (VALGRIND_MAKE_MEM_DEFINED (header, sizeof (*header)));
|
||||
m_returned_free_list = header->next;
|
||||
m_elts_free--;
|
||||
|
||||
/* Set the ID for element. */
|
||||
#if CHECKING_P
|
||||
allocation_object::get_instance (header)->id = m_id;
|
||||
#endif
|
||||
VALGRIND_DISCARD (VALGRIND_MAKE_MEM_UNDEFINED (header, size));
|
||||
|
||||
return (void *)(header);
|
||||
}
|
||||
|
||||
/* Puts PTR back on POOL's free list. */
|
||||
template <typename TBlockAllocator>
|
||||
inline void
|
||||
base_pool_allocator <TBlockAllocator>::remove (void *object)
|
||||
{
|
||||
int size = m_elt_size - offsetof (allocation_object, u.data);
|
||||
|
||||
if (flag_checking)
|
||||
{
|
||||
gcc_assert (m_initialized);
|
||||
gcc_assert (object
|
||||
/* Check if we free more than we allocated. */
|
||||
&& m_elts_free < m_elts_allocated);
|
||||
#if CHECKING_P
|
||||
/* Check whether the PTR was allocated from POOL. */
|
||||
gcc_assert (m_id == allocation_object::get_instance (object)->id);
|
||||
#endif
|
||||
|
||||
memset (object, 0xaf, size);
|
||||
}
|
||||
|
||||
#if CHECKING_P
|
||||
/* Mark the element to be free. */
|
||||
allocation_object::get_instance (object)->id = 0;
|
||||
#endif
|
||||
|
||||
allocation_pool_list *header = new (object) allocation_pool_list;
|
||||
header->next = m_returned_free_list;
|
||||
m_returned_free_list = header;
|
||||
VALGRIND_DISCARD (VALGRIND_MAKE_MEM_NOACCESS (object, size));
|
||||
m_elts_free++;
|
||||
|
||||
if (GATHER_STATISTICS)
|
||||
{
|
||||
pool_allocator_usage.release_instance_overhead (this, m_elt_size);
|
||||
}
|
||||
}
|
||||
|
||||
/* Number of elements currently active (not returned to pool). Used for cheap
|
||||
consistency checks. */
|
||||
template <typename TBlockAllocator>
|
||||
inline size_t
|
||||
base_pool_allocator <TBlockAllocator>::num_elts_current ()
|
||||
{
|
||||
return m_elts_allocated - m_elts_free;
|
||||
}
|
||||
|
||||
/* Specialization of base_pool_allocator which should be used in most cases.
|
||||
Another specialization may be needed, if object size is greater than
|
||||
memory_block_pool::block_size (64 KB). */
|
||||
typedef base_pool_allocator <memory_block_pool> pool_allocator;
|
||||
|
||||
/* Type based memory pool allocator. */
|
||||
template <typename T>
|
||||
class object_allocator
|
||||
{
|
||||
public:
|
||||
/* Default constructor for pool allocator called NAME. */
|
||||
object_allocator (const char *name CXX_MEM_STAT_INFO):
|
||||
m_allocator (name, sizeof (T) PASS_MEM_STAT) {}
|
||||
|
||||
inline void
|
||||
release ()
|
||||
{
|
||||
m_allocator.release ();
|
||||
}
|
||||
|
||||
inline void release_if_empty ()
|
||||
{
|
||||
m_allocator.release_if_empty ();
|
||||
}
|
||||
|
||||
|
||||
/* Allocate memory for instance of type T and call a default constructor. */
|
||||
|
||||
inline T *
|
||||
allocate () ATTRIBUTE_MALLOC
|
||||
{
|
||||
return ::new (m_allocator.allocate ()) T;
|
||||
}
|
||||
|
||||
/* Allocate memory for instance of type T and return void * that
|
||||
could be used in situations where a default constructor is not provided
|
||||
by the class T. */
|
||||
|
||||
inline void *
|
||||
allocate_raw () ATTRIBUTE_MALLOC
|
||||
{
|
||||
return m_allocator.allocate ();
|
||||
}
|
||||
|
||||
inline void
|
||||
remove (T *object)
|
||||
{
|
||||
/* Call destructor. */
|
||||
object->~T ();
|
||||
|
||||
m_allocator.remove (object);
|
||||
}
|
||||
|
||||
inline void
|
||||
remove_raw (void *object)
|
||||
{
|
||||
m_allocator.remove (object);
|
||||
}
|
||||
|
||||
inline size_t
|
||||
num_elts_current ()
|
||||
{
|
||||
return m_allocator.num_elts_current ();
|
||||
}
|
||||
|
||||
private:
|
||||
pool_allocator m_allocator;
|
||||
};
|
||||
|
||||
/* Store information about each particular alloc_pool. Note that this
|
||||
will underestimate the amount the amount of storage used by a small amount:
|
||||
1) The overhead in a pool is not accounted for.
|
||||
2) The unallocated elements in a block are not accounted for. Note
|
||||
that this can at worst case be one element smaller that the block
|
||||
size for that pool. */
|
||||
struct alloc_pool_descriptor
|
||||
{
|
||||
/* Number of pools allocated. */
|
||||
unsigned long created;
|
||||
/* Gross allocated storage. */
|
||||
unsigned long allocated;
|
||||
/* Amount of currently active storage. */
|
||||
unsigned long current;
|
||||
/* Peak amount of storage used. */
|
||||
unsigned long peak;
|
||||
/* Size of element in the pool. */
|
||||
int elt_size;
|
||||
};
|
||||
|
||||
/* Helper for classes that do not provide default ctor. */
|
||||
|
||||
template <typename T>
|
||||
inline void *
|
||||
operator new (size_t, object_allocator<T> &a)
|
||||
{
|
||||
return a.allocate_raw ();
|
||||
}
|
||||
|
||||
/* Hashtable mapping alloc_pool names to descriptors. */
|
||||
extern hash_map<const char *, alloc_pool_descriptor> *alloc_pool_hash;
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,354 @@
|
||||
/* Compiler compatibility macros
|
||||
Copyright (C) 1991-2023 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
/* For ease of writing code which uses GCC extensions but needs to be
|
||||
portable to other compilers, we provide the GCC_VERSION macro that
|
||||
simplifies testing __GNUC__ and __GNUC_MINOR__ together, and various
|
||||
wrappers around __attribute__. Also, __extension__ will be #defined
|
||||
to nothing if it doesn't work. See below. */
|
||||
|
||||
#ifndef _ANSIDECL_H
|
||||
#define _ANSIDECL_H 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Every source file includes this file,
|
||||
so they will all get the switch for lint. */
|
||||
/* LINTLIBRARY */
|
||||
|
||||
/* Using MACRO(x,y) in cpp #if conditionals does not work with some
|
||||
older preprocessors. Thus we can't define something like this:
|
||||
|
||||
#define HAVE_GCC_VERSION(MAJOR, MINOR) \
|
||||
(__GNUC__ > (MAJOR) || (__GNUC__ == (MAJOR) && __GNUC_MINOR__ >= (MINOR)))
|
||||
|
||||
and then test "#if HAVE_GCC_VERSION(2,7)".
|
||||
|
||||
So instead we use the macro below and test it against specific values. */
|
||||
|
||||
/* This macro simplifies testing whether we are using gcc, and if it
|
||||
is of a particular minimum version. (Both major & minor numbers are
|
||||
significant.) This macro will evaluate to 0 if we are not using
|
||||
gcc at all. */
|
||||
#ifndef GCC_VERSION
|
||||
#define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__)
|
||||
#endif /* GCC_VERSION */
|
||||
|
||||
/* inline requires special treatment; it's in C99, and GCC >=2.7 supports
|
||||
it too, but it's not in C89. */
|
||||
#undef inline
|
||||
#if (!defined(__cplusplus) && __STDC_VERSION__ >= 199901L) || defined(__cplusplus) || (defined(__SUNPRO_C) && defined(__C99FEATURES__))
|
||||
/* it's a keyword */
|
||||
#else
|
||||
# if GCC_VERSION >= 2007
|
||||
# define inline __inline__ /* __inline__ prevents -pedantic warnings */
|
||||
# else
|
||||
# define inline /* nothing */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Define macros for some gcc attributes. This permits us to use the
|
||||
macros freely, and know that they will come into play for the
|
||||
version of gcc in which they are supported. */
|
||||
|
||||
#if (GCC_VERSION < 2007)
|
||||
# define __attribute__(x)
|
||||
#endif
|
||||
|
||||
/* Attribute __malloc__ on functions was valid as of gcc 2.96. */
|
||||
#ifndef ATTRIBUTE_MALLOC
|
||||
# if (GCC_VERSION >= 2096)
|
||||
# define ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
|
||||
# else
|
||||
# define ATTRIBUTE_MALLOC
|
||||
# endif /* GNUC >= 2.96 */
|
||||
#endif /* ATTRIBUTE_MALLOC */
|
||||
|
||||
/* Attributes on labels were valid as of gcc 2.93 and g++ 4.5. For
|
||||
g++ an attribute on a label must be followed by a semicolon. */
|
||||
#ifndef ATTRIBUTE_UNUSED_LABEL
|
||||
# ifndef __cplusplus
|
||||
# if GCC_VERSION >= 2093
|
||||
# define ATTRIBUTE_UNUSED_LABEL ATTRIBUTE_UNUSED
|
||||
# else
|
||||
# define ATTRIBUTE_UNUSED_LABEL
|
||||
# endif
|
||||
# else
|
||||
# if GCC_VERSION >= 4005
|
||||
# define ATTRIBUTE_UNUSED_LABEL ATTRIBUTE_UNUSED ;
|
||||
# else
|
||||
# define ATTRIBUTE_UNUSED_LABEL
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Similarly to ARG_UNUSED below. Prior to GCC 3.4, the C++ frontend
|
||||
couldn't parse attributes placed after the identifier name, and now
|
||||
the entire compiler is built with C++. */
|
||||
#ifndef ATTRIBUTE_UNUSED
|
||||
#if GCC_VERSION >= 3004
|
||||
# define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
|
||||
#else
|
||||
#define ATTRIBUTE_UNUSED
|
||||
#endif
|
||||
#endif /* ATTRIBUTE_UNUSED */
|
||||
|
||||
/* Before GCC 3.4, the C++ frontend couldn't parse attributes placed after the
|
||||
identifier name. */
|
||||
#if ! defined(__cplusplus) || (GCC_VERSION >= 3004)
|
||||
# define ARG_UNUSED(NAME) NAME ATTRIBUTE_UNUSED
|
||||
#else /* !__cplusplus || GNUC >= 3.4 */
|
||||
# define ARG_UNUSED(NAME) NAME
|
||||
#endif /* !__cplusplus || GNUC >= 3.4 */
|
||||
|
||||
#ifndef ATTRIBUTE_NORETURN
|
||||
#define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
|
||||
#endif /* ATTRIBUTE_NORETURN */
|
||||
|
||||
/* Attribute `nonnull' was valid as of gcc 3.3. */
|
||||
#ifndef ATTRIBUTE_NONNULL
|
||||
# if (GCC_VERSION >= 3003)
|
||||
# define ATTRIBUTE_NONNULL(m) __attribute__ ((__nonnull__ (m)))
|
||||
# else
|
||||
# define ATTRIBUTE_NONNULL(m)
|
||||
# endif /* GNUC >= 3.3 */
|
||||
#endif /* ATTRIBUTE_NONNULL */
|
||||
|
||||
/* Attribute `returns_nonnull' was valid as of gcc 4.9. */
|
||||
#ifndef ATTRIBUTE_RETURNS_NONNULL
|
||||
# if (GCC_VERSION >= 4009)
|
||||
# define ATTRIBUTE_RETURNS_NONNULL __attribute__ ((__returns_nonnull__))
|
||||
# else
|
||||
# define ATTRIBUTE_RETURNS_NONNULL
|
||||
# endif /* GNUC >= 4.9 */
|
||||
#endif /* ATTRIBUTE_RETURNS_NONNULL */
|
||||
|
||||
/* Attribute `pure' was valid as of gcc 3.0. */
|
||||
#ifndef ATTRIBUTE_PURE
|
||||
# if (GCC_VERSION >= 3000)
|
||||
# define ATTRIBUTE_PURE __attribute__ ((__pure__))
|
||||
# else
|
||||
# define ATTRIBUTE_PURE
|
||||
# endif /* GNUC >= 3.0 */
|
||||
#endif /* ATTRIBUTE_PURE */
|
||||
|
||||
/* Use ATTRIBUTE_PRINTF when the format specifier must not be NULL.
|
||||
This was the case for the `printf' format attribute by itself
|
||||
before GCC 3.3, but as of 3.3 we need to add the `nonnull'
|
||||
attribute to retain this behavior. */
|
||||
#ifndef ATTRIBUTE_PRINTF
|
||||
#define ATTRIBUTE_PRINTF(m, n) __attribute__ ((__format__ (__printf__, m, n))) ATTRIBUTE_NONNULL(m)
|
||||
#define ATTRIBUTE_PRINTF_1 ATTRIBUTE_PRINTF(1, 2)
|
||||
#define ATTRIBUTE_PRINTF_2 ATTRIBUTE_PRINTF(2, 3)
|
||||
#define ATTRIBUTE_PRINTF_3 ATTRIBUTE_PRINTF(3, 4)
|
||||
#define ATTRIBUTE_PRINTF_4 ATTRIBUTE_PRINTF(4, 5)
|
||||
#define ATTRIBUTE_PRINTF_5 ATTRIBUTE_PRINTF(5, 6)
|
||||
#endif /* ATTRIBUTE_PRINTF */
|
||||
|
||||
/* Use ATTRIBUTE_FPTR_PRINTF when the format attribute is to be set on
|
||||
a function pointer. Format attributes were allowed on function
|
||||
pointers as of gcc 3.1. */
|
||||
#ifndef ATTRIBUTE_FPTR_PRINTF
|
||||
# if (GCC_VERSION >= 3001)
|
||||
# define ATTRIBUTE_FPTR_PRINTF(m, n) ATTRIBUTE_PRINTF(m, n)
|
||||
# else
|
||||
# define ATTRIBUTE_FPTR_PRINTF(m, n)
|
||||
# endif /* GNUC >= 3.1 */
|
||||
# define ATTRIBUTE_FPTR_PRINTF_1 ATTRIBUTE_FPTR_PRINTF(1, 2)
|
||||
# define ATTRIBUTE_FPTR_PRINTF_2 ATTRIBUTE_FPTR_PRINTF(2, 3)
|
||||
# define ATTRIBUTE_FPTR_PRINTF_3 ATTRIBUTE_FPTR_PRINTF(3, 4)
|
||||
# define ATTRIBUTE_FPTR_PRINTF_4 ATTRIBUTE_FPTR_PRINTF(4, 5)
|
||||
# define ATTRIBUTE_FPTR_PRINTF_5 ATTRIBUTE_FPTR_PRINTF(5, 6)
|
||||
#endif /* ATTRIBUTE_FPTR_PRINTF */
|
||||
|
||||
/* Use ATTRIBUTE_NULL_PRINTF when the format specifier may be NULL. A
|
||||
NULL format specifier was allowed as of gcc 3.3. */
|
||||
#ifndef ATTRIBUTE_NULL_PRINTF
|
||||
# if (GCC_VERSION >= 3003)
|
||||
# define ATTRIBUTE_NULL_PRINTF(m, n) __attribute__ ((__format__ (__printf__, m, n)))
|
||||
# else
|
||||
# define ATTRIBUTE_NULL_PRINTF(m, n)
|
||||
# endif /* GNUC >= 3.3 */
|
||||
# define ATTRIBUTE_NULL_PRINTF_1 ATTRIBUTE_NULL_PRINTF(1, 2)
|
||||
# define ATTRIBUTE_NULL_PRINTF_2 ATTRIBUTE_NULL_PRINTF(2, 3)
|
||||
# define ATTRIBUTE_NULL_PRINTF_3 ATTRIBUTE_NULL_PRINTF(3, 4)
|
||||
# define ATTRIBUTE_NULL_PRINTF_4 ATTRIBUTE_NULL_PRINTF(4, 5)
|
||||
# define ATTRIBUTE_NULL_PRINTF_5 ATTRIBUTE_NULL_PRINTF(5, 6)
|
||||
#endif /* ATTRIBUTE_NULL_PRINTF */
|
||||
|
||||
/* Attribute `sentinel' was valid as of gcc 3.5. */
|
||||
#ifndef ATTRIBUTE_SENTINEL
|
||||
# if (GCC_VERSION >= 3005)
|
||||
# define ATTRIBUTE_SENTINEL __attribute__ ((__sentinel__))
|
||||
# else
|
||||
# define ATTRIBUTE_SENTINEL
|
||||
# endif /* GNUC >= 3.5 */
|
||||
#endif /* ATTRIBUTE_SENTINEL */
|
||||
|
||||
|
||||
#ifndef ATTRIBUTE_ALIGNED_ALIGNOF
|
||||
# if (GCC_VERSION >= 3000)
|
||||
# define ATTRIBUTE_ALIGNED_ALIGNOF(m) __attribute__ ((__aligned__ (__alignof__ (m))))
|
||||
# else
|
||||
# define ATTRIBUTE_ALIGNED_ALIGNOF(m)
|
||||
# endif /* GNUC >= 3.0 */
|
||||
#endif /* ATTRIBUTE_ALIGNED_ALIGNOF */
|
||||
|
||||
/* Useful for structures whose layout must match some binary specification
|
||||
regardless of the alignment and padding qualities of the compiler. */
|
||||
#ifndef ATTRIBUTE_PACKED
|
||||
# define ATTRIBUTE_PACKED __attribute__ ((packed))
|
||||
#endif
|
||||
|
||||
/* Attribute `hot' and `cold' was valid as of gcc 4.3. */
|
||||
#ifndef ATTRIBUTE_COLD
|
||||
# if (GCC_VERSION >= 4003)
|
||||
# define ATTRIBUTE_COLD __attribute__ ((__cold__))
|
||||
# else
|
||||
# define ATTRIBUTE_COLD
|
||||
# endif /* GNUC >= 4.3 */
|
||||
#endif /* ATTRIBUTE_COLD */
|
||||
#ifndef ATTRIBUTE_HOT
|
||||
# if (GCC_VERSION >= 4003)
|
||||
# define ATTRIBUTE_HOT __attribute__ ((__hot__))
|
||||
# else
|
||||
# define ATTRIBUTE_HOT
|
||||
# endif /* GNUC >= 4.3 */
|
||||
#endif /* ATTRIBUTE_HOT */
|
||||
|
||||
/* Attribute 'no_sanitize_undefined' was valid as of gcc 4.9. */
|
||||
#ifndef ATTRIBUTE_NO_SANITIZE_UNDEFINED
|
||||
# if (GCC_VERSION >= 4009)
|
||||
# define ATTRIBUTE_NO_SANITIZE_UNDEFINED __attribute__ ((no_sanitize_undefined))
|
||||
# else
|
||||
# define ATTRIBUTE_NO_SANITIZE_UNDEFINED
|
||||
# endif /* GNUC >= 4.9 */
|
||||
#endif /* ATTRIBUTE_NO_SANITIZE_UNDEFINED */
|
||||
|
||||
/* Attribute 'nonstring' was valid as of gcc 8. */
|
||||
#ifndef ATTRIBUTE_NONSTRING
|
||||
# if GCC_VERSION >= 8000
|
||||
# define ATTRIBUTE_NONSTRING __attribute__ ((__nonstring__))
|
||||
# else
|
||||
# define ATTRIBUTE_NONSTRING
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Attribute `alloc_size' was valid as of gcc 4.3. */
|
||||
#ifndef ATTRIBUTE_RESULT_SIZE_1
|
||||
# if (GCC_VERSION >= 4003)
|
||||
# define ATTRIBUTE_RESULT_SIZE_1 __attribute__ ((alloc_size (1)))
|
||||
# else
|
||||
# define ATTRIBUTE_RESULT_SIZE_1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef ATTRIBUTE_RESULT_SIZE_2
|
||||
# if (GCC_VERSION >= 4003)
|
||||
# define ATTRIBUTE_RESULT_SIZE_2 __attribute__ ((alloc_size (2)))
|
||||
# else
|
||||
# define ATTRIBUTE_RESULT_SIZE_2
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef ATTRIBUTE_RESULT_SIZE_1_2
|
||||
# if (GCC_VERSION >= 4003)
|
||||
# define ATTRIBUTE_RESULT_SIZE_1_2 __attribute__ ((alloc_size (1, 2)))
|
||||
# else
|
||||
# define ATTRIBUTE_RESULT_SIZE_1_2
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Attribute `warn_unused_result' was valid as of gcc 3.3. */
|
||||
#ifndef ATTRIBUTE_WARN_UNUSED_RESULT
|
||||
# if GCC_VERSION >= 3003
|
||||
# define ATTRIBUTE_WARN_UNUSED_RESULT __attribute__ ((__warn_unused_result__))
|
||||
# else
|
||||
# define ATTRIBUTE_WARN_UNUSED_RESULT
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* We use __extension__ in some places to suppress -pedantic warnings
|
||||
about GCC extensions. This feature didn't work properly before
|
||||
gcc 2.8. */
|
||||
#if GCC_VERSION < 2008
|
||||
#define __extension__
|
||||
#endif
|
||||
|
||||
/* This is used to declare a const variable which should be visible
|
||||
outside of the current compilation unit. Use it as
|
||||
EXPORTED_CONST int i = 1;
|
||||
This is because the semantics of const are different in C and C++.
|
||||
"extern const" is permitted in C but it looks strange, and gcc
|
||||
warns about it when -Wc++-compat is not used. */
|
||||
#ifdef __cplusplus
|
||||
#define EXPORTED_CONST extern const
|
||||
#else
|
||||
#define EXPORTED_CONST const
|
||||
#endif
|
||||
|
||||
/* Be conservative and only use enum bitfields with C++ or GCC.
|
||||
FIXME: provide a complete autoconf test for buggy enum bitfields. */
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define ENUM_BITFIELD(TYPE) enum TYPE
|
||||
#elif (GCC_VERSION > 2000)
|
||||
#define ENUM_BITFIELD(TYPE) __extension__ enum TYPE
|
||||
#else
|
||||
#define ENUM_BITFIELD(TYPE) unsigned int
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus) && __cpp_constexpr >= 200704
|
||||
#define CONSTEXPR constexpr
|
||||
#else
|
||||
#define CONSTEXPR
|
||||
#endif
|
||||
|
||||
/* A macro to disable the copy constructor and assignment operator.
|
||||
When building with C++11 and above, the methods are explicitly
|
||||
deleted, causing a compile-time error if something tries to copy.
|
||||
For C++03, this just declares the methods, causing a link-time
|
||||
error if the methods end up called (assuming you don't
|
||||
define them). For C++03, for best results, place the macro
|
||||
under the private: access specifier, like this,
|
||||
|
||||
class name_lookup
|
||||
{
|
||||
private:
|
||||
DISABLE_COPY_AND_ASSIGN (name_lookup);
|
||||
};
|
||||
|
||||
so that most attempts at copy are caught at compile-time. */
|
||||
|
||||
#if defined(__cplusplus) && __cplusplus >= 201103
|
||||
#define DISABLE_COPY_AND_ASSIGN(TYPE) \
|
||||
TYPE (const TYPE&) = delete; \
|
||||
void operator= (const TYPE &) = delete
|
||||
#else
|
||||
#define DISABLE_COPY_AND_ASSIGN(TYPE) \
|
||||
TYPE (const TYPE&); \
|
||||
void operator= (const TYPE &)
|
||||
#endif /* __cplusplus >= 201103 */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ansidecl.h */
|
||||
@@ -0,0 +1,48 @@
|
||||
/* Descriptions of array-like objects.
|
||||
Copyright (C) 2019-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GCC; see the file COPYING3. If not see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef GCC_ARRAY_TRAITS_H
|
||||
#define GCC_ARRAY_TRAITS_H
|
||||
|
||||
/* Implementation for single integers (and similar types). */
|
||||
template<typename T, T zero = T (0)>
|
||||
struct scalar_array_traits
|
||||
{
|
||||
typedef T element_type;
|
||||
static const bool has_constant_size = true;
|
||||
static const size_t constant_size = 1;
|
||||
static const T *base (const T &x) { return &x; }
|
||||
static size_t size (const T &) { return 1; }
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct array_traits : scalar_array_traits<T> {};
|
||||
|
||||
/* Implementation for arrays with a static size. */
|
||||
template<typename T, size_t N>
|
||||
struct array_traits<T[N]>
|
||||
{
|
||||
typedef T element_type;
|
||||
static const bool has_constant_size = true;
|
||||
static const size_t constant_size = N;
|
||||
static const T *base (const T (&x)[N]) { return x; }
|
||||
static size_t size (const T (&)[N]) { return N; }
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,264 @@
|
||||
/* AddressSanitizer, a fast memory error detector.
|
||||
Copyright (C) 2011-2023 Free Software Foundation, Inc.
|
||||
Contributed by Kostya Serebryany <kcc@google.com>
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GCC; see the file COPYING3. If not see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef TREE_ASAN
|
||||
#define TREE_ASAN
|
||||
|
||||
extern void asan_function_start (void);
|
||||
extern void asan_finish_file (void);
|
||||
extern rtx_insn *asan_emit_stack_protection (rtx, rtx, unsigned int,
|
||||
HOST_WIDE_INT *, tree *, int);
|
||||
extern rtx_insn *asan_emit_allocas_unpoison (rtx, rtx, rtx_insn *);
|
||||
extern bool asan_protect_global (tree, bool ignore_decl_rtl_set_p = false);
|
||||
extern void initialize_sanitizer_builtins (void);
|
||||
extern tree asan_dynamic_init_call (bool);
|
||||
extern bool asan_expand_check_ifn (gimple_stmt_iterator *, bool);
|
||||
extern bool asan_expand_mark_ifn (gimple_stmt_iterator *);
|
||||
extern bool asan_expand_poison_ifn (gimple_stmt_iterator *, bool *,
|
||||
hash_map<tree, tree> &);
|
||||
extern rtx asan_memfn_rtl (tree);
|
||||
|
||||
extern void hwasan_record_frame_init ();
|
||||
extern void hwasan_record_stack_var (rtx, rtx, poly_int64, poly_int64);
|
||||
extern void hwasan_emit_prologue ();
|
||||
extern rtx_insn *hwasan_emit_untag_frame (rtx, rtx);
|
||||
extern rtx hwasan_get_frame_extent ();
|
||||
extern rtx hwasan_frame_base ();
|
||||
extern void hwasan_maybe_emit_frame_base_init (void);
|
||||
extern bool stack_vars_base_reg_p (rtx);
|
||||
extern uint8_t hwasan_current_frame_tag ();
|
||||
extern void hwasan_increment_frame_tag ();
|
||||
extern rtx hwasan_truncate_to_tag_size (rtx, rtx);
|
||||
extern void hwasan_finish_file (void);
|
||||
extern bool hwasan_sanitize_p (void);
|
||||
extern bool hwasan_sanitize_stack_p (void);
|
||||
extern bool hwasan_sanitize_allocas_p (void);
|
||||
extern bool hwasan_expand_check_ifn (gimple_stmt_iterator *, bool);
|
||||
extern bool hwasan_expand_mark_ifn (gimple_stmt_iterator *);
|
||||
extern bool gate_hwasan (void);
|
||||
|
||||
extern gimple_stmt_iterator create_cond_insert_point
|
||||
(gimple_stmt_iterator *, bool, bool, bool, basic_block *, basic_block *);
|
||||
|
||||
/* Alias set for accessing the shadow memory. */
|
||||
extern alias_set_type asan_shadow_set;
|
||||
|
||||
/* Hash set of labels that are either used in a goto, or their address
|
||||
has been taken. */
|
||||
extern hash_set <tree> *asan_used_labels;
|
||||
|
||||
/* Shadow memory is found at
|
||||
(address >> ASAN_SHADOW_SHIFT) + asan_shadow_offset (). */
|
||||
#define ASAN_SHADOW_SHIFT 3
|
||||
#define ASAN_SHADOW_GRANULARITY (1UL << ASAN_SHADOW_SHIFT)
|
||||
|
||||
/* Red zone size, stack and global variables are padded by ASAN_RED_ZONE_SIZE
|
||||
up to 2 * ASAN_RED_ZONE_SIZE - 1 bytes. */
|
||||
#define ASAN_RED_ZONE_SIZE 32
|
||||
|
||||
/* Stack variable use more compact red zones. The size includes also
|
||||
size of variable itself. */
|
||||
|
||||
#define ASAN_MIN_RED_ZONE_SIZE 16
|
||||
|
||||
/* Shadow memory values for stack protection. Left is below protected vars,
|
||||
the first pointer in stack corresponding to that offset contains
|
||||
ASAN_STACK_FRAME_MAGIC word, the second pointer to a string describing
|
||||
the frame. Middle is for padding in between variables, right is
|
||||
above the last protected variable and partial immediately after variables
|
||||
up to ASAN_RED_ZONE_SIZE alignment. */
|
||||
#define ASAN_STACK_MAGIC_LEFT 0xf1
|
||||
#define ASAN_STACK_MAGIC_MIDDLE 0xf2
|
||||
#define ASAN_STACK_MAGIC_RIGHT 0xf3
|
||||
#define ASAN_STACK_MAGIC_USE_AFTER_RET 0xf5
|
||||
#define ASAN_STACK_MAGIC_USE_AFTER_SCOPE 0xf8
|
||||
|
||||
#define ASAN_STACK_FRAME_MAGIC 0x41b58ab3
|
||||
#define ASAN_STACK_RETIRED_MAGIC 0x45e0360e
|
||||
|
||||
#define ASAN_USE_AFTER_SCOPE_ATTRIBUTE "use after scope memory"
|
||||
|
||||
/* NOTE: The values below and the hooks under targetm.memtag define an ABI and
|
||||
are hard-coded to these values in libhwasan, hence they can't be changed
|
||||
independently here. */
|
||||
/* How many bits are used to store a tag in a pointer.
|
||||
The default version uses the entire top byte of a pointer (i.e. 8 bits). */
|
||||
#define HWASAN_TAG_SIZE targetm.memtag.tag_size ()
|
||||
/* Tag Granule of HWASAN shadow stack.
|
||||
This is the size in real memory that each byte in the shadow memory refers
|
||||
to. I.e. if a variable is X bytes long in memory then its tag in shadow
|
||||
memory will span X / HWASAN_TAG_GRANULE_SIZE bytes.
|
||||
Most variables will need to be aligned to this amount since two variables
|
||||
that are neighbors in memory and share a tag granule would need to share the
|
||||
same tag (the shared tag granule can only store one tag). */
|
||||
#define HWASAN_TAG_GRANULE_SIZE targetm.memtag.granule_size ()
|
||||
/* Define the tag for the stack background.
|
||||
This defines what tag the stack pointer will be and hence what tag all
|
||||
variables that are not given special tags are (e.g. spilled registers,
|
||||
and parameters passed on the stack). */
|
||||
#define HWASAN_STACK_BACKGROUND gen_int_mode (0, QImode)
|
||||
|
||||
/* Various flags for Asan builtins. */
|
||||
enum asan_check_flags
|
||||
{
|
||||
ASAN_CHECK_STORE = 1 << 0,
|
||||
ASAN_CHECK_SCALAR_ACCESS = 1 << 1,
|
||||
ASAN_CHECK_NON_ZERO_LEN = 1 << 2,
|
||||
ASAN_CHECK_LAST = 1 << 3
|
||||
};
|
||||
|
||||
/* Flags for Asan check builtins. */
|
||||
#define IFN_ASAN_MARK_FLAGS DEF(POISON), DEF(UNPOISON)
|
||||
|
||||
enum asan_mark_flags
|
||||
{
|
||||
#define DEF(X) ASAN_MARK_##X
|
||||
IFN_ASAN_MARK_FLAGS
|
||||
#undef DEF
|
||||
};
|
||||
|
||||
/* Return true if STMT is ASAN_MARK with FLAG as first argument. */
|
||||
extern bool asan_mark_p (gimple *stmt, enum asan_mark_flags flag);
|
||||
|
||||
/* Return the size of padding needed to insert after a protected
|
||||
decl of SIZE. */
|
||||
|
||||
inline unsigned int
|
||||
asan_red_zone_size (unsigned int size)
|
||||
{
|
||||
unsigned int c = size & (ASAN_RED_ZONE_SIZE - 1);
|
||||
return c ? 2 * ASAN_RED_ZONE_SIZE - c : ASAN_RED_ZONE_SIZE;
|
||||
}
|
||||
|
||||
/* Return how much a stack variable occupis on a stack
|
||||
including a space for red zone. */
|
||||
|
||||
inline unsigned HOST_WIDE_INT
|
||||
asan_var_and_redzone_size (unsigned HOST_WIDE_INT size)
|
||||
{
|
||||
if (size <= 4)
|
||||
return 16;
|
||||
else if (size <= 16)
|
||||
return 32;
|
||||
else if (size <= 128)
|
||||
return size + 32;
|
||||
else if (size <= 512)
|
||||
return size + 64;
|
||||
else if (size <= 4096)
|
||||
return size + 128;
|
||||
else
|
||||
return size + 256;
|
||||
}
|
||||
|
||||
extern bool set_asan_shadow_offset (const char *);
|
||||
|
||||
extern bool asan_shadow_offset_set_p ();
|
||||
|
||||
extern void set_sanitized_sections (const char *);
|
||||
|
||||
extern bool asan_sanitize_stack_p (void);
|
||||
|
||||
extern bool asan_sanitize_allocas_p (void);
|
||||
|
||||
extern hash_set<tree> *asan_handled_variables;
|
||||
|
||||
/* Return TRUE if builtin with given FCODE will be intercepted by
|
||||
libasan. */
|
||||
|
||||
inline bool
|
||||
asan_intercepted_p (enum built_in_function fcode)
|
||||
{
|
||||
if (hwasan_sanitize_p ())
|
||||
return false;
|
||||
|
||||
return fcode == BUILT_IN_INDEX
|
||||
|| fcode == BUILT_IN_MEMCHR
|
||||
|| fcode == BUILT_IN_MEMCMP
|
||||
|| fcode == BUILT_IN_MEMCPY
|
||||
|| fcode == BUILT_IN_MEMMOVE
|
||||
|| fcode == BUILT_IN_MEMSET
|
||||
|| fcode == BUILT_IN_STRCASECMP
|
||||
|| fcode == BUILT_IN_STRCAT
|
||||
|| fcode == BUILT_IN_STRCHR
|
||||
|| fcode == BUILT_IN_STRCMP
|
||||
|| fcode == BUILT_IN_STRCPY
|
||||
|| fcode == BUILT_IN_STRDUP
|
||||
|| fcode == BUILT_IN_STRLEN
|
||||
|| fcode == BUILT_IN_STRNCASECMP
|
||||
|| fcode == BUILT_IN_STRNCAT
|
||||
|| fcode == BUILT_IN_STRNCMP
|
||||
|| fcode == BUILT_IN_STRCSPN
|
||||
|| fcode == BUILT_IN_STRPBRK
|
||||
|| fcode == BUILT_IN_STRSPN
|
||||
|| fcode == BUILT_IN_STRSTR
|
||||
|| fcode == BUILT_IN_STRNCPY;
|
||||
}
|
||||
|
||||
/* Return TRUE if we should instrument for use-after-scope sanity checking. */
|
||||
|
||||
inline bool
|
||||
asan_sanitize_use_after_scope (void)
|
||||
{
|
||||
return (flag_sanitize_address_use_after_scope
|
||||
&& (asan_sanitize_stack_p () || hwasan_sanitize_stack_p ()));
|
||||
}
|
||||
|
||||
/* Return true if DECL should be guarded on the stack. */
|
||||
|
||||
inline bool
|
||||
asan_protect_stack_decl (tree decl)
|
||||
{
|
||||
return DECL_P (decl)
|
||||
&& (!DECL_ARTIFICIAL (decl)
|
||||
|| (asan_sanitize_use_after_scope () && TREE_ADDRESSABLE (decl)));
|
||||
}
|
||||
|
||||
/* Return true when flag_sanitize & FLAG is non-zero. If FN is non-null,
|
||||
remove all flags mentioned in "no_sanitize" of DECL_ATTRIBUTES. */
|
||||
|
||||
inline bool
|
||||
sanitize_flags_p (unsigned int flag, const_tree fn = current_function_decl)
|
||||
{
|
||||
unsigned int result_flags = flag_sanitize & flag;
|
||||
if (result_flags == 0)
|
||||
return false;
|
||||
|
||||
if (fn != NULL_TREE)
|
||||
{
|
||||
tree value = lookup_attribute ("no_sanitize", DECL_ATTRIBUTES (fn));
|
||||
if (value)
|
||||
result_flags &= ~tree_to_uhwi (TREE_VALUE (value));
|
||||
}
|
||||
|
||||
return result_flags;
|
||||
}
|
||||
|
||||
/* Return true when coverage sanitization should happend for FN function. */
|
||||
|
||||
inline bool
|
||||
sanitize_coverage_p (const_tree fn = current_function_decl)
|
||||
{
|
||||
return (flag_sanitize_coverage
|
||||
&& (fn == NULL_TREE
|
||||
|| lookup_attribute ("no_sanitize_coverage",
|
||||
DECL_ATTRIBUTES (fn)) == NULL_TREE));
|
||||
}
|
||||
|
||||
#endif /* TREE_ASAN */
|
||||
@@ -0,0 +1,304 @@
|
||||
/* Handling of fnspec attribute specifiers
|
||||
Copyright (C) 2008-2023 Free Software Foundation, Inc.
|
||||
Contributed by Richard Guenther <rguenther@suse.de>
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GCC; see the file COPYING3. If not see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Parse string of attribute "fn spec". This is an internal attribute
|
||||
describing side effects of a function as follows:
|
||||
|
||||
character 0 specifies properties of return values as follows:
|
||||
'1'...'4' specifies number of argument function returns (as in memset)
|
||||
'm' specifies that returned value is noalias (as in malloc)
|
||||
'.' specifies that nothing is known.
|
||||
character 1 specifies additional function properties
|
||||
' ' specifies that nothing is known
|
||||
'p' or 'P' specifies that function is pure except for described side
|
||||
effects.
|
||||
'c' or 'C' specifies that function is const except for described side
|
||||
effects.
|
||||
The uppercase letter in addition specifies that function clobbers errno.
|
||||
|
||||
character 2+2i specifies properties of argument number i as follows:
|
||||
'x' or 'X' specifies that parameter is unused.
|
||||
'r' or 'R' specifies that the memory pointed to by the parameter is only
|
||||
read and does not escape
|
||||
'o' or 'O' specifies that the memory pointed to by the parameter is only
|
||||
written and does not escape
|
||||
'w' or 'W' specifies that the memory pointed to by the parameter does not
|
||||
escape
|
||||
'1'....'9' specifies that the memory pointed to by the parameter is
|
||||
copied to memory pointed to by different parameter
|
||||
(as in memcpy).
|
||||
'.' specifies that nothing is known.
|
||||
The uppercase letter in addition specifies that the memory pointed to
|
||||
by the parameter is not dereferenced. For 'r' only read applies
|
||||
transitively to pointers read from the pointed-to memory.
|
||||
|
||||
character 3+2i specifies additional properties of argument number i
|
||||
as follows:
|
||||
' ' nothing is known
|
||||
't' the size of value written/read corresponds to the size of
|
||||
of the pointed-to type of the argument type
|
||||
'1'...'9' specifies the size of value written/read is bound by the
|
||||
specified argument
|
||||
*/
|
||||
|
||||
#ifndef ATTR_FNSPEC_H
|
||||
#define ATTR_FNSPEC_H
|
||||
|
||||
class attr_fnspec
|
||||
{
|
||||
private:
|
||||
/* fn spec attribute string. */
|
||||
const char *str;
|
||||
/* length of the fn spec string. */
|
||||
const unsigned len;
|
||||
/* Number of characters specifying return value. */
|
||||
const unsigned int return_desc_size = 2;
|
||||
/* Number of characters specifying size. */
|
||||
const unsigned int arg_desc_size = 2;
|
||||
|
||||
/* Return start of specifier of arg i. */
|
||||
unsigned int arg_idx (int i)
|
||||
{
|
||||
return return_desc_size + arg_desc_size * i;
|
||||
}
|
||||
|
||||
public:
|
||||
attr_fnspec (const char *str, unsigned len)
|
||||
: str (str), len (len)
|
||||
{
|
||||
if (flag_checking)
|
||||
verify ();
|
||||
}
|
||||
attr_fnspec (const char *str)
|
||||
: str (str), len (strlen (str))
|
||||
{
|
||||
if (flag_checking)
|
||||
verify ();
|
||||
}
|
||||
attr_fnspec (const_tree identifier)
|
||||
: str (TREE_STRING_POINTER (identifier)),
|
||||
len (TREE_STRING_LENGTH (identifier))
|
||||
{
|
||||
if (flag_checking)
|
||||
verify ();
|
||||
}
|
||||
attr_fnspec ()
|
||||
: str (NULL), len (0)
|
||||
{
|
||||
}
|
||||
|
||||
/* Return true if fn spec is known. */
|
||||
bool
|
||||
known_p ()
|
||||
{
|
||||
return len;
|
||||
}
|
||||
|
||||
/* Return true if arg I is specified. */
|
||||
bool
|
||||
arg_specified_p (unsigned int i)
|
||||
{
|
||||
return len >= arg_idx (i + 1);
|
||||
}
|
||||
|
||||
/* True if the argument is not dereferenced recursively, thus only
|
||||
directly reachable memory is read or written. */
|
||||
bool
|
||||
arg_direct_p (unsigned int i)
|
||||
{
|
||||
unsigned int idx = arg_idx (i);
|
||||
gcc_checking_assert (arg_specified_p (i));
|
||||
return str[idx] == 'R' || str[idx] == 'O'
|
||||
|| str[idx] == 'W' || (str[idx] >= '1' && str[idx] <= '9');
|
||||
}
|
||||
|
||||
/* True if argument is used. */
|
||||
bool
|
||||
arg_used_p (unsigned int i)
|
||||
{
|
||||
unsigned int idx = arg_idx (i);
|
||||
gcc_checking_assert (arg_specified_p (i));
|
||||
return str[idx] != 'x' && str[idx] != 'X';
|
||||
}
|
||||
|
||||
/* True if memory reached by the argument is readonly (not clobbered). */
|
||||
bool
|
||||
arg_readonly_p (unsigned int i)
|
||||
{
|
||||
unsigned int idx = arg_idx (i);
|
||||
gcc_checking_assert (arg_specified_p (i));
|
||||
return str[idx] == 'r' || str[idx] == 'R' || (str[idx] >= '1' && str[idx] <= '9');
|
||||
}
|
||||
|
||||
/* True if memory reached by the argument is read (directly or indirectly) */
|
||||
bool
|
||||
arg_maybe_read_p (unsigned int i)
|
||||
{
|
||||
unsigned int idx = arg_idx (i);
|
||||
gcc_checking_assert (arg_specified_p (i));
|
||||
return str[idx] != 'o' && str[idx] != 'O'
|
||||
&& str[idx] != 'x' && str[idx] != 'X';
|
||||
}
|
||||
|
||||
/* True if memory reached by the argument is written.
|
||||
(directly or indirectly) */
|
||||
bool
|
||||
arg_maybe_written_p (unsigned int i)
|
||||
{
|
||||
unsigned int idx = arg_idx (i);
|
||||
gcc_checking_assert (arg_specified_p (i));
|
||||
return str[idx] != 'r' && str[idx] != 'R'
|
||||
&& (str[idx] < '1' || str[idx] > '9')
|
||||
&& str[idx] != 'x' && str[idx] != 'X';
|
||||
}
|
||||
|
||||
/* Return true if load of memory pointed to by argument I is bound
|
||||
by another argument. In this case set ARG. */
|
||||
bool
|
||||
arg_max_access_size_given_by_arg_p (unsigned int i, unsigned int *arg)
|
||||
{
|
||||
unsigned int idx = arg_idx (i);
|
||||
gcc_checking_assert (arg_specified_p (i));
|
||||
if (str[idx + 1] >= '1' && str[idx + 1] <= '9')
|
||||
{
|
||||
*arg = str[idx + 1] - '1';
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Return true if the pointed-to type of the argument correspond to the
|
||||
size of the memory acccess. */
|
||||
bool
|
||||
arg_access_size_given_by_type_p (unsigned int i)
|
||||
{
|
||||
unsigned int idx = arg_idx (i);
|
||||
gcc_checking_assert (arg_specified_p (i));
|
||||
return str[idx + 1] == 't';
|
||||
}
|
||||
|
||||
/* Return true if memory pointer to by argument is copied to a memory
|
||||
pointed to by a different argument (as in memcpy).
|
||||
In this case set ARG. */
|
||||
bool
|
||||
arg_copied_to_arg_p (unsigned int i, unsigned int *arg)
|
||||
{
|
||||
unsigned int idx = arg_idx (i);
|
||||
gcc_checking_assert (arg_specified_p (i));
|
||||
if (str[idx] < '1' || str[idx] > '9')
|
||||
return false;
|
||||
*arg = str[idx] - '1';
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/* True if the argument does not escape. */
|
||||
bool
|
||||
arg_noescape_p (unsigned int i)
|
||||
{
|
||||
unsigned int idx = arg_idx (i);
|
||||
gcc_checking_assert (arg_specified_p (i));
|
||||
return str[idx] == 'w' || str[idx] == 'W'
|
||||
|| str[idx] == 'r' || str[idx] == 'R'
|
||||
|| str[idx] == 'o' || str[idx] == 'O';
|
||||
}
|
||||
|
||||
/* Return true if function returns value of its parameter. If ARG_NO is
|
||||
non-NULL return initialize it to the argument returned. */
|
||||
bool
|
||||
returns_arg (unsigned int *arg_no)
|
||||
{
|
||||
if (str[0] >= '1' && str[0] <= '4')
|
||||
{
|
||||
if (arg_no)
|
||||
*arg_no = str[0] - '1';
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Nonzero if the return value does not alias with anything. Functions
|
||||
with the malloc attribute have this set on their return value. */
|
||||
bool
|
||||
returns_noalias_p ()
|
||||
{
|
||||
return str[0] == 'm';
|
||||
}
|
||||
|
||||
/* Return true if all memory read by the function is specified by fnspec. */
|
||||
bool
|
||||
global_memory_read_p ()
|
||||
{
|
||||
return str[1] != 'c' && str[1] != 'C';
|
||||
}
|
||||
|
||||
/* Return true if all memory written by the function
|
||||
is specified by fnspec. */
|
||||
bool
|
||||
global_memory_written_p ()
|
||||
{
|
||||
return str[1] != 'c' && str[1] != 'C' && str[1] != 'p' && str[1] != 'P';
|
||||
}
|
||||
|
||||
bool
|
||||
errno_maybe_written_p ()
|
||||
{
|
||||
return str[1] == 'C' || str[1] == 'P';
|
||||
}
|
||||
|
||||
/* Return EAF flags for arg I. */
|
||||
int
|
||||
arg_eaf_flags (unsigned int i)
|
||||
{
|
||||
int flags = 0;
|
||||
|
||||
if (!arg_specified_p (i))
|
||||
;
|
||||
else if (!arg_used_p (i))
|
||||
flags = EAF_UNUSED;
|
||||
else
|
||||
{
|
||||
if (arg_direct_p (i))
|
||||
flags |= EAF_NO_INDIRECT_READ | EAF_NO_INDIRECT_ESCAPE
|
||||
| EAF_NOT_RETURNED_INDIRECTLY | EAF_NO_INDIRECT_CLOBBER;
|
||||
if (arg_noescape_p (i))
|
||||
flags |= EAF_NO_DIRECT_ESCAPE | EAF_NO_INDIRECT_ESCAPE;
|
||||
if (arg_readonly_p (i))
|
||||
flags |= EAF_NO_DIRECT_CLOBBER | EAF_NO_INDIRECT_CLOBBER;
|
||||
}
|
||||
return flags;
|
||||
}
|
||||
|
||||
/* Check validity of the string. */
|
||||
void verify ();
|
||||
|
||||
/* Return the fnspec string. */
|
||||
const char *
|
||||
get_str ()
|
||||
{
|
||||
return str;
|
||||
}
|
||||
};
|
||||
|
||||
extern attr_fnspec gimple_call_fnspec (const gcall *stmt);
|
||||
extern attr_fnspec builtin_fnspec (tree);
|
||||
|
||||
#endif /* ATTR_FNSPEC_H */
|
||||
@@ -0,0 +1,401 @@
|
||||
/* Declarations and definitions dealing with attribute handling.
|
||||
Copyright (C) 2013-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GCC; see the file COPYING3. If not see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef GCC_ATTRIBS_H
|
||||
#define GCC_ATTRIBS_H
|
||||
|
||||
extern const struct attribute_spec *lookup_attribute_spec (const_tree);
|
||||
extern void free_attr_data ();
|
||||
extern void init_attributes (void);
|
||||
|
||||
/* Process the attributes listed in ATTRIBUTES and install them in *NODE,
|
||||
which is either a DECL (including a TYPE_DECL) or a TYPE. If a DECL,
|
||||
it should be modified in place; if a TYPE, a copy should be created
|
||||
unless ATTR_FLAG_TYPE_IN_PLACE is set in FLAGS. FLAGS gives further
|
||||
information, in the form of a bitwise OR of flags in enum attribute_flags
|
||||
from tree.h. Depending on these flags, some attributes may be
|
||||
returned to be applied at a later stage (for example, to apply
|
||||
a decl attribute to the declaration rather than to its type). */
|
||||
extern tree decl_attributes (tree *, tree, int, tree = NULL_TREE);
|
||||
|
||||
extern bool cxx11_attribute_p (const_tree);
|
||||
extern tree get_attribute_name (const_tree);
|
||||
extern tree get_attribute_namespace (const_tree);
|
||||
extern void apply_tm_attr (tree, tree);
|
||||
extern tree make_attribute (const char *, const char *, tree);
|
||||
extern bool attribute_ignored_p (tree);
|
||||
extern bool attribute_ignored_p (const attribute_spec *const);
|
||||
|
||||
extern struct scoped_attributes* register_scoped_attributes (const struct attribute_spec *,
|
||||
const char *,
|
||||
bool = false);
|
||||
|
||||
extern char *sorted_attr_string (tree);
|
||||
extern bool common_function_versions (tree, tree);
|
||||
extern tree make_dispatcher_decl (const tree);
|
||||
extern bool is_function_default_version (const tree);
|
||||
extern void handle_ignored_attributes_option (vec<char *> *);
|
||||
|
||||
/* Return a type like TTYPE except that its TYPE_ATTRIBUTES
|
||||
is ATTRIBUTE.
|
||||
|
||||
Such modified types already made are recorded so that duplicates
|
||||
are not made. */
|
||||
|
||||
extern tree build_type_attribute_variant (tree, tree);
|
||||
extern tree build_decl_attribute_variant (tree, tree);
|
||||
extern tree build_type_attribute_qual_variant (tree, tree, int);
|
||||
|
||||
extern bool simple_cst_list_equal (const_tree, const_tree);
|
||||
extern bool attribute_value_equal (const_tree, const_tree);
|
||||
|
||||
/* Return 0 if the attributes for two types are incompatible, 1 if they
|
||||
are compatible, and 2 if they are nearly compatible (which causes a
|
||||
warning to be generated). */
|
||||
extern int comp_type_attributes (const_tree, const_tree);
|
||||
|
||||
extern tree affects_type_identity_attributes (tree, bool = true);
|
||||
extern tree restrict_type_identity_attributes_to (tree, tree);
|
||||
|
||||
/* Default versions of target-overridable functions. */
|
||||
extern tree merge_decl_attributes (tree, tree);
|
||||
extern tree merge_type_attributes (tree, tree);
|
||||
|
||||
/* Remove any instances of attribute ATTR_NAME in LIST and return the
|
||||
modified list. */
|
||||
|
||||
extern tree remove_attribute (const char *, tree);
|
||||
|
||||
/* Similarly but also with specific attribute namespace. */
|
||||
|
||||
extern tree remove_attribute (const char *, const char *, tree);
|
||||
|
||||
/* Given two attributes lists, return a list of their union. */
|
||||
|
||||
extern tree merge_attributes (tree, tree);
|
||||
|
||||
/* Duplicate all attributes with name NAME in ATTR list to *ATTRS if
|
||||
they are missing there. */
|
||||
|
||||
extern void duplicate_one_attribute (tree *, tree, const char *);
|
||||
|
||||
/* Duplicate all attributes from user DECL to the corresponding
|
||||
builtin that should be propagated. */
|
||||
|
||||
extern void copy_attributes_to_builtin (tree);
|
||||
|
||||
/* Given two Windows decl attributes lists, possibly including
|
||||
dllimport, return a list of their union . */
|
||||
extern tree merge_dllimport_decl_attributes (tree, tree);
|
||||
|
||||
/* Handle a "dllimport" or "dllexport" attribute. */
|
||||
extern tree handle_dll_attribute (tree *, tree, tree, int, bool *);
|
||||
|
||||
extern int attribute_list_equal (const_tree, const_tree);
|
||||
extern int attribute_list_contained (const_tree, const_tree);
|
||||
|
||||
/* The backbone of lookup_attribute(). ATTR_LEN is the string length
|
||||
of ATTR_NAME, and LIST is not NULL_TREE.
|
||||
|
||||
The function is called from lookup_attribute in order to optimize
|
||||
for size. */
|
||||
extern tree private_lookup_attribute (const char *attr_name, size_t attr_len,
|
||||
tree list);
|
||||
extern tree private_lookup_attribute (const char *attr_ns,
|
||||
const char *attr_name,
|
||||
size_t attr_ns_len, size_t attr_len,
|
||||
tree list);
|
||||
|
||||
extern unsigned decls_mismatched_attributes (tree, tree, tree,
|
||||
const char* const[],
|
||||
pretty_printer*);
|
||||
|
||||
extern void maybe_diag_alias_attributes (tree, tree);
|
||||
|
||||
/* For a given string S of length L, strip leading and trailing '_' characters
|
||||
so that we have a canonical form of attribute names. NB: This function may
|
||||
change S and L. */
|
||||
|
||||
template <typename T>
|
||||
inline bool
|
||||
canonicalize_attr_name (const char *&s, T &l)
|
||||
{
|
||||
if (l > 4 && s[0] == '_' && s[1] == '_' && s[l - 1] == '_' && s[l - 2] == '_')
|
||||
{
|
||||
s += 2;
|
||||
l -= 4;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* For a given IDENTIFIER_NODE, strip leading and trailing '_' characters
|
||||
so that we have a canonical form of attribute names. */
|
||||
|
||||
inline tree
|
||||
canonicalize_attr_name (tree attr_name)
|
||||
{
|
||||
size_t l = IDENTIFIER_LENGTH (attr_name);
|
||||
const char *s = IDENTIFIER_POINTER (attr_name);
|
||||
|
||||
if (canonicalize_attr_name (s, l))
|
||||
return get_identifier_with_length (s, l);
|
||||
|
||||
return attr_name;
|
||||
}
|
||||
|
||||
/* Compare attribute identifiers ATTR1 and ATTR2 with length ATTR1_LEN and
|
||||
ATTR2_LEN. */
|
||||
|
||||
inline bool
|
||||
cmp_attribs (const char *attr1, size_t attr1_len,
|
||||
const char *attr2, size_t attr2_len)
|
||||
{
|
||||
return attr1_len == attr2_len && strncmp (attr1, attr2, attr1_len) == 0;
|
||||
}
|
||||
|
||||
/* Compare attribute identifiers ATTR1 and ATTR2. */
|
||||
|
||||
inline bool
|
||||
cmp_attribs (const char *attr1, const char *attr2)
|
||||
{
|
||||
return cmp_attribs (attr1, strlen (attr1), attr2, strlen (attr2));
|
||||
}
|
||||
|
||||
/* Given an identifier node IDENT and a string ATTR_NAME, return true
|
||||
if the identifier node is a valid attribute name for the string. */
|
||||
|
||||
inline bool
|
||||
is_attribute_p (const char *attr_name, const_tree ident)
|
||||
{
|
||||
return cmp_attribs (attr_name, strlen (attr_name),
|
||||
IDENTIFIER_POINTER (ident), IDENTIFIER_LENGTH (ident));
|
||||
}
|
||||
|
||||
/* Given an attribute ATTR and a string ATTR_NS, return true
|
||||
if the attribute namespace is valid for the string. ATTR_NS "" stands
|
||||
for standard attribute (NULL get_attribute_namespace) or "gnu"
|
||||
namespace. */
|
||||
|
||||
inline bool
|
||||
is_attribute_namespace_p (const char *attr_ns, const_tree attr)
|
||||
{
|
||||
tree ident = get_attribute_namespace (attr);
|
||||
if (attr_ns == NULL)
|
||||
return ident == NULL_TREE;
|
||||
if (attr_ns[0])
|
||||
return ident && is_attribute_p (attr_ns, ident);
|
||||
return ident == NULL_TREE || is_attribute_p ("gnu", ident);
|
||||
}
|
||||
|
||||
/* Given an attribute name ATTR_NAME and a list of attributes LIST,
|
||||
return a pointer to the attribute's list element if the attribute
|
||||
is part of the list, or NULL_TREE if not found. If the attribute
|
||||
appears more than once, this only returns the first occurrence; the
|
||||
TREE_CHAIN of the return value should be passed back in if further
|
||||
occurrences are wanted. ATTR_NAME must be in the form 'text' (not
|
||||
'__text__'). */
|
||||
|
||||
inline tree
|
||||
lookup_attribute (const char *attr_name, tree list)
|
||||
{
|
||||
if (CHECKING_P && attr_name[0] != '_')
|
||||
{
|
||||
size_t attr_len = strlen (attr_name);
|
||||
gcc_checking_assert (!canonicalize_attr_name (attr_name, attr_len));
|
||||
}
|
||||
/* In most cases, list is NULL_TREE. */
|
||||
if (list == NULL_TREE)
|
||||
return NULL_TREE;
|
||||
else
|
||||
{
|
||||
size_t attr_len = strlen (attr_name);
|
||||
/* Do the strlen() before calling the out-of-line implementation.
|
||||
In most cases attr_name is a string constant, and the compiler
|
||||
will optimize the strlen() away. */
|
||||
return private_lookup_attribute (attr_name, attr_len, list);
|
||||
}
|
||||
}
|
||||
|
||||
/* Similar to lookup_attribute, but also match the attribute namespace.
|
||||
ATTR_NS "" stands for either standard attribute or "gnu" namespace. */
|
||||
|
||||
inline tree
|
||||
lookup_attribute (const char *attr_ns, const char *attr_name, tree list)
|
||||
{
|
||||
if (CHECKING_P && attr_name[0] != '_')
|
||||
{
|
||||
size_t attr_len = strlen (attr_name);
|
||||
gcc_checking_assert (!canonicalize_attr_name (attr_name, attr_len));
|
||||
}
|
||||
if (CHECKING_P && attr_ns && attr_ns[0] != '_')
|
||||
{
|
||||
size_t attr_ns_len = strlen (attr_ns);
|
||||
gcc_checking_assert (!canonicalize_attr_name (attr_ns, attr_ns_len));
|
||||
}
|
||||
/* In most cases, list is NULL_TREE. */
|
||||
if (list == NULL_TREE)
|
||||
return NULL_TREE;
|
||||
else
|
||||
{
|
||||
size_t attr_ns_len = attr_ns ? strlen (attr_ns) : 0;
|
||||
size_t attr_len = strlen (attr_name);
|
||||
/* Do the strlen() before calling the out-of-line implementation.
|
||||
In most cases attr_name is a string constant, and the compiler
|
||||
will optimize the strlen() away. */
|
||||
return private_lookup_attribute (attr_ns, attr_name,
|
||||
attr_ns_len, attr_len, list);
|
||||
}
|
||||
}
|
||||
|
||||
/* Given an attribute name ATTR_NAME and a list of attributes LIST,
|
||||
return a pointer to the attribute's list first element if the attribute
|
||||
starts with ATTR_NAME. ATTR_NAME must be in the form 'text' (not
|
||||
'__text__'). */
|
||||
|
||||
inline tree
|
||||
lookup_attribute_by_prefix (const char *attr_name, tree list)
|
||||
{
|
||||
gcc_checking_assert (attr_name[0] != '_');
|
||||
/* In most cases, list is NULL_TREE. */
|
||||
if (list == NULL_TREE)
|
||||
return NULL_TREE;
|
||||
else
|
||||
{
|
||||
size_t attr_len = strlen (attr_name);
|
||||
while (list)
|
||||
{
|
||||
tree name = get_attribute_name (list);
|
||||
size_t ident_len = IDENTIFIER_LENGTH (name);
|
||||
|
||||
if (attr_len > ident_len)
|
||||
{
|
||||
list = TREE_CHAIN (list);
|
||||
continue;
|
||||
}
|
||||
|
||||
const char *p = IDENTIFIER_POINTER (name);
|
||||
gcc_checking_assert (attr_len == 0 || p[0] != '_'
|
||||
|| (ident_len > 1 && p[1] != '_'));
|
||||
if (strncmp (attr_name, p, attr_len) == 0)
|
||||
break;
|
||||
|
||||
list = TREE_CHAIN (list);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
/* Description of a function argument declared with attribute access.
|
||||
Used as an "iterator" over all such arguments in a function declaration
|
||||
or call. */
|
||||
|
||||
struct attr_access
|
||||
{
|
||||
/* The beginning and end of the internal string representation. */
|
||||
const char *str, *end;
|
||||
/* The attribute pointer argument. */
|
||||
tree ptr;
|
||||
/* For a declaration, a TREE_CHAIN of VLA bound expressions stored
|
||||
in TREE_VALUE and their positions in the argument list (stored
|
||||
in TREE_PURPOSE). Each expression may be a PARM_DECL or some
|
||||
other DECL (for ordinary variables), or an EXPR for other
|
||||
expressions (e.g., funcion calls). */
|
||||
tree size;
|
||||
|
||||
/* The zero-based position of each of the formal function arguments.
|
||||
For the optional SIZARG, UINT_MAX when not specified. For VLAs
|
||||
with multiple variable bounds, SIZARG is the position corresponding
|
||||
to the most significant bound in the argument list. Positions of
|
||||
subsequent bounds are in the TREE_PURPOSE field of the SIZE chain. */
|
||||
unsigned ptrarg;
|
||||
unsigned sizarg;
|
||||
/* For internal specifications only, the constant minimum size of
|
||||
the array, zero if not specified, and HWI_M1U for the unspecified
|
||||
VLA [*] notation. Meaningless for external (explicit) access
|
||||
specifications. */
|
||||
unsigned HOST_WIDE_INT minsize;
|
||||
|
||||
/* The access mode. */
|
||||
access_mode mode;
|
||||
|
||||
/* Set for an attribute added internally rather than by an explicit
|
||||
declaration. */
|
||||
bool internal_p;
|
||||
/* Set for the T[static MINSIZE] array notation for nonzero MINSIZE
|
||||
less than HWI_M1U. */
|
||||
bool static_p;
|
||||
|
||||
/* Return the number of specified VLA bounds. */
|
||||
unsigned vla_bounds (unsigned *) const;
|
||||
|
||||
/* Return internal representation as STRING_CST. */
|
||||
tree to_internal_string () const;
|
||||
|
||||
/* Return the human-readable representation of the external attribute
|
||||
specification (as it might appear in the source code) as STRING_CST. */
|
||||
tree to_external_string () const;
|
||||
|
||||
/* Return argument of array type formatted as a readable string. */
|
||||
std::string array_as_string (tree) const;
|
||||
|
||||
/* Return the access mode corresponding to the character code. */
|
||||
static access_mode from_mode_char (char);
|
||||
|
||||
/* Reset front end-specific attribute access data from attributes. */
|
||||
static void free_lang_data (tree);
|
||||
|
||||
/* The character codes corresponding to all the access modes. */
|
||||
static constexpr char mode_chars[5] = { '-', 'r', 'w', 'x', '^' };
|
||||
|
||||
/* The strings corresponding to just the external access modes. */
|
||||
static constexpr char mode_names[4][11] =
|
||||
{
|
||||
"none", "read_only", "write_only", "read_write"
|
||||
};
|
||||
};
|
||||
|
||||
inline access_mode
|
||||
attr_access::from_mode_char (char c)
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
case mode_chars[access_none]: return access_none;
|
||||
case mode_chars[access_read_only]: return access_read_only;
|
||||
case mode_chars[access_write_only]: return access_write_only;
|
||||
case mode_chars[access_read_write]: return access_read_write;
|
||||
case mode_chars[access_deferred]: return access_deferred;
|
||||
}
|
||||
gcc_unreachable ();
|
||||
}
|
||||
|
||||
/* Used to define rdwr_map below. */
|
||||
struct rdwr_access_hash: int_hash<int, -1> { };
|
||||
|
||||
/* A mapping between argument number corresponding to attribute access
|
||||
mode (read_only, write_only, or read_write) and operands. */
|
||||
struct attr_access;
|
||||
typedef hash_map<rdwr_access_hash, attr_access> rdwr_map;
|
||||
|
||||
extern void init_attr_rdwr_indices (rdwr_map *, tree);
|
||||
extern attr_access *get_parm_access (rdwr_map &, tree,
|
||||
tree = current_function_decl);
|
||||
|
||||
#endif // GCC_ATTRIBS_H
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,31 @@
|
||||
/* auto-profile.h - Defines data exported from auto-profile.cc
|
||||
Copyright (C) 2014-2023 Free Software Foundation, Inc.
|
||||
Contributed by Dehao Chen (dehao@google.com)
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GCC; see the file COPYING3. If not see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef AUTO_PROFILE_H
|
||||
#define AUTO_PROFILE_H
|
||||
|
||||
/* Read, process, finalize AutoFDO data structures. */
|
||||
extern void read_autofdo_file (void);
|
||||
extern void end_auto_profile (void);
|
||||
|
||||
/* Returns TRUE if EDGE is hot enough to be inlined early. */
|
||||
extern bool afdo_callsite_hot_enough_for_early_inline (struct cgraph_edge *);
|
||||
|
||||
#endif /* AUTO_PROFILE_H */
|
||||
@@ -0,0 +1,95 @@
|
||||
USER_H=float.h iso646.h stdarg.h stdbool.h stddef.h varargs.h stdfix.h stdnoreturn.h stdalign.h stdatomic.h config/riscv/riscv_vector.h tgmath.h
|
||||
T_GLIMITS_H=glimits.h
|
||||
T_STDINT_GCC_H=stdint-gcc.h
|
||||
HASHTAB_H=hashtab.h
|
||||
OBSTACK_H=obstack.h
|
||||
SPLAY_TREE_H=splay-tree.h
|
||||
MD5_H=md5.h
|
||||
XREGEX_H=xregex.h
|
||||
FNMATCH_H=fnmatch.h
|
||||
LINKER_PLUGIN_API_H=plugin-api.h
|
||||
BCONFIG_H=bconfig.h auto-host.h ansidecl.h
|
||||
CONFIG_H=config.h auto-host.h ansidecl.h
|
||||
TCONFIG_H=tconfig.h auto-host.h ansidecl.h
|
||||
TM_P_H=tm_p.h config/riscv/riscv-protos.h tm-preds.h
|
||||
TM_D_H=tm_d.h config/riscv/riscv-d.h
|
||||
GTM_H=tm.h options.h config/elfos.h newlib-stdint.h riscv.h elf.h initfini-array.h defaults.h insn-constants.h
|
||||
TM_H=tm.h options.h config/elfos.h newlib-stdint.h riscv.h elf.h initfini-array.h defaults.h insn-constants.h insn-flags.h options.h flag-types.h riscv-opts.h
|
||||
DUMPFILE_H=line-map.h dumpfile.h
|
||||
VEC_H=vec.h statistics.h ggc.h gtype-desc.h statistics.h
|
||||
HASH_TABLE_H=hashtab.h hash-table.h ggc.h gtype-desc.h statistics.h
|
||||
EXCEPT_H=except.h hashtab.h
|
||||
TARGET_H=tm.h options.h config/elfos.h newlib-stdint.h riscv.h elf.h initfini-array.h defaults.h insn-constants.h insn-flags.h options.h flag-types.h riscv-opts.h target.h target.def target-hooks-macros.h target-insns.def insn-modes.h insn-codes.h
|
||||
C_TARGET_H=c-family/c-target.h c-family/c-target.def target-hooks-macros.h
|
||||
COMMON_TARGET_H=common/common-target.h line-map.h input.h common/common-target.def target-hooks-macros.h
|
||||
D_TARGET_H=d/d-target.h d/d-target.def target-hooks-macros.h
|
||||
MACHMODE_H=machmode.h mode-classes.def
|
||||
HOOKS_H=hooks.h
|
||||
HOSTHOOKS_DEF_H=hosthooks-def.h hooks.h
|
||||
LANGHOOKS_DEF_H=langhooks-def.h hooks.h
|
||||
TARGET_DEF_H=target-def.h target-hooks-def.h hooks.h targhooks.h
|
||||
C_TARGET_DEF_H=c-family/c-target-def.h c-family/c-target-hooks-def.h tree.h tree-core.h coretypes.h insn-modes.h signop.h wide-int.h wide-int-print.h insn-modes-inline.h machmode.h mode-classes.def double-int.h align.h poly-int.h poly-int-types.h all-tree.def tree.def c-family/c-common.def ada-tree.def cp-tree.def d-tree.def m2-tree.def objc-tree.def builtins.def sync-builtins.def omp-builtins.def gtm-builtins.def sanitizer.def line-map.h input.h statistics.h vec.h statistics.h ggc.h gtype-desc.h statistics.h treestruct.def hashtab.h alias.h symtab.h obstack.h flags.h flag-types.h options.h flag-types.h config/riscv/riscv-opts.h real.h fixed-value.h tree-check.h c-family/c-common.h c-family/c-common.def tree.h tree-core.h coretypes.h insn-modes.h signop.h wide-int.h wide-int-print.h insn-modes-inline.h machmode.h mode-classes.def double-int.h align.h poly-int.h poly-int-types.h all-tree.def tree.def c-family/c-common.def ada-tree.def cp-tree.def d-tree.def m2-tree.def objc-tree.def builtins.def sync-builtins.def omp-builtins.def gtm-builtins.def sanitizer.def line-map.h input.h statistics.h vec.h statistics.h ggc.h gtype-desc.h statistics.h treestruct.def hashtab.h alias.h symtab.h obstack.h flags.h flag-types.h options.h flag-types.h riscv-opts.h real.h fixed-value.h tree-check.h splay-tree.h line-map.h cpplib.h ggc.h gtype-desc.h statistics.h diagnostic-core.h line-map.h input.h bversion.h diagnostic.def hooks.h common/common-targhooks.h
|
||||
CORETYPES_H=coretypes.h insn-modes.h signop.h wide-int.h wide-int-print.h insn-modes-inline.h machmode.h mode-classes.def double-int.h align.h poly-int.h poly-int-types.h
|
||||
RTL_BASE_H=coretypes.h insn-modes.h signop.h wide-int.h wide-int-print.h insn-modes-inline.h machmode.h mode-classes.def double-int.h align.h poly-int.h poly-int-types.h rtl.h rtl.def reg-notes.def insn-notes.def line-map.h input.h real.h statistics.h vec.h statistics.h ggc.h gtype-desc.h statistics.h fixed-value.h alias.h hashtab.h
|
||||
FIXED_VALUE_H=fixed-value.h
|
||||
RTL_H=coretypes.h insn-modes.h signop.h wide-int.h wide-int-print.h insn-modes-inline.h machmode.h mode-classes.def double-int.h align.h poly-int.h poly-int-types.h rtl.h rtl.def reg-notes.def insn-notes.def line-map.h input.h real.h statistics.h vec.h statistics.h ggc.h gtype-desc.h statistics.h fixed-value.h alias.h hashtab.h flags.h flag-types.h options.h flag-types.h config/riscv/riscv-opts.h genrtl.h
|
||||
READ_MD_H=obstack.h hashtab.h read-md.h
|
||||
INTERNAL_FN_H=internal-fn.h internal-fn.def
|
||||
TREE_CORE_H=tree-core.h coretypes.h insn-modes.h signop.h wide-int.h wide-int-print.h insn-modes-inline.h machmode.h mode-classes.def double-int.h align.h poly-int.h poly-int-types.h all-tree.def tree.def c-family/c-common.def ada-tree.def cp-tree.def d-tree.def m2-tree.def objc-tree.def builtins.def sync-builtins.def omp-builtins.def gtm-builtins.def sanitizer.def line-map.h input.h statistics.h vec.h statistics.h ggc.h gtype-desc.h statistics.h treestruct.def hashtab.h alias.h symtab.h obstack.h flags.h flag-types.h options.h flag-types.h config/riscv/riscv-opts.h real.h fixed-value.h
|
||||
TREE_H=tree.h tree-core.h coretypes.h insn-modes.h signop.h wide-int.h wide-int-print.h insn-modes-inline.h machmode.h mode-classes.def double-int.h align.h poly-int.h poly-int-types.h all-tree.def tree.def c-family/c-common.def ada-tree.def cp-tree.def d-tree.def m2-tree.def objc-tree.def builtins.def sync-builtins.def omp-builtins.def gtm-builtins.def sanitizer.def line-map.h input.h statistics.h vec.h statistics.h ggc.h gtype-desc.h statistics.h treestruct.def hashtab.h alias.h symtab.h obstack.h flags.h flag-types.h options.h flag-types.h config/riscv/riscv-opts.h real.h fixed-value.h tree-check.h
|
||||
REGSET_H=regset.h bitmap.h hashtab.h statistics.h hard-reg-set.h
|
||||
BASIC_BLOCK_H=basic-block.h predict.h predict.def vec.h statistics.h ggc.h gtype-desc.h statistics.h function.h hashtab.h tm.h options.h config/elfos.h newlib-stdint.h riscv.h elf.h initfini-array.h defaults.h insn-constants.h insn-flags.h options.h flag-types.h riscv-opts.h hard-reg-set.h vec.h statistics.h ggc.h gtype-desc.h statistics.h line-map.h input.h cfg-flags.def cfghooks.h profile-count.h
|
||||
GIMPLE_H=gimple.h gimple.def gsstruct.def vec.h statistics.h ggc.h gtype-desc.h statistics.h ggc.h gtype-desc.h statistics.h basic-block.h predict.h predict.def vec.h statistics.h ggc.h gtype-desc.h statistics.h function.h hashtab.h tm.h options.h config/elfos.h newlib-stdint.h riscv.h elf.h initfini-array.h defaults.h insn-constants.h insn-flags.h options.h flag-types.h riscv-opts.h hard-reg-set.h vec.h statistics.h ggc.h gtype-desc.h statistics.h line-map.h input.h cfg-flags.def cfghooks.h profile-count.h tree.h tree-core.h coretypes.h insn-modes.h signop.h wide-int.h wide-int-print.h insn-modes-inline.h machmode.h mode-classes.def double-int.h align.h poly-int.h poly-int-types.h all-tree.def tree.def c-family/c-common.def ada-tree.def cp-tree.def d-tree.def m2-tree.def objc-tree.def builtins.def sync-builtins.def omp-builtins.def gtm-builtins.def sanitizer.def line-map.h input.h statistics.h vec.h statistics.h ggc.h gtype-desc.h statistics.h treestruct.def hashtab.h alias.h symtab.h obstack.h flags.h flag-types.h options.h flag-types.h riscv-opts.h real.h fixed-value.h tree-check.h tree-ssa-operands.h tree-ssa-alias.h internal-fn.h internal-fn.def hashtab.h hash-table.h ggc.h gtype-desc.h statistics.h is-a.h
|
||||
GCOV_IO_H=gcov-io.h version.h auto-host.h gcov-counter.def
|
||||
RECOG_H=recog.h
|
||||
EMIT_RTL_H=emit-rtl.h
|
||||
FLAGS_H=flags.h flag-types.h options.h flag-types.h config/riscv/riscv-opts.h
|
||||
OPTIONS_H=options.h flag-types.h config/riscv/riscv-opts.h
|
||||
FUNCTION_H=function.h hashtab.h tm.h options.h config/elfos.h newlib-stdint.h riscv.h elf.h initfini-array.h defaults.h insn-constants.h insn-flags.h options.h flag-types.h riscv-opts.h hard-reg-set.h vec.h statistics.h ggc.h gtype-desc.h statistics.h line-map.h input.h
|
||||
EXPR_H=expr.h insn-config.h function.h hashtab.h tm.h options.h config/elfos.h newlib-stdint.h riscv.h elf.h initfini-array.h defaults.h insn-constants.h insn-flags.h options.h flag-types.h riscv-opts.h hard-reg-set.h vec.h statistics.h ggc.h gtype-desc.h statistics.h line-map.h input.h coretypes.h insn-modes.h signop.h wide-int.h wide-int-print.h insn-modes-inline.h machmode.h mode-classes.def double-int.h align.h poly-int.h poly-int-types.h rtl.h rtl.def reg-notes.def insn-notes.def line-map.h input.h real.h statistics.h vec.h statistics.h ggc.h gtype-desc.h statistics.h fixed-value.h alias.h hashtab.h flags.h flag-types.h options.h flag-types.h riscv-opts.h genrtl.h flags.h flag-types.h options.h flag-types.h riscv-opts.h tree.h tree-core.h coretypes.h insn-modes.h signop.h wide-int.h wide-int-print.h insn-modes-inline.h machmode.h mode-classes.def double-int.h align.h poly-int.h poly-int-types.h all-tree.def tree.def c-family/c-common.def ada-tree.def cp-tree.def d-tree.def m2-tree.def objc-tree.def builtins.def sync-builtins.def omp-builtins.def gtm-builtins.def sanitizer.def line-map.h input.h statistics.h vec.h statistics.h ggc.h gtype-desc.h statistics.h treestruct.def hashtab.h alias.h symtab.h obstack.h flags.h flag-types.h options.h flag-types.h riscv-opts.h real.h fixed-value.h tree-check.h emit-rtl.h
|
||||
OPTABS_H=optabs.h insn-codes.h insn-opinit.h
|
||||
REGS_H=regs.h hard-reg-set.h
|
||||
CFGLOOP_H=cfgloop.h basic-block.h predict.h predict.def vec.h statistics.h ggc.h gtype-desc.h statistics.h function.h hashtab.h tm.h options.h config/elfos.h newlib-stdint.h riscv.h elf.h initfini-array.h defaults.h insn-constants.h insn-flags.h options.h flag-types.h riscv-opts.h hard-reg-set.h vec.h statistics.h ggc.h gtype-desc.h statistics.h line-map.h input.h cfg-flags.def cfghooks.h profile-count.h bitmap.h hashtab.h statistics.h sbitmap.h
|
||||
IPA_UTILS_H=ipa-utils.h tree.h tree-core.h coretypes.h insn-modes.h signop.h wide-int.h wide-int-print.h insn-modes-inline.h machmode.h mode-classes.def double-int.h align.h poly-int.h poly-int-types.h all-tree.def tree.def c-family/c-common.def ada-tree.def cp-tree.def d-tree.def m2-tree.def objc-tree.def builtins.def sync-builtins.def omp-builtins.def gtm-builtins.def sanitizer.def line-map.h input.h statistics.h vec.h statistics.h ggc.h gtype-desc.h statistics.h treestruct.def hashtab.h alias.h symtab.h obstack.h flags.h flag-types.h options.h flag-types.h config/riscv/riscv-opts.h real.h fixed-value.h tree-check.h cgraph.h vec.h statistics.h ggc.h gtype-desc.h statistics.h tree.h tree-core.h coretypes.h insn-modes.h signop.h wide-int.h wide-int-print.h insn-modes-inline.h machmode.h mode-classes.def double-int.h align.h poly-int.h poly-int-types.h all-tree.def tree.def c-family/c-common.def ada-tree.def cp-tree.def d-tree.def m2-tree.def objc-tree.def builtins.def sync-builtins.def omp-builtins.def gtm-builtins.def sanitizer.def line-map.h input.h statistics.h vec.h statistics.h ggc.h gtype-desc.h statistics.h treestruct.def hashtab.h alias.h symtab.h obstack.h flags.h flag-types.h options.h flag-types.h riscv-opts.h real.h fixed-value.h tree-check.h basic-block.h predict.h predict.def vec.h statistics.h ggc.h gtype-desc.h statistics.h function.h hashtab.h tm.h options.h elfos.h newlib-stdint.h riscv.h elf.h initfini-array.h defaults.h insn-constants.h insn-flags.h options.h flag-types.h riscv-opts.h hard-reg-set.h vec.h statistics.h ggc.h gtype-desc.h statistics.h line-map.h input.h cfg-flags.def cfghooks.h profile-count.h function.h hashtab.h tm.h options.h elfos.h newlib-stdint.h riscv.h elf.h initfini-array.h defaults.h insn-constants.h insn-flags.h options.h flag-types.h riscv-opts.h hard-reg-set.h vec.h statistics.h ggc.h gtype-desc.h statistics.h line-map.h input.h cif-code.def ipa-ref.h plugin-api.h is-a.h
|
||||
IPA_REFERENCE_H=ipa-reference.h bitmap.h hashtab.h statistics.h tree.h tree-core.h coretypes.h insn-modes.h signop.h wide-int.h wide-int-print.h insn-modes-inline.h machmode.h mode-classes.def double-int.h align.h poly-int.h poly-int-types.h all-tree.def tree.def c-family/c-common.def ada-tree.def cp-tree.def d-tree.def m2-tree.def objc-tree.def builtins.def sync-builtins.def omp-builtins.def gtm-builtins.def sanitizer.def line-map.h input.h statistics.h vec.h statistics.h ggc.h gtype-desc.h statistics.h treestruct.def hashtab.h alias.h symtab.h obstack.h flags.h flag-types.h options.h flag-types.h config/riscv/riscv-opts.h real.h fixed-value.h tree-check.h
|
||||
CGRAPH_H=cgraph.h vec.h statistics.h ggc.h gtype-desc.h statistics.h tree.h tree-core.h coretypes.h insn-modes.h signop.h wide-int.h wide-int-print.h insn-modes-inline.h machmode.h mode-classes.def double-int.h align.h poly-int.h poly-int-types.h all-tree.def tree.def c-family/c-common.def ada-tree.def cp-tree.def d-tree.def m2-tree.def objc-tree.def builtins.def sync-builtins.def omp-builtins.def gtm-builtins.def sanitizer.def line-map.h input.h statistics.h vec.h statistics.h ggc.h gtype-desc.h statistics.h treestruct.def hashtab.h alias.h symtab.h obstack.h flags.h flag-types.h options.h flag-types.h config/riscv/riscv-opts.h real.h fixed-value.h tree-check.h basic-block.h predict.h predict.def vec.h statistics.h ggc.h gtype-desc.h statistics.h function.h hashtab.h tm.h options.h elfos.h newlib-stdint.h riscv.h elf.h initfini-array.h defaults.h insn-constants.h insn-flags.h options.h flag-types.h riscv-opts.h hard-reg-set.h vec.h statistics.h ggc.h gtype-desc.h statistics.h line-map.h input.h cfg-flags.def cfghooks.h profile-count.h function.h hashtab.h tm.h options.h elfos.h newlib-stdint.h riscv.h elf.h initfini-array.h defaults.h insn-constants.h insn-flags.h options.h flag-types.h riscv-opts.h hard-reg-set.h vec.h statistics.h ggc.h gtype-desc.h statistics.h line-map.h input.h cif-code.def ipa-ref.h plugin-api.h is-a.h
|
||||
DF_H=df.h bitmap.h hashtab.h statistics.h regset.h bitmap.h hashtab.h statistics.h hard-reg-set.h sbitmap.h basic-block.h predict.h predict.def vec.h statistics.h ggc.h gtype-desc.h statistics.h function.h hashtab.h tm.h options.h config/elfos.h newlib-stdint.h riscv.h elf.h initfini-array.h defaults.h insn-constants.h insn-flags.h options.h flag-types.h riscv-opts.h hard-reg-set.h vec.h statistics.h ggc.h gtype-desc.h statistics.h line-map.h input.h cfg-flags.def cfghooks.h profile-count.h alloc-pool.h timevar.h timevar.def
|
||||
RESOURCE_H=resource.h hard-reg-set.h df.h bitmap.h hashtab.h statistics.h regset.h bitmap.h hashtab.h statistics.h hard-reg-set.h sbitmap.h basic-block.h predict.h predict.def vec.h statistics.h ggc.h gtype-desc.h statistics.h function.h hashtab.h tm.h options.h config/elfos.h newlib-stdint.h riscv.h elf.h initfini-array.h defaults.h insn-constants.h insn-flags.h options.h flag-types.h riscv-opts.h hard-reg-set.h vec.h statistics.h ggc.h gtype-desc.h statistics.h line-map.h input.h cfg-flags.def cfghooks.h profile-count.h alloc-pool.h timevar.h timevar.def
|
||||
GCC_H=gcc.h version.h diagnostic-core.h line-map.h input.h bversion.h diagnostic.def
|
||||
GGC_H=ggc.h gtype-desc.h statistics.h
|
||||
TIMEVAR_H=timevar.h timevar.def
|
||||
INSN_ATTR_H=insn-attr.h insn-attr-common.h insn-addr.h
|
||||
INSN_ADDR_H=insn-addr.h
|
||||
C_COMMON_H=c-family/c-common.h c-family/c-common.def tree.h tree-core.h coretypes.h insn-modes.h signop.h wide-int.h wide-int-print.h insn-modes-inline.h machmode.h mode-classes.def double-int.h align.h poly-int.h poly-int-types.h all-tree.def tree.def c-family/c-common.def ada-tree.def cp-tree.def d-tree.def m2-tree.def objc-tree.def builtins.def sync-builtins.def omp-builtins.def gtm-builtins.def sanitizer.def line-map.h input.h statistics.h vec.h statistics.h ggc.h gtype-desc.h statistics.h treestruct.def hashtab.h alias.h symtab.h obstack.h flags.h flag-types.h options.h flag-types.h config/riscv/riscv-opts.h real.h fixed-value.h tree-check.h splay-tree.h line-map.h cpplib.h ggc.h gtype-desc.h statistics.h diagnostic-core.h line-map.h input.h bversion.h diagnostic.def
|
||||
C_PRAGMA_H=c-family/c-pragma.h line-map.h cpplib.h
|
||||
C_TREE_H=c/c-tree.h c-family/c-common.h c-family/c-common.def tree.h tree-core.h coretypes.h insn-modes.h signop.h wide-int.h wide-int-print.h insn-modes-inline.h machmode.h mode-classes.def double-int.h align.h poly-int.h poly-int-types.h all-tree.def tree.def c-family/c-common.def ada-tree.def cp-tree.def d-tree.def m2-tree.def objc-tree.def builtins.def sync-builtins.def omp-builtins.def gtm-builtins.def sanitizer.def line-map.h input.h statistics.h vec.h statistics.h ggc.h gtype-desc.h statistics.h treestruct.def hashtab.h alias.h symtab.h obstack.h flags.h flag-types.h options.h flag-types.h config/riscv/riscv-opts.h real.h fixed-value.h tree-check.h splay-tree.h line-map.h cpplib.h ggc.h gtype-desc.h statistics.h diagnostic-core.h line-map.h input.h bversion.h diagnostic.def diagnostic.h diagnostic-core.h line-map.h input.h bversion.h diagnostic.def pretty-print.h line-map.h input.h obstack.h wide-int-print.h
|
||||
SYSTEM_H=system.h hwint.h libiberty.h safe-ctype.h filenames.h hashtab.h
|
||||
PREDICT_H=predict.h predict.def
|
||||
CPPLIB_H=line-map.h cpplib.h
|
||||
CODYLIB_H=cody.hh
|
||||
INPUT_H=line-map.h input.h
|
||||
OPTS_H=line-map.h input.h vec.h statistics.h ggc.h gtype-desc.h statistics.h opts.h obstack.h
|
||||
SYMTAB_H=symtab.h obstack.h
|
||||
CPP_INTERNAL_H=internal.h
|
||||
TREE_DUMP_H=tree-dump.h splay-tree.h line-map.h dumpfile.h
|
||||
TREE_PASS_H=tree-pass.h timevar.h timevar.def line-map.h dumpfile.h
|
||||
TREE_SSA_H=tree-ssa.h tree-ssa-operands.h bitmap.h hashtab.h statistics.h sbitmap.h basic-block.h predict.h predict.def vec.h statistics.h ggc.h gtype-desc.h statistics.h function.h hashtab.h tm.h options.h config/elfos.h newlib-stdint.h riscv.h elf.h initfini-array.h defaults.h insn-constants.h insn-flags.h options.h flag-types.h riscv-opts.h hard-reg-set.h vec.h statistics.h ggc.h gtype-desc.h statistics.h line-map.h input.h cfg-flags.def cfghooks.h profile-count.h gimple.h gimple.def gsstruct.def vec.h statistics.h ggc.h gtype-desc.h statistics.h ggc.h gtype-desc.h statistics.h basic-block.h predict.h predict.def vec.h statistics.h ggc.h gtype-desc.h statistics.h function.h hashtab.h tm.h options.h elfos.h newlib-stdint.h riscv.h elf.h initfini-array.h defaults.h insn-constants.h insn-flags.h options.h flag-types.h riscv-opts.h hard-reg-set.h vec.h statistics.h ggc.h gtype-desc.h statistics.h line-map.h input.h cfg-flags.def cfghooks.h profile-count.h tree.h tree-core.h coretypes.h insn-modes.h signop.h wide-int.h wide-int-print.h insn-modes-inline.h machmode.h mode-classes.def double-int.h align.h poly-int.h poly-int-types.h all-tree.def tree.def c-family/c-common.def ada-tree.def cp-tree.def d-tree.def m2-tree.def objc-tree.def builtins.def sync-builtins.def omp-builtins.def gtm-builtins.def sanitizer.def line-map.h input.h statistics.h vec.h statistics.h ggc.h gtype-desc.h statistics.h treestruct.def hashtab.h alias.h symtab.h obstack.h flags.h flag-types.h options.h flag-types.h riscv-opts.h real.h fixed-value.h tree-check.h tree-ssa-operands.h tree-ssa-alias.h internal-fn.h internal-fn.def hashtab.h hash-table.h ggc.h gtype-desc.h statistics.h is-a.h hashtab.h cgraph.h vec.h statistics.h ggc.h gtype-desc.h statistics.h tree.h tree-core.h coretypes.h insn-modes.h signop.h wide-int.h wide-int-print.h insn-modes-inline.h machmode.h mode-classes.def double-int.h align.h poly-int.h poly-int-types.h all-tree.def tree.def c-family/c-common.def ada-tree.def cp-tree.def d-tree.def m2-tree.def objc-tree.def builtins.def sync-builtins.def omp-builtins.def gtm-builtins.def sanitizer.def line-map.h input.h statistics.h vec.h statistics.h ggc.h gtype-desc.h statistics.h treestruct.def hashtab.h alias.h symtab.h obstack.h flags.h flag-types.h options.h flag-types.h riscv-opts.h real.h fixed-value.h tree-check.h basic-block.h predict.h predict.def vec.h statistics.h ggc.h gtype-desc.h statistics.h function.h hashtab.h tm.h options.h elfos.h newlib-stdint.h riscv.h elf.h initfini-array.h defaults.h insn-constants.h insn-flags.h options.h flag-types.h riscv-opts.h hard-reg-set.h vec.h statistics.h ggc.h gtype-desc.h statistics.h line-map.h input.h cfg-flags.def cfghooks.h profile-count.h function.h hashtab.h tm.h options.h elfos.h newlib-stdint.h riscv.h elf.h initfini-array.h defaults.h insn-constants.h insn-flags.h options.h flag-types.h riscv-opts.h hard-reg-set.h vec.h statistics.h ggc.h gtype-desc.h statistics.h line-map.h input.h cif-code.def ipa-ref.h plugin-api.h is-a.h ipa-reference.h bitmap.h hashtab.h statistics.h tree.h tree-core.h coretypes.h insn-modes.h signop.h wide-int.h wide-int-print.h insn-modes-inline.h machmode.h mode-classes.def double-int.h align.h poly-int.h poly-int-types.h all-tree.def tree.def c-family/c-common.def ada-tree.def cp-tree.def d-tree.def m2-tree.def objc-tree.def builtins.def sync-builtins.def omp-builtins.def gtm-builtins.def sanitizer.def line-map.h input.h statistics.h vec.h statistics.h ggc.h gtype-desc.h statistics.h treestruct.def hashtab.h alias.h symtab.h obstack.h flags.h flag-types.h options.h flag-types.h riscv-opts.h real.h fixed-value.h tree-check.h tree-ssa-alias.h
|
||||
PRETTY_PRINT_H=pretty-print.h line-map.h input.h obstack.h wide-int-print.h
|
||||
TREE_PRETTY_PRINT_H=tree-pretty-print.h pretty-print.h line-map.h input.h obstack.h wide-int-print.h
|
||||
GIMPLE_PRETTY_PRINT_H=gimple-pretty-print.h tree-pretty-print.h pretty-print.h line-map.h input.h obstack.h wide-int-print.h
|
||||
DIAGNOSTIC_CORE_H=diagnostic-core.h line-map.h input.h bversion.h diagnostic.def
|
||||
DIAGNOSTIC_H=diagnostic.h diagnostic-core.h line-map.h input.h bversion.h diagnostic.def pretty-print.h line-map.h input.h obstack.h wide-int-print.h
|
||||
C_PRETTY_PRINT_H=c-family/c-pretty-print.h pretty-print.h line-map.h input.h obstack.h wide-int-print.h c-family/c-common.h c-family/c-common.def tree.h tree-core.h coretypes.h insn-modes.h signop.h wide-int.h wide-int-print.h insn-modes-inline.h machmode.h mode-classes.def double-int.h align.h poly-int.h poly-int-types.h all-tree.def tree.def c-family/c-common.def ada-tree.def cp-tree.def d-tree.def m2-tree.def objc-tree.def builtins.def sync-builtins.def omp-builtins.def gtm-builtins.def sanitizer.def line-map.h input.h statistics.h vec.h statistics.h ggc.h gtype-desc.h statistics.h treestruct.def hashtab.h alias.h symtab.h obstack.h flags.h flag-types.h options.h flag-types.h config/riscv/riscv-opts.h real.h fixed-value.h tree-check.h splay-tree.h line-map.h cpplib.h ggc.h gtype-desc.h statistics.h diagnostic-core.h line-map.h input.h bversion.h diagnostic.def tree.h tree-core.h coretypes.h insn-modes.h signop.h wide-int.h wide-int-print.h insn-modes-inline.h machmode.h mode-classes.def double-int.h align.h poly-int.h poly-int-types.h all-tree.def tree.def c-family/c-common.def ada-tree.def cp-tree.def d-tree.def m2-tree.def objc-tree.def builtins.def sync-builtins.def omp-builtins.def gtm-builtins.def sanitizer.def line-map.h input.h statistics.h vec.h statistics.h ggc.h gtype-desc.h statistics.h treestruct.def hashtab.h alias.h symtab.h obstack.h flags.h flag-types.h options.h flag-types.h riscv-opts.h real.h fixed-value.h tree-check.h
|
||||
TREE_INLINE_H=tree-inline.h
|
||||
REAL_H=real.h
|
||||
LTO_STREAMER_H=lto-streamer.h plugin-api.h tm.h options.h config/elfos.h newlib-stdint.h riscv.h elf.h initfini-array.h defaults.h insn-constants.h insn-flags.h options.h flag-types.h riscv-opts.h target.h target.def target-hooks-macros.h target-insns.def insn-modes.h insn-codes.h cgraph.h vec.h statistics.h ggc.h gtype-desc.h statistics.h tree.h tree-core.h coretypes.h insn-modes.h signop.h wide-int.h wide-int-print.h insn-modes-inline.h machmode.h mode-classes.def double-int.h align.h poly-int.h poly-int-types.h all-tree.def tree.def c-family/c-common.def ada-tree.def cp-tree.def d-tree.def m2-tree.def objc-tree.def builtins.def sync-builtins.def omp-builtins.def gtm-builtins.def sanitizer.def line-map.h input.h statistics.h vec.h statistics.h ggc.h gtype-desc.h statistics.h treestruct.def hashtab.h alias.h symtab.h obstack.h flags.h flag-types.h options.h flag-types.h riscv-opts.h real.h fixed-value.h tree-check.h basic-block.h predict.h predict.def vec.h statistics.h ggc.h gtype-desc.h statistics.h function.h hashtab.h tm.h options.h elfos.h newlib-stdint.h riscv.h elf.h initfini-array.h defaults.h insn-constants.h insn-flags.h options.h flag-types.h riscv-opts.h hard-reg-set.h vec.h statistics.h ggc.h gtype-desc.h statistics.h line-map.h input.h cfg-flags.def cfghooks.h profile-count.h function.h hashtab.h tm.h options.h elfos.h newlib-stdint.h riscv.h elf.h initfini-array.h defaults.h insn-constants.h insn-flags.h options.h flag-types.h riscv-opts.h hard-reg-set.h vec.h statistics.h ggc.h gtype-desc.h statistics.h line-map.h input.h cif-code.def ipa-ref.h plugin-api.h is-a.h vec.h statistics.h ggc.h gtype-desc.h statistics.h hashtab.h hash-table.h ggc.h gtype-desc.h statistics.h tree.h tree-core.h coretypes.h insn-modes.h signop.h wide-int.h wide-int-print.h insn-modes-inline.h machmode.h mode-classes.def double-int.h align.h poly-int.h poly-int-types.h all-tree.def tree.def c-family/c-common.def ada-tree.def cp-tree.def d-tree.def m2-tree.def objc-tree.def builtins.def sync-builtins.def omp-builtins.def gtm-builtins.def sanitizer.def line-map.h input.h statistics.h vec.h statistics.h ggc.h gtype-desc.h statistics.h treestruct.def hashtab.h alias.h symtab.h obstack.h flags.h flag-types.h options.h flag-types.h riscv-opts.h real.h fixed-value.h tree-check.h gimple.h gimple.def gsstruct.def vec.h statistics.h ggc.h gtype-desc.h statistics.h ggc.h gtype-desc.h statistics.h basic-block.h predict.h predict.def vec.h statistics.h ggc.h gtype-desc.h statistics.h function.h hashtab.h tm.h options.h elfos.h newlib-stdint.h riscv.h elf.h initfini-array.h defaults.h insn-constants.h insn-flags.h options.h flag-types.h riscv-opts.h hard-reg-set.h vec.h statistics.h ggc.h gtype-desc.h statistics.h line-map.h input.h cfg-flags.def cfghooks.h profile-count.h tree.h tree-core.h coretypes.h insn-modes.h signop.h wide-int.h wide-int-print.h insn-modes-inline.h machmode.h mode-classes.def double-int.h align.h poly-int.h poly-int-types.h all-tree.def tree.def c-family/c-common.def ada-tree.def cp-tree.def d-tree.def m2-tree.def objc-tree.def builtins.def sync-builtins.def omp-builtins.def gtm-builtins.def sanitizer.def line-map.h input.h statistics.h vec.h statistics.h ggc.h gtype-desc.h statistics.h treestruct.def hashtab.h alias.h symtab.h obstack.h flags.h flag-types.h options.h flag-types.h riscv-opts.h real.h fixed-value.h tree-check.h tree-ssa-operands.h tree-ssa-alias.h internal-fn.h internal-fn.def hashtab.h hash-table.h ggc.h gtype-desc.h statistics.h is-a.h gcov-io.h version.h auto-host.h gcov-counter.def diagnostic.h diagnostic-core.h line-map.h input.h bversion.h diagnostic.def pretty-print.h line-map.h input.h obstack.h wide-int-print.h alloc-pool.h
|
||||
IPA_PROP_H=ipa-prop.h tree.h tree-core.h coretypes.h insn-modes.h signop.h wide-int.h wide-int-print.h insn-modes-inline.h machmode.h mode-classes.def double-int.h align.h poly-int.h poly-int-types.h all-tree.def tree.def c-family/c-common.def ada-tree.def cp-tree.def d-tree.def m2-tree.def objc-tree.def builtins.def sync-builtins.def omp-builtins.def gtm-builtins.def sanitizer.def line-map.h input.h statistics.h vec.h statistics.h ggc.h gtype-desc.h statistics.h treestruct.def hashtab.h alias.h symtab.h obstack.h flags.h flag-types.h options.h flag-types.h config/riscv/riscv-opts.h real.h fixed-value.h tree-check.h vec.h statistics.h ggc.h gtype-desc.h statistics.h cgraph.h vec.h statistics.h ggc.h gtype-desc.h statistics.h tree.h tree-core.h coretypes.h insn-modes.h signop.h wide-int.h wide-int-print.h insn-modes-inline.h machmode.h mode-classes.def double-int.h align.h poly-int.h poly-int-types.h all-tree.def tree.def c-family/c-common.def ada-tree.def cp-tree.def d-tree.def m2-tree.def objc-tree.def builtins.def sync-builtins.def omp-builtins.def gtm-builtins.def sanitizer.def line-map.h input.h statistics.h vec.h statistics.h ggc.h gtype-desc.h statistics.h treestruct.def hashtab.h alias.h symtab.h obstack.h flags.h flag-types.h options.h flag-types.h riscv-opts.h real.h fixed-value.h tree-check.h basic-block.h predict.h predict.def vec.h statistics.h ggc.h gtype-desc.h statistics.h function.h hashtab.h tm.h options.h elfos.h newlib-stdint.h riscv.h elf.h initfini-array.h defaults.h insn-constants.h insn-flags.h options.h flag-types.h riscv-opts.h hard-reg-set.h vec.h statistics.h ggc.h gtype-desc.h statistics.h line-map.h input.h cfg-flags.def cfghooks.h profile-count.h function.h hashtab.h tm.h options.h elfos.h newlib-stdint.h riscv.h elf.h initfini-array.h defaults.h insn-constants.h insn-flags.h options.h flag-types.h riscv-opts.h hard-reg-set.h vec.h statistics.h ggc.h gtype-desc.h statistics.h line-map.h input.h cif-code.def ipa-ref.h plugin-api.h is-a.h gimple.h gimple.def gsstruct.def vec.h statistics.h ggc.h gtype-desc.h statistics.h ggc.h gtype-desc.h statistics.h basic-block.h predict.h predict.def vec.h statistics.h ggc.h gtype-desc.h statistics.h function.h hashtab.h tm.h options.h elfos.h newlib-stdint.h riscv.h elf.h initfini-array.h defaults.h insn-constants.h insn-flags.h options.h flag-types.h riscv-opts.h hard-reg-set.h vec.h statistics.h ggc.h gtype-desc.h statistics.h line-map.h input.h cfg-flags.def cfghooks.h profile-count.h tree.h tree-core.h coretypes.h insn-modes.h signop.h wide-int.h wide-int-print.h insn-modes-inline.h machmode.h mode-classes.def double-int.h align.h poly-int.h poly-int-types.h all-tree.def tree.def c-family/c-common.def ada-tree.def cp-tree.def d-tree.def m2-tree.def objc-tree.def builtins.def sync-builtins.def omp-builtins.def gtm-builtins.def sanitizer.def line-map.h input.h statistics.h vec.h statistics.h ggc.h gtype-desc.h statistics.h treestruct.def hashtab.h alias.h symtab.h obstack.h flags.h flag-types.h options.h flag-types.h riscv-opts.h real.h fixed-value.h tree-check.h tree-ssa-operands.h tree-ssa-alias.h internal-fn.h internal-fn.def hashtab.h hash-table.h ggc.h gtype-desc.h statistics.h is-a.h alloc-pool.h
|
||||
BITMAP_H=bitmap.h hashtab.h statistics.h
|
||||
GCC_PLUGIN_H=gcc-plugin.h highlev-plugin-common.h plugin.def config.h auto-host.h ansidecl.h system.h hwint.h libiberty.h safe-ctype.h filenames.h hashtab.h hashtab.h
|
||||
PLUGIN_H=plugin.h gcc-plugin.h highlev-plugin-common.h plugin.def config.h auto-host.h ansidecl.h system.h hwint.h libiberty.h safe-ctype.h filenames.h hashtab.h hashtab.h
|
||||
PLUGIN_VERSION_H=plugin-version.h configargs.h
|
||||
CONTEXT_H=context.h
|
||||
GENSUPPORT_H=gensupport.h read-md.h optabs.def
|
||||
RTL_SSA_H=pretty-print.h line-map.h input.h obstack.h wide-int-print.h insn-config.h splay-tree-utils.h recog.h regs.h hard-reg-set.h function-abi.h obstack-utils.h mux-utils.h rtlanal.h memmodel.h emit-rtl.h rtl-ssa/accesses.h rtl-ssa/insns.h rtl-ssa/blocks.h rtl-ssa/changes.h rtl-ssa/functions.h rtl-ssa/is-a.inl rtl-ssa/access-utils.h rtl-ssa/insn-utils.h rtl-ssa/movement.h rtl-ssa/change-utils.h rtl-ssa/member-fns.inl
|
||||
GTFILES_H=gt-coverage.h gt-symtab-thunks.h gt-caller-save.h gt-symtab.h gt-alias.h gt-bitmap.h gt-cselib.h gt-cgraph.h gt-ipa-prop.h gt-ipa-cp.h gt-ipa-sra.h gt-ipa-modref.h gt-diagnostic-spec.h gt-dwarf2asm.h gt-dwarf2cfi.h gt-dwarf2ctf.h gt-dwarf2out.h gt-ctfout.h gt-btfout.h gt-tree-vect-generic.h gt-gimple-isel.h gt-dojump.h gt-emit-rtl.h gt-explow.h gt-expr.h gt-function.h gt-except.h gt-ggc-tests.h gt-gcse.h gt-godump.h gt-lists.h gt-optabs-libfuncs.h gt-profile.h gt-mcf.h gt-reg-stack.h gt-cfgrtl.h gt-stor-layout.h gt-stringpool.h gt-tree.h gt-varasm.h gt-tree-ssanames.h gt-tree-eh.h gt-tree-ssa-address.h gt-tree-cfg.h gt-tree-ssa-loop-ivopts.h gt-tree-dfa.h gt-tree-iterator.h gt-gimple-expr.h gt-tree-scalar-evolution.h gt-tree-profile.h gt-tree-nested.h gt-omp-general.h gt-omp-low.h gt-targhooks.h gt-riscv.h gt-passes.h gt-cgraphclones.h gt-tree-phinodes.h gt-trans-mem.h gt-vtable-verify.h gt-asan.h gt-ubsan.h gt-tsan.h gt-sanopt.h gt-sancov.h gt-ipa-devirt.h gt-calls.h gt-analyzer-analyzer-language.h gt-riscv-vector-builtins.h gt-ada-decl.h gt-ada-trans.h gt-ada-utils.h gt-ada-misc.h gt-c-c-lang.h gt-c-c-decl.h gt-c-family-c-common.h gt-c-family-c-cppbuiltin.h gt-c-family-c-pragma.h gt-c-family-c-format.h gt-c-c-objc-common.h gt-c-c-parser.h gt-c-family-c-common.h gt-c-family-c-format.h gt-c-family-c-cppbuiltin.h gt-c-family-c-pragma.h gt-cp-call.h gt-cp-class.h gt-cp-constexpr.h gt-cp-contracts.h gt-cp-constraint.h gt-cp-coroutines.h gt-cp-cp-gimplify.h gt-cp-cp-lang.h gt-cp-cp-objcp-common.h gt-cp-decl.h gt-cp-decl2.h gt-cp-except.h gt-cp-friend.h gt-cp-init.h gt-cp-lambda.h gt-cp-lex.h gt-cp-logic.h gt-cp-mangle.h gt-cp-method.h gt-cp-module.h gt-cp-name-lookup.h gt-cp-parser.h gt-cp-pt.h gt-cp-rtti.h gt-cp-semantics.h gt-cp-tree.h gt-cp-typeck2.h gt-cp-vtable-class-hierarchy.h gt-d-d-builtins.h gt-d-d-lang.h gt-d-typeinfo.h gt-fortran-f95-lang.h gt-fortran-trans-decl.h gt-fortran-trans-intrinsic.h gt-fortran-trans-io.h gt-fortran-trans-stmt.h gt-fortran-trans-types.h gt-go-go-lang.h gt-jit-dummy-frontend.h gt-lto-lto-lang.h gt-lto-lto.h gt-lto-lto-common.h gt-lto-lto-dump.h gt-m2-gm2-lang.h gt-m2-rtegraph.h gt-m2-m2block.h gt-m2-m2builtins.h gt-m2-m2decl.h gt-m2-m2except.h gt-m2-m2expr.h gt-m2-m2statement.h gt-m2-m2type.h gt-objc-objc-act.h gt-objc-objc-runtime-shared-support.h gt-objc-objc-gnu-runtime-abi-01.h gt-objc-objc-next-runtime-abi-01.h gt-objc-objc-next-runtime-abi-02.h gt-c-c-parser.h gt-c-c-decl.h gt-c-c-objc-common.h gt-c-family-c-common.h gt-c-family-c-cppbuiltin.h gt-c-family-c-pragma.h gt-c-family-c-format.h gt-c-family-c-common.h gt-c-family-c-format.h gt-c-family-c-cppbuiltin.h gt-c-family-c-pragma.h gt-cp-call.h gt-cp-class.h gt-cp-constexpr.h gt-cp-contracts.h gt-cp-constraint.h gt-cp-coroutines.h gt-cp-cp-gimplify.h gt-objcp-objcp-lang.h gt-cp-cp-objcp-common.h gt-cp-decl.h gt-cp-decl2.h gt-cp-except.h gt-cp-friend.h gt-cp-init.h gt-cp-lambda.h gt-cp-lex.h gt-cp-logic.h gt-cp-mangle.h gt-cp-method.h gt-cp-module.h gt-cp-name-lookup.h gt-cp-parser.h gt-cp-pt.h gt-cp-rtti.h gt-cp-semantics.h gt-cp-tree.h gt-cp-typeck2.h gt-cp-vtable-class-hierarchy.h gt-objc-objc-act.h gt-objc-objc-gnu-runtime-abi-01.h gt-objc-objc-next-runtime-abi-01.h gt-objc-objc-next-runtime-abi-02.h gt-objc-objc-runtime-shared-support.h gt-rust-rust-lang.h
|
||||
GTFILES_LANG_H=gtype-ada.h gtype-c.h gtype-cp.h gtype-d.h gtype-fortran.h gtype-go.h gtype-jit.h gtype-lto.h gtype-m2.h gtype-objc.h gtype-objcp.h gtype-rust.h
|
||||
@@ -0,0 +1,35 @@
|
||||
/* Common Backend requirements.
|
||||
|
||||
Copyright (C) 2015-2023 Free Software Foundation, Inc.
|
||||
Contributed by Andrew MacLeod <amacleod@redhat.com>
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GCC; see the file COPYING3. If not see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef GCC_BACKEND_H
|
||||
#define GCC_BACKEND_H
|
||||
|
||||
/* This is an aggregation header file. This means it should contain only
|
||||
other include files. */
|
||||
|
||||
#include "tm.h"
|
||||
#include "function.h"
|
||||
#include "bitmap.h"
|
||||
#include "sbitmap.h"
|
||||
#include "basic-block.h"
|
||||
#include "cfg.h"
|
||||
|
||||
#endif /*GCC_BACKEND_H */
|
||||
@@ -0,0 +1,642 @@
|
||||
/* Define control flow data structures for the CFG.
|
||||
Copyright (C) 1987-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GCC; see the file COPYING3. If not see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef GCC_BASIC_BLOCK_H
|
||||
#define GCC_BASIC_BLOCK_H
|
||||
|
||||
#include <profile-count.h>
|
||||
|
||||
/* Control flow edge information. */
|
||||
class GTY((user)) edge_def {
|
||||
public:
|
||||
/* The two blocks at the ends of the edge. */
|
||||
basic_block src;
|
||||
basic_block dest;
|
||||
|
||||
/* Instructions queued on the edge. */
|
||||
union edge_def_insns {
|
||||
gimple_seq g;
|
||||
rtx_insn *r;
|
||||
} insns;
|
||||
|
||||
/* Auxiliary info specific to a pass. */
|
||||
void *aux;
|
||||
|
||||
/* Location of any goto implicit in the edge. */
|
||||
location_t goto_locus;
|
||||
|
||||
/* The index number corresponding to this edge in the edge vector
|
||||
dest->preds. */
|
||||
unsigned int dest_idx;
|
||||
|
||||
int flags; /* see cfg-flags.def */
|
||||
profile_probability probability;
|
||||
|
||||
/* Return count of edge E. */
|
||||
inline profile_count count () const;
|
||||
};
|
||||
|
||||
/* Masks for edge.flags. */
|
||||
#define DEF_EDGE_FLAG(NAME,IDX) EDGE_##NAME = 1 << IDX ,
|
||||
enum cfg_edge_flags {
|
||||
#include "cfg-flags.def"
|
||||
LAST_CFG_EDGE_FLAG /* this is only used for EDGE_ALL_FLAGS */
|
||||
};
|
||||
#undef DEF_EDGE_FLAG
|
||||
|
||||
/* Bit mask for all edge flags. */
|
||||
#define EDGE_ALL_FLAGS ((LAST_CFG_EDGE_FLAG - 1) * 2 - 1)
|
||||
|
||||
/* The following four flags all indicate something special about an edge.
|
||||
Test the edge flags on EDGE_COMPLEX to detect all forms of "strange"
|
||||
control flow transfers. */
|
||||
#define EDGE_COMPLEX \
|
||||
(EDGE_ABNORMAL | EDGE_ABNORMAL_CALL | EDGE_EH | EDGE_PRESERVE)
|
||||
|
||||
struct GTY(()) rtl_bb_info {
|
||||
/* The first insn of the block is embedded into bb->il.x. */
|
||||
/* The last insn of the block. */
|
||||
rtx_insn *end_;
|
||||
|
||||
/* In CFGlayout mode points to insn notes/jumptables to be placed just before
|
||||
and after the block. */
|
||||
rtx_insn *header_;
|
||||
rtx_insn *footer_;
|
||||
};
|
||||
|
||||
struct GTY(()) gimple_bb_info {
|
||||
/* Sequence of statements in this block. */
|
||||
gimple_seq seq;
|
||||
|
||||
/* PHI nodes for this block. */
|
||||
gimple_seq phi_nodes;
|
||||
};
|
||||
|
||||
/* A basic block is a sequence of instructions with only one entry and
|
||||
only one exit. If any one of the instructions are executed, they
|
||||
will all be executed, and in sequence from first to last.
|
||||
|
||||
There may be COND_EXEC instructions in the basic block. The
|
||||
COND_EXEC *instructions* will be executed -- but if the condition
|
||||
is false the conditionally executed *expressions* will of course
|
||||
not be executed. We don't consider the conditionally executed
|
||||
expression (which might have side-effects) to be in a separate
|
||||
basic block because the program counter will always be at the same
|
||||
location after the COND_EXEC instruction, regardless of whether the
|
||||
condition is true or not.
|
||||
|
||||
Basic blocks need not start with a label nor end with a jump insn.
|
||||
For example, a previous basic block may just "conditionally fall"
|
||||
into the succeeding basic block, and the last basic block need not
|
||||
end with a jump insn. Block 0 is a descendant of the entry block.
|
||||
|
||||
A basic block beginning with two labels cannot have notes between
|
||||
the labels.
|
||||
|
||||
Data for jump tables are stored in jump_insns that occur in no
|
||||
basic block even though these insns can follow or precede insns in
|
||||
basic blocks. */
|
||||
|
||||
/* Basic block information indexed by block number. */
|
||||
struct GTY((chain_next ("%h.next_bb"), chain_prev ("%h.prev_bb"))) basic_block_def {
|
||||
/* The edges into and out of the block. */
|
||||
vec<edge, va_gc> *preds;
|
||||
vec<edge, va_gc> *succs;
|
||||
|
||||
/* Auxiliary info specific to a pass. */
|
||||
void *GTY ((skip (""))) aux;
|
||||
|
||||
/* Innermost loop containing the block. */
|
||||
class loop *loop_father;
|
||||
|
||||
/* The dominance and postdominance information node. */
|
||||
struct et_node * GTY ((skip (""))) dom[2];
|
||||
|
||||
/* Previous and next blocks in the chain. */
|
||||
basic_block prev_bb;
|
||||
basic_block next_bb;
|
||||
|
||||
union basic_block_il_dependent {
|
||||
struct gimple_bb_info GTY ((tag ("0"))) gimple;
|
||||
struct {
|
||||
rtx_insn *head_;
|
||||
struct rtl_bb_info * rtl;
|
||||
} GTY ((tag ("1"))) x;
|
||||
} GTY ((desc ("((%1.flags & BB_RTL) != 0)"))) il;
|
||||
|
||||
/* Various flags. See cfg-flags.def. */
|
||||
int flags;
|
||||
|
||||
/* The index of this block. */
|
||||
int index;
|
||||
|
||||
/* Expected number of executions: calculated in profile.cc. */
|
||||
profile_count count;
|
||||
};
|
||||
|
||||
/* This ensures that struct gimple_bb_info is smaller than
|
||||
struct rtl_bb_info, so that inlining the former into basic_block_def
|
||||
is the better choice. */
|
||||
STATIC_ASSERT (sizeof (rtl_bb_info) >= sizeof (gimple_bb_info));
|
||||
|
||||
#define BB_FREQ_MAX 10000
|
||||
|
||||
/* Masks for basic_block.flags. */
|
||||
#define DEF_BASIC_BLOCK_FLAG(NAME,IDX) BB_##NAME = 1 << IDX ,
|
||||
enum cfg_bb_flags
|
||||
{
|
||||
#include "cfg-flags.def"
|
||||
LAST_CFG_BB_FLAG /* this is only used for BB_ALL_FLAGS */
|
||||
};
|
||||
#undef DEF_BASIC_BLOCK_FLAG
|
||||
|
||||
/* Bit mask for all basic block flags. */
|
||||
#define BB_ALL_FLAGS ((LAST_CFG_BB_FLAG - 1) * 2 - 1)
|
||||
|
||||
/* Bit mask for all basic block flags that must be preserved. These are
|
||||
the bit masks that are *not* cleared by clear_bb_flags. */
|
||||
#define BB_FLAGS_TO_PRESERVE \
|
||||
(BB_DISABLE_SCHEDULE | BB_RTL | BB_NON_LOCAL_GOTO_TARGET \
|
||||
| BB_HOT_PARTITION | BB_COLD_PARTITION)
|
||||
|
||||
/* Dummy bitmask for convenience in the hot/cold partitioning code. */
|
||||
#define BB_UNPARTITIONED 0
|
||||
|
||||
/* Partitions, to be used when partitioning hot and cold basic blocks into
|
||||
separate sections. */
|
||||
#define BB_PARTITION(bb) ((bb)->flags & (BB_HOT_PARTITION|BB_COLD_PARTITION))
|
||||
#define BB_SET_PARTITION(bb, part) do { \
|
||||
basic_block bb_ = (bb); \
|
||||
bb_->flags = ((bb_->flags & ~(BB_HOT_PARTITION|BB_COLD_PARTITION)) \
|
||||
| (part)); \
|
||||
} while (0)
|
||||
|
||||
#define BB_COPY_PARTITION(dstbb, srcbb) \
|
||||
BB_SET_PARTITION (dstbb, BB_PARTITION (srcbb))
|
||||
|
||||
/* Defines for accessing the fields of the CFG structure for function FN. */
|
||||
#define ENTRY_BLOCK_PTR_FOR_FN(FN) ((FN)->cfg->x_entry_block_ptr)
|
||||
#define EXIT_BLOCK_PTR_FOR_FN(FN) ((FN)->cfg->x_exit_block_ptr)
|
||||
#define basic_block_info_for_fn(FN) ((FN)->cfg->x_basic_block_info)
|
||||
#define n_basic_blocks_for_fn(FN) ((FN)->cfg->x_n_basic_blocks)
|
||||
#define n_edges_for_fn(FN) ((FN)->cfg->x_n_edges)
|
||||
#define last_basic_block_for_fn(FN) ((FN)->cfg->x_last_basic_block)
|
||||
#define label_to_block_map_for_fn(FN) ((FN)->cfg->x_label_to_block_map)
|
||||
#define profile_status_for_fn(FN) ((FN)->cfg->x_profile_status)
|
||||
|
||||
#define BASIC_BLOCK_FOR_FN(FN,N) \
|
||||
((*basic_block_info_for_fn (FN))[(N)])
|
||||
#define SET_BASIC_BLOCK_FOR_FN(FN,N,BB) \
|
||||
((*basic_block_info_for_fn (FN))[(N)] = (BB))
|
||||
|
||||
/* For iterating over basic blocks. */
|
||||
#define FOR_BB_BETWEEN(BB, FROM, TO, DIR) \
|
||||
for (BB = FROM; BB != TO; BB = BB->DIR)
|
||||
|
||||
#define FOR_EACH_BB_FN(BB, FN) \
|
||||
FOR_BB_BETWEEN (BB, (FN)->cfg->x_entry_block_ptr->next_bb, (FN)->cfg->x_exit_block_ptr, next_bb)
|
||||
|
||||
#define FOR_EACH_BB_REVERSE_FN(BB, FN) \
|
||||
FOR_BB_BETWEEN (BB, (FN)->cfg->x_exit_block_ptr->prev_bb, (FN)->cfg->x_entry_block_ptr, prev_bb)
|
||||
|
||||
/* For iterating over insns in basic block. */
|
||||
#define FOR_BB_INSNS(BB, INSN) \
|
||||
for ((INSN) = BB_HEAD (BB); \
|
||||
(INSN) && (INSN) != NEXT_INSN (BB_END (BB)); \
|
||||
(INSN) = NEXT_INSN (INSN))
|
||||
|
||||
/* For iterating over insns in basic block when we might remove the
|
||||
current insn. */
|
||||
#define FOR_BB_INSNS_SAFE(BB, INSN, CURR) \
|
||||
for ((INSN) = BB_HEAD (BB), (CURR) = (INSN) ? NEXT_INSN ((INSN)): NULL; \
|
||||
(INSN) && (INSN) != NEXT_INSN (BB_END (BB)); \
|
||||
(INSN) = (CURR), (CURR) = (INSN) ? NEXT_INSN ((INSN)) : NULL)
|
||||
|
||||
#define FOR_BB_INSNS_REVERSE(BB, INSN) \
|
||||
for ((INSN) = BB_END (BB); \
|
||||
(INSN) && (INSN) != PREV_INSN (BB_HEAD (BB)); \
|
||||
(INSN) = PREV_INSN (INSN))
|
||||
|
||||
#define FOR_BB_INSNS_REVERSE_SAFE(BB, INSN, CURR) \
|
||||
for ((INSN) = BB_END (BB),(CURR) = (INSN) ? PREV_INSN ((INSN)) : NULL; \
|
||||
(INSN) && (INSN) != PREV_INSN (BB_HEAD (BB)); \
|
||||
(INSN) = (CURR), (CURR) = (INSN) ? PREV_INSN ((INSN)) : NULL)
|
||||
|
||||
/* Cycles through _all_ basic blocks, even the fake ones (entry and
|
||||
exit block). */
|
||||
|
||||
#define FOR_ALL_BB_FN(BB, FN) \
|
||||
for (BB = ENTRY_BLOCK_PTR_FOR_FN (FN); BB; BB = BB->next_bb)
|
||||
|
||||
|
||||
/* Stuff for recording basic block info. */
|
||||
|
||||
/* For now, these will be functions (so that they can include checked casts
|
||||
to rtx_insn. Once the underlying fields are converted from rtx
|
||||
to rtx_insn, these can be converted back to macros. */
|
||||
|
||||
#define BB_HEAD(B) (B)->il.x.head_
|
||||
#define BB_END(B) (B)->il.x.rtl->end_
|
||||
#define BB_HEADER(B) (B)->il.x.rtl->header_
|
||||
#define BB_FOOTER(B) (B)->il.x.rtl->footer_
|
||||
|
||||
/* Special block numbers [markers] for entry and exit.
|
||||
Neither of them is supposed to hold actual statements. */
|
||||
#define ENTRY_BLOCK (0)
|
||||
#define EXIT_BLOCK (1)
|
||||
|
||||
/* The two blocks that are always in the cfg. */
|
||||
#define NUM_FIXED_BLOCKS (2)
|
||||
|
||||
/* This is the value which indicates no edge is present. */
|
||||
#define EDGE_INDEX_NO_EDGE -1
|
||||
|
||||
/* EDGE_INDEX returns an integer index for an edge, or EDGE_INDEX_NO_EDGE
|
||||
if there is no edge between the 2 basic blocks. */
|
||||
#define EDGE_INDEX(el, pred, succ) (find_edge_index ((el), (pred), (succ)))
|
||||
|
||||
/* INDEX_EDGE_PRED_BB and INDEX_EDGE_SUCC_BB return a pointer to the basic
|
||||
block which is either the pred or succ end of the indexed edge. */
|
||||
#define INDEX_EDGE_PRED_BB(el, index) ((el)->index_to_edge[(index)]->src)
|
||||
#define INDEX_EDGE_SUCC_BB(el, index) ((el)->index_to_edge[(index)]->dest)
|
||||
|
||||
/* INDEX_EDGE returns a pointer to the edge. */
|
||||
#define INDEX_EDGE(el, index) ((el)->index_to_edge[(index)])
|
||||
|
||||
/* Number of edges in the compressed edge list. */
|
||||
#define NUM_EDGES(el) ((el)->num_edges)
|
||||
|
||||
/* BB is assumed to contain conditional jump. Return the fallthru edge. */
|
||||
#define FALLTHRU_EDGE(bb) (EDGE_SUCC ((bb), 0)->flags & EDGE_FALLTHRU \
|
||||
? EDGE_SUCC ((bb), 0) : EDGE_SUCC ((bb), 1))
|
||||
|
||||
/* BB is assumed to contain conditional jump. Return the branch edge. */
|
||||
#define BRANCH_EDGE(bb) (EDGE_SUCC ((bb), 0)->flags & EDGE_FALLTHRU \
|
||||
? EDGE_SUCC ((bb), 1) : EDGE_SUCC ((bb), 0))
|
||||
|
||||
/* Return expected execution frequency of the edge E. */
|
||||
#define EDGE_FREQUENCY(e) e->count ().to_frequency (cfun)
|
||||
|
||||
/* Compute a scale factor (or probability) suitable for scaling of
|
||||
gcov_type values via apply_probability() and apply_scale(). */
|
||||
#define GCOV_COMPUTE_SCALE(num,den) \
|
||||
((den) ? RDIV ((num) * REG_BR_PROB_BASE, (den)) : REG_BR_PROB_BASE)
|
||||
|
||||
/* Return nonzero if edge is critical. */
|
||||
#define EDGE_CRITICAL_P(e) (EDGE_COUNT ((e)->src->succs) >= 2 \
|
||||
&& EDGE_COUNT ((e)->dest->preds) >= 2)
|
||||
|
||||
#define EDGE_COUNT(ev) vec_safe_length (ev)
|
||||
#define EDGE_I(ev,i) (*ev)[(i)]
|
||||
#define EDGE_PRED(bb,i) (*(bb)->preds)[(i)]
|
||||
#define EDGE_SUCC(bb,i) (*(bb)->succs)[(i)]
|
||||
|
||||
/* Returns true if BB has precisely one successor. */
|
||||
|
||||
inline bool
|
||||
single_succ_p (const_basic_block bb)
|
||||
{
|
||||
return EDGE_COUNT (bb->succs) == 1;
|
||||
}
|
||||
|
||||
/* Returns true if BB has precisely one predecessor. */
|
||||
|
||||
inline bool
|
||||
single_pred_p (const_basic_block bb)
|
||||
{
|
||||
return EDGE_COUNT (bb->preds) == 1;
|
||||
}
|
||||
|
||||
/* Returns the single successor edge of basic block BB. Aborts if
|
||||
BB does not have exactly one successor. */
|
||||
|
||||
inline edge
|
||||
single_succ_edge (const_basic_block bb)
|
||||
{
|
||||
gcc_checking_assert (single_succ_p (bb));
|
||||
return EDGE_SUCC (bb, 0);
|
||||
}
|
||||
|
||||
/* Returns the single predecessor edge of basic block BB. Aborts
|
||||
if BB does not have exactly one predecessor. */
|
||||
|
||||
inline edge
|
||||
single_pred_edge (const_basic_block bb)
|
||||
{
|
||||
gcc_checking_assert (single_pred_p (bb));
|
||||
return EDGE_PRED (bb, 0);
|
||||
}
|
||||
|
||||
/* Returns the single successor block of basic block BB. Aborts
|
||||
if BB does not have exactly one successor. */
|
||||
|
||||
inline basic_block
|
||||
single_succ (const_basic_block bb)
|
||||
{
|
||||
return single_succ_edge (bb)->dest;
|
||||
}
|
||||
|
||||
/* Returns the single predecessor block of basic block BB. Aborts
|
||||
if BB does not have exactly one predecessor.*/
|
||||
|
||||
inline basic_block
|
||||
single_pred (const_basic_block bb)
|
||||
{
|
||||
return single_pred_edge (bb)->src;
|
||||
}
|
||||
|
||||
/* Iterator object for edges. */
|
||||
|
||||
struct edge_iterator {
|
||||
unsigned index;
|
||||
vec<edge, va_gc> **container;
|
||||
};
|
||||
|
||||
inline vec<edge, va_gc> *
|
||||
ei_container (edge_iterator i)
|
||||
{
|
||||
gcc_checking_assert (i.container);
|
||||
return *i.container;
|
||||
}
|
||||
|
||||
#define ei_start(iter) ei_start_1 (&(iter))
|
||||
#define ei_last(iter) ei_last_1 (&(iter))
|
||||
|
||||
/* Return an iterator pointing to the start of an edge vector. */
|
||||
inline edge_iterator
|
||||
ei_start_1 (vec<edge, va_gc> **ev)
|
||||
{
|
||||
edge_iterator i;
|
||||
|
||||
i.index = 0;
|
||||
i.container = ev;
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
/* Return an iterator pointing to the last element of an edge
|
||||
vector. */
|
||||
inline edge_iterator
|
||||
ei_last_1 (vec<edge, va_gc> **ev)
|
||||
{
|
||||
edge_iterator i;
|
||||
|
||||
i.index = EDGE_COUNT (*ev) - 1;
|
||||
i.container = ev;
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
/* Is the iterator `i' at the end of the sequence? */
|
||||
inline bool
|
||||
ei_end_p (edge_iterator i)
|
||||
{
|
||||
return (i.index == EDGE_COUNT (ei_container (i)));
|
||||
}
|
||||
|
||||
/* Is the iterator `i' at one position before the end of the
|
||||
sequence? */
|
||||
inline bool
|
||||
ei_one_before_end_p (edge_iterator i)
|
||||
{
|
||||
return (i.index + 1 == EDGE_COUNT (ei_container (i)));
|
||||
}
|
||||
|
||||
/* Advance the iterator to the next element. */
|
||||
inline void
|
||||
ei_next (edge_iterator *i)
|
||||
{
|
||||
gcc_checking_assert (i->index < EDGE_COUNT (ei_container (*i)));
|
||||
i->index++;
|
||||
}
|
||||
|
||||
/* Move the iterator to the previous element. */
|
||||
inline void
|
||||
ei_prev (edge_iterator *i)
|
||||
{
|
||||
gcc_checking_assert (i->index > 0);
|
||||
i->index--;
|
||||
}
|
||||
|
||||
/* Return the edge pointed to by the iterator `i'. */
|
||||
inline edge
|
||||
ei_edge (edge_iterator i)
|
||||
{
|
||||
return EDGE_I (ei_container (i), i.index);
|
||||
}
|
||||
|
||||
/* Return an edge pointed to by the iterator. Do it safely so that
|
||||
NULL is returned when the iterator is pointing at the end of the
|
||||
sequence. */
|
||||
inline edge
|
||||
ei_safe_edge (edge_iterator i)
|
||||
{
|
||||
return !ei_end_p (i) ? ei_edge (i) : NULL;
|
||||
}
|
||||
|
||||
/* Return 1 if we should continue to iterate. Return 0 otherwise.
|
||||
*Edge P is set to the next edge if we are to continue to iterate
|
||||
and NULL otherwise. */
|
||||
|
||||
inline bool
|
||||
ei_cond (edge_iterator ei, edge *p)
|
||||
{
|
||||
if (!ei_end_p (ei))
|
||||
{
|
||||
*p = ei_edge (ei);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
*p = NULL;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* This macro serves as a convenient way to iterate each edge in a
|
||||
vector of predecessor or successor edges. It must not be used when
|
||||
an element might be removed during the traversal, otherwise
|
||||
elements will be missed. Instead, use a for-loop like that shown
|
||||
in the following pseudo-code:
|
||||
|
||||
FOR (ei = ei_start (bb->succs); (e = ei_safe_edge (ei)); )
|
||||
{
|
||||
IF (e != taken_edge)
|
||||
remove_edge (e);
|
||||
ELSE
|
||||
ei_next (&ei);
|
||||
}
|
||||
*/
|
||||
|
||||
#define FOR_EACH_EDGE(EDGE,ITER,EDGE_VEC) \
|
||||
for ((ITER) = ei_start ((EDGE_VEC)); \
|
||||
ei_cond ((ITER), &(EDGE)); \
|
||||
ei_next (&(ITER)))
|
||||
|
||||
#define CLEANUP_EXPENSIVE 1 /* Do relatively expensive optimizations
|
||||
except for edge forwarding */
|
||||
#define CLEANUP_CROSSJUMP 2 /* Do crossjumping. */
|
||||
#define CLEANUP_POST_REGSTACK 4 /* We run after reg-stack and need
|
||||
to care REG_DEAD notes. */
|
||||
#define CLEANUP_THREADING 8 /* Do jump threading. */
|
||||
#define CLEANUP_NO_INSN_DEL 16 /* Do not try to delete trivially dead
|
||||
insns. */
|
||||
#define CLEANUP_CFGLAYOUT 32 /* Do cleanup in cfglayout mode. */
|
||||
#define CLEANUP_CFG_CHANGED 64 /* The caller changed the CFG. */
|
||||
#define CLEANUP_NO_PARTITIONING 128 /* Do not try to fix partitions. */
|
||||
#define CLEANUP_FORCE_FAST_DCE 0x100 /* Force run_fast_dce to be called
|
||||
at least once. */
|
||||
|
||||
/* Return true if BB is in a transaction. */
|
||||
|
||||
inline bool
|
||||
bb_in_transaction (basic_block bb)
|
||||
{
|
||||
return bb->flags & BB_IN_TRANSACTION;
|
||||
}
|
||||
|
||||
/* Return true when one of the predecessor edges of BB is marked with EDGE_EH. */
|
||||
inline bool
|
||||
bb_has_eh_pred (basic_block bb)
|
||||
{
|
||||
edge e;
|
||||
edge_iterator ei;
|
||||
|
||||
FOR_EACH_EDGE (e, ei, bb->preds)
|
||||
{
|
||||
if (e->flags & EDGE_EH)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Return true when one of the predecessor edges of BB is marked with EDGE_ABNORMAL. */
|
||||
inline bool
|
||||
bb_has_abnormal_pred (basic_block bb)
|
||||
{
|
||||
edge e;
|
||||
edge_iterator ei;
|
||||
|
||||
FOR_EACH_EDGE (e, ei, bb->preds)
|
||||
{
|
||||
if (e->flags & EDGE_ABNORMAL)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Return the fallthru edge in EDGES if it exists, NULL otherwise. */
|
||||
inline edge
|
||||
find_fallthru_edge (vec<edge, va_gc> *edges)
|
||||
{
|
||||
edge e;
|
||||
edge_iterator ei;
|
||||
|
||||
FOR_EACH_EDGE (e, ei, edges)
|
||||
if (e->flags & EDGE_FALLTHRU)
|
||||
break;
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
/* Check tha probability is sane. */
|
||||
|
||||
inline void
|
||||
check_probability (int prob)
|
||||
{
|
||||
gcc_checking_assert (prob >= 0 && prob <= REG_BR_PROB_BASE);
|
||||
}
|
||||
|
||||
/* Given PROB1 and PROB2, return PROB1*PROB2/REG_BR_PROB_BASE.
|
||||
Used to combine BB probabilities. */
|
||||
|
||||
inline int
|
||||
combine_probabilities (int prob1, int prob2)
|
||||
{
|
||||
check_probability (prob1);
|
||||
check_probability (prob2);
|
||||
return RDIV (prob1 * prob2, REG_BR_PROB_BASE);
|
||||
}
|
||||
|
||||
/* Apply scale factor SCALE on frequency or count FREQ. Use this
|
||||
interface when potentially scaling up, so that SCALE is not
|
||||
constrained to be < REG_BR_PROB_BASE. */
|
||||
|
||||
inline gcov_type
|
||||
apply_scale (gcov_type freq, gcov_type scale)
|
||||
{
|
||||
return RDIV (freq * scale, REG_BR_PROB_BASE);
|
||||
}
|
||||
|
||||
/* Apply probability PROB on frequency or count FREQ. */
|
||||
|
||||
inline gcov_type
|
||||
apply_probability (gcov_type freq, int prob)
|
||||
{
|
||||
check_probability (prob);
|
||||
return apply_scale (freq, prob);
|
||||
}
|
||||
|
||||
/* Return inverse probability for PROB. */
|
||||
|
||||
inline int
|
||||
inverse_probability (int prob1)
|
||||
{
|
||||
check_probability (prob1);
|
||||
return REG_BR_PROB_BASE - prob1;
|
||||
}
|
||||
|
||||
/* Return true if BB has at least one abnormal outgoing edge. */
|
||||
|
||||
inline bool
|
||||
has_abnormal_or_eh_outgoing_edge_p (basic_block bb)
|
||||
{
|
||||
edge e;
|
||||
edge_iterator ei;
|
||||
|
||||
FOR_EACH_EDGE (e, ei, bb->succs)
|
||||
if (e->flags & (EDGE_ABNORMAL | EDGE_EH))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Return true when one of the predecessor edges of BB is marked with
|
||||
EDGE_ABNORMAL_CALL or EDGE_EH. */
|
||||
|
||||
inline bool
|
||||
has_abnormal_call_or_eh_pred_edge_p (basic_block bb)
|
||||
{
|
||||
edge e;
|
||||
edge_iterator ei;
|
||||
|
||||
FOR_EACH_EDGE (e, ei, bb->preds)
|
||||
if (e->flags & (EDGE_ABNORMAL_CALL | EDGE_EH))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Return count of edge E. */
|
||||
inline profile_count edge_def::count () const
|
||||
{
|
||||
return src->count.apply_probability (probability);
|
||||
}
|
||||
|
||||
#endif /* GCC_BASIC_BLOCK_H */
|
||||
@@ -0,0 +1,40 @@
|
||||
/* Basic block reordering routines for the GNU compiler.
|
||||
Copyright (C) 2000-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3, or (at your option)
|
||||
any later version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GCC; see the file COPYING3. If not see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef GCC_BB_REORDER
|
||||
#define GCC_BB_REORDER
|
||||
|
||||
/* Target-specific globals. */
|
||||
struct target_bb_reorder {
|
||||
/* Length of unconditional jump instruction. */
|
||||
int x_uncond_jump_length;
|
||||
};
|
||||
|
||||
extern struct target_bb_reorder default_target_bb_reorder;
|
||||
#if SWITCHABLE_TARGET
|
||||
extern struct target_bb_reorder *this_target_bb_reorder;
|
||||
#else
|
||||
#define this_target_bb_reorder (&default_target_bb_reorder)
|
||||
#endif
|
||||
|
||||
extern int get_uncond_jump_length (void);
|
||||
|
||||
extern void insert_section_boundary_note (void);
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,427 @@
|
||||
/* Copyright (C) 2001-2023 Free Software Foundation, Inc.
|
||||
Contributed by Joseph Myers <jsm28@cam.ac.uk>.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GCC; see the file COPYING3. If not see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* This header provides a declarative way of describing the attributes
|
||||
that are applied to some built-in functions by default. Attributes
|
||||
that are meant to be used by user-defined functions but aren't used
|
||||
by any built-ins, or attributes that apply to types or variables
|
||||
but not to functions need not and should not be defined here.
|
||||
|
||||
Before including this header, you must define the following macros.
|
||||
In each case where there is an ENUM, it is an identifier used to
|
||||
reference the tree in subsequent definitions.
|
||||
|
||||
DEF_ATTR_NULL_TREE (ENUM)
|
||||
|
||||
Constructs a NULL_TREE.
|
||||
|
||||
DEF_ATTR_INT (ENUM, VALUE)
|
||||
|
||||
Constructs an INTEGER_CST with value VALUE (an integer representable
|
||||
in HOST_WIDE_INT).
|
||||
|
||||
DEF_ATTR_IDENT (ENUM, STRING)
|
||||
|
||||
Constructs an IDENTIFIER_NODE for STRING.
|
||||
|
||||
DEF_ATTR_TREE_LIST (ENUM, PURPOSE, VALUE, CHAIN)
|
||||
|
||||
Constructs a TREE_LIST with given PURPOSE, VALUE and CHAIN (given
|
||||
as previous ENUM names). */
|
||||
|
||||
DEF_ATTR_NULL_TREE (ATTR_NULL)
|
||||
|
||||
/* Construct a tree for a given integer and a list containing it. */
|
||||
#define DEF_ATTR_FOR_INT(VALUE) \
|
||||
DEF_ATTR_INT (ATTR_##VALUE, VALUE) \
|
||||
DEF_ATTR_TREE_LIST (ATTR_LIST_##VALUE, ATTR_NULL, \
|
||||
ATTR_##VALUE, ATTR_NULL)
|
||||
DEF_ATTR_FOR_INT (0)
|
||||
DEF_ATTR_FOR_INT (1)
|
||||
DEF_ATTR_FOR_INT (2)
|
||||
DEF_ATTR_FOR_INT (3)
|
||||
DEF_ATTR_FOR_INT (4)
|
||||
DEF_ATTR_FOR_INT (5)
|
||||
DEF_ATTR_FOR_INT (6)
|
||||
#undef DEF_ATTR_FOR_INT
|
||||
|
||||
/* Construct a tree for a given string and a list containing it. */
|
||||
#define DEF_ATTR_FOR_STRING(ENUM, VALUE) \
|
||||
DEF_ATTR_STRING (ATTR_##ENUM, VALUE) \
|
||||
DEF_ATTR_TREE_LIST (ATTR_LIST_##ENUM, ATTR_NULL, \
|
||||
ATTR_##ENUM, ATTR_NULL)
|
||||
DEF_ATTR_FOR_STRING (STR1, "1 ")
|
||||
DEF_ATTR_FOR_STRING (STRERRNOC, ".C")
|
||||
DEF_ATTR_FOR_STRING (STRERRNOP, ".P")
|
||||
#undef DEF_ATTR_FOR_STRING
|
||||
|
||||
/* Construct a tree for a list of two integers. */
|
||||
#define DEF_LIST_INT_INT(VALUE1, VALUE2) \
|
||||
DEF_ATTR_TREE_LIST (ATTR_LIST_##VALUE1##_##VALUE2, ATTR_NULL, \
|
||||
ATTR_##VALUE1, ATTR_LIST_##VALUE2)
|
||||
DEF_LIST_INT_INT (1,0)
|
||||
DEF_LIST_INT_INT (1,2)
|
||||
DEF_LIST_INT_INT (1,3)
|
||||
DEF_LIST_INT_INT (1,4)
|
||||
DEF_LIST_INT_INT (1,5)
|
||||
DEF_LIST_INT_INT (2,0)
|
||||
DEF_LIST_INT_INT (2,3)
|
||||
DEF_LIST_INT_INT (3,0)
|
||||
DEF_LIST_INT_INT (3,4)
|
||||
DEF_LIST_INT_INT (4,0)
|
||||
DEF_LIST_INT_INT (4,5)
|
||||
DEF_LIST_INT_INT (5,0)
|
||||
DEF_LIST_INT_INT (5,6)
|
||||
#undef DEF_LIST_INT_INT
|
||||
|
||||
/* Construct trees for identifiers used in built-in function attributes.
|
||||
The construction contributes to startup costs so only attributes that
|
||||
are used to define built-ins should be defined here. */
|
||||
DEF_ATTR_IDENT (ATTR_ALLOC_SIZE, "alloc_size")
|
||||
DEF_ATTR_IDENT (ATTR_COLD, "cold")
|
||||
DEF_ATTR_IDENT (ATTR_CONST, "const")
|
||||
DEF_ATTR_IDENT (ATTR_FORMAT, "format")
|
||||
DEF_ATTR_IDENT (ATTR_FORMAT_ARG, "format_arg")
|
||||
DEF_ATTR_IDENT (ATTR_MALLOC, "malloc")
|
||||
DEF_ATTR_IDENT (ATTR_NONNULL, "nonnull")
|
||||
DEF_ATTR_IDENT (ATTR_NORETURN, "noreturn")
|
||||
DEF_ATTR_IDENT (ATTR_NOTHROW, "nothrow")
|
||||
DEF_ATTR_IDENT (ATTR_LEAF, "leaf")
|
||||
DEF_ATTR_IDENT (ATTR_FNSPEC, "fn spec")
|
||||
DEF_ATTR_IDENT (ATTR_PRINTF, "printf")
|
||||
DEF_ATTR_IDENT (ATTR_ASM_FPRINTF, "asm_fprintf")
|
||||
DEF_ATTR_IDENT (ATTR_GCC_DIAG, "gcc_diag")
|
||||
DEF_ATTR_IDENT (ATTR_GCC_CDIAG, "gcc_cdiag")
|
||||
DEF_ATTR_IDENT (ATTR_GCC_CXXDIAG, "gcc_cxxdiag")
|
||||
DEF_ATTR_IDENT (ATTR_PURE, "pure")
|
||||
DEF_ATTR_IDENT (ATTR_NOVOPS, "no vops")
|
||||
DEF_ATTR_IDENT (ATTR_SCANF, "scanf")
|
||||
DEF_ATTR_IDENT (ATTR_SENTINEL, "sentinel")
|
||||
DEF_ATTR_IDENT (ATTR_STRFMON, "strfmon")
|
||||
DEF_ATTR_IDENT (ATTR_STRFTIME, "strftime")
|
||||
DEF_ATTR_IDENT (ATTR_TYPEGENERIC, "type generic")
|
||||
DEF_ATTR_IDENT (ATTR_TM_REGPARM, "*tm regparm")
|
||||
DEF_ATTR_IDENT (ATTR_TM_TMPURE, "transaction_pure")
|
||||
DEF_ATTR_IDENT (ATTR_RETURNS_TWICE, "returns_twice")
|
||||
DEF_ATTR_IDENT (ATTR_RETURNS_NONNULL, "returns_nonnull")
|
||||
DEF_ATTR_IDENT (ATTR_WARN_UNUSED_RESULT, "warn_unused_result")
|
||||
|
||||
DEF_ATTR_TREE_LIST (ATTR_NOVOPS_LIST, ATTR_NOVOPS, ATTR_NULL, ATTR_NULL)
|
||||
|
||||
DEF_ATTR_TREE_LIST (ATTR_NOVOPS_LEAF_LIST, ATTR_LEAF, ATTR_NULL, ATTR_NOVOPS_LIST)
|
||||
|
||||
DEF_ATTR_TREE_LIST (ATTR_LEAF_LIST, ATTR_LEAF, ATTR_NULL, ATTR_NULL)
|
||||
|
||||
DEF_ATTR_TREE_LIST (ATTR_NOTHROW_LIST, ATTR_NOTHROW, ATTR_NULL, ATTR_NULL)
|
||||
|
||||
DEF_ATTR_TREE_LIST (ATTR_NOTHROW_LEAF_LIST, ATTR_LEAF, ATTR_NULL, ATTR_NOTHROW_LIST)
|
||||
|
||||
DEF_ATTR_TREE_LIST (ATTR_NOVOPS_NOTHROW_LEAF_LIST, ATTR_NOVOPS, \
|
||||
ATTR_NULL, ATTR_NOTHROW_LEAF_LIST)
|
||||
DEF_ATTR_TREE_LIST (ATTR_CONST_NOTHROW_LIST, ATTR_CONST, \
|
||||
ATTR_NULL, ATTR_NOTHROW_LIST)
|
||||
DEF_ATTR_TREE_LIST (ATTR_CONST_NOTHROW_LEAF_LIST, ATTR_CONST, \
|
||||
ATTR_NULL, ATTR_NOTHROW_LEAF_LIST)
|
||||
DEF_ATTR_TREE_LIST (ATTR_ERRNOCONST_NOTHROW_LEAF_LIST, ATTR_FNSPEC,\
|
||||
ATTR_LIST_STRERRNOC, ATTR_NOTHROW_LEAF_LIST)
|
||||
DEF_ATTR_TREE_LIST (ATTR_ERRNOPURE_NOTHROW_LEAF_LIST, ATTR_FNSPEC,\
|
||||
ATTR_LIST_STRERRNOP, ATTR_NOTHROW_LEAF_LIST)
|
||||
DEF_ATTR_TREE_LIST (ATTR_PURE_NOTHROW_LIST, ATTR_PURE, \
|
||||
ATTR_NULL, ATTR_NOTHROW_LIST)
|
||||
DEF_ATTR_TREE_LIST (ATTR_PURE_NOTHROW_LEAF_LIST, ATTR_PURE, \
|
||||
ATTR_NULL, ATTR_NOTHROW_LEAF_LIST)
|
||||
DEF_ATTR_TREE_LIST (ATTR_NORETURN_NOTHROW_LIST, ATTR_NORETURN, \
|
||||
ATTR_NULL, ATTR_NOTHROW_LIST)
|
||||
DEF_ATTR_TREE_LIST (ATTR_NORETURN_NOTHROW_LEAF_LIST, ATTR_NORETURN,\
|
||||
ATTR_NULL, ATTR_NOTHROW_LEAF_LIST)
|
||||
DEF_ATTR_TREE_LIST (ATTR_NORETURN_NOTHROW_LEAF_COLD_LIST, ATTR_COLD,\
|
||||
ATTR_NULL, ATTR_NORETURN_NOTHROW_LEAF_LIST)
|
||||
DEF_ATTR_TREE_LIST (ATTR_RT_NOTHROW_LEAF_LIST, ATTR_RETURNS_TWICE,\
|
||||
ATTR_NULL, ATTR_NOTHROW_LEAF_LIST)
|
||||
DEF_ATTR_TREE_LIST (ATTR_COLD_NOTHROW_LEAF_LIST, ATTR_COLD,\
|
||||
ATTR_NULL, ATTR_NOTHROW_LEAF_LIST)
|
||||
DEF_ATTR_TREE_LIST (ATTR_COLD_NORETURN_NOTHROW_LEAF_LIST, ATTR_COLD,\
|
||||
ATTR_NULL, ATTR_NORETURN_NOTHROW_LEAF_LIST)
|
||||
DEF_ATTR_TREE_LIST (ATTR_CONST_NORETURN_NOTHROW_LEAF_LIST, ATTR_CONST,\
|
||||
ATTR_NULL, ATTR_NORETURN_NOTHROW_LEAF_LIST)
|
||||
DEF_ATTR_TREE_LIST (ATTR_CONST_NORETURN_NOTHROW_LEAF_COLD_LIST, ATTR_COLD,\
|
||||
ATTR_NULL, ATTR_CONST_NORETURN_NOTHROW_LEAF_LIST)
|
||||
DEF_ATTR_TREE_LIST (ATTR_MALLOC_NOTHROW_LIST, ATTR_MALLOC, \
|
||||
ATTR_NULL, ATTR_NOTHROW_LIST)
|
||||
DEF_ATTR_TREE_LIST (ATTR_WARN_UNUSED_RESULT_NOTHROW_LEAF_LIST, ATTR_WARN_UNUSED_RESULT, \
|
||||
ATTR_NULL, ATTR_NOTHROW_LEAF_LIST)
|
||||
DEF_ATTR_TREE_LIST (ATTR_MALLOC_WARN_UNUSED_RESULT_NOTHROW_LEAF_LIST, ATTR_MALLOC, \
|
||||
ATTR_NULL, ATTR_WARN_UNUSED_RESULT_NOTHROW_LEAF_LIST)
|
||||
DEF_ATTR_TREE_LIST (ATTR_SENTINEL_NOTHROW_LIST, ATTR_SENTINEL, \
|
||||
ATTR_NULL, ATTR_NOTHROW_LIST)
|
||||
DEF_ATTR_TREE_LIST (ATTR_SENTINEL_NOTHROW_LEAF_LIST, ATTR_SENTINEL, \
|
||||
ATTR_NULL, ATTR_NOTHROW_LEAF_LIST)
|
||||
DEF_ATTR_TREE_LIST (ATTR_COLD_CONST_NORETURN_NOTHROW_LEAF_LIST, ATTR_CONST,\
|
||||
ATTR_NULL, ATTR_COLD_NORETURN_NOTHROW_LEAF_LIST)
|
||||
|
||||
/* Allocation functions like malloc and realloc whose first argument
|
||||
with _SIZE_1, or second argument with _SIZE_2, specifies the size
|
||||
of the allocated object. */
|
||||
DEF_ATTR_TREE_LIST (ATTR_MALLOC_SIZE_1_NOTHROW_LIST, ATTR_ALLOC_SIZE, \
|
||||
ATTR_LIST_1, ATTR_MALLOC_NOTHROW_LIST)
|
||||
DEF_ATTR_TREE_LIST (ATTR_MALLOC_WARN_UNUSED_RESULT_NOTHROW_LIST, ATTR_WARN_UNUSED_RESULT, \
|
||||
ATTR_NULL, ATTR_MALLOC_NOTHROW_LIST)
|
||||
DEF_ATTR_TREE_LIST (ATTR_ALLOC_WARN_UNUSED_RESULT_SIZE_2_NOTHROW_LIST, ATTR_ALLOC_SIZE, \
|
||||
ATTR_LIST_2, ATTR_MALLOC_WARN_UNUSED_RESULT_NOTHROW_LIST)
|
||||
DEF_ATTR_TREE_LIST (ATTR_MALLOC_WARN_UNUSED_RESULT_SIZE_1_NOTHROW_LEAF_LIST, ATTR_ALLOC_SIZE, \
|
||||
ATTR_LIST_1, ATTR_MALLOC_WARN_UNUSED_RESULT_NOTHROW_LEAF_LIST)
|
||||
/* Alloca is just like malloc except that it never returns null. */
|
||||
DEF_ATTR_TREE_LIST (ATTR_ALLOCA_WARN_UNUSED_RESULT_SIZE_1_NOTHROW_LEAF_LIST, ATTR_RETURNS_NONNULL,
|
||||
ATTR_NULL, ATTR_MALLOC_WARN_UNUSED_RESULT_SIZE_1_NOTHROW_LEAF_LIST)
|
||||
|
||||
/* Allocation functions like calloc the product of whose first two arguments
|
||||
specifies the size of the allocated object. */
|
||||
DEF_ATTR_TREE_LIST (ATTR_MALLOC_WARN_UNUSED_RESULT_SIZE_1_2_NOTHROW_LEAF_LIST, ATTR_ALLOC_SIZE, \
|
||||
ATTR_LIST_1_2, ATTR_MALLOC_WARN_UNUSED_RESULT_NOTHROW_LEAF_LIST)
|
||||
|
||||
/* Allocation functions like realloc whose second argument specifies
|
||||
the size of the allocated object. */
|
||||
DEF_ATTR_TREE_LIST (ATTR_ALLOC_WARN_UNUSED_RESULT_SIZE_2_NOTHROW_LEAF_LIST, ATTR_ALLOC_SIZE, \
|
||||
ATTR_LIST_2, ATTR_WARN_UNUSED_RESULT_NOTHROW_LEAF_LIST)
|
||||
|
||||
/* Functions whose pointer parameter(s) are all nonnull. */
|
||||
DEF_ATTR_TREE_LIST (ATTR_NONNULL_LIST, ATTR_NONNULL, ATTR_NULL, ATTR_NULL)
|
||||
/* Functions whose first parameter is a nonnull pointer. */
|
||||
DEF_ATTR_TREE_LIST (ATTR_NONNULL_1, ATTR_NONNULL, ATTR_LIST_1, ATTR_NULL)
|
||||
/* Functions whose second parameter is a nonnull pointer. */
|
||||
DEF_ATTR_TREE_LIST (ATTR_NONNULL_2, ATTR_NONNULL, ATTR_LIST_2, ATTR_NULL)
|
||||
/* Functions whose third parameter is a nonnull pointer. */
|
||||
DEF_ATTR_TREE_LIST (ATTR_NONNULL_3, ATTR_NONNULL, ATTR_LIST_3, ATTR_NULL)
|
||||
/* Nothrow functions with the sentinel(1) attribute. */
|
||||
DEF_ATTR_TREE_LIST (ATTR_NOTHROW_SENTINEL_1, ATTR_SENTINEL, ATTR_LIST_1, \
|
||||
ATTR_NOTHROW_LIST)
|
||||
/* Nothrow functions whose pointer parameter(s) are all nonnull. */
|
||||
DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL, ATTR_NONNULL, ATTR_NULL, \
|
||||
ATTR_NOTHROW_LIST)
|
||||
/* Nothrow leaf functions whose pointer parameter(s) are all nonnull. */
|
||||
DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL_LEAF, ATTR_NONNULL, ATTR_NULL, \
|
||||
ATTR_NOTHROW_LEAF_LIST)
|
||||
DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL_LEAF_LIST, ATTR_LEAF, ATTR_NULL, ATTR_NOTHROW_NONNULL_LEAF)
|
||||
/* Nothrow functions whose first parameter is a nonnull pointer. */
|
||||
DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL_1, ATTR_NONNULL, ATTR_LIST_1, \
|
||||
ATTR_NOTHROW_LIST)
|
||||
/* Nothrow functions whose second parameter is a nonnull pointer. */
|
||||
DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL_2, ATTR_NONNULL, ATTR_LIST_2, \
|
||||
ATTR_NOTHROW_LIST)
|
||||
/* Nothrow functions whose third parameter is a nonnull pointer. */
|
||||
DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL_3, ATTR_NONNULL, ATTR_LIST_3, \
|
||||
ATTR_NOTHROW_LIST)
|
||||
/* Nothrow functions whose fourth parameter is a nonnull pointer. */
|
||||
DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL_4, ATTR_NONNULL, ATTR_LIST_4, \
|
||||
ATTR_NOTHROW_LIST)
|
||||
/* Nothrow functions whose fifth parameter is a nonnull pointer. */
|
||||
DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL_5, ATTR_NONNULL, ATTR_LIST_5, \
|
||||
ATTR_NOTHROW_LIST)
|
||||
|
||||
/* Same as ATTR_NONNULL_1. */
|
||||
DEF_ATTR_TREE_LIST (ATTR_NONNULL_1_1, ATTR_NONNULL, ATTR_LIST_1, ATTR_NULL)
|
||||
/* Functions like {v,}fprintf whose first and second parameters are
|
||||
nonnull pointers. As cancellation points the functions are not
|
||||
nothrow. */
|
||||
DEF_ATTR_TREE_LIST (ATTR_NONNULL_1_2, ATTR_NONNULL, ATTR_LIST_1_2, ATTR_NULL)
|
||||
/* The following don't have {v,}fprintf forms. They exist only to
|
||||
make it possible to declare {v,}{f,s}printf attributes using
|
||||
the same macro. */
|
||||
DEF_ATTR_TREE_LIST (ATTR_NONNULL_1_3, ATTR_NONNULL, ATTR_LIST_1_3, ATTR_NULL)
|
||||
DEF_ATTR_TREE_LIST (ATTR_NONNULL_1_4, ATTR_NONNULL, ATTR_LIST_1_4, ATTR_NULL)
|
||||
DEF_ATTR_TREE_LIST (ATTR_NONNULL_1_5, ATTR_NONNULL, ATTR_LIST_1_5, ATTR_NULL)
|
||||
|
||||
/* Same as ATTR_NOTHROW_NONNULL_1. */
|
||||
DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL_1_1, ATTR_NONNULL, ATTR_LIST_1,
|
||||
ATTR_NOTHROW_LIST)
|
||||
/* Nothrow functions like {v,}sprintf whose first and second parameters
|
||||
are nonnull pointers. */
|
||||
DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL_1_2, ATTR_NONNULL, ATTR_LIST_1_2, \
|
||||
ATTR_NOTHROW_LIST)
|
||||
/* Nothrow functions like {v,}snprintf whose first and third parameters
|
||||
are nonnull pointers. */
|
||||
DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL_1_3, ATTR_NONNULL, ATTR_LIST_1_3, \
|
||||
ATTR_NOTHROW_LIST)
|
||||
/* Nothrow functions like {v,}sprintf_chk whose first and fourth parameters
|
||||
are nonnull pointers. */
|
||||
DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL_1_4, ATTR_NONNULL, ATTR_LIST_1_4, \
|
||||
ATTR_NOTHROW_LIST)
|
||||
/* Nothrow functions like {v,}snprintf_chk whose first and fifth parameters
|
||||
are nonnull pointers. */
|
||||
DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL_1_5, ATTR_NONNULL, ATTR_LIST_1_5, \
|
||||
ATTR_NOTHROW_LIST)
|
||||
|
||||
/* Nothrow leaf functions which are type-generic. */
|
||||
DEF_ATTR_TREE_LIST (ATTR_NOTHROW_TYPEGENERIC_LEAF, ATTR_TYPEGENERIC, ATTR_NULL, \
|
||||
ATTR_NOTHROW_LEAF_LIST)
|
||||
/* Nothrow nonnull leaf functions that are type-generic. */
|
||||
DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL_TYPEGENERIC_LEAF,
|
||||
ATTR_TYPEGENERIC, ATTR_NULL,
|
||||
ATTR_NOTHROW_NONNULL_LEAF)
|
||||
/* Nothrow const functions whose pointer parameter(s) are all nonnull. */
|
||||
DEF_ATTR_TREE_LIST (ATTR_CONST_NOTHROW_NONNULL, ATTR_CONST, ATTR_NULL, \
|
||||
ATTR_NOTHROW_NONNULL)
|
||||
/* Nothrow leaf functions whose pointer parameter(s) are all nonnull,
|
||||
and which return their first argument. */
|
||||
DEF_ATTR_TREE_LIST (ATTR_RET1_NOTHROW_NONNULL_LEAF, ATTR_FNSPEC, ATTR_LIST_STR1, \
|
||||
ATTR_NOTHROW_NONNULL_LEAF)
|
||||
/* Nothrow leaf functions whose pointer parameter(s) are all nonnull,
|
||||
and return value is also nonnull. */
|
||||
DEF_ATTR_TREE_LIST (ATTR_RETNONNULL_NOTHROW_LEAF, ATTR_RETURNS_NONNULL, ATTR_NULL, \
|
||||
ATTR_NOTHROW_NONNULL_LEAF)
|
||||
/* Nothrow const leaf functions whose pointer parameter(s) are all nonnull. */
|
||||
DEF_ATTR_TREE_LIST (ATTR_CONST_NOTHROW_NONNULL_LEAF, ATTR_CONST, ATTR_NULL, \
|
||||
ATTR_NOTHROW_NONNULL_LEAF)
|
||||
/* Nothrow const functions which are type-generic. */
|
||||
DEF_ATTR_TREE_LIST (ATTR_CONST_NOTHROW_TYPEGENERIC, ATTR_TYPEGENERIC, ATTR_NULL, \
|
||||
ATTR_CONST_NOTHROW_LIST)
|
||||
/* Nothrow const leaf functions which are type-generic. */
|
||||
DEF_ATTR_TREE_LIST (ATTR_CONST_NOTHROW_TYPEGENERIC_LEAF, ATTR_TYPEGENERIC, ATTR_NULL, \
|
||||
ATTR_CONST_NOTHROW_LEAF_LIST)
|
||||
/* Nothrow pure functions whose pointer parameter(s) are all nonnull. */
|
||||
DEF_ATTR_TREE_LIST (ATTR_PURE_NOTHROW_NONNULL, ATTR_PURE, ATTR_NULL, \
|
||||
ATTR_NOTHROW_NONNULL)
|
||||
/* Nothrow pure leaf functions whose pointer parameter(s) are all nonnull. */
|
||||
DEF_ATTR_TREE_LIST (ATTR_PURE_NOTHROW_NONNULL_LEAF, ATTR_PURE, ATTR_NULL, \
|
||||
ATTR_NOTHROW_NONNULL_LEAF)
|
||||
/* Nothrow malloc functions whose pointer parameter(s) are all nonnull. */
|
||||
DEF_ATTR_TREE_LIST (ATTR_WARN_UNUSED_RESULT_NOTHROW_NONNULL, ATTR_WARN_UNUSED_RESULT, ATTR_NULL, \
|
||||
ATTR_NOTHROW_NONNULL)
|
||||
DEF_ATTR_TREE_LIST (ATTR_MALLOC_WARN_UNUSED_RESULT_NOTHROW_NONNULL, ATTR_MALLOC, ATTR_NULL, \
|
||||
ATTR_WARN_UNUSED_RESULT_NOTHROW_NONNULL)
|
||||
/* Nothrow malloc leaf functions whose pointer parameter(s) are all nonnull. */
|
||||
DEF_ATTR_TREE_LIST (ATTR_WARN_UNUSED_RESULT_NOTHROW_NONNULL_LEAF, ATTR_WARN_UNUSED_RESULT, ATTR_NULL, \
|
||||
ATTR_NOTHROW_NONNULL_LEAF)
|
||||
DEF_ATTR_TREE_LIST (ATTR_MALLOC_WARN_UNUSED_RESULT_NOTHROW_NONNULL_LEAF, ATTR_MALLOC, ATTR_NULL, \
|
||||
ATTR_WARN_UNUSED_RESULT_NOTHROW_NONNULL_LEAF)
|
||||
|
||||
/* Construct a tree for the format attribute (and implicitly nonnull). */
|
||||
#define DEF_FORMAT_ATTRIBUTE(TYPE, FA, VALUES) \
|
||||
DEF_ATTR_TREE_LIST (ATTR_##TYPE##_##VALUES, ATTR_NULL, \
|
||||
ATTR_##TYPE, ATTR_LIST_##VALUES) \
|
||||
DEF_ATTR_TREE_LIST (ATTR_FORMAT_##TYPE##_##VALUES, ATTR_FORMAT, \
|
||||
ATTR_##TYPE##_##VALUES, ATTR_NONNULL_##FA)
|
||||
|
||||
/* Construct a tree for the format and nothrow attributes (format
|
||||
implies nonnull). */
|
||||
#define DEF_FORMAT_ATTRIBUTE_NOTHROW(TYPE, FA, VALUES) \
|
||||
DEF_ATTR_TREE_LIST (ATTR_##TYPE##_##VALUES, ATTR_NULL, \
|
||||
ATTR_##TYPE, ATTR_LIST_##VALUES) \
|
||||
DEF_ATTR_TREE_LIST (ATTR_FORMAT_##TYPE##_NOTHROW_##VALUES, ATTR_FORMAT,\
|
||||
ATTR_##TYPE##_##VALUES, ATTR_NOTHROW_NONNULL_##FA)
|
||||
|
||||
/* Construct one tree for the format attribute and another for the format
|
||||
and nothrow attributes (in both cases format implies nonnull). */
|
||||
#define DEF_FORMAT_ATTRIBUTE_BOTH(TYPE, FA, VALUES) \
|
||||
DEF_ATTR_TREE_LIST (ATTR_##TYPE##_##VALUES, ATTR_NULL, \
|
||||
ATTR_##TYPE, ATTR_LIST_##VALUES) \
|
||||
DEF_ATTR_TREE_LIST (ATTR_FORMAT_##TYPE##_##VALUES, ATTR_FORMAT, \
|
||||
ATTR_##TYPE##_##VALUES, ATTR_NONNULL_##FA) \
|
||||
DEF_ATTR_TREE_LIST (ATTR_FORMAT_##TYPE##_NOTHROW_##VALUES, ATTR_FORMAT,\
|
||||
ATTR_##TYPE##_##VALUES, ATTR_NOTHROW_NONNULL_##FA)
|
||||
|
||||
/* Construct a pair of trees for the nonnull attribute for the first
|
||||
argument, plus format printf attribute (format implies nonnull):
|
||||
the first ordinary and the second nothrow. */
|
||||
#define DEF_FORMAT_ATTRIBUTE_NONNULL(TYPE, FA, VALUES) \
|
||||
DEF_ATTR_TREE_LIST (ATTR_NONNULL_1_FORMAT_##TYPE##_##VALUES, \
|
||||
ATTR_FORMAT, ATTR_##TYPE##_##VALUES, \
|
||||
ATTR_NONNULL_1_##FA) \
|
||||
DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL_1_FORMAT_##TYPE##_##VALUES, \
|
||||
ATTR_FORMAT, ATTR_##TYPE##_##VALUES, \
|
||||
ATTR_NOTHROW_NONNULL_1_##FA)
|
||||
|
||||
DEF_FORMAT_ATTRIBUTE(PRINTF,1,1_0)
|
||||
DEF_FORMAT_ATTRIBUTE(PRINTF,1,1_2)
|
||||
DEF_FORMAT_ATTRIBUTE_BOTH(PRINTF,2,2_0)
|
||||
DEF_FORMAT_ATTRIBUTE_BOTH(PRINTF,2,2_3)
|
||||
DEF_FORMAT_ATTRIBUTE_BOTH(PRINTF,3,3_0)
|
||||
DEF_FORMAT_ATTRIBUTE_BOTH(PRINTF,3,3_4)
|
||||
DEF_FORMAT_ATTRIBUTE_NOTHROW(PRINTF,4,4_0)
|
||||
DEF_FORMAT_ATTRIBUTE_NOTHROW(PRINTF,4,4_5)
|
||||
DEF_FORMAT_ATTRIBUTE_NOTHROW(PRINTF,5,5_0)
|
||||
DEF_FORMAT_ATTRIBUTE_NOTHROW(PRINTF,5,5_6)
|
||||
|
||||
/* Attributes for fprintf(f, f, va). */
|
||||
DEF_FORMAT_ATTRIBUTE_NONNULL(PRINTF,1,1_2)
|
||||
/* Attributes for v{f,s}printf(d, f, va). vsprintf is nothrow, vfprintf
|
||||
is not. */
|
||||
DEF_FORMAT_ATTRIBUTE_NONNULL(PRINTF,2,2_0)
|
||||
/* Attributes for {f,s}printf(d, f, ...). sprintf is nothrow, fprintf
|
||||
is not. */
|
||||
DEF_FORMAT_ATTRIBUTE_NONNULL(PRINTF,2,2_3)
|
||||
/* Attributes for vprintf_chk. */
|
||||
DEF_FORMAT_ATTRIBUTE_NONNULL(PRINTF,3,3_0)
|
||||
/* Attributes for printf_chk. */
|
||||
DEF_FORMAT_ATTRIBUTE_NONNULL(PRINTF,3,3_4)
|
||||
/* Attributes for v{f,s}printf_chk(d, t, bos, f, va). vsprintf_chk is
|
||||
nothrow, vfprintf_chk is not. */
|
||||
DEF_FORMAT_ATTRIBUTE_NONNULL(PRINTF,4,4_0)
|
||||
/* Attributes for {f,s}printf_chk(d, t, bos, f, ...). sprintf_chk is
|
||||
nothrow, fprintf_chk is not. */
|
||||
DEF_FORMAT_ATTRIBUTE_NONNULL(PRINTF,4,4_5)
|
||||
|
||||
DEF_FORMAT_ATTRIBUTE(SCANF,1,1_0)
|
||||
DEF_FORMAT_ATTRIBUTE(SCANF,1,1_2)
|
||||
DEF_FORMAT_ATTRIBUTE_BOTH(SCANF,2,2_0)
|
||||
DEF_FORMAT_ATTRIBUTE_BOTH(SCANF,2,2_3)
|
||||
DEF_FORMAT_ATTRIBUTE_NOTHROW(STRFTIME,3,3_0)
|
||||
DEF_FORMAT_ATTRIBUTE_NOTHROW(STRFMON,3,3_4)
|
||||
#undef DEF_FORMAT_ATTRIBUTE
|
||||
#undef DEF_FORMAT_ATTRIBUTE_NOTHROW
|
||||
#undef DEF_FORMAT_ATTRIBUTE_BOTH
|
||||
|
||||
/* Transactional memory variants of the above. */
|
||||
|
||||
DEF_ATTR_TREE_LIST (ATTR_TM_NOTHROW_LIST,
|
||||
ATTR_TM_REGPARM, ATTR_NULL, ATTR_NOTHROW_LIST)
|
||||
DEF_ATTR_TREE_LIST (ATTR_TM_TMPURE_NOTHROW_LIST,
|
||||
ATTR_TM_TMPURE, ATTR_NULL, ATTR_TM_NOTHROW_LIST)
|
||||
DEF_ATTR_TREE_LIST (ATTR_TM_PURE_TMPURE_NOTHROW_LIST,
|
||||
ATTR_PURE, ATTR_NULL, ATTR_TM_TMPURE_NOTHROW_LIST)
|
||||
DEF_ATTR_TREE_LIST (ATTR_TM_NORETURN_NOTHROW_LIST,
|
||||
ATTR_TM_REGPARM, ATTR_NULL, ATTR_NORETURN_NOTHROW_LIST)
|
||||
DEF_ATTR_TREE_LIST (ATTR_TM_CONST_NOTHROW_LIST,
|
||||
ATTR_TM_REGPARM, ATTR_NULL, ATTR_CONST_NOTHROW_LIST)
|
||||
DEF_ATTR_TREE_LIST (ATTR_TM_NOTHROW_RT_LIST,
|
||||
ATTR_RETURNS_TWICE, ATTR_NULL, ATTR_TM_NOTHROW_LIST)
|
||||
|
||||
/* Same attributes used for BUILT_IN_MALLOC except with TM_PURE thrown in. */
|
||||
DEF_ATTR_TREE_LIST (ATTR_TMPURE_MALLOC_NOTHROW_LIST,
|
||||
ATTR_TM_TMPURE, ATTR_NULL, ATTR_MALLOC_NOTHROW_LIST)
|
||||
/* Same attributes used for BUILT_IN_FREE except with TM_PURE thrown in. */
|
||||
DEF_ATTR_TREE_LIST (ATTR_TMPURE_NOTHROW_LIST,
|
||||
ATTR_TM_TMPURE, ATTR_NULL, ATTR_NOTHROW_LIST)
|
||||
|
||||
DEF_ATTR_TREE_LIST (ATTR_TMPURE_NOTHROW_LEAF_LIST,
|
||||
ATTR_TM_TMPURE, ATTR_NULL, ATTR_NOTHROW_LEAF_LIST)
|
||||
DEF_ATTR_TREE_LIST (ATTR_TMPURE_NORETURN_NOTHROW_LEAF_LIST,
|
||||
ATTR_TM_TMPURE, ATTR_NULL, ATTR_NORETURN_NOTHROW_LEAF_LIST)
|
||||
DEF_ATTR_TREE_LIST (ATTR_TMPURE_NORETURN_NOTHROW_LEAF_COLD_LIST,
|
||||
ATTR_COLD, ATTR_NULL,
|
||||
ATTR_TMPURE_NORETURN_NOTHROW_LEAF_LIST)
|
||||
|
||||
/* Construct a tree for a format_arg attribute. */
|
||||
#define DEF_FORMAT_ARG_ATTRIBUTE(FA) \
|
||||
DEF_ATTR_TREE_LIST (ATTR_FORMAT_ARG_##FA, ATTR_FORMAT_ARG, \
|
||||
ATTR_LIST_##FA, ATTR_NOTHROW_NONNULL_##FA)
|
||||
DEF_FORMAT_ARG_ATTRIBUTE(1)
|
||||
DEF_FORMAT_ARG_ATTRIBUTE(2)
|
||||
#undef DEF_FORMAT_ARG_ATTRIBUTE
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,160 @@
|
||||
/* Expand builtin functions.
|
||||
Copyright (C) 1988-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GCC; see the file COPYING3. If not see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef GCC_BUILTINS_H
|
||||
#define GCC_BUILTINS_H
|
||||
|
||||
#include <mpc.h>
|
||||
|
||||
/* Target-dependent globals. */
|
||||
struct target_builtins {
|
||||
/* For each register that may be used for calling a function, this
|
||||
gives a mode used to copy the register's value. VOIDmode indicates
|
||||
the register is not used for calling a function. If the machine
|
||||
has register windows, this gives only the outbound registers.
|
||||
INCOMING_REGNO gives the corresponding inbound register. */
|
||||
fixed_size_mode_pod x_apply_args_mode[FIRST_PSEUDO_REGISTER];
|
||||
|
||||
/* For each register that may be used for returning values, this gives
|
||||
a mode used to copy the register's value. VOIDmode indicates the
|
||||
register is not used for returning values. If the machine has
|
||||
register windows, this gives only the outbound registers.
|
||||
INCOMING_REGNO gives the corresponding inbound register. */
|
||||
fixed_size_mode_pod x_apply_result_mode[FIRST_PSEUDO_REGISTER];
|
||||
};
|
||||
|
||||
extern struct target_builtins default_target_builtins;
|
||||
#if SWITCHABLE_TARGET
|
||||
extern struct target_builtins *this_target_builtins;
|
||||
#else
|
||||
#define this_target_builtins (&default_target_builtins)
|
||||
#endif
|
||||
|
||||
/* Non-zero if __builtin_constant_p should be folded right away. */
|
||||
extern bool force_folding_builtin_constant_p;
|
||||
|
||||
extern bool called_as_built_in (tree);
|
||||
extern bool get_object_alignment_1 (tree, unsigned int *,
|
||||
unsigned HOST_WIDE_INT *);
|
||||
extern bool get_object_alignment_2 (tree, unsigned int *,
|
||||
unsigned HOST_WIDE_INT *, bool);
|
||||
extern unsigned int get_object_alignment (tree);
|
||||
extern bool get_pointer_alignment_1 (tree, unsigned int *,
|
||||
unsigned HOST_WIDE_INT *);
|
||||
extern unsigned int get_pointer_alignment (tree);
|
||||
extern unsigned string_length (const void*, unsigned, unsigned);
|
||||
|
||||
struct c_strlen_data
|
||||
{
|
||||
/* [MINLEN, MAXBOUND, MAXLEN] is a range describing the length of
|
||||
one or more strings of possibly unknown length. For a single
|
||||
string of known length the range is a constant where
|
||||
MINLEN == MAXBOUND == MAXLEN holds.
|
||||
For other strings, MINLEN is the length of the shortest known
|
||||
string. MAXBOUND is the length of a string that could be stored
|
||||
in the largest array referenced by the expression. MAXLEN is
|
||||
the length of the longest sequence of non-zero bytes
|
||||
in an object referenced by the expression. For such strings,
|
||||
MINLEN <= MAXBOUND <= MAXLEN holds. For example, given:
|
||||
struct A { char a[7], b[]; };
|
||||
extern struct A *p;
|
||||
n = strlen (p->a);
|
||||
the computed range will be [0, 6, ALL_ONES].
|
||||
However, for a conditional expression involving a string
|
||||
of known length and an array of unknown bound such as
|
||||
n = strlen (i ? p->b : "123");
|
||||
the range will be [3, 3, ALL_ONES].
|
||||
MINLEN != 0 && MAXLEN == ALL_ONES indicates that MINLEN is
|
||||
the length of the shortest known string and implies that
|
||||
the shortest possible string referenced by the expression may
|
||||
actually be the empty string. This distinction is useful for
|
||||
diagnostics. get_range_strlen() return value distinguishes
|
||||
between these two cases.
|
||||
As the tighter (and more optimistic) bound, MAXBOUND is suitable
|
||||
for diagnostics but not for optimization.
|
||||
As the more conservative bound, MAXLEN is intended to be used
|
||||
for optimization. */
|
||||
tree minlen;
|
||||
tree maxlen;
|
||||
tree maxbound;
|
||||
/* When non-null, DECL refers to the declaration known to store
|
||||
an unterminated constant character array, as in:
|
||||
const char s[] = { 'a', 'b', 'c' };
|
||||
It is used to diagnose uses of such arrays in functions such as
|
||||
strlen() that expect a nul-terminated string as an argument. */
|
||||
tree decl;
|
||||
/* Non-constant offset from the beginning of a string not accounted
|
||||
for in the length range. Used to improve diagnostics. */
|
||||
tree off;
|
||||
};
|
||||
|
||||
extern tree c_strlen (tree, int, c_strlen_data * = NULL, unsigned = 1);
|
||||
extern rtx c_readstr (const char *, scalar_int_mode, bool = true);
|
||||
extern void expand_builtin_setjmp_setup (rtx, rtx);
|
||||
extern void expand_builtin_setjmp_receiver (rtx);
|
||||
extern void expand_builtin_update_setjmp_buf (rtx);
|
||||
extern tree mathfn_built_in (tree, enum built_in_function fn);
|
||||
extern tree mathfn_built_in (tree, combined_fn);
|
||||
extern tree mathfn_built_in_type (combined_fn);
|
||||
extern rtx builtin_strncpy_read_str (void *, void *, HOST_WIDE_INT,
|
||||
fixed_size_mode);
|
||||
extern rtx builtin_memset_read_str (void *, void *, HOST_WIDE_INT,
|
||||
fixed_size_mode);
|
||||
extern rtx expand_builtin_memset (tree, rtx, machine_mode);
|
||||
extern rtx expand_builtin_saveregs (void);
|
||||
extern tree std_build_builtin_va_list (void);
|
||||
extern tree std_fn_abi_va_list (tree);
|
||||
extern tree std_canonical_va_list_type (tree);
|
||||
extern void std_expand_builtin_va_start (tree, rtx);
|
||||
extern void expand_builtin_trap (void);
|
||||
extern void expand_ifn_atomic_bit_test_and (gcall *);
|
||||
extern void expand_ifn_atomic_compare_exchange (gcall *);
|
||||
extern void expand_ifn_atomic_op_fetch_cmp_0 (gcall *);
|
||||
extern rtx expand_builtin (tree, rtx, rtx, machine_mode, int);
|
||||
extern enum built_in_function builtin_mathfn_code (const_tree);
|
||||
extern tree fold_builtin_expect (location_t, tree, tree, tree, tree);
|
||||
extern bool avoid_folding_inline_builtin (tree);
|
||||
extern tree fold_call_expr (location_t, tree, bool);
|
||||
extern tree fold_builtin_call_array (location_t, tree, tree, int, tree *);
|
||||
extern bool validate_gimple_arglist (const gcall *, ...);
|
||||
extern rtx default_expand_builtin (tree, rtx, rtx, machine_mode, int);
|
||||
extern void maybe_emit_call_builtin___clear_cache (rtx, rtx);
|
||||
extern bool fold_builtin_next_arg (tree, bool);
|
||||
extern tree do_mpc_arg2 (tree, tree, tree, int, int (*)(mpc_ptr, mpc_srcptr, mpc_srcptr, mpc_rnd_t));
|
||||
extern tree fold_call_stmt (gcall *, bool);
|
||||
extern void set_builtin_user_assembler_name (tree decl, const char *asmspec);
|
||||
extern bool is_simple_builtin (tree);
|
||||
extern bool is_inexpensive_builtin (tree);
|
||||
extern bool readonly_data_expr (tree exp);
|
||||
extern bool init_target_chars (void);
|
||||
extern unsigned HOST_WIDE_INT target_newline;
|
||||
extern unsigned HOST_WIDE_INT target_percent;
|
||||
extern char target_percent_s[3];
|
||||
extern char target_percent_c[3];
|
||||
extern char target_percent_s_newline[4];
|
||||
extern bool target_char_cst_p (tree t, char *p);
|
||||
extern rtx get_memory_rtx (tree exp, tree len);
|
||||
|
||||
extern internal_fn associated_internal_fn (combined_fn, tree);
|
||||
extern internal_fn associated_internal_fn (tree);
|
||||
extern internal_fn replacement_internal_fn (gcall *);
|
||||
|
||||
extern bool builtin_with_linkage_p (tree);
|
||||
|
||||
#endif /* GCC_BUILTINS_H */
|
||||
@@ -0,0 +1,4 @@
|
||||
#define BUILDING_GCC_MAJOR 13
|
||||
#define BUILDING_GCC_MINOR 4
|
||||
#define BUILDING_GCC_PATCHLEVEL 0
|
||||
#define BUILDING_GCC_VERSION (BUILDING_GCC_MAJOR * 1000 + BUILDING_GCC_MINOR)
|
||||
@@ -0,0 +1,96 @@
|
||||
/* This file contains the definitions and documentation for the
|
||||
additional tree codes used in the GNU C compiler (see tree.def
|
||||
for the standard codes).
|
||||
Copyright (C) 1987-2023 Free Software Foundation, Inc.
|
||||
Written by Benjamin Chelf <chelf@codesourcery.com>
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GCC; see the file COPYING3. If not see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Tree nodes used in the C frontend. These are also shared with the
|
||||
C++ and Objective C frontends. */
|
||||
|
||||
/* A C_MAYBE_CONST_EXPR, currently only used for C and Objective C,
|
||||
tracks information about constancy of an expression and VLA type
|
||||
sizes or VM expressions from typeof that need to be evaluated
|
||||
before the main expression. It is used during parsing and removed
|
||||
in c_fully_fold. C_MAYBE_CONST_EXPR_PRE is the expression to
|
||||
evaluate first, if not NULL; C_MAYBE_CONST_EXPR_EXPR is the main
|
||||
expression. If C_MAYBE_CONST_EXPR_INT_OPERANDS is set then the
|
||||
expression may be used in an unevaluated part of an integer
|
||||
constant expression, but not in an evaluated part. If
|
||||
C_MAYBE_CONST_EXPR_NON_CONST is set then the expression contains
|
||||
something that cannot occur in an evaluated part of a constant
|
||||
expression (or outside of sizeof in C90 mode); otherwise it does
|
||||
not. */
|
||||
DEFTREECODE (C_MAYBE_CONST_EXPR, "c_maybe_const_expr", tcc_expression, 2)
|
||||
|
||||
/* An EXCESS_PRECISION_EXPR represents an expression evaluated in greater
|
||||
range or precision than its type. The type of the EXCESS_PRECISION_EXPR
|
||||
is the semantic type while the operand represents what is actually being
|
||||
evaluated. */
|
||||
DEFTREECODE (EXCESS_PRECISION_EXPR, "excess_precision_expr", tcc_expression, 1)
|
||||
|
||||
/* Used to represent a user-defined literal.
|
||||
The operands are an IDENTIFIER for the suffix, the VALUE of the literal,
|
||||
and for numeric literals the original string representation of the
|
||||
number. */
|
||||
DEFTREECODE (USERDEF_LITERAL, "userdef_literal", tcc_exceptional, 3)
|
||||
|
||||
/* Represents a 'sizeof' expression during C++ template expansion,
|
||||
or for the purpose of -Wsizeof-pointer-memaccess warning. */
|
||||
DEFTREECODE (SIZEOF_EXPR, "sizeof_expr", tcc_expression, 1)
|
||||
|
||||
/* Like above, but enclosed in parentheses. Used to suppress warnings. */
|
||||
DEFTREECODE (PAREN_SIZEOF_EXPR, "paren_sizeof_expr", tcc_expression, 1)
|
||||
|
||||
/* Used to represent a `for' statement. The operands are
|
||||
FOR_INIT_STMT, FOR_COND, FOR_EXPR, FOR_BODY, and FOR_SCOPE,
|
||||
respectively. */
|
||||
DEFTREECODE (FOR_STMT, "for_stmt", tcc_statement, 5)
|
||||
|
||||
/* Used to represent a 'while' statement. The operands are WHILE_COND
|
||||
and WHILE_BODY, respectively. */
|
||||
DEFTREECODE (WHILE_STMT, "while_stmt", tcc_statement, 2)
|
||||
|
||||
/* Used to represent a 'do' statement. The operands are DO_COND and
|
||||
DO_BODY, respectively. */
|
||||
DEFTREECODE (DO_STMT, "do_stmt", tcc_statement, 2)
|
||||
|
||||
/* Used to represent a 'break' statement. */
|
||||
DEFTREECODE (BREAK_STMT, "break_stmt", tcc_statement, 0)
|
||||
|
||||
/* Used to represent a 'continue' statement. */
|
||||
DEFTREECODE (CONTINUE_STMT, "continue_stmt", tcc_statement, 0)
|
||||
|
||||
/* Used to represent a 'switch' statement. The operands are
|
||||
SWITCH_STMT_COND, SWITCH_STMT_BODY, SWITCH_STMT_TYPE, and
|
||||
SWITCH_STMT_SCOPE, respectively. */
|
||||
DEFTREECODE (SWITCH_STMT, "switch_stmt", tcc_statement, 4)
|
||||
|
||||
/* Extensions for C++ Concepts. */
|
||||
|
||||
/* Concept definition. This is not entirely different than a VAR_DECL
|
||||
except that a) it must be a template, and b) doesn't have the wide
|
||||
range of value and linkage options available to variables. Used
|
||||
by C++ FE and in c-family attribute handling. */
|
||||
DEFTREECODE (CONCEPT_DECL, "concept_decl", tcc_declaration, 0)
|
||||
|
||||
/*
|
||||
Local variables:
|
||||
mode:c
|
||||
End:
|
||||
*/
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,183 @@
|
||||
/* Definitions of Objective-C front-end entry points used for C and C++.
|
||||
Copyright (C) 1987-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GCC; see the file COPYING3. If not see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef GCC_C_COMMON_OBJC_H
|
||||
#define GCC_C_COMMON_OBJC_H
|
||||
|
||||
/* ObjC ivar visibility types. */
|
||||
enum GTY(()) objc_ivar_visibility_kind {
|
||||
OBJC_IVAR_VIS_PROTECTED = 0,
|
||||
OBJC_IVAR_VIS_PUBLIC = 1,
|
||||
OBJC_IVAR_VIS_PRIVATE = 2,
|
||||
OBJC_IVAR_VIS_PACKAGE = 3
|
||||
};
|
||||
|
||||
/* ObjC property attribute kinds.
|
||||
These have two fields; a unique value (that identifies which attribute)
|
||||
and a group key that indicates membership of an exclusion group.
|
||||
Only one member may be present from an exclusion group in a given attribute
|
||||
list.
|
||||
getters and setters have additional rules, since they are excluded from
|
||||
non-overlapping group sets. */
|
||||
|
||||
enum objc_property_attribute_group
|
||||
{
|
||||
OBJC_PROPATTR_GROUP_UNKNOWN = 0,
|
||||
OBJC_PROPATTR_GROUP_GETTER,
|
||||
OBJC_PROPATTR_GROUP_SETTER,
|
||||
OBJC_PROPATTR_GROUP_READWRITE,
|
||||
OBJC_PROPATTR_GROUP_ASSIGN,
|
||||
OBJC_PROPATTR_GROUP_ATOMIC,
|
||||
OBJC_PROPATTR_GROUP_NULLABLE,
|
||||
OBJC_PROPATTR_GROUP_CLASS,
|
||||
OBJC_PROPATTR_GROUP_MAX
|
||||
};
|
||||
|
||||
enum objc_property_attribute_kind
|
||||
{
|
||||
OBJC_PROPERTY_ATTR_UNKNOWN = 0|OBJC_PROPATTR_GROUP_UNKNOWN,
|
||||
OBJC_PROPERTY_ATTR_GETTER = ( 1 << 8)|OBJC_PROPATTR_GROUP_GETTER,
|
||||
OBJC_PROPERTY_ATTR_SETTER = ( 2 << 8)|OBJC_PROPATTR_GROUP_SETTER,
|
||||
OBJC_PROPERTY_ATTR_READONLY = ( 3 << 8)|OBJC_PROPATTR_GROUP_READWRITE,
|
||||
OBJC_PROPERTY_ATTR_READWRITE = ( 4 << 8)|OBJC_PROPATTR_GROUP_READWRITE,
|
||||
OBJC_PROPERTY_ATTR_ASSIGN = ( 5 << 8)|OBJC_PROPATTR_GROUP_ASSIGN,
|
||||
OBJC_PROPERTY_ATTR_RETAIN = ( 6 << 8)|OBJC_PROPATTR_GROUP_ASSIGN,
|
||||
OBJC_PROPERTY_ATTR_COPY = ( 7 << 8)|OBJC_PROPATTR_GROUP_ASSIGN,
|
||||
OBJC_PROPERTY_ATTR_ATOMIC = ( 8 << 8)|OBJC_PROPATTR_GROUP_ATOMIC,
|
||||
OBJC_PROPERTY_ATTR_NONATOMIC = ( 9 << 8)|OBJC_PROPATTR_GROUP_ATOMIC,
|
||||
OBJC_PROPERTY_ATTR_NULL_UNSPECIFIED = (12 << 8)|OBJC_PROPATTR_GROUP_NULLABLE,
|
||||
OBJC_PROPERTY_ATTR_NULLABLE = (13 << 8)|OBJC_PROPATTR_GROUP_NULLABLE,
|
||||
OBJC_PROPERTY_ATTR_NONNULL = (14 << 8)|OBJC_PROPATTR_GROUP_NULLABLE,
|
||||
OBJC_PROPERTY_ATTR_NULL_RESETTABLE = (15 << 8)|OBJC_PROPATTR_GROUP_NULLABLE,
|
||||
OBJC_PROPERTY_ATTR_CLASS = (16 << 8)|OBJC_PROPATTR_GROUP_CLASS,
|
||||
OBJC_PROPERTY_ATTR_MAX = (255 << 8|OBJC_PROPATTR_GROUP_MAX)
|
||||
};
|
||||
|
||||
#define OBJC_PROPATTR_GROUP_MASK 0x0f
|
||||
|
||||
/* To contain parsed, but unverified, information about a single property
|
||||
attribute. */
|
||||
struct property_attribute_info
|
||||
{
|
||||
property_attribute_info () = default;
|
||||
property_attribute_info (tree name, location_t loc,
|
||||
enum objc_property_attribute_kind k)
|
||||
: name (name), ident (NULL_TREE), prop_loc (loc), prop_kind (k),
|
||||
parse_error (false) {}
|
||||
|
||||
enum objc_property_attribute_group group ()
|
||||
{
|
||||
return (enum objc_property_attribute_group)
|
||||
((unsigned)prop_kind & OBJC_PROPATTR_GROUP_MASK);
|
||||
}
|
||||
|
||||
tree name; /* Name of the attribute. */
|
||||
tree ident; /* For getter/setter cases, the method/selector name. */
|
||||
location_t prop_loc; /* Extended location covering the parsed attr. */
|
||||
enum objc_property_attribute_kind prop_kind : 16;
|
||||
unsigned parse_error : 1; /* The C/C++ parser saw an error in this attr. */
|
||||
};
|
||||
|
||||
extern enum objc_property_attribute_kind objc_prop_attr_kind_for_rid (enum rid);
|
||||
|
||||
/* Objective-C / Objective-C++ entry points. */
|
||||
|
||||
/* The following ObjC/ObjC++ functions are called by the C and/or C++
|
||||
front-ends; they all must have corresponding stubs in stub-objc.cc. */
|
||||
extern void objc_write_global_declarations (void);
|
||||
extern tree objc_is_class_name (tree);
|
||||
extern tree objc_is_object_ptr (tree);
|
||||
extern void objc_check_decl (tree);
|
||||
extern void objc_check_global_decl (tree);
|
||||
extern tree objc_common_type (tree, tree);
|
||||
extern bool objc_compare_types (tree, tree, int, tree);
|
||||
extern bool objc_have_common_type (tree, tree, int, tree);
|
||||
extern bool objc_diagnose_private_ivar (tree);
|
||||
extern void objc_volatilize_decl (tree);
|
||||
extern tree objc_rewrite_function_call (tree, tree);
|
||||
extern tree objc_message_selector (void);
|
||||
extern tree objc_lookup_ivar (tree, tree);
|
||||
extern void objc_clear_super_receiver (void);
|
||||
extern int objc_is_public (tree, tree);
|
||||
extern tree objc_is_id (tree);
|
||||
extern void objc_declare_alias (tree, tree);
|
||||
extern void objc_declare_class (tree);
|
||||
extern void objc_declare_protocol (tree, tree);
|
||||
extern tree objc_build_message_expr (tree, tree);
|
||||
extern tree objc_finish_message_expr (tree, tree, tree, tree*);
|
||||
extern tree objc_build_selector_expr (location_t, tree);
|
||||
extern tree objc_build_protocol_expr (tree);
|
||||
extern tree objc_build_encode_expr (tree);
|
||||
extern tree objc_build_string_object (tree);
|
||||
extern tree objc_get_protocol_qualified_type (tree, tree);
|
||||
extern tree objc_get_class_reference (tree);
|
||||
extern tree objc_get_class_ivars (tree);
|
||||
extern bool objc_detect_field_duplicates (bool);
|
||||
extern void objc_start_class_interface (tree, location_t, tree, tree, tree);
|
||||
extern void objc_start_category_interface (tree, tree, tree, tree);
|
||||
extern void objc_start_protocol (tree, tree, tree);
|
||||
extern void objc_continue_interface (void);
|
||||
extern void objc_finish_interface (void);
|
||||
extern void objc_start_class_implementation (tree, tree);
|
||||
extern void objc_start_category_implementation (tree, tree);
|
||||
extern void objc_continue_implementation (void);
|
||||
extern void objc_finish_implementation (void);
|
||||
extern void objc_set_visibility (objc_ivar_visibility_kind);
|
||||
extern tree objc_build_method_signature (bool, tree, tree, tree, bool);
|
||||
extern void objc_add_method_declaration (bool, tree, tree);
|
||||
extern bool objc_start_method_definition (bool, tree, tree, tree);
|
||||
extern void objc_finish_method_definition (tree);
|
||||
extern void objc_add_instance_variable (tree);
|
||||
extern tree objc_build_keyword_decl (tree, tree, tree, tree);
|
||||
extern tree objc_build_throw_stmt (location_t, tree);
|
||||
extern void objc_begin_try_stmt (location_t, tree);
|
||||
extern tree objc_finish_try_stmt (void);
|
||||
extern void objc_begin_catch_clause (tree);
|
||||
extern void objc_finish_catch_clause (void);
|
||||
extern void objc_build_finally_clause (location_t, tree);
|
||||
extern tree objc_build_synchronized (location_t, tree, tree);
|
||||
extern int objc_static_init_needed_p (void);
|
||||
extern tree objc_generate_static_init_call (tree);
|
||||
extern tree objc_generate_write_barrier (tree, enum tree_code, tree);
|
||||
extern void objc_set_method_opt (bool);
|
||||
extern void objc_finish_foreach_loop (location_t, tree, tree, tree, tree, tree);
|
||||
extern bool objc_method_decl (enum tree_code);
|
||||
extern void objc_add_property_declaration (location_t, tree,
|
||||
vec<property_attribute_info *>&);
|
||||
extern tree objc_maybe_build_component_ref (tree, tree);
|
||||
extern tree objc_build_class_component_ref (tree, tree);
|
||||
extern tree objc_maybe_build_modify_expr (tree, tree);
|
||||
extern tree objc_build_incr_expr_for_property_ref (location_t, enum tree_code,
|
||||
tree, tree);
|
||||
extern void objc_add_synthesize_declaration (location_t, tree);
|
||||
extern void objc_add_dynamic_declaration (location_t, tree);
|
||||
extern const char * objc_maybe_printable_name (tree, int);
|
||||
extern bool objc_is_property_ref (tree);
|
||||
extern bool objc_non_constant_expr_p (tree);
|
||||
extern bool objc_string_ref_type_p (tree);
|
||||
extern void objc_check_format_arg (tree, tree);
|
||||
extern void objc_finish_function (void);
|
||||
extern void objc_maybe_warn_exceptions (location_t);
|
||||
|
||||
/* The following are provided by the C and C++ front-ends, and called by
|
||||
ObjC/ObjC++. */
|
||||
extern void *objc_get_current_scope (void);
|
||||
extern void objc_mark_locals_volatile (void *);
|
||||
|
||||
#endif /* ! GCC_C_COMMON_OBJC_H */
|
||||
@@ -0,0 +1,286 @@
|
||||
/* Pragma related interfaces.
|
||||
Copyright (C) 1995-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GCC; see the file COPYING3. If not see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef GCC_C_PRAGMA_H
|
||||
#define GCC_C_PRAGMA_H
|
||||
|
||||
#include "cpplib.h" /* For enum cpp_ttype. */
|
||||
|
||||
/* Pragma identifiers built in to the front end parsers. Identifiers
|
||||
for ancillary handlers will follow these. */
|
||||
enum pragma_kind {
|
||||
PRAGMA_NONE = 0,
|
||||
|
||||
PRAGMA_OACC_ATOMIC,
|
||||
PRAGMA_OACC_CACHE,
|
||||
PRAGMA_OACC_DATA,
|
||||
PRAGMA_OACC_DECLARE,
|
||||
PRAGMA_OACC_ENTER_DATA,
|
||||
PRAGMA_OACC_EXIT_DATA,
|
||||
PRAGMA_OACC_HOST_DATA,
|
||||
PRAGMA_OACC_KERNELS,
|
||||
PRAGMA_OACC_LOOP,
|
||||
PRAGMA_OACC_PARALLEL,
|
||||
PRAGMA_OACC_ROUTINE,
|
||||
PRAGMA_OACC_SERIAL,
|
||||
PRAGMA_OACC_UPDATE,
|
||||
PRAGMA_OACC_WAIT,
|
||||
|
||||
/* PRAGMA_OMP__START_ should be equal to the first PRAGMA_OMP_* code. */
|
||||
PRAGMA_OMP_ALLOCATE,
|
||||
PRAGMA_OMP__START_ = PRAGMA_OMP_ALLOCATE,
|
||||
PRAGMA_OMP_ASSUME,
|
||||
PRAGMA_OMP_ASSUMES,
|
||||
PRAGMA_OMP_ATOMIC,
|
||||
PRAGMA_OMP_BARRIER,
|
||||
PRAGMA_OMP_BEGIN,
|
||||
PRAGMA_OMP_CANCEL,
|
||||
PRAGMA_OMP_CANCELLATION_POINT,
|
||||
PRAGMA_OMP_CRITICAL,
|
||||
PRAGMA_OMP_DECLARE,
|
||||
PRAGMA_OMP_DEPOBJ,
|
||||
PRAGMA_OMP_DISTRIBUTE,
|
||||
PRAGMA_OMP_ERROR,
|
||||
PRAGMA_OMP_END,
|
||||
PRAGMA_OMP_FLUSH,
|
||||
PRAGMA_OMP_FOR,
|
||||
PRAGMA_OMP_LOOP,
|
||||
PRAGMA_OMP_NOTHING,
|
||||
PRAGMA_OMP_MASKED,
|
||||
PRAGMA_OMP_MASTER,
|
||||
PRAGMA_OMP_ORDERED,
|
||||
PRAGMA_OMP_PARALLEL,
|
||||
PRAGMA_OMP_REQUIRES,
|
||||
PRAGMA_OMP_SCAN,
|
||||
PRAGMA_OMP_SCOPE,
|
||||
PRAGMA_OMP_SECTION,
|
||||
PRAGMA_OMP_SECTIONS,
|
||||
PRAGMA_OMP_SIMD,
|
||||
PRAGMA_OMP_SINGLE,
|
||||
PRAGMA_OMP_TARGET,
|
||||
PRAGMA_OMP_TASK,
|
||||
PRAGMA_OMP_TASKGROUP,
|
||||
PRAGMA_OMP_TASKLOOP,
|
||||
PRAGMA_OMP_TASKWAIT,
|
||||
PRAGMA_OMP_TASKYIELD,
|
||||
PRAGMA_OMP_THREADPRIVATE,
|
||||
PRAGMA_OMP_TEAMS,
|
||||
/* PRAGMA_OMP__LAST_ should be equal to the last PRAGMA_OMP_* code. */
|
||||
PRAGMA_OMP__LAST_ = PRAGMA_OMP_TEAMS,
|
||||
|
||||
PRAGMA_GCC_PCH_PREPROCESS,
|
||||
PRAGMA_IVDEP,
|
||||
PRAGMA_UNROLL,
|
||||
|
||||
PRAGMA_FIRST_EXTERNAL
|
||||
};
|
||||
|
||||
|
||||
/* All clauses defined by OpenACC 2.0, and OpenMP 2.5, 3.0, 3.1, 4.0, 4.5, 5.0,
|
||||
5.1 and 5.2. Used internally by both C and C++ parsers. */
|
||||
enum pragma_omp_clause {
|
||||
PRAGMA_OMP_CLAUSE_NONE = 0,
|
||||
|
||||
PRAGMA_OMP_CLAUSE_AFFINITY,
|
||||
PRAGMA_OMP_CLAUSE_ALIGNED,
|
||||
PRAGMA_OMP_CLAUSE_ALLOCATE,
|
||||
PRAGMA_OMP_CLAUSE_BIND,
|
||||
PRAGMA_OMP_CLAUSE_COLLAPSE,
|
||||
PRAGMA_OMP_CLAUSE_COPYIN,
|
||||
PRAGMA_OMP_CLAUSE_COPYPRIVATE,
|
||||
PRAGMA_OMP_CLAUSE_DEFAULT,
|
||||
PRAGMA_OMP_CLAUSE_DEFAULTMAP,
|
||||
PRAGMA_OMP_CLAUSE_DEPEND,
|
||||
PRAGMA_OMP_CLAUSE_DETACH,
|
||||
PRAGMA_OMP_CLAUSE_DEVICE,
|
||||
PRAGMA_OMP_CLAUSE_DEVICE_TYPE,
|
||||
PRAGMA_OMP_CLAUSE_DIST_SCHEDULE,
|
||||
PRAGMA_OMP_CLAUSE_DOACROSS,
|
||||
PRAGMA_OMP_CLAUSE_ENTER,
|
||||
PRAGMA_OMP_CLAUSE_FILTER,
|
||||
PRAGMA_OMP_CLAUSE_FINAL,
|
||||
PRAGMA_OMP_CLAUSE_FIRSTPRIVATE,
|
||||
PRAGMA_OMP_CLAUSE_FOR,
|
||||
PRAGMA_OMP_CLAUSE_FROM,
|
||||
PRAGMA_OMP_CLAUSE_GRAINSIZE,
|
||||
PRAGMA_OMP_CLAUSE_HAS_DEVICE_ADDR,
|
||||
PRAGMA_OMP_CLAUSE_HINT,
|
||||
PRAGMA_OMP_CLAUSE_IF,
|
||||
PRAGMA_OMP_CLAUSE_IN_REDUCTION,
|
||||
PRAGMA_OMP_CLAUSE_INBRANCH,
|
||||
PRAGMA_OMP_CLAUSE_IS_DEVICE_PTR,
|
||||
PRAGMA_OMP_CLAUSE_LASTPRIVATE,
|
||||
PRAGMA_OMP_CLAUSE_LINEAR,
|
||||
PRAGMA_OMP_CLAUSE_LINK,
|
||||
PRAGMA_OMP_CLAUSE_MAP,
|
||||
PRAGMA_OMP_CLAUSE_MERGEABLE,
|
||||
PRAGMA_OMP_CLAUSE_NOGROUP,
|
||||
PRAGMA_OMP_CLAUSE_NONTEMPORAL,
|
||||
PRAGMA_OMP_CLAUSE_NOTINBRANCH,
|
||||
PRAGMA_OMP_CLAUSE_NOWAIT,
|
||||
PRAGMA_OMP_CLAUSE_NUM_TASKS,
|
||||
PRAGMA_OMP_CLAUSE_NUM_TEAMS,
|
||||
PRAGMA_OMP_CLAUSE_NUM_THREADS,
|
||||
PRAGMA_OMP_CLAUSE_ORDER,
|
||||
PRAGMA_OMP_CLAUSE_ORDERED,
|
||||
PRAGMA_OMP_CLAUSE_PARALLEL,
|
||||
PRAGMA_OMP_CLAUSE_PRIORITY,
|
||||
PRAGMA_OMP_CLAUSE_PRIVATE,
|
||||
PRAGMA_OMP_CLAUSE_PROC_BIND,
|
||||
PRAGMA_OMP_CLAUSE_REDUCTION,
|
||||
PRAGMA_OMP_CLAUSE_SAFELEN,
|
||||
PRAGMA_OMP_CLAUSE_SCHEDULE,
|
||||
PRAGMA_OMP_CLAUSE_SECTIONS,
|
||||
PRAGMA_OMP_CLAUSE_SHARED,
|
||||
PRAGMA_OMP_CLAUSE_SIMD,
|
||||
PRAGMA_OMP_CLAUSE_SIMDLEN,
|
||||
PRAGMA_OMP_CLAUSE_TASK_REDUCTION,
|
||||
PRAGMA_OMP_CLAUSE_TASKGROUP,
|
||||
PRAGMA_OMP_CLAUSE_THREAD_LIMIT,
|
||||
PRAGMA_OMP_CLAUSE_THREADS,
|
||||
PRAGMA_OMP_CLAUSE_TO,
|
||||
PRAGMA_OMP_CLAUSE_UNIFORM,
|
||||
PRAGMA_OMP_CLAUSE_UNTIED,
|
||||
PRAGMA_OMP_CLAUSE_USE_DEVICE_PTR,
|
||||
PRAGMA_OMP_CLAUSE_USE_DEVICE_ADDR,
|
||||
|
||||
/* Clauses for OpenACC. */
|
||||
PRAGMA_OACC_CLAUSE_ASYNC,
|
||||
PRAGMA_OACC_CLAUSE_ATTACH,
|
||||
PRAGMA_OACC_CLAUSE_AUTO,
|
||||
PRAGMA_OACC_CLAUSE_COPY,
|
||||
PRAGMA_OACC_CLAUSE_COPYOUT,
|
||||
PRAGMA_OACC_CLAUSE_CREATE,
|
||||
PRAGMA_OACC_CLAUSE_DELETE,
|
||||
PRAGMA_OACC_CLAUSE_DEVICEPTR,
|
||||
PRAGMA_OACC_CLAUSE_DEVICE_RESIDENT,
|
||||
PRAGMA_OACC_CLAUSE_FINALIZE,
|
||||
PRAGMA_OACC_CLAUSE_GANG,
|
||||
PRAGMA_OACC_CLAUSE_HOST,
|
||||
PRAGMA_OACC_CLAUSE_INDEPENDENT,
|
||||
PRAGMA_OACC_CLAUSE_NO_CREATE,
|
||||
PRAGMA_OACC_CLAUSE_NOHOST,
|
||||
PRAGMA_OACC_CLAUSE_NUM_GANGS,
|
||||
PRAGMA_OACC_CLAUSE_NUM_WORKERS,
|
||||
PRAGMA_OACC_CLAUSE_PRESENT,
|
||||
PRAGMA_OACC_CLAUSE_SELF,
|
||||
PRAGMA_OACC_CLAUSE_SEQ,
|
||||
PRAGMA_OACC_CLAUSE_TILE,
|
||||
PRAGMA_OACC_CLAUSE_VECTOR,
|
||||
PRAGMA_OACC_CLAUSE_VECTOR_LENGTH,
|
||||
PRAGMA_OACC_CLAUSE_WAIT,
|
||||
PRAGMA_OACC_CLAUSE_WORKER,
|
||||
PRAGMA_OACC_CLAUSE_IF_PRESENT,
|
||||
PRAGMA_OACC_CLAUSE_COLLAPSE = PRAGMA_OMP_CLAUSE_COLLAPSE,
|
||||
PRAGMA_OACC_CLAUSE_COPYIN = PRAGMA_OMP_CLAUSE_COPYIN,
|
||||
PRAGMA_OACC_CLAUSE_DEVICE = PRAGMA_OMP_CLAUSE_DEVICE,
|
||||
PRAGMA_OACC_CLAUSE_DEFAULT = PRAGMA_OMP_CLAUSE_DEFAULT,
|
||||
PRAGMA_OACC_CLAUSE_DETACH = PRAGMA_OMP_CLAUSE_DETACH,
|
||||
PRAGMA_OACC_CLAUSE_FIRSTPRIVATE = PRAGMA_OMP_CLAUSE_FIRSTPRIVATE,
|
||||
PRAGMA_OACC_CLAUSE_IF = PRAGMA_OMP_CLAUSE_IF,
|
||||
PRAGMA_OACC_CLAUSE_PRIVATE = PRAGMA_OMP_CLAUSE_PRIVATE,
|
||||
PRAGMA_OACC_CLAUSE_REDUCTION = PRAGMA_OMP_CLAUSE_REDUCTION,
|
||||
PRAGMA_OACC_CLAUSE_LINK = PRAGMA_OMP_CLAUSE_LINK,
|
||||
PRAGMA_OACC_CLAUSE_USE_DEVICE = PRAGMA_OMP_CLAUSE_USE_DEVICE_PTR
|
||||
};
|
||||
|
||||
extern struct cpp_reader* parse_in;
|
||||
|
||||
/* It's safe to always leave visibility pragma enabled as if
|
||||
visibility is not supported on the host OS platform the
|
||||
statements are ignored. */
|
||||
extern void push_visibility (const char *, int);
|
||||
extern bool pop_visibility (int);
|
||||
|
||||
extern void init_pragma (void);
|
||||
|
||||
/* Front-end wrappers for pragma registration. */
|
||||
typedef void (*pragma_handler_1arg)(struct cpp_reader *);
|
||||
/* A second pragma handler, which adds a void * argument allowing to pass extra
|
||||
data to the handler. */
|
||||
typedef void (*pragma_handler_2arg)(struct cpp_reader *, void *);
|
||||
|
||||
/* This union allows to abstract the different handlers. */
|
||||
union gen_pragma_handler {
|
||||
pragma_handler_1arg handler_1arg;
|
||||
pragma_handler_2arg handler_2arg;
|
||||
};
|
||||
/* Internally used to keep the data of the handler. */
|
||||
struct internal_pragma_handler {
|
||||
union gen_pragma_handler handler, early_handler;
|
||||
/* Permits to know if handler is a pragma_handler_1arg (extra_data is false)
|
||||
or a pragma_handler_2arg (extra_data is true). */
|
||||
bool extra_data;
|
||||
/* A data field which can be used when extra_data is true. */
|
||||
void * data;
|
||||
};
|
||||
|
||||
extern void c_register_pragma (const char *space, const char *name,
|
||||
pragma_handler_1arg handler);
|
||||
extern void c_register_pragma_with_data (const char *space, const char *name,
|
||||
pragma_handler_2arg handler,
|
||||
void *data);
|
||||
|
||||
extern void c_register_pragma_with_expansion (const char *space,
|
||||
const char *name,
|
||||
pragma_handler_1arg handler);
|
||||
extern void c_register_pragma_with_expansion_and_data (const char *space,
|
||||
const char *name,
|
||||
pragma_handler_2arg handler,
|
||||
void *data);
|
||||
extern void c_invoke_pragma_handler (unsigned int);
|
||||
|
||||
/* Early pragma handlers run in addition to the normal ones. They can be used
|
||||
by frontends such as C++ that may want to process some pragmas during lexing
|
||||
before they start processing them. */
|
||||
extern void
|
||||
c_register_pragma_with_early_handler (const char *space, const char *name,
|
||||
pragma_handler_1arg handler,
|
||||
pragma_handler_1arg early_handler);
|
||||
extern void c_invoke_early_pragma_handler (unsigned int);
|
||||
extern void c_pp_invoke_early_pragma_handler (unsigned int);
|
||||
|
||||
|
||||
extern void maybe_apply_pragma_weak (tree);
|
||||
extern void maybe_apply_pending_pragma_weaks (void);
|
||||
extern tree maybe_apply_renaming_pragma (tree, tree);
|
||||
extern void maybe_apply_pragma_scalar_storage_order (tree);
|
||||
extern void add_to_renaming_pragma_list (tree, tree);
|
||||
|
||||
extern enum cpp_ttype pragma_lex (tree *, location_t *loc = NULL);
|
||||
|
||||
/* Flags for use with c_lex_with_flags. The values here were picked
|
||||
so that 0 means to translate and join strings. */
|
||||
#define C_LEX_STRING_NO_TRANSLATE 1 /* Do not lex strings into
|
||||
execution character set. */
|
||||
#define C_LEX_STRING_NO_JOIN 2 /* Do not concatenate strings
|
||||
nor translate them into execution
|
||||
character set. */
|
||||
|
||||
/* This is not actually available to pragma parsers. It's merely a
|
||||
convenient location to declare this function for c-lex, after
|
||||
having enum cpp_ttype declared. */
|
||||
extern enum cpp_ttype c_lex_with_flags (tree *, location_t *, unsigned char *,
|
||||
int);
|
||||
|
||||
extern void c_pp_lookup_pragma (unsigned int, const char **, const char **);
|
||||
|
||||
extern GTY(()) tree pragma_extern_prefix;
|
||||
|
||||
#endif /* GCC_C_PRAGMA_H */
|
||||
@@ -0,0 +1,142 @@
|
||||
/* Various declarations for the C and C++ pretty-printers.
|
||||
Copyright (C) 2002-2023 Free Software Foundation, Inc.
|
||||
Contributed by Gabriel Dos Reis <gdr@integrable-solutions.net>
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GCC; see the file COPYING3. If not see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef GCC_C_PRETTY_PRINTER
|
||||
#define GCC_C_PRETTY_PRINTER
|
||||
|
||||
#include "tree.h"
|
||||
#include "c-family/c-common.h"
|
||||
#include "pretty-print.h"
|
||||
|
||||
|
||||
enum pp_c_pretty_print_flags
|
||||
{
|
||||
pp_c_flag_abstract = 1 << 1,
|
||||
pp_c_flag_gnu_v3 = 1 << 2,
|
||||
pp_c_flag_last_bit = 3
|
||||
};
|
||||
|
||||
|
||||
/* The data type used to bundle information necessary for pretty-printing
|
||||
a C or C++ entity. */
|
||||
class c_pretty_printer;
|
||||
|
||||
/* The type of a C pretty-printer 'member' function. */
|
||||
typedef void (*c_pretty_print_fn) (c_pretty_printer *, tree);
|
||||
|
||||
/* The datatype that contains information necessary for pretty-printing
|
||||
a tree that represents a C construct. Any pretty-printer for a
|
||||
language using C syntax can derive from this datatype and reuse
|
||||
facilities provided here. A derived pretty-printer can override
|
||||
any function listed in the vtable below. See cp/cxx-pretty-print.h
|
||||
and cp/cxx-pretty-print.cc for an example of derivation. */
|
||||
class c_pretty_printer : public pretty_printer
|
||||
{
|
||||
public:
|
||||
c_pretty_printer ();
|
||||
pretty_printer *clone () const override;
|
||||
|
||||
// Format string, possibly translated.
|
||||
void translate_string (const char *);
|
||||
|
||||
virtual void constant (tree);
|
||||
virtual void id_expression (tree);
|
||||
virtual void primary_expression (tree);
|
||||
virtual void postfix_expression (tree);
|
||||
virtual void unary_expression (tree);
|
||||
virtual void multiplicative_expression (tree);
|
||||
virtual void conditional_expression (tree);
|
||||
virtual void assignment_expression (tree);
|
||||
virtual void expression (tree);
|
||||
|
||||
virtual void type_id (tree);
|
||||
virtual void statement (tree);
|
||||
|
||||
virtual void declaration (tree);
|
||||
virtual void declaration_specifiers (tree);
|
||||
virtual void simple_type_specifier (tree);
|
||||
virtual void function_specifier (tree);
|
||||
virtual void storage_class_specifier (tree);
|
||||
virtual void declarator (tree);
|
||||
virtual void direct_declarator (tree);
|
||||
virtual void abstract_declarator (tree);
|
||||
virtual void direct_abstract_declarator (tree);
|
||||
|
||||
virtual void initializer (tree);
|
||||
/* Points to the first element of an array of offset-list.
|
||||
Not used yet. */
|
||||
int *offset_list;
|
||||
|
||||
pp_flags flags;
|
||||
|
||||
/* These must be overridden by each of the C and C++ front-end to
|
||||
reflect their understanding of syntactic productions when they differ. */
|
||||
c_pretty_print_fn type_specifier_seq;
|
||||
c_pretty_print_fn ptr_operator;
|
||||
c_pretty_print_fn parameter_list;
|
||||
};
|
||||
|
||||
#define pp_c_tree_identifier(PPI, ID) \
|
||||
pp_c_identifier (PPI, IDENTIFIER_POINTER (ID))
|
||||
|
||||
#define pp_type_specifier_seq(PP, D) (PP)->type_specifier_seq (PP, D)
|
||||
#define pp_ptr_operator(PP, D) (PP)->ptr_operator (PP, D)
|
||||
#define pp_parameter_list(PP, T) (PP)->parameter_list (PP, T)
|
||||
|
||||
void pp_c_whitespace (c_pretty_printer *);
|
||||
void pp_c_left_paren (c_pretty_printer *);
|
||||
void pp_c_right_paren (c_pretty_printer *);
|
||||
void pp_c_left_brace (c_pretty_printer *);
|
||||
void pp_c_right_brace (c_pretty_printer *);
|
||||
void pp_c_left_bracket (c_pretty_printer *);
|
||||
void pp_c_right_bracket (c_pretty_printer *);
|
||||
void pp_c_dot (c_pretty_printer *);
|
||||
void pp_c_ampersand (c_pretty_printer *);
|
||||
void pp_c_star (c_pretty_printer *);
|
||||
void pp_c_arrow (c_pretty_printer *);
|
||||
void pp_c_semicolon (c_pretty_printer *);
|
||||
void pp_c_complement (c_pretty_printer *);
|
||||
void pp_c_exclamation (c_pretty_printer *);
|
||||
void pp_c_space_for_pointer_operator (c_pretty_printer *, tree);
|
||||
|
||||
/* Declarations. */
|
||||
void pp_c_tree_decl_identifier (c_pretty_printer *, tree);
|
||||
void pp_c_function_definition (c_pretty_printer *, tree);
|
||||
void pp_c_attributes_display (c_pretty_printer *, tree);
|
||||
void pp_c_cv_qualifiers (c_pretty_printer *pp, int qualifiers, bool func_type);
|
||||
void pp_c_type_qualifier_list (c_pretty_printer *, tree);
|
||||
void pp_c_parameter_type_list (c_pretty_printer *, tree);
|
||||
void pp_c_specifier_qualifier_list (c_pretty_printer *, tree);
|
||||
/* Expressions. */
|
||||
void pp_c_logical_or_expression (c_pretty_printer *, tree);
|
||||
void pp_c_expression_list (c_pretty_printer *, tree);
|
||||
void pp_c_constructor_elts (c_pretty_printer *, vec<constructor_elt, va_gc> *);
|
||||
void pp_c_call_argument_list (c_pretty_printer *, tree);
|
||||
void pp_c_type_cast (c_pretty_printer *, tree);
|
||||
void pp_c_cast_expression (c_pretty_printer *, tree);
|
||||
void pp_c_init_declarator (c_pretty_printer *, tree);
|
||||
void pp_c_ws_string (c_pretty_printer *, const char *);
|
||||
void pp_c_identifier (c_pretty_printer *, const char *);
|
||||
void pp_c_string_literal (c_pretty_printer *, tree);
|
||||
void pp_c_integer_constant (c_pretty_printer *, tree);
|
||||
|
||||
void print_c_tree (FILE *file, tree t);
|
||||
|
||||
#endif /* GCC_C_PRETTY_PRINTER */
|
||||
@@ -0,0 +1,911 @@
|
||||
/* Definitions for C parsing and type checking.
|
||||
Copyright (C) 1987-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GCC; see the file COPYING3. If not see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef GCC_C_TREE_H
|
||||
#define GCC_C_TREE_H
|
||||
|
||||
#include "c-family/c-common.h"
|
||||
#include "diagnostic.h"
|
||||
|
||||
/* struct lang_identifier is private to c-decl.cc, but langhooks.cc needs to
|
||||
know how big it is. This is sanity-checked in c-decl.cc. */
|
||||
#define C_SIZEOF_STRUCT_LANG_IDENTIFIER \
|
||||
(sizeof (struct c_common_identifier) + 3 * sizeof (void *))
|
||||
|
||||
/* In a RECORD_TYPE or UNION_TYPE, nonzero if any component is read-only. */
|
||||
#define C_TYPE_FIELDS_READONLY(TYPE) TREE_LANG_FLAG_1 (TYPE)
|
||||
|
||||
/* In a RECORD_TYPE or UNION_TYPE, nonzero if any component is volatile. */
|
||||
#define C_TYPE_FIELDS_VOLATILE(TYPE) TREE_LANG_FLAG_2 (TYPE)
|
||||
|
||||
/* In a RECORD_TYPE or UNION_TYPE, nonzero if any component is
|
||||
volatile, restrict-qualified or atomic; that is, has a type not
|
||||
permitted for a constexpr object. */
|
||||
#define C_TYPE_FIELDS_NON_CONSTEXPR(TYPE) TREE_LANG_FLAG_4 (TYPE)
|
||||
|
||||
/* In a RECORD_TYPE or UNION_TYPE or ENUMERAL_TYPE
|
||||
nonzero if the definition of the type has already started. */
|
||||
#define C_TYPE_BEING_DEFINED(TYPE) TYPE_LANG_FLAG_0 (TYPE)
|
||||
|
||||
/* In an incomplete RECORD_TYPE, UNION_TYPE or ENUMERAL_TYPE, a list of
|
||||
variable declarations whose type would be completed by completing
|
||||
that type. */
|
||||
#define C_TYPE_INCOMPLETE_VARS(TYPE) \
|
||||
TYPE_LANG_SLOT_1 (TREE_CHECK4 (TYPE, RECORD_TYPE, UNION_TYPE, \
|
||||
QUAL_UNION_TYPE, ENUMERAL_TYPE))
|
||||
|
||||
/* In an IDENTIFIER_NODE, nonzero if this identifier is actually a
|
||||
keyword. C_RID_CODE (node) is then the RID_* value of the keyword. */
|
||||
#define C_IS_RESERVED_WORD(ID) TREE_LANG_FLAG_0 (ID)
|
||||
|
||||
/* Record whether a type or decl was written with nonconstant size.
|
||||
Note that TYPE_SIZE may have simplified to a constant. */
|
||||
#define C_TYPE_VARIABLE_SIZE(TYPE) TYPE_LANG_FLAG_1 (TYPE)
|
||||
#define C_DECL_VARIABLE_SIZE(TYPE) DECL_LANG_FLAG_0 (TYPE)
|
||||
|
||||
/* Record whether a type is variably modified. */
|
||||
#define C_TYPE_VARIABLY_MODIFIED(TYPE) TYPE_LANG_FLAG_6 (TYPE)
|
||||
|
||||
|
||||
/* Record whether a type is defined inside a struct or union type.
|
||||
This is used for -Wc++-compat. */
|
||||
#define C_TYPE_DEFINED_IN_STRUCT(TYPE) TYPE_LANG_FLAG_2 (TYPE)
|
||||
|
||||
/* Record whether a typedef for type `int' was actually `signed int'. */
|
||||
#define C_TYPEDEF_EXPLICITLY_SIGNED(EXP) DECL_LANG_FLAG_1 (EXP)
|
||||
|
||||
/* For a FUNCTION_DECL, nonzero if it was defined without an explicit
|
||||
return type. */
|
||||
#define C_FUNCTION_IMPLICIT_INT(EXP) DECL_LANG_FLAG_1 (EXP)
|
||||
|
||||
/* For a FUNCTION_DECL, nonzero if it was an implicit declaration. */
|
||||
#define C_DECL_IMPLICIT(EXP) DECL_LANG_FLAG_2 (EXP)
|
||||
|
||||
/* For a PARM_DECL, nonzero if it was declared as an array. */
|
||||
#define C_ARRAY_PARAMETER(NODE) DECL_LANG_FLAG_0 (NODE)
|
||||
|
||||
/* For FUNCTION_DECLs, evaluates true if the decl is built-in but has
|
||||
been declared. */
|
||||
#define C_DECL_DECLARED_BUILTIN(EXP) \
|
||||
DECL_LANG_FLAG_3 (FUNCTION_DECL_CHECK (EXP))
|
||||
|
||||
/* For FUNCTION_DECLs, evaluates true if the decl is built-in, has a
|
||||
built-in prototype and does not have a non-built-in prototype. */
|
||||
#define C_DECL_BUILTIN_PROTOTYPE(EXP) \
|
||||
DECL_LANG_FLAG_6 (FUNCTION_DECL_CHECK (EXP))
|
||||
|
||||
/* Record whether a decl was declared register. This is strictly a
|
||||
front-end flag, whereas DECL_REGISTER is used for code generation;
|
||||
they may differ for structures with volatile fields. */
|
||||
#define C_DECL_REGISTER(EXP) DECL_LANG_FLAG_4 (EXP)
|
||||
|
||||
/* Record whether a decl was used in an expression anywhere except an
|
||||
unevaluated operand of sizeof / typeof / alignof. This is only
|
||||
used for functions declared static but not defined, though outside
|
||||
sizeof and typeof it is set for other function decls as well. */
|
||||
#define C_DECL_USED(EXP) DECL_LANG_FLAG_5 (FUNCTION_DECL_CHECK (EXP))
|
||||
|
||||
/* Record whether a variable has been declared threadprivate by
|
||||
#pragma omp threadprivate. */
|
||||
#define C_DECL_THREADPRIVATE_P(DECL) DECL_LANG_FLAG_3 (VAR_DECL_CHECK (DECL))
|
||||
|
||||
/* Set on VAR_DECLs for compound literals. */
|
||||
#define C_DECL_COMPOUND_LITERAL_P(DECL) \
|
||||
DECL_LANG_FLAG_5 (VAR_DECL_CHECK (DECL))
|
||||
|
||||
/* Set on decls used as placeholders for a C2x underspecified object
|
||||
definition. */
|
||||
#define C_DECL_UNDERSPECIFIED(DECL) DECL_LANG_FLAG_7 (DECL)
|
||||
|
||||
/* Set on VAR_DECLs declared as 'constexpr'. */
|
||||
#define C_DECL_DECLARED_CONSTEXPR(DECL) \
|
||||
DECL_LANG_FLAG_8 (VAR_DECL_CHECK (DECL))
|
||||
|
||||
/* Nonzero for a decl which either doesn't exist or isn't a prototype.
|
||||
N.B. Could be simplified if all built-in decls had complete prototypes
|
||||
(but this is presently difficult because some of them need FILE*). */
|
||||
#define C_DECL_ISNT_PROTOTYPE(EXP) \
|
||||
(EXP == 0 \
|
||||
|| (!prototype_p (TREE_TYPE (EXP)) \
|
||||
&& !fndecl_built_in_p (EXP)))
|
||||
|
||||
/* For FUNCTION_TYPE, a hidden list of types of arguments. The same as
|
||||
TYPE_ARG_TYPES for functions with prototypes, but created for functions
|
||||
without prototypes. */
|
||||
#define TYPE_ACTUAL_ARG_TYPES(NODE) \
|
||||
TYPE_LANG_SLOT_1 (FUNCTION_TYPE_CHECK (NODE))
|
||||
|
||||
/* For a CONSTRUCTOR, whether some initializer contains a
|
||||
subexpression meaning it is not a constant expression. */
|
||||
#define CONSTRUCTOR_NON_CONST(EXPR) TREE_LANG_FLAG_1 (CONSTRUCTOR_CHECK (EXPR))
|
||||
|
||||
/* For a SAVE_EXPR, nonzero if the operand of the SAVE_EXPR has already
|
||||
been folded. */
|
||||
#define SAVE_EXPR_FOLDED_P(EXP) TREE_LANG_FLAG_1 (SAVE_EXPR_CHECK (EXP))
|
||||
|
||||
/* Whether a type has boolean semantics: either a boolean type or an
|
||||
enumeration type with a boolean type as its underlying type. */
|
||||
#define C_BOOLEAN_TYPE_P(TYPE) \
|
||||
(TREE_CODE (TYPE) == BOOLEAN_TYPE \
|
||||
|| (TREE_CODE (TYPE) == ENUMERAL_TYPE \
|
||||
&& ENUM_UNDERLYING_TYPE (TYPE) != NULL_TREE \
|
||||
&& TREE_CODE (ENUM_UNDERLYING_TYPE (TYPE)) == BOOLEAN_TYPE))
|
||||
|
||||
/* Record parser information about an expression that is irrelevant
|
||||
for code generation alongside a tree representing its value. */
|
||||
struct c_expr
|
||||
{
|
||||
/* The value of the expression. */
|
||||
tree value;
|
||||
/* Record the original unary/binary operator of an expression, which may
|
||||
have been changed by fold, STRING_CST for unparenthesized string
|
||||
constants, C_MAYBE_CONST_EXPR for __builtin_constant_p calls
|
||||
(even if parenthesized), for subexpressions, and for non-constant
|
||||
initializers, or ERROR_MARK for other expressions (including
|
||||
parenthesized expressions). */
|
||||
enum tree_code original_code;
|
||||
/* If not NULL, the original type of an expression. This will
|
||||
differ from the type of the value field for an enum constant.
|
||||
The type of an enum constant is a plain integer type, but this
|
||||
field will be the enum type. */
|
||||
tree original_type;
|
||||
|
||||
/* The source range of this expression. This is redundant
|
||||
for node values that have locations, but not all node kinds
|
||||
have locations (e.g. constants, and references to params, locals,
|
||||
etc), so we stash a copy here. */
|
||||
source_range src_range;
|
||||
|
||||
/* True if this was directly from a decimal constant token. */
|
||||
bool m_decimal : 1;
|
||||
|
||||
/* Access to the first and last locations within the source spelling
|
||||
of this expression. */
|
||||
location_t get_start () const { return src_range.m_start; }
|
||||
location_t get_finish () const { return src_range.m_finish; }
|
||||
|
||||
location_t get_location () const
|
||||
{
|
||||
if (EXPR_HAS_LOCATION (value))
|
||||
return EXPR_LOCATION (value);
|
||||
else
|
||||
return make_location (get_start (), get_start (), get_finish ());
|
||||
}
|
||||
|
||||
/* Set the value to error_mark_node whilst ensuring that src_range
|
||||
and m_decimal are initialized. */
|
||||
void set_error ()
|
||||
{
|
||||
value = error_mark_node;
|
||||
src_range.m_start = UNKNOWN_LOCATION;
|
||||
src_range.m_finish = UNKNOWN_LOCATION;
|
||||
m_decimal = 0;
|
||||
}
|
||||
};
|
||||
|
||||
/* Type alias for struct c_expr. This allows to use the structure
|
||||
inside the VEC types. */
|
||||
typedef struct c_expr c_expr_t;
|
||||
|
||||
/* A kind of type specifier. Note that this information is currently
|
||||
only used to distinguish tag definitions, tag references and typeof
|
||||
uses. */
|
||||
enum c_typespec_kind {
|
||||
/* No typespec. This appears only in struct c_declspec. */
|
||||
ctsk_none,
|
||||
/* A reserved keyword type specifier. */
|
||||
ctsk_resword,
|
||||
/* A reference to a tag, previously declared, such as "struct foo".
|
||||
This includes where the previous declaration was as a different
|
||||
kind of tag, in which case this is only valid if shadowing that
|
||||
tag in an inner scope. */
|
||||
ctsk_tagref,
|
||||
/* Likewise, with standard attributes present in the reference. */
|
||||
ctsk_tagref_attrs,
|
||||
/* A reference to a tag, not previously declared in a visible
|
||||
scope. */
|
||||
ctsk_tagfirstref,
|
||||
/* Likewise, with standard attributes present in the reference. */
|
||||
ctsk_tagfirstref_attrs,
|
||||
/* A definition of a tag such as "struct foo { int a; }". */
|
||||
ctsk_tagdef,
|
||||
/* A typedef name. */
|
||||
ctsk_typedef,
|
||||
/* An ObjC-specific kind of type specifier. */
|
||||
ctsk_objc,
|
||||
/* A typeof specifier, or _Atomic ( type-name ). */
|
||||
ctsk_typeof
|
||||
};
|
||||
|
||||
/* A type specifier: this structure is created in the parser and
|
||||
passed to declspecs_add_type only. */
|
||||
struct c_typespec {
|
||||
/* What kind of type specifier this is. */
|
||||
enum c_typespec_kind kind;
|
||||
/* Whether the expression has operands suitable for use in constant
|
||||
expressions. */
|
||||
bool expr_const_operands;
|
||||
/* Whether the type specifier includes an enum type specifier (that
|
||||
is, ": specifier-qualifier-list" in a declaration using
|
||||
"enum"). */
|
||||
bool has_enum_type_specifier;
|
||||
/* The specifier itself. */
|
||||
tree spec;
|
||||
/* An expression to be evaluated before the type specifier, in the
|
||||
case of typeof specifiers, or NULL otherwise or if no such
|
||||
expression is required for a particular typeof specifier. In
|
||||
particular, when typeof is applied to an expression of variably
|
||||
modified type, that expression must be evaluated in order to
|
||||
determine array sizes that form part of the type, but the
|
||||
expression itself (as opposed to the array sizes) forms no part
|
||||
of the type and so needs to be recorded separately. */
|
||||
tree expr;
|
||||
};
|
||||
|
||||
/* A storage class specifier. */
|
||||
enum c_storage_class {
|
||||
csc_none,
|
||||
csc_auto,
|
||||
csc_extern,
|
||||
csc_register,
|
||||
csc_static,
|
||||
csc_typedef
|
||||
};
|
||||
|
||||
/* A type specifier keyword "void", "_Bool", "char", "int", "float",
|
||||
"double", "_Decimal32", "_Decimal64", "_Decimal128", "_Fract", "_Accum",
|
||||
or none of these. */
|
||||
enum c_typespec_keyword {
|
||||
cts_none,
|
||||
cts_void,
|
||||
cts_bool,
|
||||
cts_char,
|
||||
cts_int,
|
||||
cts_float,
|
||||
cts_int_n,
|
||||
cts_double,
|
||||
cts_dfloat32,
|
||||
cts_dfloat64,
|
||||
cts_dfloat128,
|
||||
cts_floatn_nx,
|
||||
cts_fract,
|
||||
cts_accum,
|
||||
cts_auto_type
|
||||
};
|
||||
|
||||
/* This enum lists all the possible declarator specifiers, storage
|
||||
class or attribute that a user can write. There is at least one
|
||||
enumerator per possible declarator specifier in the struct
|
||||
c_declspecs below.
|
||||
|
||||
It is used to index the array of declspec locations in struct
|
||||
c_declspecs. */
|
||||
enum c_declspec_word {
|
||||
cdw_typespec /* A catch-all for a typespec. */,
|
||||
cdw_storage_class /* A catch-all for a storage class */,
|
||||
cdw_attributes,
|
||||
cdw_typedef,
|
||||
cdw_explicit_signed,
|
||||
cdw_deprecated,
|
||||
cdw_default_int,
|
||||
cdw_long,
|
||||
cdw_long_long,
|
||||
cdw_short,
|
||||
cdw_signed,
|
||||
cdw_unsigned,
|
||||
cdw_complex,
|
||||
cdw_inline,
|
||||
cdw_noreturn,
|
||||
cdw_thread,
|
||||
cdw_const,
|
||||
cdw_volatile,
|
||||
cdw_restrict,
|
||||
cdw_atomic,
|
||||
cdw_saturating,
|
||||
cdw_alignas,
|
||||
cdw_address_space,
|
||||
cdw_gimple,
|
||||
cdw_rtl,
|
||||
cdw_number_of_elements /* This one must always be the last
|
||||
enumerator. */
|
||||
};
|
||||
|
||||
enum c_declspec_il {
|
||||
cdil_none,
|
||||
cdil_gimple, /* __GIMPLE */
|
||||
cdil_gimple_cfg, /* __GIMPLE(cfg) */
|
||||
cdil_gimple_ssa, /* __GIMPLE(ssa) */
|
||||
cdil_rtl /* __RTL */
|
||||
};
|
||||
|
||||
/* A sequence of declaration specifiers in C. When a new declaration
|
||||
specifier is added, please update the enum c_declspec_word above
|
||||
accordingly. */
|
||||
struct c_declspecs {
|
||||
location_t locations[cdw_number_of_elements];
|
||||
/* The type specified, if a single type specifier such as a struct,
|
||||
union or enum specifier, typedef name or typeof specifies the
|
||||
whole type, or NULL_TREE if none or a keyword such as "void" or
|
||||
"char" is used. Does not include qualifiers. */
|
||||
tree type;
|
||||
/* Any expression to be evaluated before the type, from a typeof
|
||||
specifier. */
|
||||
tree expr;
|
||||
/* The attributes from a typedef decl. */
|
||||
tree decl_attr;
|
||||
/* When parsing, the GNU attributes and prefix standard attributes.
|
||||
Outside the parser, this will be NULL; attributes (possibly from
|
||||
multiple lists) will be passed separately. */
|
||||
tree attrs;
|
||||
/* When parsing, postfix standard attributes (which appertain to the
|
||||
type specified by the preceding declaration specifiers, unlike
|
||||
prefix standard attributes which appertain to the declaration or
|
||||
declarations as a whole). */
|
||||
tree postfix_attrs;
|
||||
/* The pass to start compiling a __GIMPLE or __RTL function with. */
|
||||
char *gimple_or_rtl_pass;
|
||||
/* ENTRY BB count. */
|
||||
profile_count entry_bb_count;
|
||||
/* The base-2 log of the greatest alignment required by an _Alignas
|
||||
specifier, in bytes, or -1 if no such specifiers with nonzero
|
||||
alignment. */
|
||||
int align_log;
|
||||
/* For the __intN declspec, this stores the index into the int_n_* arrays. */
|
||||
int int_n_idx;
|
||||
/* For the _FloatN and _FloatNx declspec, this stores the index into
|
||||
the floatn_nx_types array. */
|
||||
int floatn_nx_idx;
|
||||
/* The storage class specifier, or csc_none if none. */
|
||||
enum c_storage_class storage_class;
|
||||
/* Any type specifier keyword used such as "int", not reflecting
|
||||
modifiers such as "short", or cts_none if none. */
|
||||
ENUM_BITFIELD (c_typespec_keyword) typespec_word : 8;
|
||||
/* The kind of type specifier if one has been seen, ctsk_none
|
||||
otherwise. */
|
||||
ENUM_BITFIELD (c_typespec_kind) typespec_kind : 4;
|
||||
ENUM_BITFIELD (c_declspec_il) declspec_il : 3;
|
||||
/* Whether any expressions in typeof specifiers may appear in
|
||||
constant expressions. */
|
||||
BOOL_BITFIELD expr_const_operands : 1;
|
||||
/* Whether any declaration specifiers have been seen at all. */
|
||||
BOOL_BITFIELD declspecs_seen_p : 1;
|
||||
/* Whether any declaration specifiers other than standard attributes
|
||||
have been seen at all. If only standard attributes have been
|
||||
seen, this is an attribute-declaration. */
|
||||
BOOL_BITFIELD non_std_attrs_seen_p : 1;
|
||||
/* Whether something other than a storage class specifier or
|
||||
attribute has been seen. This is used to warn for the
|
||||
obsolescent usage of storage class specifiers other than at the
|
||||
start of the list. (Doing this properly would require function
|
||||
specifiers to be handled separately from storage class
|
||||
specifiers.) */
|
||||
BOOL_BITFIELD non_sc_seen_p : 1;
|
||||
/* Whether the type is specified by a typedef or typeof name. */
|
||||
BOOL_BITFIELD typedef_p : 1;
|
||||
/* Whether the type is explicitly "signed" or specified by a typedef
|
||||
whose type is explicitly "signed". */
|
||||
BOOL_BITFIELD explicit_signed_p : 1;
|
||||
/* Whether the specifiers include a deprecated typedef. */
|
||||
BOOL_BITFIELD deprecated_p : 1;
|
||||
/* Whether the specifiers include an unavailable typedef. */
|
||||
BOOL_BITFIELD unavailable_p : 1;
|
||||
/* Whether the type defaulted to "int" because there were no type
|
||||
specifiers. */
|
||||
BOOL_BITFIELD default_int_p : 1;
|
||||
/* Whether "long" was specified. */
|
||||
BOOL_BITFIELD long_p : 1;
|
||||
/* Whether "long" was specified more than once. */
|
||||
BOOL_BITFIELD long_long_p : 1;
|
||||
/* Whether "short" was specified. */
|
||||
BOOL_BITFIELD short_p : 1;
|
||||
/* Whether "signed" was specified. */
|
||||
BOOL_BITFIELD signed_p : 1;
|
||||
/* Whether "unsigned" was specified. */
|
||||
BOOL_BITFIELD unsigned_p : 1;
|
||||
/* Whether "complex" was specified. */
|
||||
BOOL_BITFIELD complex_p : 1;
|
||||
/* Whether "inline" was specified. */
|
||||
BOOL_BITFIELD inline_p : 1;
|
||||
/* Whether "_Noreturn" was speciied. */
|
||||
BOOL_BITFIELD noreturn_p : 1;
|
||||
/* Whether "__thread" or "_Thread_local" was specified. */
|
||||
BOOL_BITFIELD thread_p : 1;
|
||||
/* Whether "__thread" rather than "_Thread_local" was specified. */
|
||||
BOOL_BITFIELD thread_gnu_p : 1;
|
||||
/* Whether "const" was specified. */
|
||||
BOOL_BITFIELD const_p : 1;
|
||||
/* Whether "volatile" was specified. */
|
||||
BOOL_BITFIELD volatile_p : 1;
|
||||
/* Whether "restrict" was specified. */
|
||||
BOOL_BITFIELD restrict_p : 1;
|
||||
/* Whether "_Atomic" was specified. */
|
||||
BOOL_BITFIELD atomic_p : 1;
|
||||
/* Whether "_Sat" was specified. */
|
||||
BOOL_BITFIELD saturating_p : 1;
|
||||
/* Whether any alignment specifier (even with zero alignment) was
|
||||
specified. */
|
||||
BOOL_BITFIELD alignas_p : 1;
|
||||
/* Whether an enum type specifier (": specifier-qualifier-list") was
|
||||
specified other than in a definition of that enum (if so, this is
|
||||
invalid unless it is an empty declaration "enum identifier
|
||||
enum-type-specifier;", but such an empty declaration is valid in
|
||||
C2x when "enum identifier;" would not be). */
|
||||
BOOL_BITFIELD enum_type_specifier_ref_p : 1;
|
||||
/* Whether "auto" was specified in C2X (or later) mode and means the
|
||||
type is to be deduced from an initializer, or would mean that if
|
||||
no type specifier appears later in these declaration
|
||||
specifiers. */
|
||||
BOOL_BITFIELD c2x_auto_p : 1;
|
||||
/* Whether "constexpr" was specified. */
|
||||
BOOL_BITFIELD constexpr_p : 1;
|
||||
/* The address space that the declaration belongs to. */
|
||||
addr_space_t address_space;
|
||||
};
|
||||
|
||||
/* The various kinds of declarators in C. */
|
||||
enum c_declarator_kind {
|
||||
/* An identifier. */
|
||||
cdk_id,
|
||||
/* A function. */
|
||||
cdk_function,
|
||||
/* An array. */
|
||||
cdk_array,
|
||||
/* A pointer. */
|
||||
cdk_pointer,
|
||||
/* Parenthesized declarator with nested attributes. */
|
||||
cdk_attrs
|
||||
};
|
||||
|
||||
struct c_arg_tag {
|
||||
/* The argument name. */
|
||||
tree id;
|
||||
/* The type of the argument. */
|
||||
tree type;
|
||||
};
|
||||
|
||||
|
||||
/* Information about the parameters in a function declarator. */
|
||||
struct c_arg_info {
|
||||
/* A list of parameter decls. */
|
||||
tree parms;
|
||||
/* A list of structure, union and enum tags defined. */
|
||||
vec<c_arg_tag, va_gc> *tags;
|
||||
/* A list of argument types to go in the FUNCTION_TYPE. */
|
||||
tree types;
|
||||
/* A list of non-parameter decls (notably enumeration constants)
|
||||
defined with the parameters. */
|
||||
tree others;
|
||||
/* A compound expression of VLA sizes from the parameters, or NULL.
|
||||
In a function definition, these are used to ensure that
|
||||
side-effects in sizes of arrays converted to pointers (such as a
|
||||
parameter int i[n++]) take place; otherwise, they are
|
||||
ignored. */
|
||||
tree pending_sizes;
|
||||
/* True when these arguments had [*]. */
|
||||
BOOL_BITFIELD had_vla_unspec : 1;
|
||||
/* True when the arguments are a (...) prototype. */
|
||||
BOOL_BITFIELD no_named_args_stdarg_p : 1;
|
||||
};
|
||||
|
||||
/* A declarator. */
|
||||
struct c_declarator {
|
||||
/* The kind of declarator. */
|
||||
enum c_declarator_kind kind;
|
||||
location_t id_loc; /* Currently only set for cdk_id, cdk_array. */
|
||||
/* Except for cdk_id, the contained declarator. For cdk_id, NULL. */
|
||||
struct c_declarator *declarator;
|
||||
union {
|
||||
/* For identifiers. */
|
||||
struct {
|
||||
/* An IDENTIFIER_NODE, or NULL_TREE if an abstract
|
||||
declarator. */
|
||||
tree id;
|
||||
/* Any attributes (which apply to the declaration rather than to
|
||||
the type described by the outer declarators). */
|
||||
tree attrs;
|
||||
} id;
|
||||
/* For functions. */
|
||||
struct c_arg_info *arg_info;
|
||||
/* For arrays. */
|
||||
struct {
|
||||
/* The array dimension, or NULL for [] and [*]. */
|
||||
tree dimen;
|
||||
/* The qualifiers inside []. */
|
||||
int quals;
|
||||
/* The attributes (currently ignored) inside []. */
|
||||
tree attrs;
|
||||
/* Whether [static] was used. */
|
||||
BOOL_BITFIELD static_p : 1;
|
||||
/* Whether [*] was used. */
|
||||
BOOL_BITFIELD vla_unspec_p : 1;
|
||||
} array;
|
||||
/* For pointers, the qualifiers on the pointer type. */
|
||||
int pointer_quals;
|
||||
/* For attributes. */
|
||||
tree attrs;
|
||||
} u;
|
||||
};
|
||||
|
||||
/* A type name. */
|
||||
struct c_type_name {
|
||||
/* The declaration specifiers. */
|
||||
struct c_declspecs *specs;
|
||||
/* The declarator. */
|
||||
struct c_declarator *declarator;
|
||||
};
|
||||
|
||||
/* A parameter. */
|
||||
struct c_parm {
|
||||
/* The declaration specifiers, minus any prefix attributes. */
|
||||
struct c_declspecs *specs;
|
||||
/* The attributes. */
|
||||
tree attrs;
|
||||
/* The declarator. */
|
||||
struct c_declarator *declarator;
|
||||
/* The location of the parameter. */
|
||||
location_t loc;
|
||||
};
|
||||
|
||||
/* Used when parsing an enum. Initialized by start_enum. */
|
||||
struct c_enum_contents
|
||||
{
|
||||
/* While defining an enum type, this is 1 plus the last enumerator
|
||||
constant value. */
|
||||
tree enum_next_value;
|
||||
|
||||
/* The enumeration type itself. */
|
||||
tree enum_type;
|
||||
|
||||
/* Nonzero means that there was overflow computing enum_next_value. */
|
||||
int enum_overflow;
|
||||
};
|
||||
|
||||
/* A type of reference to a static identifier in an inline
|
||||
function. */
|
||||
enum c_inline_static_type {
|
||||
/* Identifier with internal linkage used in function that may be an
|
||||
inline definition (i.e., file-scope static). */
|
||||
csi_internal,
|
||||
/* Modifiable object with static storage duration defined in
|
||||
function that may be an inline definition (i.e., local
|
||||
static). */
|
||||
csi_modifiable
|
||||
};
|
||||
|
||||
|
||||
/* in c-parser.cc */
|
||||
extern void c_parse_init (void);
|
||||
extern bool c_keyword_starts_typename (enum rid keyword);
|
||||
|
||||
/* in c-aux-info.cc */
|
||||
extern void gen_aux_info_record (tree, int, int, int);
|
||||
|
||||
/* in c-decl.cc */
|
||||
struct c_spot_bindings;
|
||||
class c_struct_parse_info;
|
||||
extern struct obstack parser_obstack;
|
||||
/* Set to IN_ITERATION_STMT if parsing an iteration-statement,
|
||||
to IN_OMP_BLOCK if parsing OpenMP structured block and
|
||||
IN_OMP_FOR if parsing OpenMP loop. If parsing a switch statement,
|
||||
this is bitwise ORed with IN_SWITCH_STMT, unless parsing an
|
||||
iteration-statement, OpenMP block or loop within that switch. */
|
||||
#define IN_SWITCH_STMT 1
|
||||
#define IN_ITERATION_STMT 2
|
||||
#define IN_OMP_BLOCK 4
|
||||
#define IN_OMP_FOR 8
|
||||
#define IN_OBJC_FOREACH 16
|
||||
extern unsigned char in_statement;
|
||||
|
||||
extern bool switch_statement_break_seen_p;
|
||||
|
||||
extern bool global_bindings_p (void);
|
||||
extern tree pushdecl (tree);
|
||||
extern unsigned int start_underspecified_init (location_t, tree);
|
||||
extern void finish_underspecified_init (tree, unsigned int);
|
||||
extern void push_scope (void);
|
||||
extern tree pop_scope (void);
|
||||
extern void c_bindings_start_stmt_expr (struct c_spot_bindings *);
|
||||
extern void c_bindings_end_stmt_expr (struct c_spot_bindings *);
|
||||
|
||||
extern void record_inline_static (location_t, tree, tree,
|
||||
enum c_inline_static_type);
|
||||
extern void c_init_decl_processing (void);
|
||||
extern void c_print_identifier (FILE *, tree, int);
|
||||
extern int quals_from_declspecs (const struct c_declspecs *);
|
||||
extern struct c_declarator *build_array_declarator (location_t, tree,
|
||||
struct c_declspecs *,
|
||||
bool, bool);
|
||||
extern tree build_enumerator (location_t, location_t, struct c_enum_contents *,
|
||||
tree, tree);
|
||||
extern tree check_for_loop_decls (location_t, bool);
|
||||
extern void mark_forward_parm_decls (void);
|
||||
extern void declare_parm_level (void);
|
||||
extern void undeclared_variable (location_t, tree);
|
||||
extern tree lookup_label_for_goto (location_t, tree);
|
||||
extern tree declare_label (tree);
|
||||
extern tree define_label (location_t, tree);
|
||||
extern struct c_spot_bindings *c_get_switch_bindings (void);
|
||||
extern void c_release_switch_bindings (struct c_spot_bindings *);
|
||||
extern bool c_check_switch_jump_warnings (struct c_spot_bindings *,
|
||||
location_t, location_t);
|
||||
extern void finish_decl (tree, location_t, tree, tree, tree);
|
||||
extern tree finish_enum (tree, tree, tree);
|
||||
extern void finish_function (location_t = input_location);
|
||||
extern tree finish_struct (location_t, tree, tree, tree,
|
||||
class c_struct_parse_info *);
|
||||
extern tree c_simulate_enum_decl (location_t, const char *,
|
||||
vec<string_int_pair> *);
|
||||
extern tree c_simulate_record_decl (location_t, const char *,
|
||||
array_slice<const tree>);
|
||||
extern struct c_arg_info *build_arg_info (void);
|
||||
extern struct c_arg_info *get_parm_info (bool, tree);
|
||||
extern tree grokfield (location_t, struct c_declarator *,
|
||||
struct c_declspecs *, tree, tree *);
|
||||
extern tree groktypename (struct c_type_name *, tree *, bool *);
|
||||
extern tree grokparm (const struct c_parm *, tree *);
|
||||
extern tree implicitly_declare (location_t, tree);
|
||||
extern void keep_next_level (void);
|
||||
extern void pending_xref_error (void);
|
||||
extern void c_push_function_context (void);
|
||||
extern void c_pop_function_context (void);
|
||||
extern void push_parm_decl (const struct c_parm *, tree *);
|
||||
extern struct c_declarator *set_array_declarator_inner (struct c_declarator *,
|
||||
struct c_declarator *);
|
||||
extern tree c_builtin_function (tree);
|
||||
extern tree c_builtin_function_ext_scope (tree);
|
||||
extern tree c_simulate_builtin_function_decl (tree);
|
||||
extern void c_warn_unused_attributes (tree);
|
||||
extern tree c_warn_type_attributes (tree);
|
||||
extern void shadow_tag (const struct c_declspecs *);
|
||||
extern void shadow_tag_warned (const struct c_declspecs *, int);
|
||||
extern tree start_enum (location_t, struct c_enum_contents *, tree, tree);
|
||||
extern bool start_function (struct c_declspecs *, struct c_declarator *, tree);
|
||||
extern tree start_decl (struct c_declarator *, struct c_declspecs *, bool,
|
||||
tree, bool = true, location_t * = NULL);
|
||||
extern tree start_struct (location_t, enum tree_code, tree,
|
||||
class c_struct_parse_info **);
|
||||
extern void store_parm_decls (void);
|
||||
extern void store_parm_decls_from (struct c_arg_info *);
|
||||
extern void temp_store_parm_decls (tree, tree);
|
||||
extern void temp_pop_parm_decls (void);
|
||||
extern tree xref_tag (enum tree_code, tree);
|
||||
extern struct c_typespec parser_xref_tag (location_t, enum tree_code, tree,
|
||||
bool, tree, bool);
|
||||
extern struct c_parm *build_c_parm (struct c_declspecs *, tree,
|
||||
struct c_declarator *, location_t);
|
||||
extern struct c_declarator *build_attrs_declarator (tree,
|
||||
struct c_declarator *);
|
||||
extern struct c_declarator *build_function_declarator (struct c_arg_info *,
|
||||
struct c_declarator *);
|
||||
extern struct c_declarator *build_id_declarator (tree);
|
||||
extern struct c_declarator *make_pointer_declarator (struct c_declspecs *,
|
||||
struct c_declarator *);
|
||||
extern struct c_declspecs *build_null_declspecs (void);
|
||||
extern struct c_declspecs *declspecs_add_qual (location_t,
|
||||
struct c_declspecs *, tree);
|
||||
extern struct c_declspecs *declspecs_add_type (location_t,
|
||||
struct c_declspecs *,
|
||||
struct c_typespec);
|
||||
extern struct c_declspecs *declspecs_add_scspec (location_t,
|
||||
struct c_declspecs *, tree);
|
||||
extern struct c_declspecs *declspecs_add_attrs (location_t,
|
||||
struct c_declspecs *, tree);
|
||||
extern struct c_declspecs *declspecs_add_addrspace (location_t,
|
||||
struct c_declspecs *,
|
||||
addr_space_t);
|
||||
extern struct c_declspecs *declspecs_add_alignas (location_t,
|
||||
struct c_declspecs *, tree);
|
||||
extern struct c_declspecs *finish_declspecs (struct c_declspecs *);
|
||||
|
||||
/* in c-objc-common.cc */
|
||||
extern bool c_objc_common_init (void);
|
||||
extern bool c_missing_noreturn_ok_p (tree);
|
||||
extern bool c_warn_unused_global_decl (const_tree);
|
||||
extern void c_initialize_diagnostics (diagnostic_context *);
|
||||
extern bool c_var_mod_p (tree x, tree fn);
|
||||
extern alias_set_type c_get_alias_set (tree);
|
||||
|
||||
/* in c-typeck.cc */
|
||||
extern int in_alignof;
|
||||
extern int in_sizeof;
|
||||
extern int in_typeof;
|
||||
extern bool c_in_omp_for;
|
||||
|
||||
extern tree c_last_sizeof_arg;
|
||||
extern location_t c_last_sizeof_loc;
|
||||
|
||||
extern struct c_switch *c_switch_stack;
|
||||
|
||||
extern bool null_pointer_constant_p (const_tree);
|
||||
|
||||
|
||||
inline
|
||||
bool c_type_variably_modified_p (tree t)
|
||||
{
|
||||
return error_mark_node != t && C_TYPE_VARIABLY_MODIFIED (t);
|
||||
}
|
||||
|
||||
|
||||
extern bool char_type_p (tree);
|
||||
extern tree c_objc_common_truthvalue_conversion (location_t, tree);
|
||||
extern tree require_complete_type (location_t, tree);
|
||||
extern bool same_translation_unit_p (const_tree, const_tree);
|
||||
extern int comptypes (tree, tree);
|
||||
extern int comptypes_check_different_types (tree, tree, bool *);
|
||||
extern int comptypes_check_enum_int (tree, tree, bool *);
|
||||
extern bool c_mark_addressable (tree, bool = false);
|
||||
extern void c_incomplete_type_error (location_t, const_tree, const_tree);
|
||||
extern tree c_type_promotes_to (tree);
|
||||
extern struct c_expr default_function_array_conversion (location_t,
|
||||
struct c_expr);
|
||||
extern struct c_expr default_function_array_read_conversion (location_t,
|
||||
struct c_expr);
|
||||
extern struct c_expr convert_lvalue_to_rvalue (location_t, struct c_expr,
|
||||
bool, bool, bool = false);
|
||||
extern tree decl_constant_value_1 (tree, bool);
|
||||
extern void mark_exp_read (tree);
|
||||
extern tree composite_type (tree, tree);
|
||||
extern tree build_component_ref (location_t, tree, tree, location_t,
|
||||
location_t);
|
||||
extern tree build_array_ref (location_t, tree, tree);
|
||||
extern tree build_external_ref (location_t, tree, bool, tree *);
|
||||
extern void pop_maybe_used (bool);
|
||||
extern struct c_expr c_expr_sizeof_expr (location_t, struct c_expr);
|
||||
extern struct c_expr c_expr_sizeof_type (location_t, struct c_type_name *);
|
||||
extern struct c_expr parser_build_unary_op (location_t, enum tree_code,
|
||||
struct c_expr);
|
||||
extern struct c_expr parser_build_binary_op (location_t,
|
||||
enum tree_code, struct c_expr,
|
||||
struct c_expr);
|
||||
extern tree build_conditional_expr (location_t, tree, bool, tree, tree,
|
||||
location_t, tree, tree, location_t);
|
||||
extern tree build_compound_expr (location_t, tree, tree);
|
||||
extern tree c_cast_expr (location_t, struct c_type_name *, tree);
|
||||
extern tree build_c_cast (location_t, tree, tree);
|
||||
extern void store_init_value (location_t, tree, tree, tree);
|
||||
extern void maybe_warn_string_init (location_t, tree, struct c_expr);
|
||||
extern void start_init (tree, tree, bool, bool, rich_location *);
|
||||
extern void finish_init (void);
|
||||
extern void really_start_incremental_init (tree);
|
||||
extern void finish_implicit_inits (location_t, struct obstack *);
|
||||
extern void push_init_level (location_t, int, struct obstack *);
|
||||
extern struct c_expr pop_init_level (location_t, int, struct obstack *,
|
||||
location_t);
|
||||
extern void set_init_index (location_t, tree, tree, struct obstack *);
|
||||
extern void set_init_label (location_t, tree, location_t, struct obstack *);
|
||||
extern void process_init_element (location_t, struct c_expr, bool,
|
||||
struct obstack *);
|
||||
extern tree build_compound_literal (location_t, tree, tree, bool,
|
||||
unsigned int, struct c_declspecs *);
|
||||
extern void check_compound_literal_type (location_t, struct c_type_name *);
|
||||
extern tree c_start_switch (location_t, location_t, tree, bool);
|
||||
extern void c_finish_switch (tree, tree);
|
||||
extern tree build_asm_expr (location_t, tree, tree, tree, tree, tree, bool,
|
||||
bool);
|
||||
extern tree build_asm_stmt (bool, tree);
|
||||
extern int c_types_compatible_p (tree, tree);
|
||||
extern tree c_begin_compound_stmt (bool);
|
||||
extern tree c_end_compound_stmt (location_t, tree, bool);
|
||||
extern void c_finish_if_stmt (location_t, tree, tree, tree);
|
||||
extern void c_finish_loop (location_t, location_t, tree, location_t, tree,
|
||||
tree, tree, tree, bool);
|
||||
extern tree c_begin_stmt_expr (void);
|
||||
extern tree c_finish_stmt_expr (location_t, tree);
|
||||
extern tree c_process_expr_stmt (location_t, tree);
|
||||
extern tree c_finish_expr_stmt (location_t, tree);
|
||||
extern tree c_finish_return (location_t, tree, tree);
|
||||
extern tree c_finish_bc_stmt (location_t, tree, bool);
|
||||
extern tree c_finish_goto_label (location_t, tree);
|
||||
extern tree c_finish_goto_ptr (location_t, c_expr val);
|
||||
extern tree c_expr_to_decl (tree, bool *, bool *);
|
||||
extern tree c_finish_omp_construct (location_t, enum tree_code, tree, tree);
|
||||
extern tree c_finish_oacc_data (location_t, tree, tree);
|
||||
extern tree c_finish_oacc_host_data (location_t, tree, tree);
|
||||
extern tree c_begin_omp_parallel (void);
|
||||
extern tree c_finish_omp_parallel (location_t, tree, tree);
|
||||
extern tree c_begin_omp_task (void);
|
||||
extern tree c_finish_omp_task (location_t, tree, tree);
|
||||
extern void c_finish_omp_cancel (location_t, tree);
|
||||
extern void c_finish_omp_cancellation_point (location_t, tree);
|
||||
extern tree c_finish_omp_clauses (tree, enum c_omp_region_type);
|
||||
extern tree c_build_va_arg (location_t, tree, location_t, tree);
|
||||
extern tree c_finish_transaction (location_t, tree, int);
|
||||
extern bool c_tree_equal (tree, tree);
|
||||
extern tree c_build_function_call_vec (location_t, const vec<location_t>&,
|
||||
tree, vec<tree, va_gc> *,
|
||||
vec<tree, va_gc> *);
|
||||
extern tree c_omp_clause_copy_ctor (tree, tree, tree);
|
||||
|
||||
/* Set to 0 at beginning of a function definition, set to 1 if
|
||||
a return statement that specifies a return value is seen. */
|
||||
|
||||
extern int current_function_returns_value;
|
||||
|
||||
/* Set to 0 at beginning of a function definition, set to 1 if
|
||||
a return statement with no argument is seen. */
|
||||
|
||||
extern int current_function_returns_null;
|
||||
|
||||
/* Set to 0 at beginning of a function definition, set to 1 if
|
||||
a call to a noreturn function is seen. */
|
||||
|
||||
extern int current_function_returns_abnormally;
|
||||
|
||||
/* In c-decl.cc */
|
||||
|
||||
/* Tell the binding oracle what kind of binding we are looking for. */
|
||||
|
||||
enum c_oracle_request
|
||||
{
|
||||
C_ORACLE_SYMBOL,
|
||||
C_ORACLE_TAG,
|
||||
C_ORACLE_LABEL
|
||||
};
|
||||
|
||||
/* If this is non-NULL, then it is a "binding oracle" which can lazily
|
||||
create bindings when needed by the C compiler. The oracle is told
|
||||
the name and type of the binding to create. It can call pushdecl
|
||||
or the like to ensure the binding is visible; or do nothing,
|
||||
leaving the binding untouched. c-decl.cc takes note of when the
|
||||
oracle has been called and will not call it again if it fails to
|
||||
create a given binding. */
|
||||
|
||||
typedef void c_binding_oracle_function (enum c_oracle_request, tree identifier);
|
||||
|
||||
extern c_binding_oracle_function *c_binding_oracle;
|
||||
|
||||
extern void c_finish_incomplete_decl (tree);
|
||||
extern tree c_omp_reduction_id (enum tree_code, tree);
|
||||
extern tree c_omp_reduction_decl (tree);
|
||||
extern tree c_omp_reduction_lookup (tree, tree);
|
||||
extern tree c_check_omp_declare_reduction_r (tree *, int *, void *);
|
||||
extern bool c_check_in_current_scope (tree);
|
||||
extern void c_pushtag (location_t, tree, tree);
|
||||
extern void c_bind (location_t, tree, bool);
|
||||
extern bool tag_exists_p (enum tree_code, tree);
|
||||
|
||||
/* In c-errors.cc */
|
||||
extern bool pedwarn_c90 (location_t, int opt, const char *, ...)
|
||||
ATTRIBUTE_GCC_DIAG(3,4);
|
||||
extern bool pedwarn_c99 (location_t, int opt, const char *, ...)
|
||||
ATTRIBUTE_GCC_DIAG(3,4);
|
||||
extern bool pedwarn_c11 (location_t, int opt, const char *, ...)
|
||||
ATTRIBUTE_GCC_DIAG(3,4);
|
||||
|
||||
extern void
|
||||
set_c_expr_source_range (c_expr *expr,
|
||||
location_t start, location_t finish);
|
||||
|
||||
extern void
|
||||
set_c_expr_source_range (c_expr *expr,
|
||||
source_range src_range);
|
||||
|
||||
/* In c-fold.cc */
|
||||
extern vec<tree> incomplete_record_decls;
|
||||
|
||||
extern const char *c_get_sarif_source_language (const char *filename);
|
||||
|
||||
#if CHECKING_P
|
||||
namespace selftest {
|
||||
extern void run_c_tests (void);
|
||||
} // namespace selftest
|
||||
#endif /* #if CHECKING_P */
|
||||
|
||||
|
||||
#endif /* ! GCC_C_TREE_H */
|
||||
@@ -0,0 +1,138 @@
|
||||
/* Declarations and data types for RTL call insn generation.
|
||||
Copyright (C) 2013-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GCC; see the file COPYING3. If not see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef GCC_CALLS_H
|
||||
#define GCC_CALLS_H
|
||||
|
||||
/* Describes a function argument.
|
||||
|
||||
Each argument conceptually has a gimple-level type. Usually this type
|
||||
is available directly as a tree via the TYPE field, but when calling
|
||||
libgcc support functions it might instead be inferred from a mode,
|
||||
in which case the type isn't available directly.
|
||||
|
||||
This gimple-level type might go through promotion before being passed to
|
||||
the target function. Depending on the context, the MODE field is either
|
||||
the mode of the gimple-level type (whether explicitly given or not)
|
||||
or the mode after promotion has been performed. */
|
||||
class function_arg_info
|
||||
{
|
||||
public:
|
||||
function_arg_info ()
|
||||
: type (NULL_TREE), mode (VOIDmode), named (false),
|
||||
pass_by_reference (false)
|
||||
{}
|
||||
|
||||
/* Initialize an argument of mode MODE, either before or after promotion. */
|
||||
function_arg_info (machine_mode mode, bool named)
|
||||
: type (NULL_TREE), mode (mode), named (named), pass_by_reference (false)
|
||||
{}
|
||||
|
||||
/* Initialize an unpromoted argument of type TYPE. */
|
||||
function_arg_info (tree type, bool named)
|
||||
: type (type), mode (TYPE_MODE (type)), named (named),
|
||||
pass_by_reference (false)
|
||||
{}
|
||||
|
||||
/* Initialize an argument with explicit properties. */
|
||||
function_arg_info (tree type, machine_mode mode, bool named)
|
||||
: type (type), mode (mode), named (named), pass_by_reference (false)
|
||||
{}
|
||||
|
||||
/* Return true if the gimple-level type is an aggregate. */
|
||||
bool aggregate_type_p () const { return type && AGGREGATE_TYPE_P (type); }
|
||||
|
||||
/* Return the size of the gimple-level type, or -1 if the size is
|
||||
variable or otherwise not representable as a poly_int64.
|
||||
|
||||
Use this function when MODE is the mode of the type before promotion,
|
||||
or in any context if the target never promotes function arguments. */
|
||||
poly_int64 type_size_in_bytes () const
|
||||
{
|
||||
if (type)
|
||||
return int_size_in_bytes (type);
|
||||
return GET_MODE_SIZE (mode);
|
||||
}
|
||||
|
||||
/* Return the size of the argument after promotion, or -1 if the size
|
||||
is variable or otherwise not representable as a poly_int64.
|
||||
|
||||
Use this function when MODE is the mode of the type after promotion. */
|
||||
poly_int64 promoted_size_in_bytes () const
|
||||
{
|
||||
if (mode == BLKmode)
|
||||
return int_size_in_bytes (type);
|
||||
return GET_MODE_SIZE (mode);
|
||||
}
|
||||
|
||||
/* True if the argument represents the end of the argument list,
|
||||
as returned by end_marker (). */
|
||||
bool end_marker_p () const { return mode == VOIDmode; }
|
||||
|
||||
/* Return a function_arg_info that represents the end of the
|
||||
argument list. */
|
||||
static function_arg_info end_marker ()
|
||||
{
|
||||
return function_arg_info (void_type_node, /*named=*/true);
|
||||
}
|
||||
|
||||
/* The type of the argument, or null if not known (which is true for
|
||||
libgcc support functions). */
|
||||
tree type;
|
||||
|
||||
/* The mode of the argument. Depending on context, this might be
|
||||
the mode of the argument type or the mode after promotion. */
|
||||
machine_mode mode;
|
||||
|
||||
/* True if the argument is treated as a named argument, false if it is
|
||||
treated as an unnamed variadic argument (i.e. one passed through
|
||||
"..."). See also TARGET_STRICT_ARGUMENT_NAMING. */
|
||||
unsigned int named : 1;
|
||||
|
||||
/* True if we have decided to pass the argument by reference, in which case
|
||||
the function_arg_info describes a pointer to the original argument. */
|
||||
unsigned int pass_by_reference : 1;
|
||||
};
|
||||
|
||||
extern int flags_from_decl_or_type (const_tree);
|
||||
extern int call_expr_flags (const_tree);
|
||||
extern int setjmp_call_p (const_tree);
|
||||
extern bool gimple_maybe_alloca_call_p (const gimple *);
|
||||
extern bool gimple_alloca_call_p (const gimple *);
|
||||
extern bool alloca_call_p (const_tree);
|
||||
extern bool must_pass_in_stack_var_size (const function_arg_info &);
|
||||
extern bool must_pass_in_stack_var_size_or_pad (const function_arg_info &);
|
||||
extern bool must_pass_va_arg_in_stack (tree);
|
||||
extern rtx prepare_call_address (tree, rtx, rtx, rtx *, int, int);
|
||||
extern bool shift_return_value (machine_mode, bool, rtx);
|
||||
extern rtx expand_call (tree, rtx, int);
|
||||
extern void fixup_tail_calls (void);
|
||||
|
||||
extern bool pass_by_reference (CUMULATIVE_ARGS *, function_arg_info);
|
||||
extern bool pass_va_arg_by_reference (tree);
|
||||
extern bool apply_pass_by_reference_rules (CUMULATIVE_ARGS *,
|
||||
function_arg_info &);
|
||||
extern bool reference_callee_copied (CUMULATIVE_ARGS *,
|
||||
const function_arg_info &);
|
||||
extern void maybe_complain_about_tail_call (tree, const char *);
|
||||
|
||||
extern rtx rtx_for_static_chain (const_tree, bool);
|
||||
extern bool cxx17_empty_base_field_p (const_tree);
|
||||
|
||||
#endif // GCC_CALLS_H
|
||||
@@ -0,0 +1,25 @@
|
||||
/* Conditional comapre related functions.
|
||||
Copyright (C) 2014-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GCC; see the file COPYING3. If not see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef GCC_CCMP_H
|
||||
#define GCC_CCMP_H
|
||||
|
||||
extern rtx expand_ccmp_expr (gimple *, machine_mode);
|
||||
|
||||
#endif /* GCC_CCMP_H */
|
||||
@@ -0,0 +1,191 @@
|
||||
/* Flags on basic blocks and edges.
|
||||
Copyright (C) 2012-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GCC; see the file COPYING3. If not see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* This file defines flags that may appear on basic blocks or on
|
||||
edges. Source files define DEF_BASIC_BLOCK_FLAG or DEF_EDGE_FLAG
|
||||
appropriately before including this file. */
|
||||
|
||||
#if !defined(DEF_BASIC_BLOCK_FLAG) && !defined(DEF_EDGE_FLAG)
|
||||
#error "You must define DEF_BASIC_BLOCK_FLAG or DEF_EDGE_FLAG"
|
||||
#endif
|
||||
|
||||
#ifdef DEF_BASIC_BLOCK_FLAG
|
||||
|
||||
/* Masks for basic_block.flags.
|
||||
|
||||
The format of this file is: DEF_BASIC_BLOCK_FLAG(NAME, IDX).
|
||||
NAME is the name of the basic block flag. A flag BB_#NAME will be
|
||||
created and the name is used in dump_edge_info.
|
||||
IDX is a sequence number that is used to determine the value
|
||||
of the flag, which is 1 << IDX).
|
||||
|
||||
BB_HOT_PARTITION and BB_COLD_PARTITION should be preserved throughout
|
||||
the compilation, so they are never cleared.
|
||||
|
||||
All other flags may be cleared by clear_bb_flags(). It is generally
|
||||
a bad idea to rely on any flags being up-to-date. */
|
||||
|
||||
/* Only set on blocks that have just been created by create_bb. */
|
||||
DEF_BASIC_BLOCK_FLAG(NEW, 0)
|
||||
|
||||
/* Set by find_unreachable_blocks. Do not rely on this being set in any
|
||||
pass. */
|
||||
DEF_BASIC_BLOCK_FLAG(REACHABLE, 1)
|
||||
|
||||
/* Set for blocks in an irreducible loop by loop analysis. */
|
||||
DEF_BASIC_BLOCK_FLAG(IRREDUCIBLE_LOOP, 2)
|
||||
|
||||
/* Set on blocks that may actually not be single-entry single-exit block. */
|
||||
DEF_BASIC_BLOCK_FLAG(SUPERBLOCK, 3)
|
||||
|
||||
/* Set on basic blocks that the scheduler should not touch. This is used
|
||||
by SMS to prevent other schedulers from messing with the loop schedule. */
|
||||
DEF_BASIC_BLOCK_FLAG(DISABLE_SCHEDULE, 4)
|
||||
|
||||
/* Set on blocks that should be put in a hot section. */
|
||||
DEF_BASIC_BLOCK_FLAG(HOT_PARTITION, 5)
|
||||
|
||||
/* Set on blocks that should be put in a cold section. */
|
||||
DEF_BASIC_BLOCK_FLAG(COLD_PARTITION, 6)
|
||||
|
||||
/* Set on block that was duplicated. */
|
||||
DEF_BASIC_BLOCK_FLAG(DUPLICATED, 7)
|
||||
|
||||
/* Set if the label at the top of this block is the target of a non-local goto. */
|
||||
DEF_BASIC_BLOCK_FLAG(NON_LOCAL_GOTO_TARGET, 8)
|
||||
|
||||
/* Set on blocks that are in RTL format. */
|
||||
DEF_BASIC_BLOCK_FLAG(RTL, 9)
|
||||
|
||||
/* Set on blocks that are forwarder blocks.
|
||||
Only used in cfgcleanup.cc. */
|
||||
DEF_BASIC_BLOCK_FLAG(FORWARDER_BLOCK, 10)
|
||||
|
||||
/* Set on blocks that cannot be threaded through.
|
||||
Only used for jump threading. */
|
||||
DEF_BASIC_BLOCK_FLAG(NONTHREADABLE_BLOCK, 11)
|
||||
|
||||
/* Set on blocks that were modified in some way. This bit is set in
|
||||
df_set_bb_dirty, but not cleared by df_analyze, so it can be used
|
||||
to test whether a block has been modified prior to a df_analyze call. */
|
||||
DEF_BASIC_BLOCK_FLAG(MODIFIED, 12)
|
||||
|
||||
/* A general visited flag for passes to use. */
|
||||
DEF_BASIC_BLOCK_FLAG(VISITED, 13)
|
||||
|
||||
/* Set on blocks that are in a transaction. This is calculated on
|
||||
demand, and is available after calling compute_transaction_bits(). */
|
||||
DEF_BASIC_BLOCK_FLAG(IN_TRANSACTION, 14)
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef DEF_EDGE_FLAG
|
||||
|
||||
/* Masks for edge.flags.
|
||||
|
||||
The format of this file is: DEF_EDGE_FLAG(NAME, IDX, STRING).
|
||||
NAME is the name of the edge flag. A flag EDGE_#NAME will be
|
||||
created and the name is used in dump_edge_info.
|
||||
IDX is a sequence number that is used to determine the value
|
||||
of the flag, which is 1 << IDX). */
|
||||
|
||||
/* 'Straight line' flow. In GIMPLE and in cfglayout mode, all normal
|
||||
edges are fallthru edges. In cfgrtl mode, this flag really means
|
||||
that control flow falls through to the next basic block in the line. */
|
||||
DEF_EDGE_FLAG(FALLTHRU, 0)
|
||||
|
||||
/* Strange flow, like a computed jump or exception handling. Usually
|
||||
this means that the edge cannot be split. */
|
||||
DEF_EDGE_FLAG(ABNORMAL, 1)
|
||||
|
||||
/* Edge out of a basic block that ends with a CALL_INSN with abnormal
|
||||
exit, like an exception or a non-local goto.
|
||||
ABNORMAL_CALL edges also have ABNORMAL set.
|
||||
This flag is only used for the RTL CFG. */
|
||||
DEF_EDGE_FLAG(ABNORMAL_CALL, 2)
|
||||
|
||||
/* Exception edge. Exception handling edges represent possible control
|
||||
transfers from a trapping instruction to an exception handler.
|
||||
EH edges also have ABNORMAL set for the RTL CFG. */
|
||||
DEF_EDGE_FLAG(EH, 3)
|
||||
|
||||
/* Never merge blocks via this edge. This is used for exception handling,
|
||||
to prevent merging away edges to the post-landing-pad basic block.
|
||||
This flag is only used for the RTL CFG. */
|
||||
DEF_EDGE_FLAG(PRESERVE, 4)
|
||||
|
||||
/* Not a real edge. This is used to connect parts of the CFG that do
|
||||
not halt, such as infinite loops and noreturn functions, to the
|
||||
EXIT_BLOCK, so that traversing of the reverse CFG is possible. */
|
||||
DEF_EDGE_FLAG(FAKE, 5)
|
||||
|
||||
/* A back edge, marked in a depth-first search of the CFG. Back edges
|
||||
are hints that this edge may be part of a loop in the CFG. */
|
||||
DEF_EDGE_FLAG(DFS_BACK, 6)
|
||||
|
||||
/* Edge in a part of the CFG that is an irreducible loop. */
|
||||
DEF_EDGE_FLAG(IRREDUCIBLE_LOOP, 7)
|
||||
|
||||
/* Edge taken when controlling predicate is nonzero.
|
||||
This is only used for the GIMPLE CFG. */
|
||||
DEF_EDGE_FLAG(TRUE_VALUE, 8)
|
||||
|
||||
/* Edge taken when controlling predicate is zero.
|
||||
This is only used for the GIMPLE CFG. */
|
||||
DEF_EDGE_FLAG(FALSE_VALUE, 9)
|
||||
|
||||
/* Edge is executable. This is only used in GIMPLE SSA-CCP and VRP.
|
||||
This is only used for the GIMPLE CFG. */
|
||||
DEF_EDGE_FLAG(EXECUTABLE, 10)
|
||||
|
||||
/* Edge crosses between hot and cold sections, when we do partitioning.
|
||||
This flag is only used for the RTL CFG. */
|
||||
DEF_EDGE_FLAG(CROSSING, 11)
|
||||
|
||||
/* Edge from a sibcall CALL_INSN to exit.
|
||||
SIBCALL edges also have ABNORMAL set.
|
||||
This flag is only used for the RTL CFG. */
|
||||
DEF_EDGE_FLAG(SIBCALL, 12)
|
||||
|
||||
/* Candidate for straight line flow. Only used in bb-reorder.cc.
|
||||
This flag is only used for the RTL CFG. */
|
||||
DEF_EDGE_FLAG(CAN_FALLTHRU, 13)
|
||||
|
||||
/* Exit of a loop. This is only used in ifcvt.cc.
|
||||
This flag is only used for the RTL CFG. */
|
||||
DEF_EDGE_FLAG(LOOP_EXIT, 14)
|
||||
|
||||
/* Uninstrumented edge out of a GIMPLE_TRANSACTION statement. */
|
||||
DEF_EDGE_FLAG(TM_UNINSTRUMENTED, 15)
|
||||
|
||||
/* Abort (over) edge out of a GIMPLE_TRANSACTION statement. */
|
||||
DEF_EDGE_FLAG(TM_ABORT, 16)
|
||||
|
||||
/* An edge we should ignore. It should be entirely local to
|
||||
passes. ie, it is never set on any edge upon the completion
|
||||
of any pass. */
|
||||
DEF_EDGE_FLAG(IGNORE, 17)
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
Local variables:
|
||||
mode:c
|
||||
End:
|
||||
*/
|
||||
@@ -0,0 +1,186 @@
|
||||
/* Control flow graph manipulation code header file.
|
||||
Copyright (C) 2014-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GCC; see the file COPYING3. If not see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef GCC_CFG_H
|
||||
#define GCC_CFG_H
|
||||
|
||||
#include "dominance.h"
|
||||
|
||||
/* What sort of profiling information we have. */
|
||||
enum profile_status_d
|
||||
{
|
||||
PROFILE_ABSENT,
|
||||
PROFILE_GUESSED,
|
||||
PROFILE_READ,
|
||||
PROFILE_LAST /* Last value, used by profile streaming. */
|
||||
};
|
||||
|
||||
/* A structure to group all the per-function control flow graph data.
|
||||
The x_* prefixing is necessary because otherwise references to the
|
||||
fields of this struct are interpreted as the defines for backward
|
||||
source compatibility following the definition of this struct. */
|
||||
struct GTY(()) control_flow_graph {
|
||||
/* Block pointers for the exit and entry of a function.
|
||||
These are always the head and tail of the basic block list. */
|
||||
basic_block x_entry_block_ptr;
|
||||
basic_block x_exit_block_ptr;
|
||||
|
||||
/* Index by basic block number, get basic block struct info. */
|
||||
vec<basic_block, va_gc> *x_basic_block_info;
|
||||
|
||||
/* Number of basic blocks in this flow graph. */
|
||||
int x_n_basic_blocks;
|
||||
|
||||
/* Number of edges in this flow graph. */
|
||||
int x_n_edges;
|
||||
|
||||
/* The first free basic block number. */
|
||||
int x_last_basic_block;
|
||||
|
||||
/* UIDs for LABEL_DECLs. */
|
||||
int last_label_uid;
|
||||
|
||||
/* Mapping of labels to their associated blocks. At present
|
||||
only used for the gimple CFG. */
|
||||
vec<basic_block, va_gc> *x_label_to_block_map;
|
||||
|
||||
enum profile_status_d x_profile_status;
|
||||
|
||||
/* Whether the dominators and the postdominators are available. */
|
||||
enum dom_state x_dom_computed[2];
|
||||
|
||||
/* Number of basic blocks in the dominance tree. */
|
||||
unsigned x_n_bbs_in_dom_tree[2];
|
||||
|
||||
/* Maximal number of entities in the single jumptable. Used to estimate
|
||||
final flowgraph size. */
|
||||
int max_jumptable_ents;
|
||||
|
||||
/* Maximal count of BB in function. */
|
||||
profile_count count_max;
|
||||
|
||||
/* Dynamically allocated edge/bb flags. */
|
||||
int edge_flags_allocated;
|
||||
int bb_flags_allocated;
|
||||
};
|
||||
|
||||
|
||||
extern void init_flow (function *);
|
||||
extern void free_cfg (function *);
|
||||
extern basic_block alloc_block (void);
|
||||
extern void link_block (basic_block, basic_block);
|
||||
extern void unlink_block (basic_block);
|
||||
extern void compact_blocks (void);
|
||||
extern void expunge_block (basic_block);
|
||||
extern edge unchecked_make_edge (basic_block, basic_block, int);
|
||||
extern edge cached_make_edge (sbitmap, basic_block, basic_block, int);
|
||||
extern edge make_edge (basic_block, basic_block, int);
|
||||
extern edge make_single_succ_edge (basic_block, basic_block, int);
|
||||
extern void remove_edge_raw (edge);
|
||||
extern void redirect_edge_succ (edge, basic_block);
|
||||
extern void redirect_edge_pred (edge, basic_block);
|
||||
extern void clear_bb_flags (void);
|
||||
extern void dump_edge_info (FILE *, edge, dump_flags_t, int);
|
||||
extern void debug (edge_def &ref);
|
||||
extern void debug (edge_def *ptr);
|
||||
extern void alloc_aux_for_blocks (int);
|
||||
extern void clear_aux_for_blocks (void);
|
||||
extern void free_aux_for_blocks (void);
|
||||
extern void alloc_aux_for_edge (edge, int);
|
||||
extern void alloc_aux_for_edges (int);
|
||||
extern void clear_aux_for_edges (void);
|
||||
extern void free_aux_for_edges (void);
|
||||
extern void debug_bb (basic_block);
|
||||
extern basic_block debug_bb_n (int);
|
||||
extern void debug_bb (basic_block, dump_flags_t);
|
||||
extern basic_block debug_bb_n (int, dump_flags_t);
|
||||
extern void dump_bb_info (FILE *, basic_block, int, dump_flags_t, bool, bool);
|
||||
extern void brief_dump_cfg (FILE *, dump_flags_t);
|
||||
extern void update_bb_profile_for_threading (basic_block, profile_count, edge);
|
||||
extern void scale_bbs_frequencies_profile_count (basic_block *, int,
|
||||
profile_count, profile_count);
|
||||
extern void scale_bbs_frequencies (basic_block *, int, profile_probability);
|
||||
extern void initialize_original_copy_tables (void);
|
||||
extern void reset_original_copy_tables (void);
|
||||
extern void free_original_copy_tables (void);
|
||||
extern bool original_copy_tables_initialized_p (void);
|
||||
extern void set_bb_original (basic_block, basic_block);
|
||||
extern basic_block get_bb_original (basic_block);
|
||||
extern void set_bb_copy (basic_block, basic_block);
|
||||
extern basic_block get_bb_copy (basic_block);
|
||||
void set_loop_copy (class loop *, class loop *);
|
||||
class loop *get_loop_copy (class loop *);
|
||||
|
||||
/* Generic RAII class to allocate a bit from storage of integer type T.
|
||||
The allocated bit is accessible as mask with the single bit set
|
||||
via the conversion operator to T. */
|
||||
|
||||
template <class T>
|
||||
class auto_flag
|
||||
{
|
||||
public:
|
||||
/* static assert T is integer type of max HOST_WIDE_INT precision. */
|
||||
auto_flag (T *sptr)
|
||||
{
|
||||
m_sptr = sptr;
|
||||
int free_bit = ffs_hwi (~*sptr);
|
||||
/* If there are no unset bits... */
|
||||
if (free_bit == 0)
|
||||
gcc_unreachable ();
|
||||
m_flag = HOST_WIDE_INT_1U << (free_bit - 1);
|
||||
/* ...or if T is signed and thus the complement is sign-extended,
|
||||
check if we ran out of bits. We could spare us this bit
|
||||
if we could use C++11 std::make_unsigned<T>::type to pass
|
||||
~*sptr to ffs_hwi. */
|
||||
if (m_flag == 0)
|
||||
gcc_unreachable ();
|
||||
gcc_checking_assert ((*sptr & m_flag) == 0);
|
||||
*sptr |= m_flag;
|
||||
}
|
||||
~auto_flag ()
|
||||
{
|
||||
gcc_checking_assert ((*m_sptr & m_flag) == m_flag);
|
||||
*m_sptr &= ~m_flag;
|
||||
}
|
||||
operator T () const { return m_flag; }
|
||||
private:
|
||||
T *m_sptr;
|
||||
T m_flag;
|
||||
};
|
||||
|
||||
/* RAII class to allocate an edge flag for temporary use. You have
|
||||
to clear the flag from all edges when you are finished using it. */
|
||||
|
||||
class auto_edge_flag : public auto_flag<int>
|
||||
{
|
||||
public:
|
||||
auto_edge_flag (function *fun)
|
||||
: auto_flag<int> (&fun->cfg->edge_flags_allocated) {}
|
||||
};
|
||||
|
||||
/* RAII class to allocate a bb flag for temporary use. You have
|
||||
to clear the flag from all edges when you are finished using it. */
|
||||
class auto_bb_flag : public auto_flag<int>
|
||||
{
|
||||
public:
|
||||
auto_bb_flag (function *fun)
|
||||
: auto_flag<int> (&fun->cfg->bb_flags_allocated) {}
|
||||
};
|
||||
|
||||
#endif /* GCC_CFG_H */
|
||||
@@ -0,0 +1,90 @@
|
||||
/* Control flow graph analysis header file.
|
||||
Copyright (C) 2014-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GCC; see the file COPYING3. If not see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
|
||||
#ifndef GCC_CFGANAL_H
|
||||
#define GCC_CFGANAL_H
|
||||
|
||||
/* This structure maintains an edge list vector. */
|
||||
/* FIXME: Make this a vec<edge>. */
|
||||
struct edge_list
|
||||
{
|
||||
int num_edges;
|
||||
edge *index_to_edge;
|
||||
};
|
||||
|
||||
|
||||
/* Class to compute and manage control dependences on an edge-list. */
|
||||
class control_dependences
|
||||
{
|
||||
public:
|
||||
control_dependences ();
|
||||
~control_dependences ();
|
||||
bitmap get_edges_dependent_on (int);
|
||||
basic_block get_edge_src (int);
|
||||
basic_block get_edge_dest (int);
|
||||
|
||||
private:
|
||||
void set_control_dependence_map_bit (basic_block, int);
|
||||
void clear_control_dependence_bitmap (basic_block);
|
||||
void find_control_dependence (int);
|
||||
vec<bitmap_head> control_dependence_map;
|
||||
vec<std::pair<int, int> > m_el;
|
||||
bitmap_obstack m_bitmaps;
|
||||
};
|
||||
|
||||
extern bool mark_dfs_back_edges (struct function *);
|
||||
extern bool mark_dfs_back_edges (void);
|
||||
extern void verify_marked_backedges (struct function *);
|
||||
extern void find_unreachable_blocks (void);
|
||||
extern void verify_no_unreachable_blocks (void);
|
||||
struct edge_list * create_edge_list (void);
|
||||
void free_edge_list (struct edge_list *);
|
||||
void print_edge_list (FILE *, struct edge_list *);
|
||||
void verify_edge_list (FILE *, struct edge_list *);
|
||||
edge find_edge (basic_block, basic_block);
|
||||
int find_edge_index (struct edge_list *, basic_block, basic_block);
|
||||
extern void remove_fake_edges (void);
|
||||
extern void remove_fake_exit_edges (void);
|
||||
extern void add_noreturn_fake_exit_edges (void);
|
||||
extern void connect_infinite_loops_to_exit (void);
|
||||
extern int post_order_compute (int *, bool, bool);
|
||||
extern basic_block dfs_find_deadend (basic_block);
|
||||
extern void inverted_post_order_compute (vec<int> *postorder, sbitmap *start_points = 0);
|
||||
extern int pre_and_rev_post_order_compute_fn (struct function *,
|
||||
int *, int *, bool);
|
||||
extern int pre_and_rev_post_order_compute (int *, int *, bool);
|
||||
extern int rev_post_order_and_mark_dfs_back_seme (struct function *, edge,
|
||||
bitmap, bool, int *,
|
||||
vec<std::pair<int, int> > *);
|
||||
extern int dfs_enumerate_from (basic_block, int,
|
||||
bool (*)(const_basic_block, const void *),
|
||||
basic_block *, int, const void *);
|
||||
extern void compute_dominance_frontiers (class bitmap_head *);
|
||||
extern bitmap compute_idf (bitmap, class bitmap_head *);
|
||||
extern void bitmap_intersection_of_succs (sbitmap, sbitmap *, basic_block);
|
||||
extern void bitmap_intersection_of_preds (sbitmap, sbitmap *, basic_block);
|
||||
extern void bitmap_union_of_succs (sbitmap, sbitmap *, basic_block);
|
||||
extern void bitmap_union_of_preds (sbitmap, sbitmap *, basic_block);
|
||||
extern basic_block * single_pred_before_succ_order (void);
|
||||
extern edge single_incoming_edge_ignoring_loop_edges (basic_block, bool);
|
||||
extern edge single_pred_edge_ignoring_loop_edges (basic_block, bool);
|
||||
|
||||
|
||||
#endif /* GCC_CFGANAL_H */
|
||||
@@ -0,0 +1,28 @@
|
||||
/* Control flow graph building header file.
|
||||
Copyright (C) 2014-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GCC; see the file COPYING3. If not see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef GCC_CFGBUILD_H
|
||||
#define GCC_CFGBUILD_H
|
||||
|
||||
extern bool inside_basic_block_p (const rtx_insn *);
|
||||
extern bool control_flow_insn_p (const rtx_insn *);
|
||||
extern void rtl_make_eh_edge (sbitmap, basic_block, rtx);
|
||||
extern void find_many_sub_basic_blocks (sbitmap);
|
||||
|
||||
#endif /* GCC_CFGBUILD_H */
|
||||
@@ -0,0 +1,35 @@
|
||||
/* Control flow optimization header file.
|
||||
Copyright (C) 2014-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GCC; see the file COPYING3. If not see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
|
||||
#ifndef GCC_CFGCLEANUP_H
|
||||
#define GCC_CFGCLEANUP_H
|
||||
|
||||
enum replace_direction { dir_none, dir_forward, dir_backward, dir_both };
|
||||
|
||||
extern int flow_find_cross_jump (basic_block, basic_block, rtx_insn **,
|
||||
rtx_insn **, enum replace_direction*);
|
||||
extern int flow_find_head_matching_sequence (basic_block, basic_block,
|
||||
rtx_insn **, rtx_insn **, int);
|
||||
extern bool delete_unreachable_blocks (void);
|
||||
extern void delete_dead_jumptables (void);
|
||||
extern bool cleanup_cfg (int);
|
||||
extern bool bb_is_just_return (basic_block, rtx_insn **, rtx_insn **);
|
||||
|
||||
#endif /* GCC_CFGCLEANUP_H */
|
||||
@@ -0,0 +1,28 @@
|
||||
/* Header file for lowering trees to RTL.
|
||||
Copyright (C) 2013-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GCC; see the file COPYING3. If not see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef GCC_CFGEXPAND_H
|
||||
#define GCC_CFGEXPAND_H
|
||||
|
||||
extern tree gimple_assign_rhs_to_tree (gimple *);
|
||||
extern HOST_WIDE_INT estimated_stack_frame_size (struct cgraph_node *);
|
||||
extern void set_parm_rtl (tree, rtx);
|
||||
|
||||
|
||||
#endif /* GCC_CFGEXPAND_H */
|
||||
@@ -0,0 +1,289 @@
|
||||
/* Hooks for cfg representation specific functions.
|
||||
Copyright (C) 2003-2023 Free Software Foundation, Inc.
|
||||
Contributed by Sebastian Pop <s.pop@laposte.net>
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3, or (at your option)
|
||||
any later version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GCC; see the file COPYING3. If not see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef GCC_CFGHOOKS_H
|
||||
#define GCC_CFGHOOKS_H
|
||||
|
||||
#include "predict.h"
|
||||
|
||||
/* Structure to gather statistic about profile consistency, per pass.
|
||||
An array of this structure, indexed by pass static number, is allocated
|
||||
in passes.cc. The structure is defined here so that different CFG modes
|
||||
can do their book-keeping via CFG hooks.
|
||||
|
||||
For every field[2], field[0] is the count before the pass runs, and
|
||||
field[1] is the post-pass count. This allows us to monitor the effect
|
||||
of each individual pass on the profile consistency.
|
||||
|
||||
This structure is not supposed to be used by anything other than passes.cc
|
||||
and one CFG hook per CFG mode. */
|
||||
struct profile_record
|
||||
{
|
||||
/* A weighted cost of the run-time of the function body. */
|
||||
double time;
|
||||
/* Frequency of execution of basic blocks where sum(prob) of the block's
|
||||
predecessors doesn't match reasonably probability 1. */
|
||||
double dyn_mismatched_prob_out;
|
||||
/* Frequency of execution basic blocks where sum(count) of the block's
|
||||
predecessors doesn't match reasonably well with the incoming frequency. */
|
||||
double dyn_mismatched_count_in;
|
||||
/* The number of basic blocks where sum(prob) of the block's predecessors
|
||||
doesn't match reasonably probability 1. */
|
||||
int num_mismatched_prob_out;
|
||||
/* The number of basic blocks where sum(count) of the block's predecessors
|
||||
doesn't match reasonably well with the incoming frequency. */
|
||||
int num_mismatched_count_in;
|
||||
/* A weighted cost of the size of the function body. */
|
||||
int size;
|
||||
/* True iff this pass actually was run. */
|
||||
bool run;
|
||||
bool fdo;
|
||||
};
|
||||
|
||||
typedef int_hash <unsigned short, 0> dependence_hash;
|
||||
|
||||
/* Optional data for duplicate_block. */
|
||||
|
||||
class copy_bb_data
|
||||
{
|
||||
public:
|
||||
copy_bb_data() : dependence_map (NULL) {}
|
||||
~copy_bb_data () { delete dependence_map; }
|
||||
|
||||
/* A map from the copied BBs dependence info cliques to
|
||||
equivalents in the BBs duplicated to. */
|
||||
hash_map<dependence_hash, unsigned short> *dependence_map;
|
||||
};
|
||||
|
||||
struct cfg_hooks
|
||||
{
|
||||
/* Name of the corresponding ir. */
|
||||
const char *name;
|
||||
|
||||
/* Debugging. */
|
||||
int (*verify_flow_info) (void);
|
||||
void (*dump_bb) (FILE *, basic_block, int, dump_flags_t);
|
||||
void (*dump_bb_for_graph) (pretty_printer *, basic_block);
|
||||
|
||||
/* Basic CFG manipulation. */
|
||||
|
||||
/* Return new basic block. */
|
||||
basic_block (*create_basic_block) (void *head, void *end, basic_block after);
|
||||
|
||||
/* Redirect edge E to the given basic block B and update underlying program
|
||||
representation. Returns edge representing redirected branch (that may not
|
||||
be equivalent to E in the case of duplicate edges being removed) or NULL
|
||||
if edge is not easily redirectable for whatever reason. */
|
||||
edge (*redirect_edge_and_branch) (edge e, basic_block b);
|
||||
|
||||
/* Same as the above but allows redirecting of fallthru edges. In that case
|
||||
newly created forwarder basic block is returned. The edge must
|
||||
not be abnormal. */
|
||||
basic_block (*redirect_edge_and_branch_force) (edge, basic_block);
|
||||
|
||||
/* Returns true if it is possible to remove the edge by redirecting it
|
||||
to the destination of the other edge going from its source. */
|
||||
bool (*can_remove_branch_p) (const_edge);
|
||||
|
||||
/* Remove statements corresponding to a given basic block. */
|
||||
void (*delete_basic_block) (basic_block);
|
||||
|
||||
/* Creates a new basic block just after basic block B by splitting
|
||||
everything after specified instruction I. */
|
||||
basic_block (*split_block) (basic_block b, void * i);
|
||||
|
||||
/* Move block B immediately after block A. */
|
||||
bool (*move_block_after) (basic_block b, basic_block a);
|
||||
|
||||
/* Return true when blocks A and B can be merged into single basic block. */
|
||||
bool (*can_merge_blocks_p) (basic_block a, basic_block b);
|
||||
|
||||
/* Merge blocks A and B. */
|
||||
void (*merge_blocks) (basic_block a, basic_block b);
|
||||
|
||||
/* Predict edge E using PREDICTOR to given PROBABILITY. */
|
||||
void (*predict_edge) (edge e, enum br_predictor predictor, int probability);
|
||||
|
||||
/* Return true if the one of outgoing edges is already predicted by
|
||||
PREDICTOR. */
|
||||
bool (*predicted_by_p) (const_basic_block bb, enum br_predictor predictor);
|
||||
|
||||
/* Return true when block A can be duplicated. */
|
||||
bool (*can_duplicate_block_p) (const_basic_block a);
|
||||
|
||||
/* Duplicate block A. */
|
||||
basic_block (*duplicate_block) (basic_block a, copy_bb_data *);
|
||||
|
||||
/* Higher level functions representable by primitive operations above if
|
||||
we didn't have some oddities in RTL and Tree representations. */
|
||||
basic_block (*split_edge) (edge);
|
||||
void (*make_forwarder_block) (edge);
|
||||
|
||||
/* Try to make the edge fallthru. */
|
||||
void (*tidy_fallthru_edge) (edge);
|
||||
|
||||
/* Make the edge non-fallthru. */
|
||||
basic_block (*force_nonfallthru) (edge);
|
||||
|
||||
/* Say whether a block ends with a call, possibly followed by some
|
||||
other code that must stay with the call. */
|
||||
bool (*block_ends_with_call_p) (basic_block);
|
||||
|
||||
/* Say whether a block ends with a conditional branch. Switches
|
||||
and unconditional branches do not qualify. */
|
||||
bool (*block_ends_with_condjump_p) (const_basic_block);
|
||||
|
||||
/* Add fake edges to the function exit for any non constant and non noreturn
|
||||
calls, volatile inline assembly in the bitmap of blocks specified by
|
||||
BLOCKS or to the whole CFG if BLOCKS is zero. Return the number of blocks
|
||||
that were split.
|
||||
|
||||
The goal is to expose cases in which entering a basic block does not imply
|
||||
that all subsequent instructions must be executed. */
|
||||
int (*flow_call_edges_add) (sbitmap);
|
||||
|
||||
/* This function is called immediately after edge E is added to the
|
||||
edge vector E->dest->preds. */
|
||||
void (*execute_on_growing_pred) (edge);
|
||||
|
||||
/* This function is called immediately before edge E is removed from
|
||||
the edge vector E->dest->preds. */
|
||||
void (*execute_on_shrinking_pred) (edge);
|
||||
|
||||
/* A hook for duplicating loop in CFG, currently this is used
|
||||
in loop versioning. */
|
||||
bool (*cfg_hook_duplicate_loop_body_to_header_edge) (class loop *, edge,
|
||||
unsigned, sbitmap, edge,
|
||||
vec<edge> *, int);
|
||||
|
||||
/* Add condition to new basic block and update CFG used in loop
|
||||
versioning. */
|
||||
void (*lv_add_condition_to_bb) (basic_block, basic_block, basic_block,
|
||||
void *);
|
||||
/* Update the PHI nodes in case of loop versioning. */
|
||||
void (*lv_adjust_loop_header_phi) (basic_block, basic_block,
|
||||
basic_block, edge);
|
||||
|
||||
/* Given a condition BB extract the true/false taken/not taken edges
|
||||
(depending if we are on tree's or RTL). */
|
||||
void (*extract_cond_bb_edges) (basic_block, edge *, edge *);
|
||||
|
||||
|
||||
/* Add PHI arguments queued in PENDINT_STMT list on edge E to edge
|
||||
E->dest (only in tree-ssa loop versioning. */
|
||||
void (*flush_pending_stmts) (edge);
|
||||
|
||||
/* True if a block contains no executable instructions. */
|
||||
bool (*empty_block_p) (basic_block);
|
||||
|
||||
/* Split a basic block if it ends with a conditional branch and if
|
||||
the other part of the block is not empty. */
|
||||
basic_block (*split_block_before_cond_jump) (basic_block);
|
||||
|
||||
/* Do book-keeping of a basic block for the profile consistency checker. */
|
||||
void (*account_profile_record) (basic_block, struct profile_record *);
|
||||
};
|
||||
|
||||
extern void verify_flow_info (void);
|
||||
|
||||
/* Check control flow invariants, if internal consistency checks are
|
||||
enabled. */
|
||||
|
||||
inline void
|
||||
checking_verify_flow_info (void)
|
||||
{
|
||||
/* TODO: Add a separate option for -fchecking=cfg. */
|
||||
if (flag_checking)
|
||||
verify_flow_info ();
|
||||
}
|
||||
|
||||
extern void dump_bb (FILE *, basic_block, int, dump_flags_t);
|
||||
extern void dump_bb_for_graph (pretty_printer *, basic_block);
|
||||
extern void dump_flow_info (FILE *, dump_flags_t);
|
||||
|
||||
extern edge redirect_edge_and_branch (edge, basic_block);
|
||||
extern basic_block redirect_edge_and_branch_force (edge, basic_block);
|
||||
extern edge redirect_edge_succ_nodup (edge, basic_block);
|
||||
extern bool can_remove_branch_p (const_edge);
|
||||
extern void remove_branch (edge);
|
||||
extern void remove_edge (edge);
|
||||
extern edge split_block (basic_block, rtx);
|
||||
extern edge split_block (basic_block, gimple *);
|
||||
extern edge split_block_after_labels (basic_block);
|
||||
extern bool move_block_after (basic_block, basic_block);
|
||||
extern void delete_basic_block (basic_block);
|
||||
extern basic_block split_edge (edge);
|
||||
extern basic_block create_basic_block (rtx, rtx, basic_block);
|
||||
extern basic_block create_basic_block (gimple_seq, basic_block);
|
||||
extern basic_block create_empty_bb (basic_block);
|
||||
extern bool can_merge_blocks_p (basic_block, basic_block);
|
||||
extern void merge_blocks (basic_block, basic_block);
|
||||
extern edge make_forwarder_block (basic_block, bool (*)(edge),
|
||||
void (*) (basic_block));
|
||||
extern basic_block force_nonfallthru (edge);
|
||||
extern void tidy_fallthru_edge (edge);
|
||||
extern void tidy_fallthru_edges (void);
|
||||
extern void predict_edge (edge e, enum br_predictor predictor, int probability);
|
||||
extern bool predicted_by_p (const_basic_block bb, enum br_predictor predictor);
|
||||
extern bool can_duplicate_block_p (const_basic_block);
|
||||
extern basic_block duplicate_block (basic_block, edge, basic_block,
|
||||
copy_bb_data * = NULL);
|
||||
extern bool block_ends_with_call_p (basic_block bb);
|
||||
extern bool empty_block_p (basic_block);
|
||||
extern basic_block split_block_before_cond_jump (basic_block);
|
||||
extern bool block_ends_with_condjump_p (const_basic_block bb);
|
||||
extern int flow_call_edges_add (sbitmap);
|
||||
extern void execute_on_growing_pred (edge);
|
||||
extern void execute_on_shrinking_pred (edge);
|
||||
extern bool
|
||||
cfg_hook_duplicate_loop_body_to_header_edge (class loop *loop, edge,
|
||||
unsigned int ndupl,
|
||||
sbitmap wont_exit, edge orig,
|
||||
vec<edge> *to_remove, int flags);
|
||||
|
||||
extern void lv_flush_pending_stmts (edge);
|
||||
extern void extract_cond_bb_edges (basic_block, edge *, edge*);
|
||||
extern void lv_adjust_loop_header_phi (basic_block, basic_block, basic_block,
|
||||
edge);
|
||||
extern void lv_add_condition_to_bb (basic_block, basic_block, basic_block,
|
||||
void *);
|
||||
|
||||
extern bool can_copy_bbs_p (basic_block *, unsigned);
|
||||
extern void copy_bbs (basic_block *, unsigned, basic_block *,
|
||||
edge *, unsigned, edge *, class loop *,
|
||||
basic_block, bool);
|
||||
|
||||
void profile_record_check_consistency (profile_record *);
|
||||
void profile_record_account_profile (profile_record *);
|
||||
|
||||
/* Hooks containers. */
|
||||
extern struct cfg_hooks gimple_cfg_hooks;
|
||||
extern struct cfg_hooks rtl_cfg_hooks;
|
||||
extern struct cfg_hooks cfg_layout_rtl_cfg_hooks;
|
||||
|
||||
/* Declarations. */
|
||||
extern enum ir_type current_ir_type (void);
|
||||
extern void rtl_register_cfg_hooks (void);
|
||||
extern void cfg_layout_rtl_register_cfg_hooks (void);
|
||||
extern void gimple_register_cfg_hooks (void);
|
||||
extern struct cfg_hooks get_cfg_hooks (void);
|
||||
extern void set_cfg_hooks (struct cfg_hooks);
|
||||
|
||||
#endif /* GCC_CFGHOOKS_H */
|
||||
@@ -0,0 +1,936 @@
|
||||
/* Natural loop functions
|
||||
Copyright (C) 1987-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GCC; see the file COPYING3. If not see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef GCC_CFGLOOP_H
|
||||
#define GCC_CFGLOOP_H
|
||||
|
||||
#include "cfgloopmanip.h"
|
||||
|
||||
/* Structure to hold decision about unrolling/peeling. */
|
||||
enum lpt_dec
|
||||
{
|
||||
LPT_NONE,
|
||||
LPT_UNROLL_CONSTANT,
|
||||
LPT_UNROLL_RUNTIME,
|
||||
LPT_UNROLL_STUPID
|
||||
};
|
||||
|
||||
struct GTY (()) lpt_decision {
|
||||
enum lpt_dec decision;
|
||||
unsigned times;
|
||||
};
|
||||
|
||||
/* The type of extend applied to an IV. */
|
||||
enum iv_extend_code
|
||||
{
|
||||
IV_SIGN_EXTEND,
|
||||
IV_ZERO_EXTEND,
|
||||
IV_UNKNOWN_EXTEND
|
||||
};
|
||||
|
||||
/* The structure describing a bound on number of iterations of a loop. */
|
||||
|
||||
class GTY ((chain_next ("%h.next"))) nb_iter_bound {
|
||||
public:
|
||||
/* The statement STMT is executed at most ... */
|
||||
gimple *stmt;
|
||||
|
||||
/* ... BOUND + 1 times (BOUND must be an unsigned constant).
|
||||
The + 1 is added for the following reasons:
|
||||
|
||||
a) 0 would otherwise be unused, while we would need to care more about
|
||||
overflows (as MAX + 1 is sometimes produced as the estimate on number
|
||||
of executions of STMT).
|
||||
b) it is consistent with the result of number_of_iterations_exit. */
|
||||
widest_int bound;
|
||||
|
||||
/* True if, after executing the statement BOUND + 1 times, we will
|
||||
leave the loop; that is, all the statements after it are executed at most
|
||||
BOUND times. */
|
||||
bool is_exit;
|
||||
|
||||
/* The next bound in the list. */
|
||||
class nb_iter_bound *next;
|
||||
};
|
||||
|
||||
/* Description of the loop exit. */
|
||||
|
||||
struct GTY ((for_user)) loop_exit {
|
||||
/* The exit edge. */
|
||||
edge e;
|
||||
|
||||
/* Previous and next exit in the list of the exits of the loop. */
|
||||
struct loop_exit *prev;
|
||||
struct loop_exit *next;
|
||||
|
||||
/* Next element in the list of loops from that E exits. */
|
||||
struct loop_exit *next_e;
|
||||
};
|
||||
|
||||
struct loop_exit_hasher : ggc_ptr_hash<loop_exit>
|
||||
{
|
||||
typedef edge compare_type;
|
||||
|
||||
static hashval_t hash (loop_exit *);
|
||||
static bool equal (loop_exit *, edge);
|
||||
static void remove (loop_exit *);
|
||||
};
|
||||
|
||||
typedef class loop *loop_p;
|
||||
|
||||
/* An integer estimation of the number of iterations. Estimate_state
|
||||
describes what is the state of the estimation. */
|
||||
enum loop_estimation
|
||||
{
|
||||
/* Estimate was not computed yet. */
|
||||
EST_NOT_COMPUTED,
|
||||
/* Estimate is ready. */
|
||||
EST_AVAILABLE,
|
||||
EST_LAST
|
||||
};
|
||||
|
||||
/* The structure describing non-overflow control induction variable for
|
||||
loop's exit edge. */
|
||||
struct GTY ((chain_next ("%h.next"))) control_iv {
|
||||
tree base;
|
||||
tree step;
|
||||
struct control_iv *next;
|
||||
};
|
||||
|
||||
/* Structure to hold information for each natural loop. */
|
||||
class GTY ((chain_next ("%h.next"))) loop {
|
||||
public:
|
||||
/* Index into loops array. Note indices will never be reused after loop
|
||||
is destroyed. */
|
||||
int num;
|
||||
|
||||
/* Number of loop insns. */
|
||||
unsigned ninsns;
|
||||
|
||||
/* Basic block of loop header. */
|
||||
basic_block header;
|
||||
|
||||
/* Basic block of loop latch. */
|
||||
basic_block latch;
|
||||
|
||||
/* For loop unrolling/peeling decision. */
|
||||
struct lpt_decision lpt_decision;
|
||||
|
||||
/* Average number of executed insns per iteration. */
|
||||
unsigned av_ninsns;
|
||||
|
||||
/* Number of blocks contained within the loop. */
|
||||
unsigned num_nodes;
|
||||
|
||||
/* Superloops of the loop, starting with the outermost loop. */
|
||||
vec<loop_p, va_gc> *superloops;
|
||||
|
||||
/* The first inner (child) loop or NULL if innermost loop. */
|
||||
class loop *inner;
|
||||
|
||||
/* Link to the next (sibling) loop. */
|
||||
class loop *next;
|
||||
|
||||
/* Auxiliary info specific to a pass. */
|
||||
void *GTY ((skip (""))) aux;
|
||||
|
||||
/* The number of times the latch of the loop is executed. This can be an
|
||||
INTEGER_CST, or a symbolic expression representing the number of
|
||||
iterations like "N - 1", or a COND_EXPR containing the runtime
|
||||
conditions under which the number of iterations is non zero.
|
||||
|
||||
Don't access this field directly: number_of_latch_executions
|
||||
computes and caches the computed information in this field. */
|
||||
tree nb_iterations;
|
||||
|
||||
/* An integer guaranteed to be greater or equal to nb_iterations. Only
|
||||
valid if any_upper_bound is true. */
|
||||
widest_int nb_iterations_upper_bound;
|
||||
|
||||
widest_int nb_iterations_likely_upper_bound;
|
||||
|
||||
/* An integer giving an estimate on nb_iterations. Unlike
|
||||
nb_iterations_upper_bound, there is no guarantee that it is at least
|
||||
nb_iterations. */
|
||||
widest_int nb_iterations_estimate;
|
||||
|
||||
/* If > 0, an integer, where the user asserted that for any
|
||||
I in [ 0, nb_iterations ) and for any J in
|
||||
[ I, min ( I + safelen, nb_iterations ) ), the Ith and Jth iterations
|
||||
of the loop can be safely evaluated concurrently. */
|
||||
int safelen;
|
||||
|
||||
/* Preferred vectorization factor for the loop if non-zero. */
|
||||
int simdlen;
|
||||
|
||||
/* Constraints are generally set by consumers and affect certain
|
||||
semantics of niter analyzer APIs. Currently the APIs affected are
|
||||
number_of_iterations_exit* functions and their callers. One typical
|
||||
use case of constraints is to vectorize possibly infinite loop:
|
||||
|
||||
1) Compute niter->assumptions by calling niter analyzer API and
|
||||
record it as possible condition for loop versioning.
|
||||
2) Clear buffered result of niter/scev analyzer.
|
||||
3) Set constraint LOOP_C_FINITE assuming the loop is finite.
|
||||
4) Analyze data references. Since data reference analysis depends
|
||||
on niter/scev analyzer, the point is that niter/scev analysis
|
||||
is done under circumstance of LOOP_C_FINITE constraint.
|
||||
5) Version the loop with niter->assumptions computed in step 1).
|
||||
6) Vectorize the versioned loop in which niter->assumptions is
|
||||
checked to be true.
|
||||
7) Update constraints in versioned loops so that niter analyzer
|
||||
in following passes can use it.
|
||||
|
||||
Note consumers are usually the loop optimizers and it is consumers'
|
||||
responsibility to set/clear constraints correctly. Failing to do
|
||||
that might result in hard to track down bugs in niter/scev consumers. */
|
||||
unsigned constraints;
|
||||
|
||||
/* An integer estimation of the number of iterations. Estimate_state
|
||||
describes what is the state of the estimation. */
|
||||
ENUM_BITFIELD(loop_estimation) estimate_state : 8;
|
||||
|
||||
unsigned any_upper_bound : 1;
|
||||
unsigned any_estimate : 1;
|
||||
unsigned any_likely_upper_bound : 1;
|
||||
|
||||
/* True if the loop can be parallel. */
|
||||
unsigned can_be_parallel : 1;
|
||||
|
||||
/* True if -Waggressive-loop-optimizations warned about this loop
|
||||
already. */
|
||||
unsigned warned_aggressive_loop_optimizations : 1;
|
||||
|
||||
/* True if this loop should never be vectorized. */
|
||||
unsigned dont_vectorize : 1;
|
||||
|
||||
/* True if we should try harder to vectorize this loop. */
|
||||
unsigned force_vectorize : 1;
|
||||
|
||||
/* True if the loop is part of an oacc kernels region. */
|
||||
unsigned in_oacc_kernels_region : 1;
|
||||
|
||||
/* True if the loop is known to be finite. This is a localized
|
||||
flag_finite_loops or similar pragmas state. */
|
||||
unsigned finite_p : 1;
|
||||
|
||||
/* The number of times to unroll the loop. 0 means no information given,
|
||||
just do what we always do. A value of 1 means do not unroll the loop.
|
||||
A value of USHRT_MAX means unroll with no specific unrolling factor.
|
||||
Other values means unroll with the given unrolling factor. */
|
||||
unsigned short unroll;
|
||||
|
||||
/* If this loop was inlined the main clique of the callee which does
|
||||
not need remapping when copying the loop body. */
|
||||
unsigned short owned_clique;
|
||||
|
||||
/* For SIMD loops, this is a unique identifier of the loop, referenced
|
||||
by IFN_GOMP_SIMD_VF, IFN_GOMP_SIMD_LANE and IFN_GOMP_SIMD_LAST_LANE
|
||||
builtins. */
|
||||
tree simduid;
|
||||
|
||||
/* In loop optimization, it's common to generate loops from the original
|
||||
loop. This field records the index of the original loop which can be
|
||||
used to track the original loop from newly generated loops. This can
|
||||
be done by calling function get_loop (cfun, orig_loop_num). Note the
|
||||
original loop could be destroyed for various reasons thus no longer
|
||||
exists, as a result, function call to get_loop returns NULL pointer.
|
||||
In this case, this field should not be used and needs to be cleared
|
||||
whenever possible. */
|
||||
int orig_loop_num;
|
||||
|
||||
/* Upper bound on number of iterations of a loop. */
|
||||
class nb_iter_bound *bounds;
|
||||
|
||||
/* Non-overflow control ivs of a loop. */
|
||||
struct control_iv *control_ivs;
|
||||
|
||||
/* Head of the cyclic list of the exits of the loop. */
|
||||
struct loop_exit *exits;
|
||||
|
||||
/* Number of iteration analysis data for RTL. */
|
||||
class niter_desc *simple_loop_desc;
|
||||
|
||||
/* For sanity checking during loop fixup we record here the former
|
||||
loop header for loops marked for removal. Note that this prevents
|
||||
the basic-block from being collected but its index can still be
|
||||
reused. */
|
||||
basic_block former_header;
|
||||
};
|
||||
|
||||
/* Set if the loop is known to be infinite. */
|
||||
#define LOOP_C_INFINITE (1 << 0)
|
||||
/* Set if the loop is known to be finite without any assumptions. */
|
||||
#define LOOP_C_FINITE (1 << 1)
|
||||
|
||||
/* Set C to the LOOP constraint. */
|
||||
inline void
|
||||
loop_constraint_set (class loop *loop, unsigned c)
|
||||
{
|
||||
loop->constraints |= c;
|
||||
}
|
||||
|
||||
/* Clear C from the LOOP constraint. */
|
||||
inline void
|
||||
loop_constraint_clear (class loop *loop, unsigned c)
|
||||
{
|
||||
loop->constraints &= ~c;
|
||||
}
|
||||
|
||||
/* Check if C is set in the LOOP constraint. */
|
||||
inline bool
|
||||
loop_constraint_set_p (class loop *loop, unsigned c)
|
||||
{
|
||||
return (loop->constraints & c) == c;
|
||||
}
|
||||
|
||||
/* Flags for state of loop structure. */
|
||||
enum
|
||||
{
|
||||
LOOPS_HAVE_PREHEADERS = 1,
|
||||
LOOPS_HAVE_SIMPLE_LATCHES = 2,
|
||||
LOOPS_HAVE_MARKED_IRREDUCIBLE_REGIONS = 4,
|
||||
LOOPS_HAVE_RECORDED_EXITS = 8,
|
||||
LOOPS_MAY_HAVE_MULTIPLE_LATCHES = 16,
|
||||
LOOP_CLOSED_SSA = 32,
|
||||
LOOPS_NEED_FIXUP = 64,
|
||||
LOOPS_HAVE_FALLTHRU_PREHEADERS = 128
|
||||
};
|
||||
|
||||
#define LOOPS_NORMAL (LOOPS_HAVE_PREHEADERS | LOOPS_HAVE_SIMPLE_LATCHES \
|
||||
| LOOPS_HAVE_MARKED_IRREDUCIBLE_REGIONS)
|
||||
#define AVOID_CFG_MODIFICATIONS (LOOPS_MAY_HAVE_MULTIPLE_LATCHES)
|
||||
|
||||
/* Structure to hold CFG information about natural loops within a function. */
|
||||
struct GTY (()) loops {
|
||||
/* State of loops. */
|
||||
int state;
|
||||
|
||||
/* Array of the loops. */
|
||||
vec<loop_p, va_gc> *larray;
|
||||
|
||||
/* Maps edges to the list of their descriptions as loop exits. Edges
|
||||
whose sources or destinations have loop_father == NULL (which may
|
||||
happen during the cfg manipulations) should not appear in EXITS. */
|
||||
hash_table<loop_exit_hasher> *GTY(()) exits;
|
||||
|
||||
/* Pointer to root of loop hierarchy tree. */
|
||||
class loop *tree_root;
|
||||
};
|
||||
|
||||
/* Loop recognition. */
|
||||
bool bb_loop_header_p (basic_block);
|
||||
void init_loops_structure (struct function *, struct loops *, unsigned);
|
||||
extern struct loops *flow_loops_find (struct loops *);
|
||||
extern void disambiguate_loops_with_multiple_latches (void);
|
||||
extern void flow_loops_free (struct loops *);
|
||||
extern void flow_loops_dump (FILE *,
|
||||
void (*)(const class loop *, FILE *, int), int);
|
||||
extern void flow_loop_dump (const class loop *, FILE *,
|
||||
void (*)(const class loop *, FILE *, int), int);
|
||||
class loop *alloc_loop (void);
|
||||
extern void flow_loop_free (class loop *);
|
||||
int flow_loop_nodes_find (basic_block, class loop *);
|
||||
unsigned fix_loop_structure (bitmap changed_bbs);
|
||||
bool mark_irreducible_loops (void);
|
||||
void release_recorded_exits (function *);
|
||||
void record_loop_exits (void);
|
||||
void rescan_loop_exit (edge, bool, bool);
|
||||
void sort_sibling_loops (function *);
|
||||
|
||||
/* Loop data structure manipulation/querying. */
|
||||
extern void flow_loop_tree_node_add (class loop *, class loop *,
|
||||
class loop * = NULL);
|
||||
extern void flow_loop_tree_node_remove (class loop *);
|
||||
extern bool flow_loop_nested_p (const class loop *, const class loop *);
|
||||
extern bool flow_bb_inside_loop_p (const class loop *, const_basic_block);
|
||||
extern class loop * find_common_loop (class loop *, class loop *);
|
||||
class loop *superloop_at_depth (class loop *, unsigned);
|
||||
struct eni_weights;
|
||||
extern int num_loop_insns (const class loop *);
|
||||
extern int average_num_loop_insns (const class loop *);
|
||||
extern unsigned get_loop_level (const class loop *);
|
||||
extern bool loop_exit_edge_p (const class loop *, const_edge);
|
||||
extern bool loop_exits_to_bb_p (class loop *, basic_block);
|
||||
extern bool loop_exits_from_bb_p (class loop *, basic_block);
|
||||
extern void mark_loop_exit_edges (void);
|
||||
extern dump_user_location_t get_loop_location (class loop *loop);
|
||||
|
||||
/* Loops & cfg manipulation. */
|
||||
extern basic_block *get_loop_body (const class loop *);
|
||||
extern unsigned get_loop_body_with_size (const class loop *, basic_block *,
|
||||
unsigned);
|
||||
extern basic_block *get_loop_body_in_dom_order (const class loop *);
|
||||
extern basic_block *get_loop_body_in_bfs_order (const class loop *);
|
||||
extern basic_block *get_loop_body_in_custom_order (const class loop *,
|
||||
int (*) (const void *, const void *));
|
||||
extern basic_block *get_loop_body_in_custom_order (const class loop *, void *,
|
||||
int (*) (const void *, const void *, void *));
|
||||
|
||||
extern auto_vec<edge> get_loop_exit_edges (const class loop *, basic_block * = NULL);
|
||||
extern edge single_exit (const class loop *);
|
||||
extern edge single_likely_exit (class loop *loop, const vec<edge> &);
|
||||
extern unsigned num_loop_branches (const class loop *);
|
||||
|
||||
extern edge loop_preheader_edge (const class loop *);
|
||||
extern edge loop_latch_edge (const class loop *);
|
||||
|
||||
extern void add_bb_to_loop (basic_block, class loop *);
|
||||
extern void remove_bb_from_loops (basic_block);
|
||||
|
||||
extern void cancel_loop_tree (class loop *);
|
||||
extern void delete_loop (class loop *);
|
||||
|
||||
|
||||
extern void verify_loop_structure (void);
|
||||
|
||||
/* Loop analysis. */
|
||||
extern bool just_once_each_iteration_p (const class loop *, const_basic_block);
|
||||
gcov_type expected_loop_iterations_unbounded (const class loop *,
|
||||
bool *read_profile_p = NULL, bool by_profile_only = false);
|
||||
extern unsigned expected_loop_iterations (class loop *);
|
||||
extern rtx doloop_condition_get (rtx_insn *);
|
||||
|
||||
void mark_loop_for_removal (loop_p);
|
||||
|
||||
/* Induction variable analysis. */
|
||||
|
||||
/* The description of induction variable. The things are a bit complicated
|
||||
due to need to handle subregs and extends. The value of the object described
|
||||
by it can be obtained as follows (all computations are done in extend_mode):
|
||||
|
||||
Value in i-th iteration is
|
||||
delta + mult * extend_{extend_mode} (subreg_{mode} (base + i * step)).
|
||||
|
||||
If first_special is true, the value in the first iteration is
|
||||
delta + mult * base
|
||||
|
||||
If extend = UNKNOWN, first_special must be false, delta 0, mult 1 and value is
|
||||
subreg_{mode} (base + i * step)
|
||||
|
||||
The get_iv_value function can be used to obtain these expressions.
|
||||
|
||||
??? Add a third mode field that would specify the mode in that inner
|
||||
computation is done, which would enable it to be different from the
|
||||
outer one? */
|
||||
|
||||
class rtx_iv
|
||||
{
|
||||
public:
|
||||
/* Its base and step (mode of base and step is supposed to be extend_mode,
|
||||
see the description above). */
|
||||
rtx base, step;
|
||||
|
||||
/* The type of extend applied to it (IV_SIGN_EXTEND, IV_ZERO_EXTEND,
|
||||
or IV_UNKNOWN_EXTEND). */
|
||||
enum iv_extend_code extend;
|
||||
|
||||
/* Operations applied in the extended mode. */
|
||||
rtx delta, mult;
|
||||
|
||||
/* The mode it is extended to. */
|
||||
scalar_int_mode extend_mode;
|
||||
|
||||
/* The mode the variable iterates in. */
|
||||
scalar_int_mode mode;
|
||||
|
||||
/* Whether the first iteration needs to be handled specially. */
|
||||
unsigned first_special : 1;
|
||||
};
|
||||
|
||||
/* The description of an exit from the loop and of the number of iterations
|
||||
till we take the exit. */
|
||||
|
||||
class GTY(()) niter_desc
|
||||
{
|
||||
public:
|
||||
/* The edge out of the loop. */
|
||||
edge out_edge;
|
||||
|
||||
/* The other edge leading from the condition. */
|
||||
edge in_edge;
|
||||
|
||||
/* True if we are able to say anything about number of iterations of the
|
||||
loop. */
|
||||
bool simple_p;
|
||||
|
||||
/* True if the loop iterates the constant number of times. */
|
||||
bool const_iter;
|
||||
|
||||
/* Number of iterations if constant. */
|
||||
uint64_t niter;
|
||||
|
||||
/* Assumptions under that the rest of the information is valid. */
|
||||
rtx assumptions;
|
||||
|
||||
/* Assumptions under that the loop ends before reaching the latch,
|
||||
even if value of niter_expr says otherwise. */
|
||||
rtx noloop_assumptions;
|
||||
|
||||
/* Condition under that the loop is infinite. */
|
||||
rtx infinite;
|
||||
|
||||
/* Whether the comparison is signed. */
|
||||
bool signed_p;
|
||||
|
||||
/* The mode in that niter_expr should be computed. */
|
||||
scalar_int_mode mode;
|
||||
|
||||
/* The number of iterations of the loop. */
|
||||
rtx niter_expr;
|
||||
};
|
||||
|
||||
extern void iv_analysis_loop_init (class loop *);
|
||||
extern bool iv_analyze (rtx_insn *, scalar_int_mode, rtx, class rtx_iv *);
|
||||
extern bool iv_analyze_result (rtx_insn *, rtx, class rtx_iv *);
|
||||
extern bool iv_analyze_expr (rtx_insn *, scalar_int_mode, rtx,
|
||||
class rtx_iv *);
|
||||
extern rtx get_iv_value (class rtx_iv *, rtx);
|
||||
extern bool biv_p (rtx_insn *, scalar_int_mode, rtx);
|
||||
extern void iv_analysis_done (void);
|
||||
|
||||
extern class niter_desc *get_simple_loop_desc (class loop *loop);
|
||||
extern void free_simple_loop_desc (class loop *loop);
|
||||
|
||||
inline class niter_desc *
|
||||
simple_loop_desc (class loop *loop)
|
||||
{
|
||||
return loop->simple_loop_desc;
|
||||
}
|
||||
|
||||
/* Accessors for the loop structures. */
|
||||
|
||||
/* Returns the loop with index NUM from FNs loop tree. */
|
||||
|
||||
inline class loop *
|
||||
get_loop (struct function *fn, unsigned num)
|
||||
{
|
||||
return (*loops_for_fn (fn)->larray)[num];
|
||||
}
|
||||
|
||||
/* Returns the number of superloops of LOOP. */
|
||||
|
||||
inline unsigned
|
||||
loop_depth (const class loop *loop)
|
||||
{
|
||||
return vec_safe_length (loop->superloops);
|
||||
}
|
||||
|
||||
/* Returns the immediate superloop of LOOP, or NULL if LOOP is the outermost
|
||||
loop. */
|
||||
|
||||
inline class loop *
|
||||
loop_outer (const class loop *loop)
|
||||
{
|
||||
unsigned n = vec_safe_length (loop->superloops);
|
||||
|
||||
if (n == 0)
|
||||
return NULL;
|
||||
|
||||
return (*loop->superloops)[n - 1];
|
||||
}
|
||||
|
||||
/* Returns true if LOOP has at least one exit edge. */
|
||||
|
||||
inline bool
|
||||
loop_has_exit_edges (const class loop *loop)
|
||||
{
|
||||
return loop->exits->next->e != NULL;
|
||||
}
|
||||
|
||||
/* Returns the list of loops in FN. */
|
||||
|
||||
inline vec<loop_p, va_gc> *
|
||||
get_loops (struct function *fn)
|
||||
{
|
||||
struct loops *loops = loops_for_fn (fn);
|
||||
if (!loops)
|
||||
return NULL;
|
||||
|
||||
return loops->larray;
|
||||
}
|
||||
|
||||
/* Returns the number of loops in FN (including the removed
|
||||
ones and the fake loop that forms the root of the loop tree). */
|
||||
|
||||
inline unsigned
|
||||
number_of_loops (struct function *fn)
|
||||
{
|
||||
struct loops *loops = loops_for_fn (fn);
|
||||
if (!loops)
|
||||
return 0;
|
||||
|
||||
return vec_safe_length (loops->larray);
|
||||
}
|
||||
|
||||
/* Returns true if state of the loops satisfies all properties
|
||||
described by FLAGS. */
|
||||
|
||||
inline bool
|
||||
loops_state_satisfies_p (function *fn, unsigned flags)
|
||||
{
|
||||
return (loops_for_fn (fn)->state & flags) == flags;
|
||||
}
|
||||
|
||||
inline bool
|
||||
loops_state_satisfies_p (unsigned flags)
|
||||
{
|
||||
return loops_state_satisfies_p (cfun, flags);
|
||||
}
|
||||
|
||||
/* Sets FLAGS to the loops state. */
|
||||
|
||||
inline void
|
||||
loops_state_set (function *fn, unsigned flags)
|
||||
{
|
||||
loops_for_fn (fn)->state |= flags;
|
||||
}
|
||||
|
||||
inline void
|
||||
loops_state_set (unsigned flags)
|
||||
{
|
||||
loops_state_set (cfun, flags);
|
||||
}
|
||||
|
||||
/* Clears FLAGS from the loops state. */
|
||||
|
||||
inline void
|
||||
loops_state_clear (function *fn, unsigned flags)
|
||||
{
|
||||
loops_for_fn (fn)->state &= ~flags;
|
||||
}
|
||||
|
||||
inline void
|
||||
loops_state_clear (unsigned flags)
|
||||
{
|
||||
if (!current_loops)
|
||||
return;
|
||||
loops_state_clear (cfun, flags);
|
||||
}
|
||||
|
||||
/* Check loop structure invariants, if internal consistency checks are
|
||||
enabled. */
|
||||
|
||||
inline void
|
||||
checking_verify_loop_structure (void)
|
||||
{
|
||||
/* VERIFY_LOOP_STRUCTURE essentially asserts that no loops need fixups.
|
||||
|
||||
The loop optimizers should never make changes to the CFG which
|
||||
require loop fixups. But the low level CFG manipulation code may
|
||||
set the flag conservatively.
|
||||
|
||||
Go ahead and clear the flag here. That avoids the assert inside
|
||||
VERIFY_LOOP_STRUCTURE, and if there is an inconsistency in the loop
|
||||
structures VERIFY_LOOP_STRUCTURE will detect it.
|
||||
|
||||
This also avoid the compile time cost of excessive fixups. */
|
||||
loops_state_clear (LOOPS_NEED_FIXUP);
|
||||
if (flag_checking)
|
||||
verify_loop_structure ();
|
||||
}
|
||||
|
||||
/* Loop iterators. */
|
||||
|
||||
/* Flags for loop iteration. */
|
||||
|
||||
enum li_flags
|
||||
{
|
||||
LI_INCLUDE_ROOT = 1, /* Include the fake root of the loop tree. */
|
||||
LI_FROM_INNERMOST = 2, /* Iterate over the loops in the reverse order,
|
||||
starting from innermost ones. */
|
||||
LI_ONLY_INNERMOST = 4 /* Iterate only over innermost loops. */
|
||||
};
|
||||
|
||||
/* Provide the functionality of std::as_const to support range-based for
|
||||
to use const iterator. (We can't use std::as_const itself because it's
|
||||
a C++17 feature.) */
|
||||
template <typename T>
|
||||
constexpr const T &
|
||||
as_const (T &t)
|
||||
{
|
||||
return t;
|
||||
}
|
||||
|
||||
/* A list for visiting loops, which contains the loop numbers instead of
|
||||
the loop pointers. If the loop ROOT is offered (non-null), the visiting
|
||||
will start from it, otherwise it would start from the tree_root of
|
||||
loops_for_fn (FN) instead. The scope is restricted in function FN and
|
||||
the visiting order is specified by FLAGS. */
|
||||
|
||||
class loops_list
|
||||
{
|
||||
public:
|
||||
loops_list (function *fn, unsigned flags, class loop *root = nullptr);
|
||||
|
||||
template <typename T> class Iter
|
||||
{
|
||||
public:
|
||||
Iter (const loops_list &l, unsigned idx) : list (l), curr_idx (idx)
|
||||
{
|
||||
fill_curr_loop ();
|
||||
}
|
||||
|
||||
T operator* () const { return curr_loop; }
|
||||
|
||||
Iter &
|
||||
operator++ ()
|
||||
{
|
||||
if (curr_idx < list.to_visit.length ())
|
||||
{
|
||||
/* Bump the index and fill a new one. */
|
||||
curr_idx++;
|
||||
fill_curr_loop ();
|
||||
}
|
||||
else
|
||||
gcc_assert (!curr_loop);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool
|
||||
operator!= (const Iter &rhs) const
|
||||
{
|
||||
return this->curr_idx != rhs.curr_idx;
|
||||
}
|
||||
|
||||
private:
|
||||
/* Fill the current loop starting from the current index. */
|
||||
void fill_curr_loop ();
|
||||
|
||||
/* Reference to the loop list to visit. */
|
||||
const loops_list &list;
|
||||
|
||||
/* The current index in the list to visit. */
|
||||
unsigned curr_idx;
|
||||
|
||||
/* The loop implied by the current index. */
|
||||
class loop *curr_loop;
|
||||
};
|
||||
|
||||
using iterator = Iter<class loop *>;
|
||||
using const_iterator = Iter<const class loop *>;
|
||||
|
||||
iterator
|
||||
begin ()
|
||||
{
|
||||
return iterator (*this, 0);
|
||||
}
|
||||
|
||||
iterator
|
||||
end ()
|
||||
{
|
||||
return iterator (*this, to_visit.length ());
|
||||
}
|
||||
|
||||
const_iterator
|
||||
begin () const
|
||||
{
|
||||
return const_iterator (*this, 0);
|
||||
}
|
||||
|
||||
const_iterator
|
||||
end () const
|
||||
{
|
||||
return const_iterator (*this, to_visit.length ());
|
||||
}
|
||||
|
||||
private:
|
||||
/* Walk loop tree starting from ROOT as the visiting order specified
|
||||
by FLAGS. */
|
||||
void walk_loop_tree (class loop *root, unsigned flags);
|
||||
|
||||
/* The function we are visiting. */
|
||||
function *fn;
|
||||
|
||||
/* The list of loops to visit. */
|
||||
auto_vec<int, 16> to_visit;
|
||||
};
|
||||
|
||||
/* Starting from current index CURR_IDX (inclusive), find one index
|
||||
which stands for one valid loop and fill the found loop as CURR_LOOP,
|
||||
if we can't find one, set CURR_LOOP as null. */
|
||||
|
||||
template <typename T>
|
||||
inline void
|
||||
loops_list::Iter<T>::fill_curr_loop ()
|
||||
{
|
||||
int anum;
|
||||
|
||||
while (this->list.to_visit.iterate (this->curr_idx, &anum))
|
||||
{
|
||||
class loop *loop = get_loop (this->list.fn, anum);
|
||||
if (loop)
|
||||
{
|
||||
curr_loop = loop;
|
||||
return;
|
||||
}
|
||||
this->curr_idx++;
|
||||
}
|
||||
|
||||
curr_loop = nullptr;
|
||||
}
|
||||
|
||||
/* Set up the loops list to visit according to the specified
|
||||
function scope FN and iterating order FLAGS. If ROOT is
|
||||
not null, the visiting would start from it, otherwise it
|
||||
will start from tree_root of loops_for_fn (FN). */
|
||||
|
||||
inline loops_list::loops_list (function *fn, unsigned flags, class loop *root)
|
||||
{
|
||||
struct loops *loops = loops_for_fn (fn);
|
||||
gcc_assert (!root || loops);
|
||||
|
||||
/* Check mutually exclusive flags should not co-exist. */
|
||||
unsigned checked_flags = LI_ONLY_INNERMOST | LI_FROM_INNERMOST;
|
||||
gcc_assert ((flags & checked_flags) != checked_flags);
|
||||
|
||||
this->fn = fn;
|
||||
if (!loops)
|
||||
return;
|
||||
|
||||
class loop *tree_root = root ? root : loops->tree_root;
|
||||
|
||||
this->to_visit.reserve_exact (number_of_loops (fn));
|
||||
|
||||
/* When root is tree_root of loops_for_fn (fn) and the visiting
|
||||
order is LI_ONLY_INNERMOST, we would like to use linear
|
||||
search here since it has a more stable bound than the
|
||||
walk_loop_tree. */
|
||||
if (flags & LI_ONLY_INNERMOST && tree_root == loops->tree_root)
|
||||
{
|
||||
gcc_assert (tree_root->num == 0);
|
||||
if (tree_root->inner == NULL)
|
||||
{
|
||||
if (flags & LI_INCLUDE_ROOT)
|
||||
this->to_visit.quick_push (0);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
class loop *aloop;
|
||||
unsigned int i;
|
||||
for (i = 1; vec_safe_iterate (loops->larray, i, &aloop); i++)
|
||||
if (aloop != NULL && aloop->inner == NULL)
|
||||
this->to_visit.quick_push (aloop->num);
|
||||
}
|
||||
else
|
||||
walk_loop_tree (tree_root, flags);
|
||||
}
|
||||
|
||||
/* The properties of the target. */
|
||||
struct target_cfgloop {
|
||||
/* Number of available registers. */
|
||||
unsigned x_target_avail_regs;
|
||||
|
||||
/* Number of available registers that are call-clobbered. */
|
||||
unsigned x_target_clobbered_regs;
|
||||
|
||||
/* Number of registers reserved for temporary expressions. */
|
||||
unsigned x_target_res_regs;
|
||||
|
||||
/* The cost for register when there still is some reserve, but we are
|
||||
approaching the number of available registers. */
|
||||
unsigned x_target_reg_cost[2];
|
||||
|
||||
/* The cost for register when we need to spill. */
|
||||
unsigned x_target_spill_cost[2];
|
||||
};
|
||||
|
||||
extern struct target_cfgloop default_target_cfgloop;
|
||||
#if SWITCHABLE_TARGET
|
||||
extern struct target_cfgloop *this_target_cfgloop;
|
||||
#else
|
||||
#define this_target_cfgloop (&default_target_cfgloop)
|
||||
#endif
|
||||
|
||||
#define target_avail_regs \
|
||||
(this_target_cfgloop->x_target_avail_regs)
|
||||
#define target_clobbered_regs \
|
||||
(this_target_cfgloop->x_target_clobbered_regs)
|
||||
#define target_res_regs \
|
||||
(this_target_cfgloop->x_target_res_regs)
|
||||
#define target_reg_cost \
|
||||
(this_target_cfgloop->x_target_reg_cost)
|
||||
#define target_spill_cost \
|
||||
(this_target_cfgloop->x_target_spill_cost)
|
||||
|
||||
/* Register pressure estimation for induction variable optimizations & loop
|
||||
invariant motion. */
|
||||
extern unsigned estimate_reg_pressure_cost (unsigned, unsigned, bool, bool);
|
||||
extern void init_set_costs (void);
|
||||
|
||||
/* Loop optimizer initialization. */
|
||||
extern void loop_optimizer_init (unsigned);
|
||||
extern void loop_optimizer_finalize (function *, bool = false);
|
||||
inline void
|
||||
loop_optimizer_finalize ()
|
||||
{
|
||||
loop_optimizer_finalize (cfun);
|
||||
}
|
||||
|
||||
/* Optimization passes. */
|
||||
enum
|
||||
{
|
||||
UAP_UNROLL = 1, /* Enables unrolling of loops if it seems profitable. */
|
||||
UAP_UNROLL_ALL = 2 /* Enables unrolling of all loops. */
|
||||
};
|
||||
|
||||
extern void doloop_optimize_loops (void);
|
||||
extern void move_loop_invariants (void);
|
||||
extern auto_vec<basic_block> get_loop_hot_path (const class loop *loop);
|
||||
|
||||
/* Returns the outermost loop of the loop nest that contains LOOP.*/
|
||||
inline class loop *
|
||||
loop_outermost (class loop *loop)
|
||||
{
|
||||
unsigned n = vec_safe_length (loop->superloops);
|
||||
|
||||
if (n <= 1)
|
||||
return loop;
|
||||
|
||||
return (*loop->superloops)[1];
|
||||
}
|
||||
|
||||
extern void record_niter_bound (class loop *, const widest_int &, bool, bool);
|
||||
extern HOST_WIDE_INT get_estimated_loop_iterations_int (class loop *);
|
||||
extern HOST_WIDE_INT get_max_loop_iterations_int (const class loop *);
|
||||
extern HOST_WIDE_INT get_likely_max_loop_iterations_int (class loop *);
|
||||
extern bool get_estimated_loop_iterations (class loop *loop, widest_int *nit);
|
||||
extern bool get_max_loop_iterations (const class loop *loop, widest_int *nit);
|
||||
extern bool get_likely_max_loop_iterations (class loop *loop, widest_int *nit);
|
||||
extern int bb_loop_depth (const_basic_block);
|
||||
|
||||
/* Converts VAL to widest_int. */
|
||||
|
||||
inline widest_int
|
||||
gcov_type_to_wide_int (gcov_type val)
|
||||
{
|
||||
HOST_WIDE_INT a[2];
|
||||
|
||||
a[0] = (unsigned HOST_WIDE_INT) val;
|
||||
/* If HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_WIDEST_INT, avoid shifting by
|
||||
the size of type. */
|
||||
val >>= HOST_BITS_PER_WIDE_INT - 1;
|
||||
val >>= 1;
|
||||
a[1] = (unsigned HOST_WIDE_INT) val;
|
||||
|
||||
return widest_int::from_array (a, 2);
|
||||
}
|
||||
#endif /* GCC_CFGLOOP_H */
|
||||
@@ -0,0 +1,63 @@
|
||||
/* Loop manipulation header.
|
||||
Copyright (C) 2014-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GCC; see the file COPYING3. If not see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef GCC_CFGLOOPMANIP_H
|
||||
#define GCC_CFGLOOPMANIP_H
|
||||
|
||||
enum
|
||||
{
|
||||
CP_SIMPLE_PREHEADERS = 1,
|
||||
CP_FALLTHRU_PREHEADERS = 2
|
||||
};
|
||||
|
||||
#define DLTHE_FLAG_UPDATE_FREQ 1 /* Update frequencies in
|
||||
duplicate_loop_to_header_edge. */
|
||||
#define DLTHE_RECORD_COPY_NUMBER 2 /* Record copy number in the aux
|
||||
field of newly create BB. */
|
||||
#define DLTHE_FLAG_COMPLETTE_PEEL 4 /* Update frequencies expecting
|
||||
a complete peeling. */
|
||||
extern edge mfb_kj_edge;
|
||||
|
||||
extern bool remove_path (edge, bool * = NULL, bitmap = NULL);
|
||||
extern void place_new_loop (struct function *, class loop *);
|
||||
extern void add_loop (class loop *, class loop *);
|
||||
extern void scale_loop_frequencies (class loop *, profile_probability);
|
||||
extern void scale_loop_profile (class loop *, profile_probability, gcov_type);
|
||||
extern edge create_empty_if_region_on_edge (edge, tree);
|
||||
extern class loop *create_empty_loop_on_edge (edge, tree, tree, tree, tree,
|
||||
tree *, tree *, class loop *);
|
||||
extern void unloop (class loop *, bool *, bitmap);
|
||||
extern void copy_loop_info (class loop *loop, class loop *target);
|
||||
extern class loop * duplicate_loop (class loop *, class loop *,
|
||||
class loop * = NULL);
|
||||
extern void duplicate_subloops (class loop *, class loop *);
|
||||
extern bool can_duplicate_loop_p (const class loop *loop);
|
||||
extern bool
|
||||
duplicate_loop_body_to_header_edge (class loop *, edge, unsigned, sbitmap, edge,
|
||||
vec<edge> *, int);
|
||||
extern bool mfb_keep_just (edge);
|
||||
basic_block create_preheader (class loop *, int);
|
||||
extern void create_preheaders (int);
|
||||
extern void force_single_succ_latches (void);
|
||||
class loop * loop_version (class loop *, void *,
|
||||
basic_block *,
|
||||
profile_probability, profile_probability,
|
||||
profile_probability, profile_probability, bool);
|
||||
|
||||
#endif /* GCC_CFGLOOPMANIP_H */
|
||||
@@ -0,0 +1,62 @@
|
||||
/* Define control flow data structures for the CFG.
|
||||
Copyright (C) 2014-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GCC; see the file COPYING3. If not see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef GCC_CFGRTL_H
|
||||
#define GCC_CFGRTL_H
|
||||
|
||||
extern void delete_insn (rtx_insn *);
|
||||
extern bool delete_insn_and_edges (rtx_insn *);
|
||||
extern void delete_insn_chain (rtx, rtx_insn *, bool);
|
||||
extern basic_block create_basic_block_structure (rtx_insn *, rtx_insn *,
|
||||
rtx_note *, basic_block);
|
||||
extern void compute_bb_for_insn (void);
|
||||
extern unsigned int free_bb_for_insn (void);
|
||||
extern rtx_insn *entry_of_function (void);
|
||||
extern void update_bb_for_insn (basic_block);
|
||||
extern bool contains_no_active_insn_p (const_basic_block);
|
||||
extern bool forwarder_block_p (const_basic_block);
|
||||
extern bool can_fallthru (basic_block, basic_block);
|
||||
extern rtx_note *bb_note (basic_block);
|
||||
extern rtx_code_label *block_label (basic_block);
|
||||
extern edge try_redirect_by_replacing_jump (edge, basic_block, bool);
|
||||
extern void emit_barrier_after_bb (basic_block bb);
|
||||
extern basic_block force_nonfallthru_and_redirect (edge, basic_block, rtx);
|
||||
extern void insert_insn_on_edge (rtx, edge);
|
||||
extern void prepend_insn_to_edge (rtx, edge);
|
||||
extern void commit_one_edge_insertion (edge e);
|
||||
extern void commit_edge_insertions (void);
|
||||
extern void print_rtl_with_bb (FILE *, const rtx_insn *, dump_flags_t);
|
||||
extern void update_br_prob_note (basic_block);
|
||||
extern rtx_insn *get_last_bb_insn (basic_block);
|
||||
extern void fixup_partitions (void);
|
||||
extern bool purge_dead_edges (basic_block);
|
||||
extern bool purge_all_dead_edges (void);
|
||||
extern bool fixup_abnormal_edges (void);
|
||||
extern void update_cfg_for_uncondjump (rtx_insn *);
|
||||
extern rtx_insn *unlink_insn_chain (rtx_insn *, rtx_insn *);
|
||||
extern void relink_block_chain (bool);
|
||||
extern rtx_insn *duplicate_insn_chain (rtx_insn *, rtx_insn *,
|
||||
class loop *, class copy_bb_data *);
|
||||
extern void cfg_layout_initialize (int);
|
||||
extern void cfg_layout_finalize (void);
|
||||
extern void break_superblocks (void);
|
||||
extern void init_rtl_bb_info (basic_block);
|
||||
extern void find_bbs_reachable_by_hot_paths (hash_set <basic_block> *);
|
||||
|
||||
#endif /* GCC_CFGRTL_H */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,144 @@
|
||||
/* This file contains the definitions of the cgraph_inline_failed_t
|
||||
enums used in GCC.
|
||||
|
||||
Copyright (C) 2008-2023 Free Software Foundation, Inc.
|
||||
Contributed by Doug Kwan <dougkwan@google.com>
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GCC see the file COPYING3. If not see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* The format of this file is
|
||||
DEFCIFCODE(code, string).
|
||||
|
||||
Where symbol is the enumeration name without the ``''.
|
||||
The argument STRING is a explain the failure. Except for OK,
|
||||
which is a NULL pointer. */
|
||||
|
||||
/* Inlining successful. This must be the first code. */
|
||||
DEFCIFCODE(OK, CIF_FINAL_NORMAL, NULL)
|
||||
|
||||
/* Inlining failed for an unspecified reason. */
|
||||
DEFCIFCODE(UNSPECIFIED, CIF_FINAL_ERROR, "")
|
||||
|
||||
/* Function has not be considered for inlining. This is the code for
|
||||
functions that have not been rejected for inlining yet. */
|
||||
DEFCIFCODE(FUNCTION_NOT_CONSIDERED, CIF_FINAL_NORMAL,
|
||||
N_("function not considered for inlining"))
|
||||
|
||||
/* Caller is compiled with optimizations disabled. */
|
||||
DEFCIFCODE(FUNCTION_NOT_OPTIMIZED, CIF_FINAL_ERROR,
|
||||
N_("caller is not optimized"))
|
||||
|
||||
/* Inlining failed owing to unavailable function body. */
|
||||
DEFCIFCODE(BODY_NOT_AVAILABLE, CIF_FINAL_ERROR,
|
||||
N_("function body not available"))
|
||||
|
||||
/* Extern inline function that has been redefined. */
|
||||
DEFCIFCODE(REDEFINED_EXTERN_INLINE, CIF_FINAL_ERROR,
|
||||
N_("redefined extern inline functions are not considered for "
|
||||
"inlining"))
|
||||
|
||||
/* Function is not inlinable. */
|
||||
DEFCIFCODE(FUNCTION_NOT_INLINABLE, CIF_FINAL_ERROR,
|
||||
N_("function not inlinable"))
|
||||
|
||||
/* Function is overwritable. */
|
||||
DEFCIFCODE(OVERWRITABLE, CIF_FINAL_ERROR,
|
||||
N_("function body can be overwritten at link time"))
|
||||
|
||||
/* Function is not an inlining candidate. */
|
||||
DEFCIFCODE(FUNCTION_NOT_INLINE_CANDIDATE, CIF_FINAL_NORMAL,
|
||||
N_("function not inline candidate"))
|
||||
|
||||
/* Inlining failed because of various limit parameters. */
|
||||
DEFCIFCODE(LARGE_FUNCTION_GROWTH_LIMIT, CIF_FINAL_NORMAL,
|
||||
N_("--param large-function-growth limit reached"))
|
||||
DEFCIFCODE(LARGE_STACK_FRAME_GROWTH_LIMIT, CIF_FINAL_NORMAL,
|
||||
N_("--param large-stack-frame-growth limit reached"))
|
||||
DEFCIFCODE(MAX_INLINE_INSNS_SINGLE_LIMIT, CIF_FINAL_NORMAL,
|
||||
N_("--param max-inline-insns-single limit reached"))
|
||||
DEFCIFCODE(MAX_INLINE_INSNS_AUTO_LIMIT, CIF_FINAL_NORMAL,
|
||||
N_("--param max-inline-insns-auto limit reached"))
|
||||
DEFCIFCODE(INLINE_UNIT_GROWTH_LIMIT, CIF_FINAL_NORMAL,
|
||||
N_("--param inline-unit-growth limit reached"))
|
||||
|
||||
/* Recursive inlining. */
|
||||
DEFCIFCODE(RECURSIVE_INLINING, CIF_FINAL_NORMAL,
|
||||
N_("recursive inlining"))
|
||||
|
||||
/* Call is unlikely. */
|
||||
DEFCIFCODE(UNLIKELY_CALL, CIF_FINAL_NORMAL,
|
||||
N_("call is unlikely and code size would grow"))
|
||||
|
||||
/* Call is considered never executed. */
|
||||
DEFCIFCODE(NEVER_CALL, CIF_FINAL_NORMAL,
|
||||
N_("call is considered never executed and code size would grow"))
|
||||
|
||||
/* Function is not declared as inline. */
|
||||
DEFCIFCODE(NOT_DECLARED_INLINED, CIF_FINAL_NORMAL,
|
||||
N_("function not declared inline and code size would grow"))
|
||||
|
||||
/* Caller and callee disagree on the arguments. */
|
||||
DEFCIFCODE(LTO_MISMATCHED_DECLARATIONS, CIF_FINAL_ERROR,
|
||||
N_("mismatched declarations during linktime optimization"))
|
||||
|
||||
/* Caller is variadic thunk. */
|
||||
DEFCIFCODE(VARIADIC_THUNK, CIF_FINAL_ERROR,
|
||||
N_("variadic thunk call"))
|
||||
|
||||
/* Call was originally indirect. */
|
||||
DEFCIFCODE(ORIGINALLY_INDIRECT_CALL, CIF_FINAL_NORMAL,
|
||||
N_("originally indirect function call not considered for inlining"))
|
||||
|
||||
/* Ths edge represents an indirect edge with a yet-undetermined callee . */
|
||||
DEFCIFCODE(INDIRECT_UNKNOWN_CALL, CIF_FINAL_NORMAL,
|
||||
N_("indirect function call with a yet undetermined callee"))
|
||||
|
||||
/* We can't inline different EH personalities together. */
|
||||
DEFCIFCODE(EH_PERSONALITY, CIF_FINAL_ERROR,
|
||||
N_("exception handling personality mismatch"))
|
||||
|
||||
/* We can't inline if the callee can throw non-call exceptions but the
|
||||
caller cannot. */
|
||||
DEFCIFCODE(NON_CALL_EXCEPTIONS, CIF_FINAL_ERROR,
|
||||
N_("non-call exception handling mismatch"))
|
||||
|
||||
/* We can't inline because of mismatched target specific options. */
|
||||
DEFCIFCODE(TARGET_OPTION_MISMATCH, CIF_FINAL_ERROR,
|
||||
N_("target specific option mismatch"))
|
||||
|
||||
/* We can't inline because of mismatched optimization levels. */
|
||||
DEFCIFCODE(OPTIMIZATION_MISMATCH, CIF_FINAL_ERROR,
|
||||
N_("optimization level attribute mismatch"))
|
||||
|
||||
/* We can't inline because the callee refers to comdat-local symbols. */
|
||||
DEFCIFCODE(USES_COMDAT_LOCAL, CIF_FINAL_NORMAL,
|
||||
N_("callee refers to comdat-local symbols"))
|
||||
|
||||
/* We can't inline because of mismatched caller/callee
|
||||
sanitizer attributes. */
|
||||
DEFCIFCODE(SANITIZE_ATTRIBUTE_MISMATCH, CIF_FINAL_ERROR,
|
||||
N_("sanitizer function attribute mismatch"))
|
||||
|
||||
/* We can't inline because the user requests only static functions
|
||||
but the function has external linkage for live patching purpose. */
|
||||
DEFCIFCODE(EXTERN_LIVE_ONLY_STATIC, CIF_FINAL_ERROR,
|
||||
N_("function has external linkage when the user requests only"
|
||||
" inlining static for live patching"))
|
||||
|
||||
/* We proved that the call is unreachable. */
|
||||
DEFCIFCODE(UNREACHABLE, CIF_FINAL_ERROR,
|
||||
N_("unreachable"))
|
||||
@@ -0,0 +1,51 @@
|
||||
/* Utility functions used by tools like collect2 and lto-wrapper.
|
||||
Copyright (C) 2009-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GCC; see the file COPYING3. If not see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef GCC_COLLECT_UTILS_H
|
||||
#define GCC_COLLECT_UTILS_H
|
||||
|
||||
/* Provided in collect-utils.cc. */
|
||||
extern void notice (const char *, ...)
|
||||
__attribute__ ((format (printf, 1, 2)));
|
||||
extern void fatal_signal (int);
|
||||
extern void setup_signals (void);
|
||||
|
||||
extern struct pex_obj *collect_execute (const char *, char **,
|
||||
const char *, const char *,
|
||||
int, bool, const char *);
|
||||
extern int collect_wait (const char *, struct pex_obj *);
|
||||
extern void do_wait (const char *, struct pex_obj *);
|
||||
extern void fork_execute (const char *, char **, bool, const char *);
|
||||
extern void utils_cleanup (bool);
|
||||
|
||||
|
||||
extern bool debug;
|
||||
extern bool verbose;
|
||||
extern bool save_temps;
|
||||
extern const char *dumppfx;
|
||||
|
||||
/* Provided by the tool itself. */
|
||||
|
||||
/* The name of the tool, printed in error messages. */
|
||||
extern const char tool_name[];
|
||||
/* Called by utils_cleanup. */
|
||||
extern void tool_cleanup (bool);
|
||||
extern void maybe_unlink (const char *);
|
||||
|
||||
#endif /* GCC_COLLECT_UTILS_H */
|
||||
@@ -0,0 +1,306 @@
|
||||
/* AIX cross support for collect2.
|
||||
Copyright (C) 2009-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GCC; see the file COPYING3. If not see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef GCC_COLLECT2_AIX_H
|
||||
#define GCC_COLLECT2_AIX_H
|
||||
/* collect2-aix.cc requires mmap support. It should otherwise be
|
||||
fairly portable. */
|
||||
#if defined(CROSS_DIRECTORY_STRUCTURE) \
|
||||
&& defined(TARGET_AIX_VERSION) \
|
||||
&& HAVE_MMAP
|
||||
|
||||
#define CROSS_AIX_SUPPORT 1
|
||||
|
||||
/* -------------------------------------------------------------------------
|
||||
Definitions adapted from bfd. (Fairly heavily adapted in some cases.)
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
/* Compatibility types for bfd. */
|
||||
typedef unsigned HOST_WIDE_INT bfd_vma;
|
||||
|
||||
/* The size of an archive's fl_magic field. */
|
||||
#define FL_MAGIC_SIZE 8
|
||||
|
||||
/* The expected contents of fl_magic for big archives. */
|
||||
#define FL_MAGIC_BIG_AR "<bigaf>\012"
|
||||
|
||||
/* The size of each offset string in the header of a big archive. */
|
||||
#define AR_BIG_OFFSET_SIZE 20
|
||||
|
||||
/* The format of the file header in a "big" XCOFF archive. */
|
||||
struct external_big_ar_filehdr
|
||||
{
|
||||
/* Magic string. */
|
||||
char fl_magic[FL_MAGIC_SIZE];
|
||||
|
||||
/* Offset of the member table (decimal ASCII string). */
|
||||
char fl_memoff[AR_BIG_OFFSET_SIZE];
|
||||
|
||||
/* Offset of the global symbol table for 32-bit objects (decimal ASCII
|
||||
string). */
|
||||
char fl_symoff[AR_BIG_OFFSET_SIZE];
|
||||
|
||||
/* Offset of the global symbol table for 64-bit objects (decimal ASCII
|
||||
string). */
|
||||
char fl_symoff64[AR_BIG_OFFSET_SIZE];
|
||||
|
||||
/* Offset of the first member in the archive (decimal ASCII string). */
|
||||
char fl_firstmemoff[AR_BIG_OFFSET_SIZE];
|
||||
|
||||
/* Offset of the last member in the archive (decimal ASCII string). */
|
||||
char fl_lastmemoff[AR_BIG_OFFSET_SIZE];
|
||||
|
||||
/* Offset of the first member on the free list (decimal ASCII
|
||||
string). */
|
||||
char fl_freeoff[AR_BIG_OFFSET_SIZE];
|
||||
};
|
||||
|
||||
/* Each archive name is followed by this many bytes of magic string. */
|
||||
#define SXCOFFARFMAG 2
|
||||
|
||||
/* The format of a member header in a "big" XCOFF archive. */
|
||||
struct external_big_ar_member
|
||||
{
|
||||
/* File size not including the header (decimal ASCII string). */
|
||||
char ar_size[AR_BIG_OFFSET_SIZE];
|
||||
|
||||
/* File offset of next archive member (decimal ASCII string). */
|
||||
char ar_nextoff[AR_BIG_OFFSET_SIZE];
|
||||
|
||||
/* File offset of previous archive member (decimal ASCII string). */
|
||||
char ar_prevoff[AR_BIG_OFFSET_SIZE];
|
||||
|
||||
/* File mtime (decimal ASCII string). */
|
||||
char ar_date[12];
|
||||
|
||||
/* File UID (decimal ASCII string). */
|
||||
char ar_uid[12];
|
||||
|
||||
/* File GID (decimal ASCII string). */
|
||||
char ar_gid[12];
|
||||
|
||||
/* File mode (octal ASCII string). */
|
||||
char ar_mode[12];
|
||||
|
||||
/* Length of file name (decimal ASCII string). */
|
||||
char ar_namlen[4];
|
||||
|
||||
/* This structure is followed by the file name. The length of the
|
||||
name is given in the namlen field. If the length of the name is
|
||||
odd, the name is followed by a null byte. The name and optional
|
||||
null byte are followed by XCOFFARFMAG, which is not included in
|
||||
namlen. The contents of the archive member follow; the number of
|
||||
bytes is given in the size field. */
|
||||
};
|
||||
|
||||
/* The known values of f_magic in an XCOFF file header. */
|
||||
#define U802WRMAGIC 0730 /* Writeable text segments. */
|
||||
#define U802ROMAGIC 0735 /* Readonly sharable text segments. */
|
||||
#define U802TOCMAGIC 0737 /* Readonly text segments and TOC. */
|
||||
#define U803XTOCMAGIC 0757 /* Aix 4.3 64-bit XCOFF. */
|
||||
#define U64_TOCMAGIC 0767 /* AIX 5+ 64-bit XCOFF. */
|
||||
|
||||
/* The number of bytes in an XCOFF file's f_magic field. */
|
||||
#define F_MAGIC_SIZE 2
|
||||
|
||||
/* The format of a 32-bit XCOFF file header. */
|
||||
struct external_filehdr_32
|
||||
{
|
||||
/* The magic number. */
|
||||
char f_magic[F_MAGIC_SIZE];
|
||||
|
||||
/* The number of sections. */
|
||||
char f_nscns[2];
|
||||
|
||||
/* Time & date stamp. */
|
||||
char f_timdat[4];
|
||||
|
||||
/* The offset of the symbol table from the start of the file. */
|
||||
char f_symptr[4];
|
||||
|
||||
/* The number of entries in the symbol table. */
|
||||
char f_nsyms[4];
|
||||
|
||||
/* The size of the auxiliary header. */
|
||||
char f_opthdr[2];
|
||||
|
||||
/* Flags. */
|
||||
char f_flags[2];
|
||||
};
|
||||
|
||||
/* The format of a 64-bit XCOFF file header. */
|
||||
struct external_filehdr_64
|
||||
{
|
||||
/* The magic number. */
|
||||
char f_magic[F_MAGIC_SIZE];
|
||||
|
||||
/* The number of sections. */
|
||||
char f_nscns[2];
|
||||
|
||||
/* Time & date stamp. */
|
||||
char f_timdat[4];
|
||||
|
||||
/* The offset of the symbol table from the start of the file. */
|
||||
char f_symptr[8];
|
||||
|
||||
/* The size of the auxiliary header. */
|
||||
char f_opthdr[2];
|
||||
|
||||
/* Flags. */
|
||||
char f_flags[2];
|
||||
|
||||
/* The number of entries in the symbol table. */
|
||||
char f_nsyms[4];
|
||||
};
|
||||
|
||||
/* An internal representation of the XCOFF file header. */
|
||||
struct internal_filehdr
|
||||
{
|
||||
unsigned short f_magic;
|
||||
unsigned short f_nscns;
|
||||
long f_timdat;
|
||||
bfd_vma f_symptr;
|
||||
long f_nsyms;
|
||||
unsigned short f_opthdr;
|
||||
unsigned short f_flags;
|
||||
};
|
||||
|
||||
/* Symbol classes have their names in the debug section if this flag
|
||||
is set. */
|
||||
#define DBXMASK 0x80
|
||||
|
||||
/* The format of an XCOFF symbol-table entry. */
|
||||
struct external_syment
|
||||
{
|
||||
union {
|
||||
struct {
|
||||
union {
|
||||
/* The name of the symbol. There is an implicit null character
|
||||
after the end of the array. */
|
||||
char n_name[8];
|
||||
struct {
|
||||
/* If n_zeroes is zero, n_offset is the offset the name from
|
||||
the start of the string table. */
|
||||
char n_zeroes[4];
|
||||
char n_offset[4];
|
||||
} u;
|
||||
} u;
|
||||
|
||||
/* The symbol's value. */
|
||||
char n_value[4];
|
||||
} xcoff32;
|
||||
struct {
|
||||
/* The symbol's value. */
|
||||
char n_value[8];
|
||||
|
||||
/* The offset of the symbol from the start of the string table. */
|
||||
char n_offset[4];
|
||||
} xcoff64;
|
||||
} u;
|
||||
|
||||
/* The number of the section to which this symbol belongs. */
|
||||
char n_scnum[2];
|
||||
|
||||
/* The type of symbol. (It can be interpreted as an n_lang
|
||||
and an n_cpu byte, but we don't care about that here.) */
|
||||
char n_type[2];
|
||||
|
||||
/* The class of symbol (a C_* value). */
|
||||
char n_sclass[1];
|
||||
|
||||
/* The number of auxiliary symbols attached to this entry. */
|
||||
char n_numaux[1];
|
||||
};
|
||||
|
||||
/* Definitions required by collect2. */
|
||||
#define C_EXT 2
|
||||
|
||||
#define F_SHROBJ 0x2000
|
||||
#define F_LOADONLY 0x4000
|
||||
|
||||
#define N_UNDEF ((short) 0)
|
||||
#define N_TMASK 060
|
||||
#define N_BTSHFT 4
|
||||
|
||||
#define DT_NON 0
|
||||
#define DT_FCN 2
|
||||
|
||||
/* -------------------------------------------------------------------------
|
||||
Local code.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
/* An internal representation of an XCOFF symbol-table entry,
|
||||
which is associated with the API-defined SYMENT type. */
|
||||
struct internal_syment
|
||||
{
|
||||
char n_name[9];
|
||||
unsigned int n_zeroes;
|
||||
bfd_vma n_offset;
|
||||
bfd_vma n_value;
|
||||
short n_scnum;
|
||||
unsigned short n_flags;
|
||||
unsigned short n_type;
|
||||
unsigned char n_sclass;
|
||||
unsigned char n_numaux;
|
||||
};
|
||||
typedef struct internal_syment SYMENT;
|
||||
|
||||
/* The internal representation of the API-defined LDFILE type. */
|
||||
struct internal_ldfile
|
||||
{
|
||||
/* The file handle for the associated file, or -1 if it hasn't been
|
||||
opened yet. */
|
||||
int fd;
|
||||
|
||||
/* The start of the current XCOFF object, if one has been mapped
|
||||
into memory. Null otherwise. */
|
||||
char *object;
|
||||
|
||||
/* The offset of OBJECT from the start of the containing page. */
|
||||
size_t page_offset;
|
||||
|
||||
/* The size of the file pointed to by OBJECT. Valid iff OFFSET
|
||||
is nonnull. */
|
||||
size_t object_size;
|
||||
|
||||
/* The offset of the next member in an archive after OBJECT,
|
||||
or -1 if this isn't an archive. Valid iff OFFSET is nonnull. */
|
||||
off_t next_member;
|
||||
|
||||
/* The parsed version of the XCOFF file header. */
|
||||
struct internal_filehdr filehdr;
|
||||
};
|
||||
typedef struct internal_ldfile LDFILE;
|
||||
|
||||
/* The API allows the file header to be directly accessed via this macro. */
|
||||
#define HEADER(FILE) ((FILE)->filehdr)
|
||||
|
||||
/* API-defined return codes. SUCCESS must be > 0 and FAILURE must be <= 0. */
|
||||
#define SUCCESS 1
|
||||
#define FAILURE 0
|
||||
|
||||
/* API-defined functions. */
|
||||
extern LDFILE *ldopen (char *, LDFILE *);
|
||||
extern char *ldgetname (LDFILE *, SYMENT *);
|
||||
extern int ldtbread (LDFILE *, long, SYMENT *);
|
||||
extern int ldclose (LDFILE *);
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* GCC_COLLECT2_AIX_H */
|
||||
@@ -0,0 +1,39 @@
|
||||
/* Header file for collect routines.
|
||||
Copyright (C) 1998-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GCC; see the file COPYING3. If not see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef GCC_COLLECT2_H
|
||||
#define GCC_COLLECT2_H
|
||||
|
||||
extern struct pex_obj *collect_execute (const char *, char **, const char *,
|
||||
const char *, int flags);
|
||||
|
||||
extern int collect_wait (const char *, struct pex_obj *);
|
||||
|
||||
extern int file_exists (const char *);
|
||||
|
||||
extern const char *c_file_name;
|
||||
extern struct obstack temporary_obstack;
|
||||
extern char *temporary_firstobj;
|
||||
extern bool may_unlink_output_file;
|
||||
|
||||
extern void notice_translated (const char *, ...) ATTRIBUTE_PRINTF_1;
|
||||
extern void notice (const char *, ...) ATTRIBUTE_PRINTF_1;
|
||||
|
||||
extern bool at_file_supplied;
|
||||
#endif /* ! GCC_COLLECT2_H */
|
||||
@@ -0,0 +1,108 @@
|
||||
/* Terminal color manipulation macros.
|
||||
Copyright (C) 2005-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GCC; see the file COPYING3. If not see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef GCC_COLOR_MACROS_H
|
||||
#define GCC_COLOR_MACROS_H
|
||||
|
||||
/* Select Graphic Rendition (SGR, "\33[...m") strings. */
|
||||
/* Also Erase in Line (EL) to Right ("\33[K") by default. */
|
||||
/* Why have EL to Right after SGR?
|
||||
-- The behavior of line-wrapping when at the bottom of the
|
||||
terminal screen and at the end of the current line is often
|
||||
such that a new line is introduced, entirely cleared with
|
||||
the current background color which may be different from the
|
||||
default one (see the boolean back_color_erase terminfo(5)
|
||||
capability), thus scrolling the display by one line.
|
||||
The end of this new line will stay in this background color
|
||||
even after reverting to the default background color with
|
||||
"\33[m', unless it is explicitly cleared again with "\33[K"
|
||||
(which is the behavior the user would instinctively expect
|
||||
from the whole thing). There may be some unavoidable
|
||||
background-color flicker at the end of this new line because
|
||||
of this (when timing with the monitor's redraw is just right).
|
||||
-- The behavior of HT (tab, "\t") is usually the same as that of
|
||||
Cursor Forward Tabulation (CHT) with a default parameter
|
||||
of 1 ("\33[I"), i.e., it performs pure movement to the next
|
||||
tab stop, without any clearing of either content or screen
|
||||
attributes (including background color); try
|
||||
printf 'asdfqwerzxcv\rASDF\tZXCV\n'
|
||||
in a bash(1) shell to demonstrate this. This is not what the
|
||||
user would instinctively expect of HT (but is ok for CHT).
|
||||
The instinctive behavior would include clearing the terminal
|
||||
cells that are skipped over by HT with blank cells in the
|
||||
current screen attributes, including background color;
|
||||
the boolean dest_tabs_magic_smso terminfo(5) capability
|
||||
indicates this saner behavior for HT, but only some rare
|
||||
terminals have it (although it also indicates a special
|
||||
glitch with standout mode in the Teleray terminal for which
|
||||
it was initially introduced). The remedy is to add "\33K"
|
||||
after each SGR sequence, be it START (to fix the behavior
|
||||
of any HT after that before another SGR) or END (to fix the
|
||||
behavior of an HT in default background color that would
|
||||
follow a line-wrapping at the bottom of the screen in another
|
||||
background color, and to complement doing it after START).
|
||||
Piping GCC's output through a pager such as less(1) avoids
|
||||
any HT problems since the pager performs tab expansion.
|
||||
|
||||
Generic disadvantages of this remedy are:
|
||||
-- Some very rare terminals might support SGR but not EL (nobody
|
||||
will use "gcc -fdiagnostics-color" on a terminal that does not
|
||||
support SGR in the first place).
|
||||
-- Having these extra control sequences might somewhat complicate
|
||||
the task of any program trying to parse "gcc -fdiagnostics-color"
|
||||
output in order to extract structuring information from it.
|
||||
A specific disadvantage to doing it after SGR START is:
|
||||
-- Even more possible background color flicker (when timing
|
||||
with the monitor's redraw is just right), even when not at the
|
||||
bottom of the screen.
|
||||
There are no additional disadvantages specific to doing it after
|
||||
SGR END.
|
||||
|
||||
It would be impractical for GCC to become a full-fledged
|
||||
terminal program linked against ncurses or the like, so it will
|
||||
not detect terminfo(5) capabilities. */
|
||||
|
||||
#define COLOR_SEPARATOR ";"
|
||||
#define COLOR_NONE "00"
|
||||
#define COLOR_BOLD "01"
|
||||
#define COLOR_UNDERSCORE "04"
|
||||
#define COLOR_BLINK "05"
|
||||
#define COLOR_REVERSE "07"
|
||||
#define COLOR_FG_BLACK "30"
|
||||
#define COLOR_FG_RED "31"
|
||||
#define COLOR_FG_GREEN "32"
|
||||
#define COLOR_FG_YELLOW "33"
|
||||
#define COLOR_FG_BLUE "34"
|
||||
#define COLOR_FG_MAGENTA "35"
|
||||
#define COLOR_FG_CYAN "36"
|
||||
#define COLOR_FG_WHITE "37"
|
||||
#define COLOR_BG_BLACK "40"
|
||||
#define COLOR_BG_RED "41"
|
||||
#define COLOR_BG_GREEN "42"
|
||||
#define COLOR_BG_YELLOW "43"
|
||||
#define COLOR_BG_BLUE "44"
|
||||
#define COLOR_BG_MAGENTA "45"
|
||||
#define COLOR_BG_CYAN "46"
|
||||
#define COLOR_BG_WHITE "47"
|
||||
#define SGR_START "\33["
|
||||
#define SGR_END "m\33[K"
|
||||
#define SGR_SEQ(str) SGR_START str SGR_END
|
||||
#define SGR_RESET SGR_SEQ("")
|
||||
|
||||
#endif /* GCC_COLOR_MACROS_H */
|
||||
@@ -0,0 +1,69 @@
|
||||
/* Definitions for condition code handling in final.cc and output routines.
|
||||
Copyright (C) 1987-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GCC; see the file COPYING3. If not see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef GCC_CONDITIONS_H
|
||||
#define GCC_CONDITIONS_H
|
||||
|
||||
/* These are the machine-independent flags: */
|
||||
|
||||
/* Set if the sign of the cc value is inverted:
|
||||
output a following jump-if-less as a jump-if-greater, etc. */
|
||||
#define CC_REVERSED 1
|
||||
|
||||
/* This bit means that the current setting of the N bit is bogus
|
||||
and conditional jumps should use the Z bit in its place.
|
||||
This state obtains when an extraction of a signed single-bit field
|
||||
or an arithmetic shift right of a byte by 7 bits
|
||||
is turned into a btst, because btst does not set the N bit. */
|
||||
#define CC_NOT_POSITIVE 2
|
||||
|
||||
/* This bit means that the current setting of the N bit is bogus
|
||||
and conditional jumps should pretend that the N bit is clear.
|
||||
Used after extraction of an unsigned bit
|
||||
or logical shift right of a byte by 7 bits is turned into a btst.
|
||||
The btst does not alter the N bit, but the result of that shift
|
||||
or extract is never negative. */
|
||||
#define CC_NOT_NEGATIVE 4
|
||||
|
||||
/* This bit means that the current setting of the overflow flag
|
||||
is bogus and conditional jumps should pretend there is no overflow. */
|
||||
/* ??? Note that for most targets this macro is misnamed as it applies
|
||||
to the carry flag, not the overflow flag. */
|
||||
#define CC_NO_OVERFLOW 010
|
||||
|
||||
/* This bit means that what ought to be in the Z bit
|
||||
should be tested as the complement of the N bit. */
|
||||
#define CC_Z_IN_NOT_N 020
|
||||
|
||||
/* This bit means that what ought to be in the Z bit
|
||||
should be tested as the N bit. */
|
||||
#define CC_Z_IN_N 040
|
||||
|
||||
/* Nonzero if we must invert the sense of the following branch, i.e.
|
||||
change EQ to NE. This is not safe for IEEE floating point operations!
|
||||
It is intended for use only when a combination of arithmetic
|
||||
or logical insns can leave the condition codes set in a fortuitous
|
||||
(though inverted) state. */
|
||||
#define CC_INVERTED 0100
|
||||
|
||||
/* Nonzero if we must convert signed condition operators to unsigned.
|
||||
This is only used by machine description files. */
|
||||
#define CC_NOT_SIGNED 0200
|
||||
|
||||
#endif /* GCC_CONDITIONS_H */
|
||||
@@ -0,0 +1,10 @@
|
||||
#ifndef GCC_CONFIG_H
|
||||
#define GCC_CONFIG_H
|
||||
#ifdef GENERATOR_FILE
|
||||
#error config.h is for the host, not build, machine.
|
||||
#endif
|
||||
#include "auto-host.h"
|
||||
#ifdef IN_GCC
|
||||
# include "ansidecl.h"
|
||||
#endif
|
||||
#endif /* GCC_CONFIG_H */
|
||||
@@ -0,0 +1,484 @@
|
||||
/* elfos.h -- operating system specific defines to be used when
|
||||
targeting GCC for some generic ELF system
|
||||
Copyright (C) 1991-2023 Free Software Foundation, Inc.
|
||||
Based on svr4.h contributed by Ron Guilmette (rfg@netcom.com).
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3, or (at your option)
|
||||
any later version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Under Section 7 of GPL version 3, you are granted additional
|
||||
permissions described in the GCC Runtime Library Exception, version
|
||||
3.1, as published by the Free Software Foundation.
|
||||
|
||||
You should have received a copy of the GNU General Public License and
|
||||
a copy of the GCC Runtime Library Exception along with this program;
|
||||
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#define TARGET_OBJFMT_CPP_BUILTINS() \
|
||||
do \
|
||||
{ \
|
||||
builtin_define ("__ELF__"); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
/* Define a symbol indicating that we are using elfos.h.
|
||||
Some CPU specific configuration files use this. */
|
||||
#define USING_ELFOS_H
|
||||
|
||||
/* The prefix to add to user-visible assembler symbols.
|
||||
|
||||
For ELF systems the convention is *not* to prepend a leading
|
||||
underscore onto user-level symbol names. */
|
||||
|
||||
#undef USER_LABEL_PREFIX
|
||||
#define USER_LABEL_PREFIX ""
|
||||
|
||||
/* The biggest alignment supported by ELF in bits. 32-bit ELF
|
||||
supports section alignment up to (0x80000000 * 8), while
|
||||
64-bit ELF supports (0x8000000000000000 * 8). If this macro
|
||||
is not defined, the default is the largest alignment supported
|
||||
by 32-bit ELF and representable on a 32-bit host. Use this
|
||||
macro to limit the alignment which can be specified using
|
||||
the `__attribute__ ((aligned (N)))' construct. */
|
||||
#ifndef MAX_OFILE_ALIGNMENT
|
||||
#define MAX_OFILE_ALIGNMENT (((unsigned int) 1 << 28) * 8)
|
||||
#endif
|
||||
|
||||
/* Use periods rather than dollar signs in special g++ assembler names. */
|
||||
|
||||
#define NO_DOLLAR_IN_LABEL
|
||||
|
||||
/* Writing `int' for a bit-field forces int alignment for the structure. */
|
||||
|
||||
#ifndef PCC_BITFIELD_TYPE_MATTERS
|
||||
#define PCC_BITFIELD_TYPE_MATTERS 1
|
||||
#endif
|
||||
|
||||
/* All ELF targets can support DWARF-2. */
|
||||
|
||||
#define DWARF2_DEBUGGING_INFO 1
|
||||
|
||||
/* All ELF targets can support CTF. */
|
||||
|
||||
#define CTF_DEBUGGING_INFO 1
|
||||
|
||||
/* All ELF targets can support BTF. */
|
||||
|
||||
#define BTF_DEBUGGING_INFO 1
|
||||
|
||||
/* The GNU tools operate better with dwarf2, and it is required by some
|
||||
psABI's. Since we don't have any native tools to be compatible with,
|
||||
default to dwarf2. */
|
||||
|
||||
#ifndef PREFERRED_DEBUGGING_TYPE
|
||||
#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
|
||||
#endif
|
||||
|
||||
/* All SVR4 targets use the ELF object file format. */
|
||||
#define OBJECT_FORMAT_ELF
|
||||
|
||||
|
||||
/* Output #ident as a .ident. */
|
||||
|
||||
#undef TARGET_ASM_OUTPUT_IDENT
|
||||
#define TARGET_ASM_OUTPUT_IDENT default_asm_output_ident_directive
|
||||
|
||||
#undef SET_ASM_OP
|
||||
#define SET_ASM_OP "\t.set\t"
|
||||
|
||||
/* Most svr4 assemblers want a .file directive at the beginning of
|
||||
their input file. */
|
||||
#define TARGET_ASM_FILE_START_FILE_DIRECTIVE true
|
||||
|
||||
/* This is how to allocate empty space in some section. The .zero
|
||||
pseudo-op is used for this on most svr4 assemblers. */
|
||||
|
||||
#define SKIP_ASM_OP "\t.zero\t"
|
||||
|
||||
#undef ASM_OUTPUT_SKIP
|
||||
#define ASM_OUTPUT_SKIP(FILE, SIZE) \
|
||||
fprintf ((FILE), "%s" HOST_WIDE_INT_PRINT_UNSIGNED "\n",\
|
||||
SKIP_ASM_OP, (SIZE))
|
||||
|
||||
/* This is how to store into the string LABEL
|
||||
the symbol_ref name of an internal numbered label where
|
||||
PREFIX is the class of label and NUM is the number within the class.
|
||||
This is suitable for output with `assemble_name'.
|
||||
|
||||
For most svr4 systems, the convention is that any symbol which begins
|
||||
with a period is not put into the linker symbol table by the assembler. */
|
||||
|
||||
#undef ASM_GENERATE_INTERNAL_LABEL
|
||||
#define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \
|
||||
do \
|
||||
{ \
|
||||
char *__p; \
|
||||
(LABEL)[0] = '*'; \
|
||||
(LABEL)[1] = '.'; \
|
||||
__p = stpcpy (&(LABEL)[2], PREFIX); \
|
||||
sprint_ul (__p, (unsigned long) (NUM)); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
/* Output the label which precedes a jumptable. Note that for all svr4
|
||||
systems where we actually generate jumptables (which is to say every
|
||||
svr4 target except i386, where we use casesi instead) we put the jump-
|
||||
tables into the .rodata section and since other stuff could have been
|
||||
put into the .rodata section prior to any given jumptable, we have to
|
||||
make sure that the location counter for the .rodata section gets pro-
|
||||
perly re-aligned prior to the actual beginning of the jump table. */
|
||||
|
||||
#undef ALIGN_ASM_OP
|
||||
#define ALIGN_ASM_OP "\t.align\t"
|
||||
|
||||
#ifndef ASM_OUTPUT_BEFORE_CASE_LABEL
|
||||
#define ASM_OUTPUT_BEFORE_CASE_LABEL(FILE, PREFIX, NUM, TABLE) \
|
||||
ASM_OUTPUT_ALIGN ((FILE), 2)
|
||||
#endif
|
||||
|
||||
#undef ASM_OUTPUT_CASE_LABEL
|
||||
#define ASM_OUTPUT_CASE_LABEL(FILE, PREFIX, NUM, JUMPTABLE) \
|
||||
do \
|
||||
{ \
|
||||
ASM_OUTPUT_BEFORE_CASE_LABEL (FILE, PREFIX, NUM, JUMPTABLE); \
|
||||
(*targetm.asm_out.internal_label) (FILE, PREFIX, NUM); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
/* The standard SVR4 assembler seems to require that certain builtin
|
||||
library routines (e.g. .udiv) be explicitly declared as .globl
|
||||
in each assembly file where they are referenced. */
|
||||
|
||||
#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
|
||||
(*targetm.asm_out.globalize_label) (FILE, XSTR (FUN, 0))
|
||||
|
||||
/* This says how to output assembler code to declare an
|
||||
uninitialized external linkage data object. Under SVR4,
|
||||
the linker seems to want the alignment of data objects
|
||||
to depend on their types. We do exactly that here. */
|
||||
|
||||
#define COMMON_ASM_OP "\t.comm\t"
|
||||
|
||||
#undef ASM_OUTPUT_ALIGNED_COMMON
|
||||
#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \
|
||||
do \
|
||||
{ \
|
||||
fprintf ((FILE), "%s", COMMON_ASM_OP); \
|
||||
assemble_name ((FILE), (NAME)); \
|
||||
fprintf ((FILE), "," HOST_WIDE_INT_PRINT_UNSIGNED ",%u\n", \
|
||||
(SIZE), (ALIGN) / BITS_PER_UNIT); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
/* This says how to output assembler code to declare an
|
||||
uninitialized internal linkage data object. Under SVR4,
|
||||
the linker seems to want the alignment of data objects
|
||||
to depend on their types. We do exactly that here. */
|
||||
|
||||
#define LOCAL_ASM_OP "\t.local\t"
|
||||
|
||||
#undef ASM_OUTPUT_ALIGNED_LOCAL
|
||||
#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
|
||||
do \
|
||||
{ \
|
||||
fprintf ((FILE), "%s", LOCAL_ASM_OP); \
|
||||
assemble_name ((FILE), (NAME)); \
|
||||
fprintf ((FILE), "\n"); \
|
||||
ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
/* This is the pseudo-op used to generate a contiguous sequence of byte
|
||||
values from a double-quoted string WITHOUT HAVING A TERMINATING NUL
|
||||
AUTOMATICALLY APPENDED. This is the same for most svr4 assemblers. */
|
||||
|
||||
#undef ASCII_DATA_ASM_OP
|
||||
#define ASCII_DATA_ASM_OP "\t.ascii\t"
|
||||
|
||||
/* Support a read-only data section. */
|
||||
#define READONLY_DATA_SECTION_ASM_OP "\t.section\t.rodata"
|
||||
|
||||
/* On svr4, we *do* have support for the .init and .fini sections, and we
|
||||
can put stuff in there to be executed before and after `main'. We let
|
||||
crtstuff.c and other files know this by defining the following symbols.
|
||||
The definitions say how to change sections to the .init and .fini
|
||||
sections. This is the same for all known svr4 assemblers. */
|
||||
|
||||
#define INIT_SECTION_ASM_OP "\t.section\t.init"
|
||||
#define FINI_SECTION_ASM_OP "\t.section\t.fini"
|
||||
|
||||
/* Output assembly directive to move to the beginning of current section. */
|
||||
#ifdef HAVE_GAS_SUBSECTION_ORDERING
|
||||
# define ASM_SECTION_START_OP "\t.subsection\t-1"
|
||||
# define ASM_OUTPUT_SECTION_START(FILE) \
|
||||
fprintf ((FILE), "%s\n", ASM_SECTION_START_OP)
|
||||
#endif
|
||||
|
||||
#define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)
|
||||
|
||||
/* Switch into a generic section. */
|
||||
#define TARGET_ASM_NAMED_SECTION default_elf_asm_named_section
|
||||
|
||||
#undef TARGET_ASM_SELECT_RTX_SECTION
|
||||
#define TARGET_ASM_SELECT_RTX_SECTION default_elf_select_rtx_section
|
||||
#undef TARGET_ASM_SELECT_SECTION
|
||||
#define TARGET_ASM_SELECT_SECTION default_elf_select_section
|
||||
#undef TARGET_HAVE_SWITCHABLE_BSS_SECTIONS
|
||||
#define TARGET_HAVE_SWITCHABLE_BSS_SECTIONS true
|
||||
|
||||
/* Define the strings used for the special svr4 .type and .size directives.
|
||||
These strings generally do not vary from one system running svr4 to
|
||||
another, but if a given system (e.g. m88k running svr) needs to use
|
||||
different pseudo-op names for these, they may be overridden in the
|
||||
file which includes this one. */
|
||||
|
||||
#define TYPE_ASM_OP "\t.type\t"
|
||||
#define SIZE_ASM_OP "\t.size\t"
|
||||
|
||||
/* This is how we tell the assembler that a symbol is weak. */
|
||||
|
||||
#define ASM_WEAKEN_LABEL(FILE, NAME) \
|
||||
do \
|
||||
{ \
|
||||
fputs ("\t.weak\t", (FILE)); \
|
||||
assemble_name ((FILE), (NAME)); \
|
||||
fputc ('\n', (FILE)); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#define ASM_OUTPUT_SYMVER_DIRECTIVE(FILE, NAME, NAME2) \
|
||||
do \
|
||||
{ \
|
||||
fputs ("\t.symver\t", (FILE)); \
|
||||
assemble_name ((FILE), (NAME)); \
|
||||
fputs (", ", (FILE)); \
|
||||
assemble_name ((FILE), (NAME2)); \
|
||||
fputc ('\n', (FILE)); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
/* The following macro defines the format used to output the second
|
||||
operand of the .type assembler directive. Different svr4 assemblers
|
||||
expect various different forms for this operand. The one given here
|
||||
is just a default. You may need to override it in your machine-
|
||||
specific tm.h file (depending upon the particulars of your assembler). */
|
||||
|
||||
#define TYPE_OPERAND_FMT "@%s"
|
||||
|
||||
/* Write the extra assembler code needed to declare a function's result.
|
||||
Most svr4 assemblers don't require any special declaration of the
|
||||
result value, but there are exceptions. */
|
||||
|
||||
#ifndef ASM_DECLARE_RESULT
|
||||
#define ASM_DECLARE_RESULT(FILE, RESULT)
|
||||
#endif
|
||||
|
||||
/* These macros generate the special .type and .size directives which
|
||||
are used to set the corresponding fields of the linker symbol table
|
||||
entries in an ELF object file under SVR4. These macros also output
|
||||
the starting labels for the relevant functions/objects. */
|
||||
|
||||
/* Write the extra assembler code needed to declare a function properly.
|
||||
Some svr4 assemblers need to also have something extra said about the
|
||||
function's return value. We allow for that here. */
|
||||
|
||||
#ifndef ASM_DECLARE_FUNCTION_NAME
|
||||
#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
|
||||
do \
|
||||
{ \
|
||||
ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function"); \
|
||||
ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
|
||||
ASM_OUTPUT_FUNCTION_LABEL (FILE, NAME, DECL); \
|
||||
} \
|
||||
while (0)
|
||||
#endif
|
||||
|
||||
/* Write the extra assembler code needed to declare the name of a
|
||||
cold function partition properly. Some svr4 assemblers need to also
|
||||
have something extra said about the function's return value. We
|
||||
allow for that here. */
|
||||
|
||||
#ifndef ASM_DECLARE_COLD_FUNCTION_NAME
|
||||
#define ASM_DECLARE_COLD_FUNCTION_NAME(FILE, NAME, DECL) \
|
||||
do \
|
||||
{ \
|
||||
ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function"); \
|
||||
ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
|
||||
ASM_OUTPUT_FUNCTION_LABEL (FILE, NAME, DECL); \
|
||||
} \
|
||||
while (0)
|
||||
#endif
|
||||
|
||||
/* Write the extra assembler code needed to declare an object properly. */
|
||||
|
||||
#ifdef HAVE_GAS_GNU_UNIQUE_OBJECT
|
||||
#define USE_GNU_UNIQUE_OBJECT flag_gnu_unique
|
||||
#else
|
||||
#define USE_GNU_UNIQUE_OBJECT 0
|
||||
#endif
|
||||
|
||||
#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
|
||||
do \
|
||||
{ \
|
||||
HOST_WIDE_INT size; \
|
||||
\
|
||||
/* For template static data member instantiations or \
|
||||
inline fn local statics and their guard variables, use \
|
||||
gnu_unique_object so that they will be combined even under \
|
||||
RTLD_LOCAL. Don't use gnu_unique_object for typeinfo, \
|
||||
vtables and other read-only artificial decls. */ \
|
||||
if (USE_GNU_UNIQUE_OBJECT && DECL_ONE_ONLY (DECL) \
|
||||
&& (!DECL_ARTIFICIAL (DECL) || !TREE_READONLY (DECL))) \
|
||||
ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "gnu_unique_object"); \
|
||||
else \
|
||||
ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \
|
||||
\
|
||||
size_directive_output = 0; \
|
||||
if (!flag_inhibit_size_directive \
|
||||
&& (DECL) && DECL_SIZE (DECL)) \
|
||||
{ \
|
||||
size_directive_output = 1; \
|
||||
size = tree_to_uhwi (DECL_SIZE_UNIT (DECL)); \
|
||||
ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, size); \
|
||||
} \
|
||||
\
|
||||
ASM_OUTPUT_LABEL (FILE, NAME); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
/* Output the size directive for a decl in rest_of_decl_compilation
|
||||
in the case where we did not do so before the initializer.
|
||||
Once we find the error_mark_node, we know that the value of
|
||||
size_directive_output was set
|
||||
by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */
|
||||
|
||||
#undef ASM_FINISH_DECLARE_OBJECT
|
||||
#define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END)\
|
||||
do \
|
||||
{ \
|
||||
const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
|
||||
HOST_WIDE_INT size; \
|
||||
\
|
||||
if (!flag_inhibit_size_directive \
|
||||
&& DECL_SIZE (DECL) \
|
||||
&& ! AT_END && TOP_LEVEL \
|
||||
&& DECL_INITIAL (DECL) == error_mark_node \
|
||||
&& !size_directive_output) \
|
||||
{ \
|
||||
size_directive_output = 1; \
|
||||
size = tree_to_uhwi (DECL_SIZE_UNIT (DECL)); \
|
||||
ASM_OUTPUT_SIZE_DIRECTIVE (FILE, name, size); \
|
||||
} \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
/* This is how to declare the size of a function. */
|
||||
#ifndef ASM_DECLARE_FUNCTION_SIZE
|
||||
#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
|
||||
do \
|
||||
{ \
|
||||
if (!flag_inhibit_size_directive) \
|
||||
ASM_OUTPUT_MEASURED_SIZE (FILE, FNAME); \
|
||||
} \
|
||||
while (0)
|
||||
#endif
|
||||
|
||||
/* This is how to declare the size of a cold function partition. */
|
||||
#ifndef ASM_DECLARE_COLD_FUNCTION_SIZE
|
||||
#define ASM_DECLARE_COLD_FUNCTION_SIZE(FILE, FNAME, DECL) \
|
||||
do \
|
||||
{ \
|
||||
if (!flag_inhibit_size_directive) \
|
||||
ASM_OUTPUT_MEASURED_SIZE (FILE, FNAME); \
|
||||
} \
|
||||
while (0)
|
||||
#endif
|
||||
|
||||
/* A table of bytes codes used by the ASM_OUTPUT_ASCII and
|
||||
ASM_OUTPUT_LIMITED_STRING macros. Each byte in the table
|
||||
corresponds to a particular byte value [0..255]. For any
|
||||
given byte value, if the value in the corresponding table
|
||||
position is zero, the given character can be output directly.
|
||||
If the table value is 1, the byte must be output as a \ooo
|
||||
octal escape. If the tables value is anything else, then the
|
||||
byte value should be output as a \ followed by the value
|
||||
in the table. Note that we can use standard UN*X escape
|
||||
sequences for many control characters, but we don't use
|
||||
\a to represent BEL because some svr4 assemblers (e.g. on
|
||||
the i386) don't know about that. Also, we don't use \v
|
||||
since some versions of gas, such as 2.2 did not accept it. */
|
||||
|
||||
#define ELF_ASCII_ESCAPES \
|
||||
"\1\1\1\1\1\1\1\1btn\1fr\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\
|
||||
\0\0\"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\
|
||||
\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\\\0\0\0\
|
||||
\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\
|
||||
\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\
|
||||
\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\
|
||||
\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\
|
||||
\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1"
|
||||
|
||||
/* Some svr4 assemblers have a limit on the number of characters which
|
||||
can appear in the operand of a .string directive. If your assembler
|
||||
has such a limitation, you should define STRING_LIMIT to reflect that
|
||||
limit. Note that at least some svr4 assemblers have a limit on the
|
||||
actual number of bytes in the double-quoted string, and that they
|
||||
count each character in an escape sequence as one byte. Thus, an
|
||||
escape sequence like \377 would count as four bytes.
|
||||
|
||||
If your target assembler doesn't support the .string directive, you
|
||||
should define this to zero.
|
||||
*/
|
||||
|
||||
#define ELF_STRING_LIMIT ((unsigned) 256)
|
||||
|
||||
#define STRING_ASM_OP "\t.string\t"
|
||||
|
||||
/* The routine used to output NUL terminated strings. We use a special
|
||||
version of this for most svr4 targets because doing so makes the
|
||||
generated assembly code more compact (and thus faster to assemble)
|
||||
as well as more readable, especially for targets like the i386
|
||||
(where the only alternative is to output character sequences as
|
||||
comma separated lists of numbers). */
|
||||
|
||||
#define ASM_OUTPUT_LIMITED_STRING(FILE, STR) \
|
||||
default_elf_asm_output_limited_string ((FILE), (STR))
|
||||
|
||||
/* The routine used to output sequences of byte values. We use a special
|
||||
version of this for most svr4 targets because doing so makes the
|
||||
generated assembly code more compact (and thus faster to assemble)
|
||||
as well as more readable. Note that if we find subparts of the
|
||||
character sequence which end with NUL (and which are shorter than
|
||||
STRING_LIMIT) we output those using ASM_OUTPUT_LIMITED_STRING. */
|
||||
|
||||
#undef ASM_OUTPUT_ASCII
|
||||
#define ASM_OUTPUT_ASCII(FILE, STR, LENGTH) \
|
||||
default_elf_asm_output_ascii ((FILE), (STR), (LENGTH))
|
||||
|
||||
/* Allow the use of the -frecord-gcc-switches switch via the
|
||||
elf_record_gcc_switches function defined in varasm.cc. */
|
||||
#undef TARGET_ASM_RECORD_GCC_SWITCHES
|
||||
#define TARGET_ASM_RECORD_GCC_SWITCHES elf_record_gcc_switches
|
||||
|
||||
/* A C statement (sans semicolon) to output to the stdio stream STREAM
|
||||
any text necessary for declaring the name of an external symbol
|
||||
named NAME which is referenced in this compilation but not defined.
|
||||
It is needed to properly support non-default visibility. */
|
||||
|
||||
#ifndef ASM_OUTPUT_EXTERNAL
|
||||
#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \
|
||||
default_elf_asm_output_external (FILE, DECL, NAME)
|
||||
#endif
|
||||
|
||||
#undef TARGET_LIBC_HAS_FUNCTION
|
||||
#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function
|
||||
@@ -0,0 +1,45 @@
|
||||
/* Definitions for ELF systems with .init_array/.fini_array section
|
||||
support.
|
||||
Copyright (C) 2011-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published
|
||||
by the Free Software Foundation; either version 3, or (at your
|
||||
option) any later version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
License for more details.
|
||||
|
||||
Under Section 7 of GPL version 3, you are granted additional
|
||||
permissions described in the GCC Runtime Library Exception, version
|
||||
3.1, as published by the Free Software Foundation.
|
||||
|
||||
You should have received a copy of the GNU General Public License and
|
||||
a copy of the GCC Runtime Library Exception along with this program;
|
||||
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#if HAVE_INITFINI_ARRAY_SUPPORT
|
||||
|
||||
#define USE_INITFINI_ARRAY
|
||||
|
||||
#undef INIT_SECTION_ASM_OP
|
||||
#undef FINI_SECTION_ASM_OP
|
||||
|
||||
#undef INIT_ARRAY_SECTION_ASM_OP
|
||||
#define INIT_ARRAY_SECTION_ASM_OP
|
||||
|
||||
#undef FINI_ARRAY_SECTION_ASM_OP
|
||||
#define FINI_ARRAY_SECTION_ASM_OP
|
||||
|
||||
/* Use .init_array/.fini_array section for constructors and destructors. */
|
||||
#undef TARGET_ASM_CONSTRUCTOR
|
||||
#define TARGET_ASM_CONSTRUCTOR default_elf_init_array_asm_out_constructor
|
||||
#undef TARGET_ASM_DESTRUCTOR
|
||||
#define TARGET_ASM_DESTRUCTOR default_elf_fini_array_asm_out_destructor
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,69 @@
|
||||
/* Definitions for <stdint.h> types on systems using newlib.
|
||||
Copyright (C) 2008-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3, or (at your option)
|
||||
any later version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Under Section 7 of GPL version 3, you are granted additional
|
||||
permissions described in the GCC Runtime Library Exception, version
|
||||
3.1, as published by the Free Software Foundation.
|
||||
|
||||
You should have received a copy of the GNU General Public License and
|
||||
a copy of the GCC Runtime Library Exception along with this program;
|
||||
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* newlib uses 32-bit long in certain cases for all non-SPU
|
||||
targets. */
|
||||
#ifndef STDINT_LONG32
|
||||
#define STDINT_LONG32 (LONG_TYPE_SIZE == 32)
|
||||
#endif
|
||||
|
||||
#define SIG_ATOMIC_TYPE "int"
|
||||
|
||||
/* The newlib logic actually checks for sizes greater than 32 rather
|
||||
than equal to 64 for various 64-bit types. */
|
||||
|
||||
#define INT8_TYPE (CHAR_TYPE_SIZE == 8 ? "signed char" : 0)
|
||||
#define INT16_TYPE (SHORT_TYPE_SIZE == 16 ? "short int" : INT_TYPE_SIZE == 16 ? "int" : CHAR_TYPE_SIZE == 16 ? "signed char" : 0)
|
||||
#define INT32_TYPE (STDINT_LONG32 ? "long int" : INT_TYPE_SIZE == 32 ? "int" : SHORT_TYPE_SIZE == 32 ? "short int" : CHAR_TYPE_SIZE == 32 ? "signed char" : 0)
|
||||
#define INT64_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : LONG_LONG_TYPE_SIZE == 64 ? "long long int" : INT_TYPE_SIZE == 64 ? "int" : 0)
|
||||
#define UINT8_TYPE (CHAR_TYPE_SIZE == 8 ? "unsigned char" : 0)
|
||||
#define UINT16_TYPE (SHORT_TYPE_SIZE == 16 ? "short unsigned int" : INT_TYPE_SIZE == 16 ? "unsigned int" : CHAR_TYPE_SIZE == 16 ? "unsigned char" : 0)
|
||||
#define UINT32_TYPE (STDINT_LONG32 ? "long unsigned int" : INT_TYPE_SIZE == 32 ? "unsigned int" : SHORT_TYPE_SIZE == 32 ? "short unsigned int" : CHAR_TYPE_SIZE == 32 ? "unsigned char" : 0)
|
||||
#define UINT64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : LONG_LONG_TYPE_SIZE == 64 ? "long long unsigned int" : INT_TYPE_SIZE == 64 ? "unsigned int" : 0)
|
||||
|
||||
#define INT_LEAST8_TYPE (INT8_TYPE ? INT8_TYPE : INT16_TYPE ? INT16_TYPE : INT32_TYPE ? INT32_TYPE : INT64_TYPE ? INT64_TYPE : 0)
|
||||
#define INT_LEAST16_TYPE (INT16_TYPE ? INT16_TYPE : INT32_TYPE ? INT32_TYPE : INT64_TYPE ? INT64_TYPE : 0)
|
||||
#define INT_LEAST32_TYPE (INT32_TYPE ? INT32_TYPE : INT64_TYPE ? INT64_TYPE : 0)
|
||||
#define INT_LEAST64_TYPE INT64_TYPE
|
||||
#define UINT_LEAST8_TYPE (UINT8_TYPE ? UINT8_TYPE : UINT16_TYPE ? UINT16_TYPE : UINT32_TYPE ? UINT32_TYPE : UINT64_TYPE ? UINT64_TYPE : 0)
|
||||
#define UINT_LEAST16_TYPE (UINT16_TYPE ? UINT16_TYPE : UINT32_TYPE ? UINT32_TYPE : UINT64_TYPE ? UINT64_TYPE : 0)
|
||||
#define UINT_LEAST32_TYPE (UINT32_TYPE ? UINT32_TYPE : UINT64_TYPE ? UINT64_TYPE : 0)
|
||||
#define UINT_LEAST64_TYPE UINT64_TYPE
|
||||
|
||||
#define INT_FAST8_TYPE (INT_TYPE_SIZE >= 8 ? "int" : INT_LEAST8_TYPE)
|
||||
#define INT_FAST16_TYPE (INT_TYPE_SIZE >= 16 ? "int" : INT_LEAST16_TYPE)
|
||||
#define INT_FAST32_TYPE (INT_TYPE_SIZE >= 32 ? "int" : INT_LEAST32_TYPE)
|
||||
#define INT_FAST64_TYPE (INT_TYPE_SIZE >= 64 ? "int" : INT_LEAST64_TYPE)
|
||||
#define UINT_FAST8_TYPE (INT_TYPE_SIZE >= 8 ? "unsigned int" : UINT_LEAST8_TYPE)
|
||||
#define UINT_FAST16_TYPE (INT_TYPE_SIZE >= 16 ? "unsigned int" : UINT_LEAST16_TYPE)
|
||||
#define UINT_FAST32_TYPE (INT_TYPE_SIZE >= 32 ? "unsigned int" : UINT_LEAST32_TYPE)
|
||||
#define UINT_FAST64_TYPE (INT_TYPE_SIZE >= 64 ? "unsigned int" : UINT_LEAST64_TYPE)
|
||||
|
||||
/* Newlib uses the unsigned type corresponding to ptrdiff_t for
|
||||
uintptr_t; this is the same as size_t for most newlib-using
|
||||
targets. */
|
||||
#define INTPTR_TYPE PTRDIFF_TYPE
|
||||
#ifndef UINTPTR_TYPE
|
||||
#define UINTPTR_TYPE SIZE_TYPE
|
||||
#endif
|
||||
@@ -0,0 +1,40 @@
|
||||
/* Target macros for riscv*-elf targets.
|
||||
Copyright (C) 1994-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3, or (at your option)
|
||||
any later version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GCC; see the file COPYING3. If not see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#define LINK_SPEC "\
|
||||
-melf" XLEN_SPEC DEFAULT_ENDIAN_SPEC "riscv \
|
||||
%{mno-relax:--no-relax} \
|
||||
%{mbig-endian:-EB} \
|
||||
%{mlittle-endian:-EL} \
|
||||
%{shared}"
|
||||
|
||||
/* Link against Newlib libraries, because the ELF backend assumes Newlib.
|
||||
Handle the circular dependence between libc and libgloss. */
|
||||
#undef LIB_SPEC
|
||||
#define LIB_SPEC \
|
||||
"--start-group -lc %{!specs=nosys.specs:-lgloss} --end-group " \
|
||||
"%{!nostartfiles:%{!nodefaultlibs:%{!nolibc:%{!nostdlib:%:riscv_multi_lib_check()}}}}"
|
||||
|
||||
#undef STARTFILE_SPEC
|
||||
#define STARTFILE_SPEC "crt0%O%s crtbegin%O%s"
|
||||
|
||||
#undef ENDFILE_SPEC
|
||||
#define ENDFILE_SPEC "crtend%O%s"
|
||||
|
||||
#define RISCV_USE_CUSTOMISED_MULTI_LIB select_by_abi_arch_cmodel
|
||||
@@ -0,0 +1,227 @@
|
||||
/* Definition of RISC-V target for GNU compiler.
|
||||
Copyright (C) 2016-2023 Free Software Foundation, Inc.
|
||||
Contributed by Andrew Waterman (andrew@sifive.com).
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3, or (at your option)
|
||||
any later version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GCC; see the file COPYING3. If not see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef GCC_RISCV_OPTS_H
|
||||
#define GCC_RISCV_OPTS_H
|
||||
|
||||
enum riscv_abi_type {
|
||||
ABI_ILP32,
|
||||
ABI_ILP32E,
|
||||
ABI_ILP32F,
|
||||
ABI_ILP32D,
|
||||
ABI_LP64,
|
||||
ABI_LP64F,
|
||||
ABI_LP64D
|
||||
};
|
||||
extern enum riscv_abi_type riscv_abi;
|
||||
|
||||
enum riscv_code_model {
|
||||
CM_MEDLOW,
|
||||
CM_MEDANY,
|
||||
CM_PIC
|
||||
};
|
||||
extern enum riscv_code_model riscv_cmodel;
|
||||
|
||||
enum riscv_isa_spec_class {
|
||||
ISA_SPEC_CLASS_NONE,
|
||||
|
||||
ISA_SPEC_CLASS_2P2,
|
||||
ISA_SPEC_CLASS_20190608,
|
||||
ISA_SPEC_CLASS_20191213
|
||||
};
|
||||
|
||||
extern enum riscv_isa_spec_class riscv_isa_spec;
|
||||
|
||||
/* Keep this list in sync with define_attr "tune" in riscv.md. */
|
||||
enum riscv_microarchitecture_type {
|
||||
generic,
|
||||
sifive_7
|
||||
};
|
||||
extern enum riscv_microarchitecture_type riscv_microarchitecture;
|
||||
|
||||
enum riscv_align_data {
|
||||
riscv_align_data_type_xlen,
|
||||
riscv_align_data_type_natural
|
||||
};
|
||||
|
||||
/* Where to get the canary for the stack protector. */
|
||||
enum stack_protector_guard {
|
||||
SSP_TLS, /* per-thread canary in TLS block */
|
||||
SSP_GLOBAL /* global canary */
|
||||
};
|
||||
|
||||
enum riscv_multilib_select_kind {
|
||||
/* Select multilib by builtin way. */
|
||||
select_by_builtin,
|
||||
/* Select multilib by ABI, arch and code model. */
|
||||
select_by_abi_arch_cmodel,
|
||||
/* Select multilib by ABI only. */
|
||||
select_by_abi,
|
||||
};
|
||||
|
||||
#define MASK_ZICSR (1 << 0)
|
||||
#define MASK_ZIFENCEI (1 << 1)
|
||||
|
||||
#define TARGET_ZICSR ((riscv_zi_subext & MASK_ZICSR) != 0)
|
||||
#define TARGET_ZIFENCEI ((riscv_zi_subext & MASK_ZIFENCEI) != 0)
|
||||
|
||||
#define MASK_ZAWRS (1 << 0)
|
||||
#define TARGET_ZAWRS ((riscv_za_subext & MASK_ZAWRS) != 0)
|
||||
|
||||
#define MASK_ZBA (1 << 0)
|
||||
#define MASK_ZBB (1 << 1)
|
||||
#define MASK_ZBC (1 << 2)
|
||||
#define MASK_ZBS (1 << 3)
|
||||
|
||||
#define TARGET_ZBA ((riscv_zb_subext & MASK_ZBA) != 0)
|
||||
#define TARGET_ZBB ((riscv_zb_subext & MASK_ZBB) != 0)
|
||||
#define TARGET_ZBC ((riscv_zb_subext & MASK_ZBC) != 0)
|
||||
#define TARGET_ZBS ((riscv_zb_subext & MASK_ZBS) != 0)
|
||||
|
||||
#define MASK_ZFINX (1 << 0)
|
||||
#define MASK_ZDINX (1 << 1)
|
||||
#define MASK_ZHINX (1 << 2)
|
||||
#define MASK_ZHINXMIN (1 << 3)
|
||||
|
||||
#define TARGET_ZFINX ((riscv_zinx_subext & MASK_ZFINX) != 0)
|
||||
#define TARGET_ZDINX ((riscv_zinx_subext & MASK_ZDINX) != 0)
|
||||
#define TARGET_ZHINX ((riscv_zinx_subext & MASK_ZHINX) != 0)
|
||||
#define TARGET_ZHINXMIN ((riscv_zinx_subext & MASK_ZHINXMIN) != 0)
|
||||
|
||||
#define MASK_ZBKB (1 << 0)
|
||||
#define MASK_ZBKC (1 << 1)
|
||||
#define MASK_ZBKX (1 << 2)
|
||||
#define MASK_ZKNE (1 << 3)
|
||||
#define MASK_ZKND (1 << 4)
|
||||
#define MASK_ZKNH (1 << 5)
|
||||
#define MASK_ZKR (1 << 6)
|
||||
#define MASK_ZKSED (1 << 7)
|
||||
#define MASK_ZKSH (1 << 8)
|
||||
#define MASK_ZKT (1 << 9)
|
||||
|
||||
#define TARGET_ZBKB ((riscv_zk_subext & MASK_ZBKB) != 0)
|
||||
#define TARGET_ZBKC ((riscv_zk_subext & MASK_ZBKC) != 0)
|
||||
#define TARGET_ZBKX ((riscv_zk_subext & MASK_ZBKX) != 0)
|
||||
#define TARGET_ZKNE ((riscv_zk_subext & MASK_ZKNE) != 0)
|
||||
#define TARGET_ZKND ((riscv_zk_subext & MASK_ZKND) != 0)
|
||||
#define TARGET_ZKNH ((riscv_zk_subext & MASK_ZKNH) != 0)
|
||||
#define TARGET_ZKR ((riscv_zk_subext & MASK_ZKR) != 0)
|
||||
#define TARGET_ZKSED ((riscv_zk_subext & MASK_ZKSED) != 0)
|
||||
#define TARGET_ZKSH ((riscv_zk_subext & MASK_ZKSH) != 0)
|
||||
#define TARGET_ZKT ((riscv_zk_subext & MASK_ZKT) != 0)
|
||||
|
||||
#define MASK_VECTOR_ELEN_32 (1 << 0)
|
||||
#define MASK_VECTOR_ELEN_64 (1 << 1)
|
||||
#define MASK_VECTOR_ELEN_FP_32 (1 << 2)
|
||||
#define MASK_VECTOR_ELEN_FP_64 (1 << 3)
|
||||
|
||||
#define TARGET_VECTOR_ELEN_32 \
|
||||
((riscv_vector_elen_flags & MASK_VECTOR_ELEN_32) != 0)
|
||||
#define TARGET_VECTOR_ELEN_64 \
|
||||
((riscv_vector_elen_flags & MASK_VECTOR_ELEN_64) != 0)
|
||||
#define TARGET_VECTOR_ELEN_FP_32 \
|
||||
((riscv_vector_elen_flags & MASK_VECTOR_ELEN_FP_32) != 0)
|
||||
#define TARGET_VECTOR_ELEN_FP_64 \
|
||||
((riscv_vector_elen_flags & MASK_VECTOR_ELEN_FP_64) != 0)
|
||||
|
||||
#define MASK_ZVL32B (1 << 0)
|
||||
#define MASK_ZVL64B (1 << 1)
|
||||
#define MASK_ZVL128B (1 << 2)
|
||||
#define MASK_ZVL256B (1 << 3)
|
||||
#define MASK_ZVL512B (1 << 4)
|
||||
#define MASK_ZVL1024B (1 << 5)
|
||||
#define MASK_ZVL2048B (1 << 6)
|
||||
#define MASK_ZVL4096B (1 << 7)
|
||||
#define MASK_ZVL8192B (1 << 8)
|
||||
#define MASK_ZVL16384B (1 << 9)
|
||||
#define MASK_ZVL32768B (1 << 10)
|
||||
#define MASK_ZVL65536B (1 << 11)
|
||||
|
||||
#define TARGET_ZVL32B ((riscv_zvl_flags & MASK_ZVL32B) != 0)
|
||||
#define TARGET_ZVL64B ((riscv_zvl_flags & MASK_ZVL64B) != 0)
|
||||
#define TARGET_ZVL128B ((riscv_zvl_flags & MASK_ZVL128B) != 0)
|
||||
#define TARGET_ZVL256B ((riscv_zvl_flags & MASK_ZVL256B) != 0)
|
||||
#define TARGET_ZVL512B ((riscv_zvl_flags & MASK_ZVL512B) != 0)
|
||||
#define TARGET_ZVL1024B ((riscv_zvl_flags & MASK_ZVL1024B) != 0)
|
||||
#define TARGET_ZVL2048B ((riscv_zvl_flags & MASK_ZVL2048B) != 0)
|
||||
#define TARGET_ZVL4096B ((riscv_zvl_flags & MASK_ZVL4096B) != 0)
|
||||
#define TARGET_ZVL8192B ((riscv_zvl_flags & MASK_ZVL8192B) != 0)
|
||||
#define TARGET_ZVL16384B ((riscv_zvl_flags & MASK_ZVL16384B) != 0)
|
||||
#define TARGET_ZVL32768B ((riscv_zvl_flags & MASK_ZVL32768B) != 0)
|
||||
#define TARGET_ZVL65536B ((riscv_zvl_flags & MASK_ZVL65536B) != 0)
|
||||
|
||||
#define MASK_ZICBOZ (1 << 0)
|
||||
#define MASK_ZICBOM (1 << 1)
|
||||
#define MASK_ZICBOP (1 << 2)
|
||||
|
||||
#define TARGET_ZICBOZ ((riscv_zicmo_subext & MASK_ZICBOZ) != 0)
|
||||
#define TARGET_ZICBOM ((riscv_zicmo_subext & MASK_ZICBOM) != 0)
|
||||
#define TARGET_ZICBOP ((riscv_zicmo_subext & MASK_ZICBOP) != 0)
|
||||
|
||||
#define MASK_ZFHMIN (1 << 0)
|
||||
#define MASK_ZFH (1 << 1)
|
||||
|
||||
#define TARGET_ZFHMIN ((riscv_zf_subext & MASK_ZFHMIN) != 0)
|
||||
#define TARGET_ZFH ((riscv_zf_subext & MASK_ZFH) != 0)
|
||||
|
||||
#define MASK_ZMMUL (1 << 0)
|
||||
#define TARGET_ZMMUL ((riscv_zm_subext & MASK_ZMMUL) != 0)
|
||||
|
||||
#define MASK_SVINVAL (1 << 0)
|
||||
#define MASK_SVNAPOT (1 << 1)
|
||||
|
||||
#define TARGET_SVINVAL ((riscv_sv_subext & MASK_SVINVAL) != 0)
|
||||
#define TARGET_SVNAPOT ((riscv_sv_subext & MASK_SVNAPOT) != 0)
|
||||
|
||||
/* Bit of riscv_zvl_flags will set contintuly, N-1 bit will set if N-bit is
|
||||
set, e.g. MASK_ZVL64B has set then MASK_ZVL32B is set, so we can use
|
||||
popcount to caclulate the minimal VLEN. */
|
||||
#define TARGET_MIN_VLEN \
|
||||
((riscv_zvl_flags == 0) \
|
||||
? 0 \
|
||||
: 32 << (__builtin_popcount (riscv_zvl_flags) - 1))
|
||||
|
||||
#define MASK_XTHEADBA (1 << 0)
|
||||
#define MASK_XTHEADBB (1 << 1)
|
||||
#define MASK_XTHEADBS (1 << 2)
|
||||
#define MASK_XTHEADCMO (1 << 3)
|
||||
#define MASK_XTHEADCONDMOV (1 << 4)
|
||||
#define MASK_XTHEADFMEMIDX (1 << 5)
|
||||
#define MASK_XTHEADFMV (1 << 6)
|
||||
#define MASK_XTHEADINT (1 << 7)
|
||||
#define MASK_XTHEADMAC (1 << 8)
|
||||
#define MASK_XTHEADMEMIDX (1 << 9)
|
||||
#define MASK_XTHEADMEMPAIR (1 << 10)
|
||||
#define MASK_XTHEADSYNC (1 << 11)
|
||||
|
||||
#define TARGET_XTHEADBA ((riscv_xthead_subext & MASK_XTHEADBA) != 0)
|
||||
#define TARGET_XTHEADBB ((riscv_xthead_subext & MASK_XTHEADBB) != 0)
|
||||
#define TARGET_XTHEADBS ((riscv_xthead_subext & MASK_XTHEADBS) != 0)
|
||||
#define TARGET_XTHEADCMO ((riscv_xthead_subext & MASK_XTHEADCMO) != 0)
|
||||
#define TARGET_XTHEADCONDMOV ((riscv_xthead_subext & MASK_XTHEADCONDMOV) != 0)
|
||||
#define TARGET_XTHEADFMEMIDX ((riscv_xthead_subext & MASK_XTHEADFMEMIDX) != 0)
|
||||
#define TARGET_XTHEADFMV ((riscv_xthead_subext & MASK_XTHEADFMV) != 0)
|
||||
#define TARGET_XTHEADINT ((riscv_xthead_subext & MASK_XTHEADINT) != 0)
|
||||
#define TARGET_XTHEADMAC ((riscv_xthead_subext & MASK_XTHEADMAC) != 0)
|
||||
#define TARGET_XTHEADMEMIDX ((riscv_xthead_subext & MASK_XTHEADMEMIDX) != 0)
|
||||
#define TARGET_XTHEADMEMPAIR ((riscv_xthead_subext & MASK_XTHEADMEMPAIR) != 0)
|
||||
#define TARGET_XTHEADSYNC ((riscv_xthead_subext & MASK_XTHEADSYNC) != 0)
|
||||
|
||||
#endif /* ! GCC_RISCV_OPTS_H */
|
||||
@@ -0,0 +1,245 @@
|
||||
/* Definition of RISC-V target for GNU compiler.
|
||||
Copyright (C) 2011-2023 Free Software Foundation, Inc.
|
||||
Contributed by Andrew Waterman (andrew@sifive.com).
|
||||
Based on MIPS target for GNU compiler.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3, or (at your option)
|
||||
any later version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GCC; see the file COPYING3. If not see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef GCC_RISCV_PROTOS_H
|
||||
#define GCC_RISCV_PROTOS_H
|
||||
|
||||
#include "memmodel.h"
|
||||
|
||||
/* Symbol types we understand. The order of this list must match that of
|
||||
the unspec enum in riscv.md, subsequent to UNSPEC_ADDRESS_FIRST. */
|
||||
enum riscv_symbol_type {
|
||||
SYMBOL_ABSOLUTE,
|
||||
SYMBOL_PCREL,
|
||||
SYMBOL_GOT_DISP,
|
||||
SYMBOL_TLS,
|
||||
SYMBOL_TLS_LE,
|
||||
SYMBOL_TLS_IE,
|
||||
SYMBOL_TLS_GD
|
||||
};
|
||||
#define NUM_SYMBOL_TYPES (SYMBOL_TLS_GD + 1)
|
||||
|
||||
/* Routines implemented in riscv.cc. */
|
||||
extern enum riscv_symbol_type riscv_classify_symbolic_expression (rtx);
|
||||
extern bool riscv_symbolic_constant_p (rtx, enum riscv_symbol_type *);
|
||||
extern int riscv_regno_mode_ok_for_base_p (int, machine_mode, bool);
|
||||
extern int riscv_address_insns (rtx, machine_mode, bool);
|
||||
extern int riscv_const_insns (rtx);
|
||||
extern int riscv_split_const_insns (rtx);
|
||||
extern int riscv_load_store_insns (rtx, rtx_insn *);
|
||||
extern rtx riscv_emit_move (rtx, rtx);
|
||||
extern bool riscv_split_symbol (rtx, rtx, machine_mode, rtx *, bool);
|
||||
extern bool riscv_split_symbol_type (enum riscv_symbol_type);
|
||||
extern rtx riscv_unspec_address (rtx, enum riscv_symbol_type);
|
||||
extern void riscv_move_integer (rtx, rtx, HOST_WIDE_INT, machine_mode, bool);
|
||||
extern bool riscv_legitimize_move (machine_mode, rtx, rtx);
|
||||
extern rtx riscv_subword (rtx, bool);
|
||||
extern bool riscv_split_64bit_move_p (rtx, rtx);
|
||||
extern void riscv_split_doubleword_move (rtx, rtx);
|
||||
extern const char *riscv_output_move (rtx, rtx);
|
||||
extern const char *riscv_output_return ();
|
||||
|
||||
#ifdef RTX_CODE
|
||||
extern void riscv_expand_int_scc (rtx, enum rtx_code, rtx, rtx);
|
||||
extern void riscv_expand_float_scc (rtx, enum rtx_code, rtx, rtx);
|
||||
extern void riscv_expand_conditional_branch (rtx, enum rtx_code, rtx, rtx);
|
||||
#endif
|
||||
extern bool riscv_expand_conditional_move (rtx, rtx, rtx, rtx);
|
||||
extern rtx riscv_legitimize_call_address (rtx);
|
||||
extern void riscv_set_return_address (rtx, rtx);
|
||||
extern bool riscv_expand_block_move (rtx, rtx, rtx);
|
||||
extern rtx riscv_return_addr (int, rtx);
|
||||
extern poly_int64 riscv_initial_elimination_offset (int, int);
|
||||
extern void riscv_expand_prologue (void);
|
||||
extern void riscv_expand_epilogue (int);
|
||||
extern bool riscv_epilogue_uses (unsigned int);
|
||||
extern bool riscv_can_use_return_insn (void);
|
||||
extern rtx riscv_function_value (const_tree, const_tree, enum machine_mode);
|
||||
extern bool riscv_expand_block_move (rtx, rtx, rtx);
|
||||
extern bool riscv_store_data_bypass_p (rtx_insn *, rtx_insn *);
|
||||
extern rtx riscv_gen_gpr_save_insn (struct riscv_frame_info *);
|
||||
extern bool riscv_gpr_save_operation_p (rtx);
|
||||
extern void riscv_reinit (void);
|
||||
extern poly_uint64 riscv_regmode_natural_size (machine_mode);
|
||||
extern bool riscv_v_ext_vector_mode_p (machine_mode);
|
||||
extern bool riscv_shamt_matches_mask_p (int, HOST_WIDE_INT);
|
||||
extern void riscv_subword_address (rtx, rtx *, rtx *, rtx *, rtx *);
|
||||
extern void riscv_lshift_subword (machine_mode, rtx, rtx, rtx *);
|
||||
extern enum memmodel riscv_union_memmodels (enum memmodel, enum memmodel);
|
||||
|
||||
/* Routines implemented in riscv-c.cc. */
|
||||
void riscv_cpu_cpp_builtins (cpp_reader *);
|
||||
void riscv_register_pragmas (void);
|
||||
|
||||
/* Routines implemented in riscv-builtins.cc. */
|
||||
extern void riscv_atomic_assign_expand_fenv (tree *, tree *, tree *);
|
||||
extern bool riscv_gimple_fold_builtin (gimple_stmt_iterator *);
|
||||
extern rtx riscv_expand_builtin (tree, rtx, rtx, machine_mode, int);
|
||||
extern tree riscv_builtin_decl (unsigned int, bool);
|
||||
extern void riscv_init_builtins (void);
|
||||
|
||||
/* Routines implemented in riscv-common.cc. */
|
||||
extern std::string riscv_arch_str (bool version_p = true);
|
||||
extern void riscv_parse_arch_string (const char *, struct gcc_options *, location_t);
|
||||
|
||||
extern bool riscv_hard_regno_rename_ok (unsigned, unsigned);
|
||||
|
||||
rtl_opt_pass * make_pass_shorten_memrefs (gcc::context *ctxt);
|
||||
rtl_opt_pass * make_pass_vsetvl (gcc::context *ctxt);
|
||||
|
||||
/* Information about one CPU we know about. */
|
||||
struct riscv_cpu_info {
|
||||
/* This CPU's canonical name. */
|
||||
const char *name;
|
||||
|
||||
/* Default arch for this CPU, could be NULL if no default arch. */
|
||||
const char *arch;
|
||||
|
||||
/* Which automaton to use for tuning. */
|
||||
const char *tune;
|
||||
};
|
||||
|
||||
extern const riscv_cpu_info *riscv_find_cpu (const char *);
|
||||
|
||||
/* Routines implemented in riscv-selftests.cc. */
|
||||
#if CHECKING_P
|
||||
namespace selftest {
|
||||
void riscv_run_selftests (void);
|
||||
} // namespace selftest
|
||||
#endif
|
||||
|
||||
namespace riscv_vector {
|
||||
#define RVV_VLMAX gen_rtx_REG (Pmode, X0_REGNUM)
|
||||
#define RVV_VUNDEF(MODE) \
|
||||
gen_rtx_UNSPEC (MODE, gen_rtvec (1, gen_rtx_REG (SImode, X0_REGNUM)), \
|
||||
UNSPEC_VUNDEF)
|
||||
enum vlmul_type
|
||||
{
|
||||
LMUL_1 = 0,
|
||||
LMUL_2 = 1,
|
||||
LMUL_4 = 2,
|
||||
LMUL_8 = 3,
|
||||
LMUL_RESERVED = 4,
|
||||
LMUL_F8 = 5,
|
||||
LMUL_F4 = 6,
|
||||
LMUL_F2 = 7,
|
||||
NUM_LMUL = 8
|
||||
};
|
||||
|
||||
enum avl_type
|
||||
{
|
||||
NONVLMAX,
|
||||
VLMAX,
|
||||
};
|
||||
/* Routines implemented in riscv-vector-builtins.cc. */
|
||||
void init_builtins (void);
|
||||
const char *mangle_builtin_type (const_tree);
|
||||
#ifdef GCC_TARGET_H
|
||||
bool verify_type_context (location_t, type_context_kind, const_tree, bool);
|
||||
#endif
|
||||
void handle_pragma_vector (void);
|
||||
tree builtin_decl (unsigned, bool);
|
||||
gimple *gimple_fold_builtin (unsigned int, gimple_stmt_iterator *, gcall *);
|
||||
rtx expand_builtin (unsigned int, tree, rtx);
|
||||
bool check_builtin_call (location_t, vec<location_t>, unsigned int,
|
||||
tree, unsigned int, tree *);
|
||||
bool const_vec_all_same_in_range_p (rtx, HOST_WIDE_INT, HOST_WIDE_INT);
|
||||
bool legitimize_move (rtx, rtx, machine_mode);
|
||||
void emit_vlmax_vsetvl (machine_mode, rtx);
|
||||
void emit_hard_vlmax_vsetvl (machine_mode, rtx);
|
||||
void emit_vlmax_op (unsigned, rtx, rtx, machine_mode);
|
||||
void emit_vlmax_op (unsigned, rtx, rtx, rtx, machine_mode);
|
||||
void emit_nonvlmax_op (unsigned, rtx, rtx, rtx, machine_mode);
|
||||
enum vlmul_type get_vlmul (machine_mode);
|
||||
unsigned int get_ratio (machine_mode);
|
||||
int get_ta (rtx);
|
||||
int get_ma (rtx);
|
||||
int get_avl_type (rtx);
|
||||
unsigned int calculate_ratio (unsigned int, enum vlmul_type);
|
||||
enum tail_policy
|
||||
{
|
||||
TAIL_UNDISTURBED = 0,
|
||||
TAIL_AGNOSTIC = 1,
|
||||
TAIL_ANY = 2,
|
||||
};
|
||||
|
||||
enum mask_policy
|
||||
{
|
||||
MASK_UNDISTURBED = 0,
|
||||
MASK_AGNOSTIC = 1,
|
||||
MASK_ANY = 2,
|
||||
};
|
||||
enum tail_policy get_prefer_tail_policy ();
|
||||
enum mask_policy get_prefer_mask_policy ();
|
||||
rtx get_avl_type_rtx (enum avl_type);
|
||||
opt_machine_mode get_vector_mode (scalar_mode, poly_uint64);
|
||||
bool simm5_p (rtx);
|
||||
bool neg_simm5_p (rtx);
|
||||
#ifdef RTX_CODE
|
||||
bool has_vi_variant_p (rtx_code, rtx);
|
||||
#endif
|
||||
bool sew64_scalar_helper (rtx *, rtx *, rtx, machine_mode, machine_mode,
|
||||
bool, void (*)(rtx *, rtx));
|
||||
rtx gen_scalar_move_mask (machine_mode);
|
||||
|
||||
/* RVV vector register sizes.
|
||||
TODO: Currently, we only add RVV_32/RVV_64/RVV_128, we may need to
|
||||
support other values in the future. */
|
||||
enum vlen_enum
|
||||
{
|
||||
RVV_32 = 32,
|
||||
RVV_64 = 64,
|
||||
RVV_65536 = 65536
|
||||
};
|
||||
bool slide1_sew64_helper (int, machine_mode, machine_mode,
|
||||
machine_mode, rtx *);
|
||||
rtx gen_avl_for_scalar_move (rtx);
|
||||
}
|
||||
|
||||
/* We classify builtin types into two classes:
|
||||
1. General builtin class which is defined in riscv_builtins.
|
||||
2. Vector builtin class which is a special builtin architecture
|
||||
that implement intrinsic short into "pragma". */
|
||||
enum riscv_builtin_class
|
||||
{
|
||||
RISCV_BUILTIN_GENERAL,
|
||||
RISCV_BUILTIN_VECTOR
|
||||
};
|
||||
|
||||
const unsigned int RISCV_BUILTIN_SHIFT = 1;
|
||||
|
||||
/* Mask that selects the riscv_builtin_class part of a function code. */
|
||||
const unsigned int RISCV_BUILTIN_CLASS = (1 << RISCV_BUILTIN_SHIFT) - 1;
|
||||
|
||||
/* Routines implemented in thead.cc. */
|
||||
extern bool th_mempair_operands_p (rtx[4], bool, machine_mode);
|
||||
extern void th_mempair_order_operands (rtx[4], bool, machine_mode);
|
||||
extern void th_mempair_prepare_save_restore_operands (rtx[4], bool,
|
||||
machine_mode,
|
||||
int, HOST_WIDE_INT,
|
||||
int, HOST_WIDE_INT);
|
||||
extern void th_mempair_save_restore_regs (rtx[4], bool, machine_mode);
|
||||
#ifdef RTX_CODE
|
||||
extern const char*
|
||||
th_mempair_output_move (rtx[4], bool, machine_mode, RTX_CODE);
|
||||
#endif
|
||||
|
||||
#endif /* ! GCC_RISCV_PROTOS_H */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,7 @@
|
||||
/* Generated automatically. */
|
||||
static const char configuration_arguments[] = "/home/ilg/actions-runners/xpack-dev-tools/1/_work/riscv-none-elf-gcc-xpack/riscv-none-elf-gcc-xpack/build-assets/build/linux-x64/sources/gcc-13.4.0/configure --prefix=/home/ilg/actions-runners/xpack-dev-tools/1/_work/riscv-none-elf-gcc-xpack/riscv-none-elf-gcc-xpack/build-assets/build/linux-x64/application --with-sysroot=/home/ilg/actions-runners/xpack-dev-tools/1/_work/riscv-none-elf-gcc-xpack/riscv-none-elf-gcc-xpack/build-assets/build/linux-x64/application/riscv-none-elf --with-native-system-header-dir=/include --infodir=/home/ilg/actions-runners/xpack-dev-tools/1/_work/riscv-none-elf-gcc-xpack/riscv-none-elf-gcc-xpack/build-assets/build/linux-x64/x86_64-pc-linux-gnu/install/share/info --mandir=/home/ilg/actions-runners/xpack-dev-tools/1/_work/riscv-none-elf-gcc-xpack/riscv-none-elf-gcc-xpack/build-assets/build/linux-x64/x86_64-pc-linux-gnu/install/share/man --htmldir=/home/ilg/actions-runners/xpack-dev-tools/1/_work/riscv-none-elf-gcc-xpack/riscv-none-elf-gcc-xpack/build-assets/build/linux-x64/x86_64-pc-linux-gnu/install/share/html --pdfdir=/home/ilg/actions-runners/xpack-dev-tools/1/_work/riscv-none-elf-gcc-xpack/riscv-none-elf-gcc-xpack/build-assets/build/linux-x64/x86_64-pc-linux-gnu/install/share/pdf --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --target=riscv-none-elf --disable-nls --disable-shared --disable-threads --disable-tls --enable-checking=release --enable-languages=c,c++,fortran --with-gmp=/home/ilg/actions-runners/xpack-dev-tools/1/_work/riscv-none-elf-gcc-xpack/riscv-none-elf-gcc-xpack/build-assets/build/linux-x64/x86_64-pc-linux-gnu/install --with-newlib --with-pkgversion='xPack GNU RISC-V Embedded GCC x86_64' --with-gnu-as --with-gnu-ld --with-system-zlib --with-abi=ilp32 --with-arch=rv32imac --enable-multilib";
|
||||
static const char thread_model[] = "single";
|
||||
|
||||
static const struct {
|
||||
const char *name, *value;
|
||||
} configure_default_options[] = { { "abi", "ilp32" }, { "arch", "rv32imac" }, { "isa_spec", "20191213" } };
|
||||
@@ -0,0 +1,69 @@
|
||||
/* context.h - Holder for global state
|
||||
Copyright (C) 2013-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GCC; see the file COPYING3. If not see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef GCC_CONTEXT_H
|
||||
#define GCC_CONTEXT_H
|
||||
|
||||
namespace gcc {
|
||||
|
||||
class pass_manager;
|
||||
class dump_manager;
|
||||
|
||||
/* GCC's internal state can be divided into zero or more
|
||||
"parallel universe" of state; an instance of this class is one such
|
||||
context of state. */
|
||||
class context
|
||||
{
|
||||
public:
|
||||
context ();
|
||||
~context ();
|
||||
|
||||
/* The flag shows if there are symbols to be streamed for offloading. */
|
||||
bool have_offload;
|
||||
|
||||
/* Pass-management. */
|
||||
|
||||
void set_passes (pass_manager *m)
|
||||
{
|
||||
gcc_assert (!m_passes);
|
||||
m_passes = m;
|
||||
}
|
||||
|
||||
pass_manager *get_passes () { gcc_assert (m_passes); return m_passes; }
|
||||
|
||||
/* Handling dump files. */
|
||||
|
||||
dump_manager *get_dumps () {gcc_assert (m_dumps); return m_dumps; }
|
||||
|
||||
private:
|
||||
/* Pass-management. */
|
||||
pass_manager *m_passes;
|
||||
|
||||
/* Dump files. */
|
||||
dump_manager *m_dumps;
|
||||
|
||||
}; // class context
|
||||
|
||||
} // namespace gcc
|
||||
|
||||
/* The global singleton context aka "g".
|
||||
(the name is chosen to be easy to type in a debugger). */
|
||||
extern gcc::context *g;
|
||||
|
||||
#endif /* ! GCC_CONTEXT_H */
|
||||
@@ -0,0 +1,45 @@
|
||||
/* Definition of functions in convert.cc.
|
||||
Copyright (C) 1993-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GCC; see the file COPYING3. If not see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef GCC_CONVERT_H
|
||||
#define GCC_CONVERT_H
|
||||
|
||||
extern tree convert_to_integer (tree, tree);
|
||||
extern tree convert_to_integer_maybe_fold (tree, tree, bool);
|
||||
extern tree convert_to_pointer (tree, tree);
|
||||
extern tree convert_to_pointer_maybe_fold (tree, tree, bool);
|
||||
extern tree convert_to_real (tree, tree);
|
||||
extern tree convert_to_real_maybe_fold (tree, tree, bool);
|
||||
extern tree convert_to_fixed (tree, tree);
|
||||
extern tree convert_to_complex (tree, tree);
|
||||
extern tree convert_to_complex_maybe_fold (tree, tree, bool);
|
||||
extern tree convert_to_vector (tree, tree);
|
||||
|
||||
extern inline tree convert_to_integer_nofold (tree t, tree x)
|
||||
{ return convert_to_integer_maybe_fold (t, x, false); }
|
||||
extern inline tree convert_to_pointer_nofold (tree t, tree x)
|
||||
{ return convert_to_pointer_maybe_fold (t, x, false); }
|
||||
extern inline tree convert_to_real_nofold (tree t, tree x)
|
||||
{ return convert_to_real_maybe_fold (t, x, false); }
|
||||
extern inline tree convert_to_complex_nofold (tree t, tree x)
|
||||
{ return convert_to_complex_maybe_fold (t, x, false); }
|
||||
|
||||
extern tree preserve_any_location_wrapper (tree result, tree orig_expr);
|
||||
|
||||
#endif /* GCC_CONVERT_H */
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user