diff options
author | Giuliano Belinassi <giuliano.belinassi@usp.br> | 2019-11-18 20:05:16 +0000 |
---|---|---|
committer | Giuliano Belinassi <giulianob@gcc.gnu.org> | 2019-11-18 20:05:16 +0000 |
commit | eef99cd9567d40f72654faf6f21fdc65c63c9c3d (patch) | |
tree | 92ed33dfe90ac4b9908ab5e37775a2734518b0b0 /gcc/cfgloop.c | |
parent | 8d890d37e0183735586c18f1f056deb5848617ca (diff) | |
download | gcc-eef99cd9567d40f72654faf6f21fdc65c63c9c3d.zip gcc-eef99cd9567d40f72654faf6f21fdc65c63c9c3d.tar.gz gcc-eef99cd9567d40f72654faf6f21fdc65c63c9c3d.tar.bz2 |
Refactor tree-loop-distribution.c for thread safety
This patch refactors tree-loop-distribution.c for thread safety without
use of C11 __thread feature. All global variables were moved to
`class loop_distribution` which is initialized at ::execute time.
From-SVN: r278421
Diffstat (limited to 'gcc/cfgloop.c')
-rw-r--r-- | gcc/cfgloop.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/cfgloop.c b/gcc/cfgloop.c index 4ad1f65..308ed7d 100644 --- a/gcc/cfgloop.c +++ b/gcc/cfgloop.c @@ -980,6 +980,19 @@ get_loop_body_in_custom_order (const class loop *loop, return bbs; } +/* Same as above, but use gcc_sort_r instead of qsort. */ + +basic_block * +get_loop_body_in_custom_order (const class loop *loop, void *data, + int (*bb_comparator) (const void *, const void *, void *)) +{ + basic_block *bbs = get_loop_body (loop); + + gcc_sort_r (bbs, loop->num_nodes, sizeof (basic_block), bb_comparator, data); + + return bbs; +} + /* Get body of a LOOP in breadth first sort order. */ basic_block * |