This is the mail archive of the gcc@gcc.gnu.org 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]
Other format: [Raw text]

Re: Require help with the backend in gcc


"V. Karthik Kumar" <karthikkumar@gmail.com> writes:

> I require help with some work i've been doing lately on gcc (4.2.1
> tree). I have managed to put some code in.
> 
> Now, for function compilation, i require to invoke the i386 (as of
> now) backend multiple times and with different switches; one time with
> 3dnow!, another with mmx, another with sse2. And floating point code
> will require usage of both 387 and sse.
> 
> It is intended that multiple archs are passed as part of the -march
> option. (-m3dnow,sse2,sse3  or -march=k6,nocona or maybe
> -march=sse2,sse3)
> 
> Eventually, some of this code may also get used in the PowerPC backend
> (one time with AltiVec and one time without)..
> 
> it is intended that multiple versions of functions would go into the
> assembly file; The global data segment would be created only once,
> aligned to targeted instruction sets' requirement for efficient
> accesses (if mmx and sse, alignment might be 8 bytes than 4).
> 
> I have started working, but not sure which parts I should be touching
> by now.
> 
> Please give me your suggestions. Any help in this regard would be
> greatly appreciated.

The first thing you need to do is move to mainline, and take advantage
of the patch by Sandra Loosemore, David Ung, and Nigel Stephens to add
TARGET_SET_CURRENT_FUNCTION.  That is the framework you'll need to
change the architecture on a per-function basis.

Then you'll need to figure out how to clone the function the way the
inliner does, and presumably give each copy different names or
something--you didn't mention how you plan to handle that issue.

Then you can wind up compiling each function with different
parameters.

This is a nontrivial exercise, but an interesting one.  Good luck.

Ian


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