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
903d1e67
Commit
903d1e67
authored
Apr 22, 2011
by
Xinliang David Li
Committed by
Xinliang David Li
Apr 22, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove cgraph pid
From-SVN: r172848
parent
7378e95f
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
68 additions
and
27 deletions
+68
-27
gcc/ChangeLog
+15
-0
gcc/cgraph.c
+1
-6
gcc/cgraph.h
+0
-5
gcc/cgraphunit.c
+0
-1
gcc/function.c
+7
-0
gcc/function.h
+1
-0
gcc/profile.h
+3
-0
gcc/tree-profile.c
+5
-1
gcc/value-prof.c
+36
-14
No files found.
gcc/ChangeLog
View file @
903d1e67
2011-04-21 Xinliang David Li <davidxl@google.com>
* cgraph.h: Remove pid.
* cgraph.c: Remove pid.
* value-prof.c (init_node_map): New function.
(del_node_map): New function.
(find_func_by_funcdef_no): New function.
(gimple_ic_transform): Call new function.
* cgraphunit.c (cgraph_finalize_function): Remove pid.
* function.c (get_last_funcdef_no): New function.
* function.h (get_last_funcdef_no): New function.
* tree-profile.c (gimple_gen_ic_func_profiler): Pass funcdef_no
to libgcov function.
(tree-profiling): Call node map init and delete function.
2011-04-21 Ian Lance Taylor <iant@google.com>
* godump.c (go_format_type): Use exported Go name for anonymous
...
...
gcc/cgraph.c
View file @
903d1e67
...
...
@@ -142,9 +142,6 @@ int cgraph_max_uid;
/* Maximal uid used in cgraph edges. */
int
cgraph_edge_max_uid
;
/* Maximal pid used for profiling */
int
cgraph_max_pid
;
/* Set when whole unit has been analyzed so we can access global info. */
bool
cgraph_global_info_ready
=
false
;
...
...
@@ -472,7 +469,6 @@ cgraph_create_node_1 (void)
struct
cgraph_node
*
node
=
cgraph_allocate_node
();
node
->
next
=
cgraph_nodes
;
node
->
pid
=
-
1
;
node
->
order
=
cgraph_order
++
;
if
(
cgraph_nodes
)
cgraph_nodes
->
previous
=
node
;
...
...
@@ -1827,8 +1823,7 @@ dump_cgraph_node (FILE *f, struct cgraph_node *node)
struct
cgraph_edge
*
edge
;
int
indirect_calls_count
=
0
;
fprintf
(
f
,
"%s/%i(%i)"
,
cgraph_node_name
(
node
),
node
->
uid
,
node
->
pid
);
fprintf
(
f
,
"%s/%i"
,
cgraph_node_name
(
node
),
node
->
uid
);
dump_addr
(
f
,
" @"
,
(
void
*
)
node
);
if
(
DECL_ASSEMBLER_NAME_SET_P
(
node
->
decl
))
fprintf
(
f
,
" (asm: %s)"
,
IDENTIFIER_POINTER
(
DECL_ASSEMBLER_NAME
(
node
->
decl
)));
...
...
gcc/cgraph.h
View file @
903d1e67
...
...
@@ -200,9 +200,6 @@ struct GTY((chain_next ("%h.next"), chain_prev ("%h.previous"))) cgraph_node {
/* Ordering of all cgraph nodes. */
int
order
;
/* unique id for profiling. pid is not suitable because of different
number of cfg nodes with -fprofile-generate and -fprofile-use */
int
pid
;
enum
ld_plugin_symbol_resolution
resolution
;
/* Set when function must be output for some reason. The primary
...
...
@@ -472,7 +469,6 @@ extern GTY(()) struct cgraph_node *cgraph_nodes;
extern
GTY
(())
int
cgraph_n_nodes
;
extern
GTY
(())
int
cgraph_max_uid
;
extern
GTY
(())
int
cgraph_edge_max_uid
;
extern
GTY
(())
int
cgraph_max_pid
;
extern
bool
cgraph_global_info_ready
;
enum
cgraph_state
{
...
...
@@ -730,7 +726,6 @@ void cgraph_clone_inlined_nodes (struct cgraph_edge *, bool, bool);
void
compute_inline_parameters
(
struct
cgraph_node
*
);
cgraph_inline_failed_t
cgraph_edge_inlinable_p
(
struct
cgraph_edge
*
);
/* Create a new static variable of type TYPE. */
tree
add_new_static_var
(
tree
type
);
...
...
gcc/cgraphunit.c
View file @
903d1e67
...
...
@@ -348,7 +348,6 @@ cgraph_finalize_function (tree decl, bool nested)
if
(
node
->
local
.
finalized
)
cgraph_reset_node
(
node
);
node
->
pid
=
cgraph_max_pid
++
;
notice_global_symbol
(
decl
);
node
->
local
.
finalized
=
true
;
node
->
lowered
=
DECL_STRUCT_FUNCTION
(
decl
)
->
cfg
!=
NULL
;
...
...
gcc/function.c
View file @
903d1e67
...
...
@@ -4378,6 +4378,13 @@ get_next_funcdef_no (void)
return
funcdef_no
++
;
}
/* Return value of funcdef. */
int
get_last_funcdef_no
(
void
)
{
return
funcdef_no
;
}
/* Allocate a function structure for FNDECL and set its contents
to the defaults. Set cfun to the newly-allocated object.
Some of the helper functions invoked during initialization assume
...
...
gcc/function.h
View file @
903d1e67
...
...
@@ -755,6 +755,7 @@ extern bool reference_callee_copied (CUMULATIVE_ARGS *, enum machine_mode,
extern
void
used_types_insert
(
tree
);
extern
int
get_next_funcdef_no
(
void
);
extern
int
get_last_funcdef_no
(
void
);
/* In predict.c */
extern
bool
optimize_function_for_size_p
(
struct
function
*
);
...
...
gcc/profile.h
View file @
903d1e67
...
...
@@ -44,4 +44,7 @@ extern void mcf_smooth_cfg (void);
extern
gcov_type
sum_edge_counts
(
VEC
(
edge
,
gc
)
*
edges
);
extern
void
init_node_map
(
void
);
extern
void
del_node_map
(
void
);
#endif
/* PROFILE_H */
gcc/tree-profile.c
View file @
903d1e67
...
...
@@ -43,6 +43,7 @@ along with GCC; see the file COPYING3. If not see
#include "timevar.h"
#include "value-prof.h"
#include "cgraph.h"
#include "profile.h"
static
GTY
(())
tree
gcov_type_node
;
static
GTY
(())
tree
gcov_type_tmp_var
;
...
...
@@ -369,7 +370,7 @@ gimple_gen_ic_func_profiler (void)
ptr_var
=
force_gimple_operand_gsi
(
&
gsi
,
ic_void_ptr_var
,
true
,
NULL_TREE
,
true
,
GSI_SAME_STMT
);
tree_uid
=
build_int_cst
(
gcov_type_node
,
c
_node
->
pid
);
tree_uid
=
build_int_cst
(
gcov_type_node
,
c
urrent_function_funcdef_no
);
stmt1
=
gimple_build_call
(
tree_indirect_call_profiler_fn
,
4
,
counter_ptr
,
tree_uid
,
cur_func
,
ptr_var
);
gsi_insert_before
(
&
gsi
,
stmt1
,
GSI_SAME_STMT
);
...
...
@@ -454,6 +455,8 @@ tree_profiling (void)
if
(
cgraph_state
==
CGRAPH_STATE_FINISHED
)
return
0
;
init_node_map
();
for
(
node
=
cgraph_nodes
;
node
;
node
=
node
->
next
)
{
if
(
!
node
->
analyzed
...
...
@@ -548,6 +551,7 @@ tree_profiling (void)
pop_cfun
();
}
del_node_map
();
return
0
;
}
...
...
gcc/value-prof.c
View file @
903d1e67
...
...
@@ -46,6 +46,7 @@ along with GCC; see the file COPYING3. If not see
#include "timevar.h"
#include "tree-pass.h"
#include "pointer-set.h"
#include "profile.h"
/* In this file value profile based optimizations are placed. Currently the
following optimizations are implemented (for more detailed descriptions
...
...
@@ -1059,35 +1060,56 @@ gimple_mod_subtract_transform (gimple_stmt_iterator *si)
return
true
;
}
static
struct
cgraph_node
**
pid
_map
=
NULL
;
static
VEC
(
cgraph_node_ptr
,
heap
)
*
cgraph_node
_map
=
NULL
;
/* Initialize map
of pids (pid -> cgraph node)
*/
/* Initialize map
from FUNCDEF_NO to CGRAPH_NODE.
*/
static
void
init_
pid
_map
(
void
)
void
init_
node
_map
(
void
)
{
struct
cgraph_node
*
n
;
if
(
pid_map
!=
NULL
)
return
;
pid_map
=
XCNEWVEC
(
struct
cgraph_node
*
,
cgraph_max_pid
);
if
(
get_last_funcdef_no
())
VEC_safe_grow_cleared
(
cgraph_node_ptr
,
heap
,
cgraph_node_map
,
get_last_funcdef_no
());
for
(
n
=
cgraph_nodes
;
n
;
n
=
n
->
next
)
{
if
(
n
->
pid
!=
-
1
)
pid_map
[
n
->
pid
]
=
n
;
if
(
DECL_STRUCT_FUNCTION
(
n
->
decl
))
VEC_replace
(
cgraph_node_ptr
,
cgraph_node_map
,
DECL_STRUCT_FUNCTION
(
n
->
decl
)
->
funcdef_no
,
n
);
}
}
/* Delete the CGRAPH_NODE_MAP. */
void
del_node_map
(
void
)
{
VEC_free
(
cgraph_node_ptr
,
heap
,
cgraph_node_map
);
cgraph_node_map
=
NULL
;
}
/* Return cgraph node for function with pid */
static
inline
struct
cgraph_node
*
find_func_by_
pid
(
int
p
id
)
find_func_by_
funcdef_no
(
int
func_
id
)
{
init_pid_map
();
int
max_id
=
get_last_funcdef_no
();
if
(
func_id
>=
max_id
||
VEC_index
(
cgraph_node_ptr
,
cgraph_node_map
,
func_id
)
==
NULL
)
{
if
(
flag_profile_correction
)
inform
(
DECL_SOURCE_LOCATION
(
current_function_decl
),
"Inconsistent profile: indirect call target (%d) does not exist"
,
func_id
);
else
error
(
"Inconsistent profile: indirect call target (%d) does not exist"
,
func_id
);
return
NULL
;
}
return
pid_map
[
pid
]
;
return
VEC_index
(
cgraph_node_ptr
,
cgraph_node_map
,
func_id
)
;
}
/* Perform sanity check on the indirect call target. Due to race conditions,
...
...
@@ -1285,7 +1307,7 @@ gimple_ic_transform (gimple stmt)
prob
=
(
count
*
REG_BR_PROB_BASE
+
all
/
2
)
/
all
;
else
prob
=
0
;
direct_call
=
find_func_by_
pid
((
int
)
val
);
direct_call
=
find_func_by_
funcdef_no
((
int
)
val
);
if
(
direct_call
==
NULL
)
return
false
;
...
...
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