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
92832bb5
Commit
92832bb5
authored
Sep 02, 1993
by
Michael Meissner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update basic block profiling.
From-SVN: r5249
parent
9d436547
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
196 additions
and
19 deletions
+196
-19
gcc/Makefile.in
+1
-1
gcc/config/m68k/sun3.h
+13
-0
gcc/final.c
+0
-0
gcc/libgcc2.c
+182
-18
No files found.
gcc/Makefile.in
View file @
92832bb5
...
@@ -971,7 +971,7 @@ reorg.o : reorg.c $(CONFIG_H) $(RTL_H) conditions.h hard-reg-set.h \
...
@@ -971,7 +971,7 @@ reorg.o : reorg.c $(CONFIG_H) $(RTL_H) conditions.h hard-reg-set.h \
flags.h output.h
flags.h output.h
sched.o
:
sched.c $(CONFIG_H) $(RTL_H) basic-block.h regs.h hard-reg-set.h
\
sched.o
:
sched.c $(CONFIG_H) $(RTL_H) basic-block.h regs.h hard-reg-set.h
\
flags.h insn-config.h insn-attr.h
flags.h insn-config.h insn-attr.h
final.o
:
final.c $(CONFIG_H) $(RTL_H) gvarargs.h flags.h regs.h
\
final.o
:
final.c $(CONFIG_H) $(RTL_H)
$(TREE_H)
gvarargs.h flags.h regs.h
\
recog.h conditions.h insn-config.h insn-attr.h real.h output.h
\
recog.h conditions.h insn-config.h insn-attr.h real.h output.h
\
hard-reg-set.h insn-flags.h insn-codes.h gstab.h xcoffout.h defaults.h
hard-reg-set.h insn-flags.h insn-codes.h gstab.h xcoffout.h defaults.h
recog.o
:
recog.c $(CONFIG_H) $(RTL_H)
\
recog.o
:
recog.c $(CONFIG_H) $(RTL_H)
\
...
...
gcc/config/m68k/sun3.h
View file @
92832bb5
...
@@ -275,3 +275,16 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
...
@@ -275,3 +275,16 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
asm_fprintf (FILE, "%I0r%s", dstr); \
asm_fprintf (FILE, "%I0r%s", dstr); \
} \
} \
} while (0)
} while (0)
#undef BLOCK_PROFILER_CODE
#define BLOCK_PROFILER_CODE \
extern int ___tcov_init; \
\
__bb_init_func (blocks) \
struct bb *blocks; \
{ \
if (! ___tcov_init) \
___tcov_init_func (); \
\
___bb_link (blocks->filename, blocks->counts, blocks->ncounts); \
}
gcc/final.c
View file @
92832bb5
This diff is collapsed.
Click to expand it.
gcc/libgcc2.c
View file @
92832bb5
...
@@ -1285,35 +1285,199 @@ __eprintf (string, expression, line, filename)
...
@@ -1285,35 +1285,199 @@ __eprintf (string, expression, line, filename)
#endif
#endif
#ifdef L_bb
#ifdef L_bb
/* Avoid warning from ranlib about empty object file. */
void
__bb_avoid_warning
()
{}
#if defined (__sun__) && defined (__mc68000__)
/* Structure emitted by -a */
struct
bb
struct
bb
{
{
int
initialized
;
long
zero_word
;
char
*
filename
;
const
char
*
filename
;
int
*
counts
;
long
*
counts
;
int
ncounts
;
long
ncounts
;
int
zero_word
;
struct
bb
*
next
;
int
*
addresses
;
const
unsigned
long
*
addresses
;
/* Older GCC's did not emit these fields. */
long
nwords
;
const
char
**
functions
;
const
long
*
line_nums
;
const
char
**
filenames
;
};
};
extern
int
___tcov_init
;
#ifdef BLOCK_PROFILER_CODE
BLOCK_PROFILER_CODE
#else
/* Simple minded basic block profiling output dumper for
systems that don't provde tcov support. At present,
it requires atexit and stdio. */
#include <stdio.h>
__bb_init_func
(
blocks
)
#ifdef HAVE_ATEXIT
struct
bb
*
blocks
;
extern
void
atexit
(
void
(
*
)
(
void
));
#define ON_EXIT(FUNC,ARG) atexit ((FUNC))
#else
#ifdef sun
extern
void
on_exit
(
void
*
,
void
*
);
#define ON_EXIT(FUNC,ARG) on_exit ((FUNC), (ARG))
#endif
#endif
static
struct
bb
*
bb_head
=
(
struct
bb
*
)
0
;
/* Return the number of digits needed to print a value */
/* __inline__ */
static
int
num_digits
(
long
value
,
int
base
)
{
{
if
(
!
___tcov_init
)
int
minus
=
(
value
<
0
&&
base
!=
16
);
___tcov_init_func
();
unsigned
long
v
=
(
minus
)
?
-
value
:
value
;
int
ret
=
minus
;
___bb_link
(
blocks
->
filename
,
blocks
->
counts
,
blocks
->
ncounts
);
do
{
v
/=
base
;
ret
++
;
}
while
(
v
);
return
ret
;
}
}
void
__bb_exit_func
(
void
)
{
FILE
*
file
=
fopen
(
"bb.out"
,
"a"
);
long
time_value
;
if
(
!
file
)
perror
(
"bb.out"
);
else
{
struct
bb
*
ptr
;
/* This is somewhat type incorrect, but it avoids worrying about
exactly where time.h is included from. It should be ok unless
a void * differs from other pointer formats, or if sizeof(long)
is < sizeof (time_t). It would be nice if we could assume the
use of rationale standards here. */
time
((
void
*
)
&
time_value
);
fprintf
(
file
,
"Basic block profiling finished on %s
\n
"
,
ctime
((
void
*
)
&
time_value
));
/* We check the length field explicitly in order to allow compatibility
with older GCC's which did not provide it. */
for
(
ptr
=
bb_head
;
ptr
!=
(
struct
bb
*
)
0
;
ptr
=
ptr
->
next
)
{
int
i
;
int
func_p
=
(
ptr
->
nwords
>=
sizeof
(
struct
bb
)
&&
ptr
->
nwords
<=
1000
);
int
line_p
=
(
func_p
&&
ptr
->
line_nums
);
int
file_p
=
(
func_p
&&
ptr
->
filenames
);
long
ncounts
=
ptr
->
ncounts
;
long
cnt_max
=
0
;
long
line_max
=
0
;
long
addr_max
=
0
;
int
file_len
=
0
;
int
func_len
=
0
;
int
blk_len
=
num_digits
(
ncounts
,
10
);
int
cnt_len
;
int
line_len
;
int
addr_len
;
fprintf
(
file
,
"File %s, %ld basic blocks
\n\n
"
,
ptr
->
filename
,
ncounts
);
/* Get max values for each field. */
for
(
i
=
0
;
i
<
ncounts
;
i
++
)
{
const
char
*
p
;
int
len
;
if
(
cnt_max
<
ptr
->
counts
[
i
])
cnt_max
=
ptr
->
counts
[
i
];
if
(
addr_max
<
ptr
->
addresses
[
i
])
addr_max
=
ptr
->
addresses
[
i
];
if
(
line_p
&&
line_max
<
ptr
->
line_nums
[
i
])
line_max
=
ptr
->
line_nums
[
i
];
if
(
func_p
)
{
p
=
(
ptr
->
functions
[
i
])
?
(
ptr
->
functions
[
i
])
:
"<none>"
;
len
=
strlen
(
p
);
if
(
func_len
<
len
)
func_len
=
len
;
}
if
(
file_p
)
{
p
=
(
ptr
->
filenames
[
i
])
?
(
ptr
->
filenames
[
i
])
:
"<none>"
;
len
=
strlen
(
p
);
if
(
file_len
<
len
)
file_len
=
len
;
}
}
addr_len
=
num_digits
(
addr_max
,
16
);
cnt_len
=
num_digits
(
cnt_max
,
10
);
line_len
=
num_digits
(
line_max
,
10
);
/* Now print out the basic block information. */
for
(
i
=
0
;
i
<
ncounts
;
i
++
)
{
fprintf
(
file
,
" Block #%*d: executed %*ld time(s) address=0x%.*lx"
,
blk_len
,
i
+
1
,
cnt_len
,
ptr
->
counts
[
i
],
addr_len
,
ptr
->
addresses
[
i
]);
if
(
func_p
)
fprintf
(
file
,
" function=%-*s"
,
func_len
,
(
ptr
->
functions
[
i
])
?
ptr
->
functions
[
i
]
:
"<none>"
);
if
(
line_p
)
fprintf
(
file
,
" line=%*d"
,
line_len
,
ptr
->
line_nums
[
i
]);
if
(
file_p
)
fprintf
(
file
,
" file=%s"
,
(
ptr
->
filenames
[
i
])
?
ptr
->
filenames
[
i
]
:
"<none>"
);
fprintf
(
file
,
"
\n
"
);
}
fprintf
(
file
,
"
\n
"
);
fflush
(
file
);
}
fprintf
(
file
,
"
\n\n
"
);
fclose
(
file
);
}
}
void
__bb_init_func
(
struct
bb
*
blocks
)
{
/* User is supposed to check whether the first word is non-0,
but just in case.... */
if
(
blocks
->
zero_word
)
return
;
#ifdef ON_EXIT
/* Initialize destructor. */
if
(
!
bb_head
)
ON_EXIT
(
__bb_exit_func
,
0
);
#endif
#endif
#endif
/* Set up linked list. */
blocks
->
zero_word
=
1
;
blocks
->
next
=
bb_head
;
bb_head
=
blocks
;
}
#endif
/* !BLOCK_PROFILER_CODE */
#endif
/* L_bb */
/* frills for C++ */
/* frills for C++ */
...
...
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