This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Merging simplify-rtx, fold_rtx

So I got bored this weekend, and for no particular reason, implemented an
SSA based conditional constant propagation pass (Wegman and Zadick's

This requires, of course, writing all the evaluation routines to determine
if things were constant, etc.
I didnt' want to do this, especially since we already have simplify-rtx
and fold-rtx.
The rest is done (IE it runs, but only handles constant sets and copy
So I thought about it some, and realized that I could merge fold_rtx into
simplify-rtx, and be able to use it in my SSA CCP algorithm, if I made a
version of simplify-rtx that took a callback routine that was used to
determine if a given rtx was constant, given an rtx and an insn.  It would
call the callback when trying to determine if a register or mem was
constant. Then i would just modify simplify-rtx to just call this new
function, with a callback that always said no.
I believe this would allow the removal of fold_rtx (well, the gutting of
fold_rtx and the removal of all it's helpers). It could just be
replaced with a call to simplify-rtx with a callback that used the cse
info to determine if something was constant.
I could then do the same type of thing in my SSA-CCP algorithm, using a
callback that looked it up in the lattice.

Is this the right approach?
Or am I completely off base?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]