gcc/gcc/lcm.h
Juzhe-Zhong d5dfba19ae LCM: Export 2 helpful functions as global for VSETVL PASS use in RISC-V backend
This patch exports 'compute_antinout_edge' and 'compute_earliest' as global scope
which is going to be used in VSETVL PASS of RISC-V backend.

The demand fusion is the fusion of VSETVL information to emit VSETVL which dominate and pre-config for most
of the RVV instructions in order to elide redundant VSETVLs.

For exmaple:

for
 for
  for
    if (cond}
      VSETVL demand 1: SEW/LMUL = 16 and TU policy
    else
      VSETVL demand 2: SEW = 32

VSETVL pass should be able to fuse demand 1 and demand 2 into new demand: SEW = 32, LMUL = M2, TU policy.
Then emit such VSETVL at the outmost of the for loop to get the most optimal codegen and run-time execution.

Currenty the VSETVL PASS Phase 3 (demand fusion) is really messy and un-reliable as well as un-maintainable.
And, I recently read dragon book and morgan's book again, I found there "earliest" can allow us to do the
demand fusion in a very reliable and optimal way.

So, this patch exports these 2 functions which are very helpful for VSETVL pass.

gcc/ChangeLog:

	* lcm.cc (compute_antinout_edge): Export as global use.
	(compute_earliest): Ditto.
	(compute_rev_insert_delete): Ditto.
	* lcm.h (compute_antinout_edge): Ditto.
	(compute_earliest): Ditto.
2023-08-21 17:18:14 +08:00

37 lines
1.5 KiB
C

/* Generic partial redundancy elimination with lazy code motion header file.
Copyright (C) 2014-2023 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
#ifndef GCC_LCM_H
#define GCC_LCM_H
extern struct edge_list *pre_edge_lcm_avs (int, sbitmap *, sbitmap *,
sbitmap *, sbitmap *, sbitmap *,
sbitmap *, sbitmap **, sbitmap **);
extern struct edge_list *pre_edge_lcm (int, sbitmap *, sbitmap *,
sbitmap *, sbitmap *, sbitmap **,
sbitmap **);
extern void compute_available (sbitmap *, sbitmap *, sbitmap *, sbitmap *);
extern struct edge_list *pre_edge_rev_lcm (int, sbitmap *,
sbitmap *, sbitmap *,
sbitmap *, sbitmap **,
sbitmap **);
extern void compute_antinout_edge (sbitmap *, sbitmap *, sbitmap *, sbitmap *);
extern void compute_earliest (struct edge_list *, int, sbitmap *, sbitmap *,
sbitmap *, sbitmap *, sbitmap *);
#endif /* GCC_LCM_H */