Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
aa4a53af
Commit
aa4a53af
authored
Jun 24, 2004
by
Richard Kenner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update whitespace and comments
From-SVN: r83632
parent
eb6127a4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
81 additions
and
76 deletions
+81
-76
gcc/gimplify.c
+10
-10
gcc/tree-dfa.c
+7
-12
gcc/tree-gimple.c
+1
-1
gcc/tree-inline.c
+63
-53
No files found.
gcc/gimplify.c
View file @
aa4a53af
...
@@ -77,13 +77,12 @@ static enum gimplify_status gimplify_modify_expr_rhs (tree *, tree *, tree *,
...
@@ -77,13 +77,12 @@ static enum gimplify_status gimplify_modify_expr_rhs (tree *, tree *, tree *,
static
enum
gimplify_status
gimplify_compound_expr
(
tree
*
,
tree
*
,
bool
);
static
enum
gimplify_status
gimplify_compound_expr
(
tree
*
,
tree
*
,
bool
);
/* Return a hash value for a formal temporary table entry. */
/* Return a hash value for a formal temporary table entry. */
static
hashval_t
static
hashval_t
gimple_tree_hash
(
const
void
*
p
)
gimple_tree_hash
(
const
void
*
p
)
{
{
tree
t
=
((
const
elt_t
*
)
p
)
->
val
;
tree
t
=
((
const
elt_t
*
)
p
)
->
val
;
return
iterative_hash_expr
(
t
,
0
);
return
iterative_hash_expr
(
t
,
0
);
}
}
...
@@ -92,8 +91,8 @@ gimple_tree_hash (const void *p)
...
@@ -92,8 +91,8 @@ gimple_tree_hash (const void *p)
static
int
static
int
gimple_tree_eq
(
const
void
*
p1
,
const
void
*
p2
)
gimple_tree_eq
(
const
void
*
p1
,
const
void
*
p2
)
{
{
tree
t1
=
((
const
elt_t
*
)
p1
)
->
val
;
tree
t1
=
((
const
elt_t
*
)
p1
)
->
val
;
tree
t2
=
((
const
elt_t
*
)
p2
)
->
val
;
tree
t2
=
((
const
elt_t
*
)
p2
)
->
val
;
enum
tree_code
code
=
TREE_CODE
(
t1
);
enum
tree_code
code
=
TREE_CODE
(
t1
);
if
(
TREE_CODE
(
t2
)
!=
code
if
(
TREE_CODE
(
t2
)
!=
code
...
@@ -194,6 +193,7 @@ static void
...
@@ -194,6 +193,7 @@ static void
gimple_pop_condition
(
tree
*
pre_p
)
gimple_pop_condition
(
tree
*
pre_p
)
{
{
int
conds
=
--
(
gimplify_ctxp
->
conditions
);
int
conds
=
--
(
gimplify_ctxp
->
conditions
);
if
(
conds
==
0
)
if
(
conds
==
0
)
{
{
append_to_statement_list
(
gimplify_ctxp
->
conditional_cleanups
,
pre_p
);
append_to_statement_list
(
gimplify_ctxp
->
conditional_cleanups
,
pre_p
);
...
@@ -281,6 +281,7 @@ tree
...
@@ -281,6 +281,7 @@ tree
create_artificial_label
(
void
)
create_artificial_label
(
void
)
{
{
tree
lab
=
build_decl
(
LABEL_DECL
,
NULL_TREE
,
void_type_node
);
tree
lab
=
build_decl
(
LABEL_DECL
,
NULL_TREE
,
void_type_node
);
DECL_ARTIFICIAL
(
lab
)
=
1
;
DECL_ARTIFICIAL
(
lab
)
=
1
;
DECL_CONTEXT
(
lab
)
=
current_function_decl
;
DECL_CONTEXT
(
lab
)
=
current_function_decl
;
return
lab
;
return
lab
;
...
@@ -298,6 +299,7 @@ create_tmp_var_name (const char *prefix)
...
@@ -298,6 +299,7 @@ create_tmp_var_name (const char *prefix)
if
(
prefix
)
if
(
prefix
)
{
{
char
*
preftmp
=
ASTRDUP
(
prefix
);
char
*
preftmp
=
ASTRDUP
(
prefix
);
remove_suffix
(
preftmp
,
strlen
(
preftmp
));
remove_suffix
(
preftmp
,
strlen
(
preftmp
));
prefix
=
preftmp
;
prefix
=
preftmp
;
}
}
...
@@ -486,8 +488,7 @@ is_gimple_tmp_var (tree t)
...
@@ -486,8 +488,7 @@ is_gimple_tmp_var (tree t)
&&
!
TREE_STATIC
(
t
)
&&
!
DECL_EXTERNAL
(
t
));
&&
!
TREE_STATIC
(
t
)
&&
!
DECL_EXTERNAL
(
t
));
}
}
/* Declares all the variables in VARS in SCOPE. Returns the last
/* Declares all the variables in VARS in SCOPE. */
DECL_STMT emitted. */
void
void
declare_tmp_vars
(
tree
vars
,
tree
scope
)
declare_tmp_vars
(
tree
vars
,
tree
scope
)
...
@@ -497,7 +498,7 @@ declare_tmp_vars (tree vars, tree scope)
...
@@ -497,7 +498,7 @@ declare_tmp_vars (tree vars, tree scope)
{
{
tree
temps
;
tree
temps
;
/* C99 mode puts the default 'return 0;' for main
()
outside the outer
/* C99 mode puts the default 'return 0;' for main outside the outer
braces. So drill down until we find an actual scope. */
braces. So drill down until we find an actual scope. */
while
(
TREE_CODE
(
scope
)
==
COMPOUND_EXPR
)
while
(
TREE_CODE
(
scope
)
==
COMPOUND_EXPR
)
scope
=
TREE_OPERAND
(
scope
,
0
);
scope
=
TREE_OPERAND
(
scope
,
0
);
...
@@ -1577,9 +1578,8 @@ canonicalize_component_ref (tree *expr_p)
...
@@ -1577,9 +1578,8 @@ canonicalize_component_ref (tree *expr_p)
(T *)&array
(T *)&array
==>
==>
&array[L]
&array[L]
where L is the lower bound. Only do this for constant lower bound since
where L is the lower bound. For simplicity, only do this for constant
we have no place to put any statements made during gimplification of
lower bound. */
the lower bound. */
static
void
static
void
canonicalize_addr_expr
(
tree
*
expr_p
)
canonicalize_addr_expr
(
tree
*
expr_p
)
...
...
gcc/tree-dfa.c
View file @
aa4a53af
...
@@ -852,24 +852,19 @@ collect_dfa_stats_r (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED,
...
@@ -852,24 +852,19 @@ collect_dfa_stats_r (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED,
static
tree
static
tree
find_vars_r
(
tree
*
tp
,
int
*
walk_subtrees
,
void
*
data
)
find_vars_r
(
tree
*
tp
,
int
*
walk_subtrees
,
void
*
data
)
{
{
tree
t
=
*
tp
;
struct
walk_state
*
walk_state
=
(
struct
walk_state
*
)
data
;
struct
walk_state
*
walk_state
=
(
struct
walk_state
*
)
data
;
if
(
SSA_VAR_P
(
t
))
{
/* If T is a regular variable that the optimizers are interested
/* If T is a regular variable that the optimizers are interested
in, add it to the list of variables. */
in, add it to the list of variables. */
add_referenced_var
(
t
,
walk_state
);
if
(
SSA_VAR_P
(
*
tp
))
}
add_referenced_var
(
*
tp
,
walk_state
);
else
if
(
DECL_P
(
t
)
||
TYPE_P
(
t
)
||
TREE_CODE_CLASS
(
TREE_CODE
(
t
))
==
'c'
)
{
/* Type, _DECL and constant nodes have no interesting children.
/* Type, _DECL and constant nodes have no interesting children.
Ignore them. */
Ignore them. */
else
if
(
DECL_P
(
*
tp
)
||
TYPE_P
(
*
tp
)
||
TREE_CODE_CLASS
(
TREE_CODE
(
*
tp
))
==
'c'
)
*
walk_subtrees
=
0
;
*
walk_subtrees
=
0
;
}
return
NULL_TREE
;
return
NULL_TREE
;
}
}
...
...
gcc/tree-gimple.c
View file @
aa4a53af
/* Functions to analyze and validate GIMPLE trees.
/* Functions to analyze and validate GIMPLE trees.
Copyright (C) 2002, 2003 Free Software Foundation, Inc.
Copyright (C) 2002, 2003
, 2004
Free Software Foundation, Inc.
Contributed by Diego Novillo <dnovillo@redhat.com>
Contributed by Diego Novillo <dnovillo@redhat.com>
Rewritten by Jason Merrill <jason@redhat.com>
Rewritten by Jason Merrill <jason@redhat.com>
...
...
gcc/tree-inline.c
View file @
aa4a53af
...
@@ -446,8 +446,8 @@ copy_bind_expr (tree *tp, int *walk_subtrees, inline_data *id)
...
@@ -446,8 +446,8 @@ copy_bind_expr (tree *tp, int *walk_subtrees, inline_data *id)
BIND_EXPR_VARS
(
*
tp
)
=
remap_decls
(
BIND_EXPR_VARS
(
*
tp
),
id
);
BIND_EXPR_VARS
(
*
tp
)
=
remap_decls
(
BIND_EXPR_VARS
(
*
tp
),
id
);
}
}
/* Called from copy_body via walk_tree. DATA is really an
/* Called from copy_body via walk_tree. DATA is really an
`inline_data *'. */
`inline_data *'. */
static
tree
static
tree
copy_body_r
(
tree
*
tp
,
int
*
walk_subtrees
,
void
*
data
)
copy_body_r
(
tree
*
tp
,
int
*
walk_subtrees
,
void
*
data
)
{
{
...
@@ -648,9 +648,9 @@ copy_body_r (tree *tp, int *walk_subtrees, void *data)
...
@@ -648,9 +648,9 @@ copy_body_r (tree *tp, int *walk_subtrees, void *data)
}
}
else
else
{
{
struct
cgraph_edge
*
edge
;
struct
cgraph_edge
*
edge
=
cgraph_edge
(
id
->
current_node
,
old_node
);
edge
=
cgraph_edge
(
id
->
current_node
,
old_node
);
if
(
edge
)
if
(
edge
)
cgraph_clone_edge
(
edge
,
id
->
node
,
*
tp
);
cgraph_clone_edge
(
edge
,
id
->
node
,
*
tp
);
}
}
...
@@ -691,9 +691,8 @@ copy_body (inline_data *id)
...
@@ -691,9 +691,8 @@ copy_body (inline_data *id)
}
}
static
void
static
void
setup_one_parameter
(
inline_data
*
id
,
tree
p
,
tree
value
,
setup_one_parameter
(
inline_data
*
id
,
tree
p
,
tree
value
,
tree
fn
,
tree
fn
,
tree
*
init_stmts
,
tree
*
vars
,
tree
*
init_stmts
,
tree
*
vars
,
bool
*
gimplify_init_stmts_p
)
bool
*
gimplify_init_stmts_p
)
{
{
tree
init_stmt
;
tree
init_stmt
;
tree
var
;
tree
var
;
...
@@ -864,9 +863,9 @@ initialize_inlined_parameters (inline_data *id, tree args, tree static_chain,
...
@@ -864,9 +863,9 @@ initialize_inlined_parameters (inline_data *id, tree args, tree static_chain,
}
}
/* Declare a return variable to replace the RESULT_DECL for the
/* Declare a return variable to replace the RESULT_DECL for the
function we are calling. An appropriate
DECL_STMT
is returned.
function we are calling. An appropriate
decl
is returned.
The USE_STMT is filled in to contain a use of the declaration to
indicate the return value of the function.
*/
??? Needs documentation of parameters.
*/
static
tree
static
tree
declare_return_variable
(
inline_data
*
id
,
tree
return_slot_addr
,
tree
*
use_p
)
declare_return_variable
(
inline_data
*
id
,
tree
return_slot_addr
,
tree
*
use_p
)
...
@@ -964,7 +963,6 @@ inline_forbidden_p_1 (tree *nodep, int *walk_subtrees ATTRIBUTE_UNUSED,
...
@@ -964,7 +963,6 @@ inline_forbidden_p_1 (tree *nodep, int *walk_subtrees ATTRIBUTE_UNUSED,
if
(
!
t
)
if
(
!
t
)
break
;
break
;
/* We cannot inline functions that call setjmp. */
/* We cannot inline functions that call setjmp. */
if
(
setjmp_call_p
(
t
))
if
(
setjmp_call_p
(
t
))
{
{
...
@@ -1151,8 +1149,7 @@ inlinable_function_p (tree fn)
...
@@ -1151,8 +1149,7 @@ inlinable_function_p (tree fn)
&&
DECL_DECLARED_INLINE_P
(
fn
)
&&
DECL_DECLARED_INLINE_P
(
fn
)
&&
!
DECL_IN_SYSTEM_HEADER
(
fn
));
&&
!
DECL_IN_SYSTEM_HEADER
(
fn
));
if
(
lookup_attribute
(
"always_inline"
,
if
(
lookup_attribute
(
"always_inline"
,
DECL_ATTRIBUTES
(
fn
)))
DECL_ATTRIBUTES
(
fn
)))
sorry
(
inline_forbidden_reason
,
fn
,
fn
);
sorry
(
inline_forbidden_reason
,
fn
,
fn
);
else
if
(
do_warning
)
else
if
(
do_warning
)
warning
(
inline_forbidden_reason
,
fn
,
fn
);
warning
(
inline_forbidden_reason
,
fn
,
fn
);
...
@@ -1168,6 +1165,7 @@ inlinable_function_p (tree fn)
...
@@ -1168,6 +1165,7 @@ inlinable_function_p (tree fn)
/* Used by estimate_num_insns. Estimate number of instructions seen
/* Used by estimate_num_insns. Estimate number of instructions seen
by given statement. */
by given statement. */
static
tree
static
tree
estimate_num_insns_1
(
tree
*
tp
,
int
*
walk_subtrees
,
void
*
data
)
estimate_num_insns_1
(
tree
*
tp
,
int
*
walk_subtrees
,
void
*
data
)
{
{
...
@@ -1233,6 +1231,7 @@ estimate_num_insns_1 (tree *tp, int *walk_subtrees, void *data)
...
@@ -1233,6 +1231,7 @@ estimate_num_insns_1 (tree *tp, int *walk_subtrees, void *data)
case
LOOP_EXPR
:
case
LOOP_EXPR
:
case
PHI_NODE
:
case
PHI_NODE
:
break
;
break
;
/* We don't account constants for now. Assume that the cost is amortized
/* We don't account constants for now. Assume that the cost is amortized
by operations that do use them. We may re-consider this decision once
by operations that do use them. We may re-consider this decision once
we are able to optimize the tree before estimating it's size and break
we are able to optimize the tree before estimating it's size and break
...
@@ -1375,6 +1374,7 @@ estimate_num_insns_1 (tree *tp, int *walk_subtrees, void *data)
...
@@ -1375,6 +1374,7 @@ estimate_num_insns_1 (tree *tp, int *walk_subtrees, void *data)
}
}
/* Estimate number of instructions that will be created by expanding EXPR. */
/* Estimate number of instructions that will be created by expanding EXPR. */
int
int
estimate_num_insns
(
tree
expr
)
estimate_num_insns
(
tree
expr
)
{
{
...
@@ -1647,10 +1647,10 @@ expand_call_inline (tree *tp, int *walk_subtrees, void *data)
...
@@ -1647,10 +1647,10 @@ expand_call_inline (tree *tp, int *walk_subtrees, void *data)
BIND_EXPR_BODY
(
expr
)
BIND_EXPR_BODY
(
expr
)
=
rationalize_compound_expr
(
BIND_EXPR_BODY
(
expr
));
=
rationalize_compound_expr
(
BIND_EXPR_BODY
(
expr
));
/* We want to create a new variable to hold the result of the
/* We want to create a new variable to hold the result of the
inlined
inlined body. This new variable needs to be added to th
e
body. This new variable needs to be added to the function which w
e
function which we are inlining into, thus the saving and
are inlining into, thus the saving and restoring of
restoring of
current_function_decl. */
current_function_decl. */
save_decl
=
current_function_decl
;
save_decl
=
current_function_decl
;
current_function_decl
=
id
->
node
->
decl
;
current_function_decl
=
id
->
node
->
decl
;
inline_result
=
voidify_wrapper_expr
(
expr
,
NULL
);
inline_result
=
voidify_wrapper_expr
(
expr
,
NULL
);
...
@@ -1668,18 +1668,18 @@ expand_call_inline (tree *tp, int *walk_subtrees, void *data)
...
@@ -1668,18 +1668,18 @@ expand_call_inline (tree *tp, int *walk_subtrees, void *data)
else
else
*
tp
=
expr
;
*
tp
=
expr
;
/* When we gimplify a function call, we may clear TREE_SIDE_EFFECTS
/* When we gimplify a function call, we may clear TREE_SIDE_EFFECTS
on
on
the call if it is to a "const" function. Thus the copy of
the call if it is to a "const" function. Thus the copy of
TREE_SIDE_EFFECTS from the CALL_EXPR to the BIND_EXPR above
TREE_SIDE_EFFECTS from the CALL_EXPR to the BIND_EXPR above
with
with result in TREE_SIDE_EFFECTS not being set for the inlined
result in TREE_SIDE_EFFECTS not being set for the inlined copy of a
copy of a
"const" function.
"const" function.
Unfortunately, that is wrong as inlining the function
Unfortunately, that is wrong as inlining the function
can
c
an create/expose interesting side effects (such as setting
c
reate/expose interesting side effects (such as setting of a return
of a return
value).
value).
The easiest solution is to simply recalculate TREE_SIDE_EFFECTS
The easiest solution is to simply recalculate TREE_SIDE_EFFECTS
for
for
the toplevel expression. */
the toplevel expression. */
recalculate_side_effects
(
expr
);
recalculate_side_effects
(
expr
);
}
}
else
else
...
@@ -1743,17 +1743,21 @@ gimple_expand_calls_inline (tree *stmt_p, inline_data *id)
...
@@ -1743,17 +1743,21 @@ gimple_expand_calls_inline (tree *stmt_p, inline_data *id)
gimple_expand_calls_inline
(
&
COND_EXPR_THEN
(
stmt
),
id
);
gimple_expand_calls_inline
(
&
COND_EXPR_THEN
(
stmt
),
id
);
gimple_expand_calls_inline
(
&
COND_EXPR_ELSE
(
stmt
),
id
);
gimple_expand_calls_inline
(
&
COND_EXPR_ELSE
(
stmt
),
id
);
break
;
break
;
case
CATCH_EXPR
:
case
CATCH_EXPR
:
gimple_expand_calls_inline
(
&
CATCH_BODY
(
stmt
),
id
);
gimple_expand_calls_inline
(
&
CATCH_BODY
(
stmt
),
id
);
break
;
break
;
case
EH_FILTER_EXPR
:
case
EH_FILTER_EXPR
:
gimple_expand_calls_inline
(
&
EH_FILTER_FAILURE
(
stmt
),
id
);
gimple_expand_calls_inline
(
&
EH_FILTER_FAILURE
(
stmt
),
id
);
break
;
break
;
case
TRY_CATCH_EXPR
:
case
TRY_CATCH_EXPR
:
case
TRY_FINALLY_EXPR
:
case
TRY_FINALLY_EXPR
:
gimple_expand_calls_inline
(
&
TREE_OPERAND
(
stmt
,
0
),
id
);
gimple_expand_calls_inline
(
&
TREE_OPERAND
(
stmt
,
0
),
id
);
gimple_expand_calls_inline
(
&
TREE_OPERAND
(
stmt
,
1
),
id
);
gimple_expand_calls_inline
(
&
TREE_OPERAND
(
stmt
,
1
),
id
);
break
;
break
;
case
BIND_EXPR
:
case
BIND_EXPR
:
gimple_expand_calls_inline
(
&
BIND_EXPR_BODY
(
stmt
),
id
);
gimple_expand_calls_inline
(
&
BIND_EXPR_BODY
(
stmt
),
id
);
break
;
break
;
...
@@ -1767,13 +1771,17 @@ gimple_expand_calls_inline (tree *stmt_p, inline_data *id)
...
@@ -1767,13 +1771,17 @@ gimple_expand_calls_inline (tree *stmt_p, inline_data *id)
stmt
=
*
stmt_p
;
stmt
=
*
stmt_p
;
if
(
!
stmt
||
TREE_CODE
(
stmt
)
!=
MODIFY_EXPR
)
if
(
!
stmt
||
TREE_CODE
(
stmt
)
!=
MODIFY_EXPR
)
break
;
break
;
/* FALLTHRU */
/* FALLTHRU */
case
MODIFY_EXPR
:
case
MODIFY_EXPR
:
stmt_p
=
&
TREE_OPERAND
(
stmt
,
1
);
stmt_p
=
&
TREE_OPERAND
(
stmt
,
1
);
stmt
=
*
stmt_p
;
stmt
=
*
stmt_p
;
if
(
TREE_CODE
(
stmt
)
!=
CALL_EXPR
)
if
(
TREE_CODE
(
stmt
)
!=
CALL_EXPR
)
break
;
break
;
/* FALLTHRU */
/* FALLTHRU */
case
CALL_EXPR
:
case
CALL_EXPR
:
expand_call_inline
(
stmt_p
,
&
dummy
,
id
);
expand_call_inline
(
stmt_p
,
&
dummy
,
id
);
break
;
break
;
...
@@ -1836,8 +1844,7 @@ optimize_inline_calls (tree fn)
...
@@ -1836,8 +1844,7 @@ optimize_inline_calls (tree fn)
prev_fn
=
current_function_decl
;
prev_fn
=
current_function_decl
;
}
}
prev_fn
=
(
lang_hooks
.
tree_inlining
.
add_pending_fn_decls
prev_fn
=
lang_hooks
.
tree_inlining
.
add_pending_fn_decls
(
&
id
.
fns
,
prev_fn
);
(
&
id
.
fns
,
prev_fn
));
/* Create the list of functions this call will inline. */
/* Create the list of functions this call will inline. */
VARRAY_TREE_INIT
(
id
.
inlined_fns
,
32
,
"inlined_fns"
);
VARRAY_TREE_INIT
(
id
.
inlined_fns
,
32
,
"inlined_fns"
);
...
@@ -1848,8 +1855,7 @@ optimize_inline_calls (tree fn)
...
@@ -1848,8 +1855,7 @@ optimize_inline_calls (tree fn)
/* Replace all calls to inline functions with the bodies of those
/* Replace all calls to inline functions with the bodies of those
functions. */
functions. */
id
.
tree_pruner
=
htab_create
(
37
,
htab_hash_pointer
,
id
.
tree_pruner
=
htab_create
(
37
,
htab_hash_pointer
,
htab_eq_pointer
,
NULL
);
htab_eq_pointer
,
NULL
);
expand_calls_inline
(
&
DECL_SAVED_TREE
(
fn
),
&
id
);
expand_calls_inline
(
&
DECL_SAVED_TREE
(
fn
),
&
id
);
/* Clean up. */
/* Clean up. */
...
@@ -1878,19 +1884,18 @@ optimize_inline_calls (tree fn)
...
@@ -1878,19 +1884,18 @@ optimize_inline_calls (tree fn)
#endif
#endif
}
}
/* FN is a function that has a complete body, and CLONE is a function
/* FN is a function that has a complete body, and CLONE is a function
whose
whose body is to be set to a copy of FN, mapping argument
body is to be set to a copy of FN, mapping argument declarations according
declarations according
to the ARG_MAP splay_tree. */
to the ARG_MAP splay_tree. */
void
void
clone_body
(
tree
clone
,
tree
fn
,
void
*
arg_map
)
clone_body
(
tree
clone
,
tree
fn
,
void
*
arg_map
)
{
{
inline_data
id
;
inline_data
id
;
/* Clone the body, as if we were making an inline call. But, remap
/* Clone the body, as if we were making an inline call. But, remap the
the parameters in the callee to the parameters of caller. If
parameters in the callee to the parameters of caller. If there's an
there's an in-charge parameter, map it to an appropriate
in-charge parameter, map it to an appropriate constant. */
constant. */
memset
(
&
id
,
0
,
sizeof
(
id
));
memset
(
&
id
,
0
,
sizeof
(
id
));
VARRAY_TREE_INIT
(
id
.
fns
,
2
,
"fns"
);
VARRAY_TREE_INIT
(
id
.
fns
,
2
,
"fns"
);
VARRAY_PUSH_TREE
(
id
.
fns
,
clone
);
VARRAY_PUSH_TREE
(
id
.
fns
,
clone
);
...
@@ -1920,15 +1925,18 @@ save_body (tree fn, tree *arg_copy)
...
@@ -1920,15 +1925,18 @@ save_body (tree fn, tree *arg_copy)
id
.
saving_p
=
true
;
id
.
saving_p
=
true
;
id
.
decl_map
=
splay_tree_new
(
splay_tree_compare_pointers
,
NULL
,
NULL
);
id
.
decl_map
=
splay_tree_new
(
splay_tree_compare_pointers
,
NULL
,
NULL
);
*
arg_copy
=
DECL_ARGUMENTS
(
fn
);
*
arg_copy
=
DECL_ARGUMENTS
(
fn
);
for
(
parg
=
arg_copy
;
*
parg
;
parg
=
&
TREE_CHAIN
(
*
parg
))
for
(
parg
=
arg_copy
;
*
parg
;
parg
=
&
TREE_CHAIN
(
*
parg
))
{
{
tree
new
=
copy_node
(
*
parg
);
tree
new
=
copy_node
(
*
parg
);
lang_hooks
.
dup_lang_specific_decl
(
new
);
lang_hooks
.
dup_lang_specific_decl
(
new
);
DECL_ABSTRACT_ORIGIN
(
new
)
=
DECL_ORIGIN
(
*
parg
);
DECL_ABSTRACT_ORIGIN
(
new
)
=
DECL_ORIGIN
(
*
parg
);
insert_decl_map
(
&
id
,
*
parg
,
new
);
insert_decl_map
(
&
id
,
*
parg
,
new
);
TREE_CHAIN
(
new
)
=
TREE_CHAIN
(
*
parg
);
TREE_CHAIN
(
new
)
=
TREE_CHAIN
(
*
parg
);
*
parg
=
new
;
*
parg
=
new
;
}
}
insert_decl_map
(
&
id
,
DECL_RESULT
(
fn
),
DECL_RESULT
(
fn
));
insert_decl_map
(
&
id
,
DECL_RESULT
(
fn
),
DECL_RESULT
(
fn
));
/* Actually copy the body. */
/* Actually copy the body. */
...
@@ -1939,12 +1947,11 @@ save_body (tree fn, tree *arg_copy)
...
@@ -1939,12 +1947,11 @@ save_body (tree fn, tree *arg_copy)
return
body
;
return
body
;
}
}
/* Apply FUNC to all the sub-trees of TP in a pre-order traversal.
/* Apply FUNC to all the sub-trees of TP in a pre-order traversal. FUNC is
FUNC is called with the DATA and the address of each sub-tree. If
called with the DATA and the address of each sub-tree. If FUNC returns a
FUNC returns a non-NULL value, the traversal is aborted, and the
non-NULL value, the traversal is aborted, and the value returned by FUNC
value returned by FUNC is returned. If HTAB is non-NULL it is used
is returned. If HTAB is non-NULL it is used to record the nodes visited,
to record the nodes visited, and to avoid visiting a node more than
and to avoid visiting a node more than once. */
once. */
tree
tree
walk_tree
(
tree
*
tp
,
walk_tree_fn
func
,
void
*
data
,
void
*
htab_
)
walk_tree
(
tree
*
tp
,
walk_tree_fn
func
,
void
*
data
,
void
*
htab_
)
...
@@ -2028,6 +2035,7 @@ walk_tree (tree *tp, walk_tree_fn func, void *data, void *htab_)
...
@@ -2028,6 +2035,7 @@ walk_tree (tree *tp, walk_tree_fn func, void *data, void *htab_)
if
(
code
==
TARGET_EXPR
if
(
code
==
TARGET_EXPR
&&
TREE_OPERAND
(
*
tp
,
3
)
==
TREE_OPERAND
(
*
tp
,
1
))
&&
TREE_OPERAND
(
*
tp
,
3
)
==
TREE_OPERAND
(
*
tp
,
1
))
--
len
;
--
len
;
/* Go through the subtrees. We need to do this in forward order so
/* Go through the subtrees. We need to do this in forward order so
that the scope of a FOR_EXPR is handled properly. */
that the scope of a FOR_EXPR is handled properly. */
#ifdef DEBUG_WALK_TREE
#ifdef DEBUG_WALK_TREE
...
@@ -2227,8 +2235,7 @@ walk_tree (tree *tp, walk_tree_fn func, void *data, void *htab_)
...
@@ -2227,8 +2235,7 @@ walk_tree (tree *tp, walk_tree_fn func, void *data, void *htab_)
#undef WALK_SUBTREE_TAIL
#undef WALK_SUBTREE_TAIL
}
}
/* Like walk_tree, but does not walk duplicate nodes more than
/* Like walk_tree, but does not walk duplicate nodes more than once. */
once. */
tree
tree
walk_tree_without_duplicates
(
tree
*
tp
,
walk_tree_fn
func
,
void
*
data
)
walk_tree_without_duplicates
(
tree
*
tp
,
walk_tree_fn
func
,
void
*
data
)
...
@@ -2280,6 +2287,7 @@ copy_tree_r (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED)
...
@@ -2280,6 +2287,7 @@ copy_tree_r (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED)
if
(
TREE_CODE
(
*
tp
)
==
BIND_EXPR
)
if
(
TREE_CODE
(
*
tp
)
==
BIND_EXPR
)
BIND_EXPR_BLOCK
(
*
tp
)
=
NULL_TREE
;
BIND_EXPR_BLOCK
(
*
tp
)
=
NULL_TREE
;
}
}
else
if
(
TREE_CODE_CLASS
(
code
)
==
't'
)
else
if
(
TREE_CODE_CLASS
(
code
)
==
't'
)
*
walk_subtrees
=
0
;
*
walk_subtrees
=
0
;
else
if
(
TREE_CODE_CLASS
(
code
)
==
'd'
)
else
if
(
TREE_CODE_CLASS
(
code
)
==
'd'
)
...
@@ -2291,9 +2299,9 @@ copy_tree_r (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED)
...
@@ -2291,9 +2299,9 @@ copy_tree_r (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED)
}
}
/* The SAVE_EXPR pointed to by TP is being copied. If ST contains
/* The SAVE_EXPR pointed to by TP is being copied. If ST contains
information indicating to what new SAVE_EXPR this one should be
information indicating to what new SAVE_EXPR this one should be
mapped,
mapped, use that one. Otherwise, create a new node and enter it in
use that one. Otherwise, create a new node and enter it in ST. FN is the
ST. FN is the
function into which the copy will be placed. */
function into which the copy will be placed. */
void
void
remap_save_expr
(
tree
*
tp
,
void
*
st_
,
tree
fn
,
int
*
walk_subtrees
)
remap_save_expr
(
tree
*
tp
,
void
*
st_
,
tree
fn
,
int
*
walk_subtrees
)
...
@@ -2331,9 +2339,9 @@ remap_save_expr (tree *tp, void *st_, tree fn, int *walk_subtrees)
...
@@ -2331,9 +2339,9 @@ remap_save_expr (tree *tp, void *st_, tree fn, int *walk_subtrees)
*
tp
=
t
;
*
tp
=
t
;
}
}
/* Called via walk_tree. If *TP points to a DECL_STMT for a local
/* Called via walk_tree. If *TP points to a DECL_STMT for a local
label,
declaration, copies the declaration and enters it in the splay_tree
copies the declaration and enters it in the splay_tree in DATA (which is
in DATA (which is
really an `inline_data *'). */
really an `inline_data *'). */
static
tree
static
tree
mark_local_for_remap_r
(
tree
*
tp
,
int
*
walk_subtrees
ATTRIBUTE_UNUSED
,
mark_local_for_remap_r
(
tree
*
tp
,
int
*
walk_subtrees
ATTRIBUTE_UNUSED
,
...
@@ -2394,6 +2402,7 @@ unsave_r (tree *tp, int *walk_subtrees, void *data)
...
@@ -2394,6 +2402,7 @@ unsave_r (tree *tp, int *walk_subtrees, void *data)
if
(
n
)
if
(
n
)
*
tp
=
(
tree
)
n
->
value
;
*
tp
=
(
tree
)
n
->
value
;
}
}
else
if
(
TREE_CODE
(
*
tp
)
==
STATEMENT_LIST
)
else
if
(
TREE_CODE
(
*
tp
)
==
STATEMENT_LIST
)
copy_statement_list
(
tp
);
copy_statement_list
(
tp
);
else
if
(
TREE_CODE
(
*
tp
)
==
BIND_EXPR
)
else
if
(
TREE_CODE
(
*
tp
)
==
BIND_EXPR
)
...
@@ -2443,6 +2452,7 @@ lhd_unsave_expr_now (tree expr)
...
@@ -2443,6 +2452,7 @@ lhd_unsave_expr_now (tree expr)
}
}
/* Allow someone to determine if SEARCH is a child of TOP from gdb. */
/* Allow someone to determine if SEARCH is a child of TOP from gdb. */
static
tree
static
tree
debug_find_tree_1
(
tree
*
tp
,
int
*
walk_subtrees
ATTRIBUTE_UNUSED
,
void
*
data
)
debug_find_tree_1
(
tree
*
tp
,
int
*
walk_subtrees
ATTRIBUTE_UNUSED
,
void
*
data
)
{
{
...
@@ -2458,7 +2468,6 @@ debug_find_tree (tree top, tree search)
...
@@ -2458,7 +2468,6 @@ debug_find_tree (tree top, tree search)
return
walk_tree_without_duplicates
(
&
top
,
debug_find_tree_1
,
search
)
!=
0
;
return
walk_tree_without_duplicates
(
&
top
,
debug_find_tree_1
,
search
)
!=
0
;
}
}
/* Declare the variables created by the inliner. Add all the variables in
/* Declare the variables created by the inliner. Add all the variables in
VARS to BIND_EXPR. */
VARS to BIND_EXPR. */
...
@@ -2468,6 +2477,7 @@ declare_inline_vars (tree bind_expr, tree vars)
...
@@ -2468,6 +2477,7 @@ declare_inline_vars (tree bind_expr, tree vars)
if
(
lang_hooks
.
gimple_before_inlining
)
if
(
lang_hooks
.
gimple_before_inlining
)
{
{
tree
t
;
tree
t
;
for
(
t
=
vars
;
t
;
t
=
TREE_CHAIN
(
t
))
for
(
t
=
vars
;
t
;
t
=
TREE_CHAIN
(
t
))
vars
->
decl
.
seen_in_bind_expr
=
1
;
vars
->
decl
.
seen_in_bind_expr
=
1
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment