]>
Commit | Line | Data |
---|---|---|
4d99a848 MJ |
1 | /* Manipulation of formal and actual parameters of functions and function |
2 | calls. | |
a5544970 | 3 | Copyright (C) 2017-2019 Free Software Foundation, Inc. |
4d99a848 MJ |
4 | |
5 | This file is part of GCC. | |
6 | ||
7 | GCC is free software; you can redistribute it and/or modify it under | |
8 | the terms of the GNU General Public License as published by the Free | |
9 | Software Foundation; either version 3, or (at your option) any later | |
10 | version. | |
11 | ||
12 | GCC is distributed in the hope that it will be useful, but WITHOUT ANY | |
13 | WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 | for more details. | |
16 | ||
17 | You should have received a copy of the GNU General Public License | |
18 | along with GCC; see the file COPYING3. If not see | |
19 | <http://www.gnu.org/licenses/>. */ | |
20 | ||
21 | #ifndef IPA_PARAM_MANIPULATION_H | |
22 | #define IPA_PARAM_MANIPULATION_H | |
23 | ||
24 | /* Operation to be performed for the parameter in ipa_parm_adjustment | |
25 | below. */ | |
26 | enum ipa_parm_op { | |
27 | IPA_PARM_OP_NONE, | |
28 | ||
29 | /* This describes a brand new parameter. | |
30 | ||
31 | The field `type' should be set to the new type, `arg_prefix' | |
32 | should be set to the string prefix for the new DECL_NAME, and | |
33 | `new_decl' will ultimately hold the newly created argument. */ | |
34 | IPA_PARM_OP_NEW, | |
35 | ||
36 | /* This new parameter is an unmodified parameter at index base_index. */ | |
37 | IPA_PARM_OP_COPY, | |
38 | ||
39 | /* This adjustment describes a parameter that is about to be removed | |
40 | completely. Most users will probably need to book keep those so that they | |
41 | don't leave behinfd any non default def ssa names belonging to them. */ | |
42 | IPA_PARM_OP_REMOVE | |
43 | }; | |
44 | ||
45 | /* Structure to describe transformations of formal parameters and actual | |
46 | arguments. Each instance describes one new parameter and they are meant to | |
47 | be stored in a vector. Additionally, most users will probably want to store | |
48 | adjustments about parameters that are being removed altogether so that SSA | |
49 | names belonging to them can be replaced by SSA names of an artificial | |
50 | variable. */ | |
51 | struct ipa_parm_adjustment | |
52 | { | |
53 | /* The original PARM_DECL itself, helpful for processing of the body of the | |
54 | function itself. Intended for traversing function bodies. | |
55 | ipa_modify_formal_parameters, ipa_modify_call_arguments and | |
56 | ipa_combine_adjustments ignore this and use base_index. | |
57 | ipa_modify_formal_parameters actually sets this. */ | |
58 | tree base; | |
59 | ||
60 | /* Type of the new parameter. However, if by_ref is true, the real type will | |
61 | be a pointer to this type. */ | |
62 | tree type; | |
63 | ||
64 | /* Alias refrerence type to be used in MEM_REFs when adjusting caller | |
65 | arguments. */ | |
66 | tree alias_ptr_type; | |
67 | ||
68 | /* The new declaration when creating/replacing a parameter. Created | |
69 | by ipa_modify_formal_parameters, useful for functions modifying | |
70 | the body accordingly. For brand new arguments, this is the newly | |
71 | created argument. */ | |
72 | tree new_decl; | |
73 | ||
74 | /* New declaration of a substitute variable that we may use to replace all | |
75 | non-default-def ssa names when a parm decl is going away. */ | |
76 | tree new_ssa_base; | |
77 | ||
78 | /* If non-NULL and the original parameter is to be removed (copy_param below | |
79 | is NULL), this is going to be its nonlocalized vars value. */ | |
80 | tree nonlocal_value; | |
81 | ||
82 | /* This holds the prefix to be used for the new DECL_NAME. */ | |
83 | const char *arg_prefix; | |
84 | ||
85 | /* Offset into the original parameter (for the cases when the new parameter | |
86 | is a component of an original one). */ | |
80d0198b | 87 | poly_int64_pod offset; |
4d99a848 MJ |
88 | |
89 | /* Zero based index of the original parameter this one is based on. */ | |
90 | int base_index; | |
91 | ||
92 | /* Whether this parameter is a new parameter, a copy of an old one, | |
93 | or one about to be removed. */ | |
94 | enum ipa_parm_op op; | |
95 | ||
96 | /* Storage order of the original parameter (for the cases when the new | |
97 | parameter is a component of an original one). */ | |
98 | unsigned reverse : 1; | |
99 | ||
100 | /* The parameter is to be passed by reference. */ | |
101 | unsigned by_ref : 1; | |
102 | }; | |
103 | ||
104 | typedef vec<ipa_parm_adjustment> ipa_parm_adjustment_vec; | |
105 | ||
106 | vec<tree> ipa_get_vector_of_formal_parms (tree fndecl); | |
107 | vec<tree> ipa_get_vector_of_formal_parm_types (tree fntype); | |
108 | void ipa_modify_formal_parameters (tree fndecl, ipa_parm_adjustment_vec); | |
109 | void ipa_modify_call_arguments (struct cgraph_edge *, gcall *, | |
110 | ipa_parm_adjustment_vec); | |
111 | ipa_parm_adjustment_vec ipa_combine_adjustments (ipa_parm_adjustment_vec, | |
112 | ipa_parm_adjustment_vec); | |
113 | void ipa_dump_param_adjustments (FILE *, ipa_parm_adjustment_vec, tree); | |
114 | ||
115 | bool ipa_modify_expr (tree *, bool, ipa_parm_adjustment_vec); | |
116 | ipa_parm_adjustment *ipa_get_adjustment_candidate (tree **, bool *, | |
117 | ipa_parm_adjustment_vec, | |
118 | bool); | |
119 | ||
120 | #endif /* IPA_PARAM_MANIPULATION_H */ |