aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/arm/aarch-common.h
blob: c6a67f0d05cc75d85d019e1cc910c37173884c03 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/* Types shared between arm and aarch64.

   Copyright (C) 2009-2021 Free Software Foundation, Inc.
   Contributed by Arm Ltd.

   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_AARCH_COMMON_H
#define GCC_AARCH_COMMON_H

/* Enum describing the various ways that the
   aarch*_parse_{arch,tune,cpu,extension} functions can fail.
   This way their callers can choose what kind of error to give.  */

enum aarch_parse_opt_result
{
  AARCH_PARSE_OK,			/* Parsing was successful.  */
  AARCH_PARSE_MISSING_ARG,		/* Missing argument.  */
  AARCH_PARSE_INVALID_FEATURE,		/* Invalid feature modifier.  */
  AARCH_PARSE_INVALID_ARG		/* Invalid arch, tune, cpu arg.  */
};

/* Function types -msign-return-address should sign.  */
enum aarch_function_type {
  /* Don't sign any function.  */
  AARCH_FUNCTION_NONE,
  /* Non-leaf functions.  */
  AARCH_FUNCTION_NON_LEAF,
  /* All functions.  */
  AARCH_FUNCTION_ALL
};

/* The key type that -msign-return-address should use.  */
enum aarch_key_type {
  AARCH_KEY_A,
  AARCH_KEY_B
};

struct aarch_branch_protect_type
{
  /* The type's name that the user passes to the branch-protection option
     string.  */
  const char* name;
  /* Function to handle the protection type and set global variables.
     First argument is the string token corresponding with this type and the
     second argument is the next token in the option string.
     Return values:
     * AARCH_PARSE_OK: Handling was sucessful.
     * AARCH_INVALID_ARG: The type is invalid in this context and the caller
     should print an error.
     * AARCH_INVALID_FEATURE: The type is invalid and the handler prints its
     own error.  */
  enum aarch_parse_opt_result (*handler)(char*, char*);
  /* A list of types that can follow this type in the option string.  */
  const struct aarch_branch_protect_type* subtypes;
  unsigned int num_subtypes;
};

#endif /* GCC_AARCH_COMMON_H */