Re: Replacing certain operations with function calls

2009-09-02 Thread Jean Christophe Beyler
> Yes. Though I do wonder why you are avoiding using the normal libcall > machinery. If all you really care about is changing the function name, then > all you need to do is modify the appropriate optab. See, for instance, > arm_init_libfuncs. I guess both could work. I had seen the TARGET_INIT

Re: Replacing certain operations with function calls

2009-09-02 Thread Richard Henderson
On 09/01/2009 03:20 PM, Jean Christophe Beyler wrote: First off: does this seem correct? Yes. Though I do wonder why you are avoiding using the normal libcall machinery. If all you really care about is changing the function name, then all you need to do is modify the appropriate optab. See

Re: Replacing certain operations with function calls

2009-09-01 Thread Ian Lance Taylor
Jean Christophe Beyler writes: > In regard to what you said, do you mean I should build the tree before > the expand pass, by writing a new pass that will work on the trees > instead of rtx? Oh, sorry, I'm an idiot. I forgot that you only have RTL at this point. I would go with what you wrote

Re: Replacing certain operations with function calls

2009-09-01 Thread Jean Christophe Beyler
Finally, I guess the one thing I can do is simply generate pseudo_registers and copy all my registers into the pseudos before the call I make. Then I do my expand like I showed above. And finally, move everything back. Later passes will remove anything that was not needed, anything that was will

Re: Replacing certain operations with function calls

2009-09-01 Thread Jean Christophe Beyler
I don't think I quite understand what you're meaning. I want to use the standard ABI, basically I want to transform certain operations into function calls. In regard to what you said, do you mean I should build the tree before the expand pass, by writing a new pass that will work on the trees inst

Re: Replacing certain operations with function calls

2009-09-01 Thread Ian Lance Taylor
Jean Christophe Beyler writes: > First off: does this seem correct? Awkward though it is, it may be more reliable to build a small tree here and pass it to expand_call. This assumes that you want to use the standard ABI when calling this function. Then your second issue would go away. Ian

Re: Replacing certain operations with function calls

2009-09-01 Thread Jean Christophe Beyler
Actually, what I've done is probably something in between what you were suggesting and what I was initially doing. If we consider the multiplication, I've modified the define_expand for example to: (define_expand "muldi3" [(set (match_operand:DI 0 "register_operand" "") (mult:DI (match_o

Re: Replacing certain operations with function calls

2009-09-01 Thread Jean Christophe Beyler
I have looked at how other targest use the init_builtins/expand_builtins. Of course, I don't understand everything there but it seems indeed to be more for generating a series of instructions instead of a function call. I haven't seen anything resembling what I want to do. I had also first thought

Re: Replacing certain operations with function calls

2009-09-01 Thread Ian Lance Taylor
Jean Christophe Beyler writes: > I have been also been looking into how to generate a function call for > certain operations. I've looked at various other targets for a similar > problem/solution but have not seen anything. On my target > architecture, we have certain optimized versions of the mu

Replacing certain operations with function calls

2009-09-01 Thread Jean Christophe Beyler
Dear all, I have been also been looking into how to generate a function call for certain operations. I've looked at various other targets for a similar problem/solution but have not seen anything. On my target architecture, we have certain optimized versions of the multiplication for example. I w